react 18.2.0 → 18.3.0-canary-b7972822b-20230503
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 +1 -1
- package/README.md +3 -3
- package/cjs/react-jsx-dev-runtime.development.js +92 -57
- package/cjs/react-jsx-dev-runtime.production.min.js +1 -1
- package/cjs/react-jsx-dev-runtime.profiling.min.js +1 -1
- package/cjs/react-jsx-runtime.development.js +90 -55
- package/cjs/react-jsx-runtime.production.min.js +1 -1
- package/cjs/react-jsx-runtime.profiling.min.js +1 -1
- package/cjs/react.development.js +506 -195
- package/cjs/react.production.min.js +22 -18
- package/cjs/react.shared-subset.development.js +2617 -3
- package/cjs/react.shared-subset.production.min.js +21 -2
- package/package.json +1 -1
- package/umd/react.development.js +564 -245
- package/umd/react.production.min.js +25 -22
- package/umd/react.profiling.min.js +25 -22
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -25,13 +25,13 @@ function Counter() {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const root = createRoot(document.getElementById('root'));
|
|
28
|
-
root.render(<
|
|
28
|
+
root.render(<Counter />);
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
## Documentation
|
|
32
32
|
|
|
33
|
-
See https://
|
|
33
|
+
See https://react.dev/
|
|
34
34
|
|
|
35
35
|
## API
|
|
36
36
|
|
|
37
|
-
See https://
|
|
37
|
+
See https://react.dev/reference/react
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-dev-runtime.development.js
|
|
4
4
|
*
|
|
5
|
-
* Copyright (c)
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -27,12 +27,14 @@ var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
|
27
27
|
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
28
28
|
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
29
29
|
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
30
|
+
var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
|
|
30
31
|
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
31
32
|
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
32
33
|
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
33
34
|
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
34
35
|
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
35
36
|
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
37
|
+
var REACT_CACHE_TYPE = Symbol.for('react.cache');
|
|
36
38
|
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
37
39
|
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
38
40
|
function getIteratorFn(maybeIterable) {
|
|
@@ -100,12 +102,7 @@ var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in
|
|
|
100
102
|
|
|
101
103
|
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
102
104
|
|
|
103
|
-
var
|
|
104
|
-
|
|
105
|
-
{
|
|
106
|
-
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
107
|
-
}
|
|
108
|
-
|
|
105
|
+
var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference');
|
|
109
106
|
function isValidElementType(type) {
|
|
110
107
|
if (typeof type === 'string' || typeof type === 'function') {
|
|
111
108
|
return true;
|
|
@@ -121,7 +118,7 @@ function isValidElementType(type) {
|
|
|
121
118
|
// types supported by any Flight configuration anywhere since
|
|
122
119
|
// we don't know which Flight build this will end up being used
|
|
123
120
|
// with.
|
|
124
|
-
type.$$typeof ===
|
|
121
|
+
type.$$typeof === REACT_CLIENT_REFERENCE$1 || type.getModuleId !== undefined) {
|
|
125
122
|
return true;
|
|
126
123
|
}
|
|
127
124
|
}
|
|
@@ -185,6 +182,11 @@ function getComponentNameFromType(type) {
|
|
|
185
182
|
case REACT_SUSPENSE_LIST_TYPE:
|
|
186
183
|
return 'SuspenseList';
|
|
187
184
|
|
|
185
|
+
case REACT_CACHE_TYPE:
|
|
186
|
+
{
|
|
187
|
+
return 'Cache';
|
|
188
|
+
}
|
|
189
|
+
|
|
188
190
|
}
|
|
189
191
|
|
|
190
192
|
if (typeof type === 'object') {
|
|
@@ -222,7 +224,12 @@ function getComponentNameFromType(type) {
|
|
|
222
224
|
}
|
|
223
225
|
}
|
|
224
226
|
|
|
225
|
-
|
|
227
|
+
case REACT_SERVER_CONTEXT_TYPE:
|
|
228
|
+
{
|
|
229
|
+
var context2 = type;
|
|
230
|
+
return (context2.displayName || context2._globalName) + '.Provider';
|
|
231
|
+
}
|
|
232
|
+
|
|
226
233
|
}
|
|
227
234
|
}
|
|
228
235
|
|
|
@@ -264,7 +271,7 @@ function disableLogs() {
|
|
|
264
271
|
enumerable: true,
|
|
265
272
|
value: disabledLog,
|
|
266
273
|
writable: true
|
|
267
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
274
|
+
}; // $FlowFixMe[cannot-write] Flow thinks console is immutable.
|
|
268
275
|
|
|
269
276
|
Object.defineProperties(console, {
|
|
270
277
|
info: props,
|
|
@@ -291,7 +298,7 @@ function reenableLogs() {
|
|
|
291
298
|
configurable: true,
|
|
292
299
|
enumerable: true,
|
|
293
300
|
writable: true
|
|
294
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
301
|
+
}; // $FlowFixMe[cannot-write] Flow thinks console is immutable.
|
|
295
302
|
|
|
296
303
|
Object.defineProperties(console, {
|
|
297
304
|
log: assign({}, props, {
|
|
@@ -353,7 +360,7 @@ var componentFrameCache;
|
|
|
353
360
|
|
|
354
361
|
function describeNativeComponentFrame(fn, construct) {
|
|
355
362
|
// If something asked for a stack inside a fake render, it should get ignored.
|
|
356
|
-
if (
|
|
363
|
+
if (!fn || reentry) {
|
|
357
364
|
return '';
|
|
358
365
|
}
|
|
359
366
|
|
|
@@ -367,7 +374,7 @@ function describeNativeComponentFrame(fn, construct) {
|
|
|
367
374
|
|
|
368
375
|
var control;
|
|
369
376
|
reentry = true;
|
|
370
|
-
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
377
|
+
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined.
|
|
371
378
|
|
|
372
379
|
Error.prepareStackTrace = undefined;
|
|
373
380
|
var previousDispatcher;
|
|
@@ -386,7 +393,7 @@ function describeNativeComponentFrame(fn, construct) {
|
|
|
386
393
|
// Something should be setting the props in the constructor.
|
|
387
394
|
var Fake = function () {
|
|
388
395
|
throw Error();
|
|
389
|
-
}; // $FlowFixMe
|
|
396
|
+
}; // $FlowFixMe[prop-missing]
|
|
390
397
|
|
|
391
398
|
|
|
392
399
|
Object.defineProperty(Fake.prototype, 'props', {
|
|
@@ -412,7 +419,8 @@ function describeNativeComponentFrame(fn, construct) {
|
|
|
412
419
|
Fake.call();
|
|
413
420
|
} catch (x) {
|
|
414
421
|
control = x;
|
|
415
|
-
}
|
|
422
|
+
} // $FlowFixMe[prop-missing] found when upgrading Flow
|
|
423
|
+
|
|
416
424
|
|
|
417
425
|
fn.call(Fake.prototype);
|
|
418
426
|
}
|
|
@@ -421,7 +429,10 @@ function describeNativeComponentFrame(fn, construct) {
|
|
|
421
429
|
throw Error();
|
|
422
430
|
} catch (x) {
|
|
423
431
|
control = x;
|
|
424
|
-
}
|
|
432
|
+
} // TODO(luna): This will currently only throw if the function component
|
|
433
|
+
// tries to access React/ReactDOM/props. We should probably make this throw
|
|
434
|
+
// in simple components too
|
|
435
|
+
|
|
425
436
|
|
|
426
437
|
fn();
|
|
427
438
|
}
|
|
@@ -571,26 +582,27 @@ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
|
571
582
|
return '';
|
|
572
583
|
}
|
|
573
584
|
|
|
585
|
+
// $FlowFixMe[method-unbinding]
|
|
574
586
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
575
587
|
|
|
576
588
|
var loggedTypeFailures = {};
|
|
577
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
589
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
578
590
|
|
|
579
|
-
function setCurrentlyValidatingElement(element) {
|
|
591
|
+
function setCurrentlyValidatingElement$1(element) {
|
|
580
592
|
{
|
|
581
593
|
if (element) {
|
|
582
594
|
var owner = element._owner;
|
|
583
595
|
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
584
|
-
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
596
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
585
597
|
} else {
|
|
586
|
-
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
598
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
587
599
|
}
|
|
588
600
|
}
|
|
589
601
|
}
|
|
590
602
|
|
|
591
603
|
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
592
604
|
{
|
|
593
|
-
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
605
|
+
// $FlowFixMe[incompatible-use] This is okay but Flow doesn't know it.
|
|
594
606
|
var has = Function.call.bind(hasOwnProperty);
|
|
595
607
|
|
|
596
608
|
for (var typeSpecName in typeSpecs) {
|
|
@@ -615,22 +627,22 @@ function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
|
615
627
|
}
|
|
616
628
|
|
|
617
629
|
if (error$1 && !(error$1 instanceof Error)) {
|
|
618
|
-
setCurrentlyValidatingElement(element);
|
|
630
|
+
setCurrentlyValidatingElement$1(element);
|
|
619
631
|
|
|
620
632
|
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
|
|
621
633
|
|
|
622
|
-
setCurrentlyValidatingElement(null);
|
|
634
|
+
setCurrentlyValidatingElement$1(null);
|
|
623
635
|
}
|
|
624
636
|
|
|
625
637
|
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
626
638
|
// Only monitor this failure once because there tends to be a lot of the
|
|
627
639
|
// same error.
|
|
628
640
|
loggedTypeFailures[error$1.message] = true;
|
|
629
|
-
setCurrentlyValidatingElement(element);
|
|
641
|
+
setCurrentlyValidatingElement$1(element);
|
|
630
642
|
|
|
631
643
|
error('Failed %s type: %s', location, error$1.message);
|
|
632
644
|
|
|
633
|
-
setCurrentlyValidatingElement(null);
|
|
645
|
+
setCurrentlyValidatingElement$1(null);
|
|
634
646
|
}
|
|
635
647
|
}
|
|
636
648
|
}
|
|
@@ -644,7 +656,7 @@ function isArray(a) {
|
|
|
644
656
|
}
|
|
645
657
|
|
|
646
658
|
/*
|
|
647
|
-
* The `'' + value` pattern (used in
|
|
659
|
+
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
|
|
648
660
|
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
|
649
661
|
*
|
|
650
662
|
* The functions in this module will throw an easier-to-understand,
|
|
@@ -652,15 +664,16 @@ function isArray(a) {
|
|
|
652
664
|
* problem. (Instead of a confusing exception thrown inside the implementation
|
|
653
665
|
* of the `value` object).
|
|
654
666
|
*/
|
|
655
|
-
// $FlowFixMe only called in DEV, so void return is not possible.
|
|
667
|
+
// $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible.
|
|
656
668
|
function typeName(value) {
|
|
657
669
|
{
|
|
658
670
|
// toStringTag is needed for namespaced types like Temporal.Instant
|
|
659
671
|
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
|
660
|
-
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
|
672
|
+
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object'; // $FlowFixMe[incompatible-return]
|
|
673
|
+
|
|
661
674
|
return type;
|
|
662
675
|
}
|
|
663
|
-
} // $FlowFixMe only called in DEV, so void return is not possible.
|
|
676
|
+
} // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible.
|
|
664
677
|
|
|
665
678
|
|
|
666
679
|
function willCoercionThrow(value) {
|
|
@@ -710,7 +723,7 @@ function checkKeyStringCoercion(value) {
|
|
|
710
723
|
}
|
|
711
724
|
}
|
|
712
725
|
|
|
713
|
-
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
726
|
+
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
714
727
|
var RESERVED_PROPS = {
|
|
715
728
|
key: true,
|
|
716
729
|
ref: true,
|
|
@@ -755,11 +768,11 @@ function hasValidKey(config) {
|
|
|
755
768
|
|
|
756
769
|
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
757
770
|
{
|
|
758
|
-
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
|
759
|
-
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
771
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner$1.current && self && ReactCurrentOwner$1.current.stateNode !== self) {
|
|
772
|
+
var componentName = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
760
773
|
|
|
761
774
|
if (!didWarnAboutStringRefs[componentName]) {
|
|
762
|
-
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);
|
|
775
|
+
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$1.current.type), config.ref);
|
|
763
776
|
|
|
764
777
|
didWarnAboutStringRefs[componentName] = true;
|
|
765
778
|
}
|
|
@@ -824,7 +837,7 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
824
837
|
*/
|
|
825
838
|
|
|
826
839
|
|
|
827
|
-
|
|
840
|
+
function ReactElement(type, key, ref, self, source, owner, props) {
|
|
828
841
|
var element = {
|
|
829
842
|
// This tag allows us to uniquely identify this as a React Element
|
|
830
843
|
$$typeof: REACT_ELEMENT_TYPE,
|
|
@@ -876,7 +889,7 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
876
889
|
}
|
|
877
890
|
|
|
878
891
|
return element;
|
|
879
|
-
}
|
|
892
|
+
}
|
|
880
893
|
/**
|
|
881
894
|
* https://github.com/reactjs/rfcs/pull/107
|
|
882
895
|
* @param {*} type
|
|
@@ -884,7 +897,7 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
884
897
|
* @param {string} key
|
|
885
898
|
*/
|
|
886
899
|
|
|
887
|
-
function jsxDEV(type, config, maybeKey, source, self) {
|
|
900
|
+
function jsxDEV$1(type, config, maybeKey, source, self) {
|
|
888
901
|
{
|
|
889
902
|
var propName; // Reserved names are extracted
|
|
890
903
|
|
|
@@ -948,21 +961,22 @@ function jsxDEV(type, config, maybeKey, source, self) {
|
|
|
948
961
|
}
|
|
949
962
|
}
|
|
950
963
|
|
|
951
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
964
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner$1.current, props);
|
|
952
965
|
}
|
|
953
966
|
}
|
|
954
967
|
|
|
955
|
-
var ReactCurrentOwner
|
|
956
|
-
var ReactDebugCurrentFrame
|
|
968
|
+
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
969
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
970
|
+
var REACT_CLIENT_REFERENCE = Symbol.for('react.client.reference');
|
|
957
971
|
|
|
958
|
-
function setCurrentlyValidatingElement
|
|
972
|
+
function setCurrentlyValidatingElement(element) {
|
|
959
973
|
{
|
|
960
974
|
if (element) {
|
|
961
975
|
var owner = element._owner;
|
|
962
976
|
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
963
|
-
ReactDebugCurrentFrame
|
|
977
|
+
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
964
978
|
} else {
|
|
965
|
-
ReactDebugCurrentFrame
|
|
979
|
+
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
966
980
|
}
|
|
967
981
|
}
|
|
968
982
|
}
|
|
@@ -989,8 +1003,8 @@ function isValidElement(object) {
|
|
|
989
1003
|
|
|
990
1004
|
function getDeclarationErrorAddendum() {
|
|
991
1005
|
{
|
|
992
|
-
if (ReactCurrentOwner
|
|
993
|
-
var name = getComponentNameFromType(ReactCurrentOwner
|
|
1006
|
+
if (ReactCurrentOwner.current) {
|
|
1007
|
+
var name = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
994
1008
|
|
|
995
1009
|
if (name) {
|
|
996
1010
|
return '\n\nCheck the render method of `' + name + '`.';
|
|
@@ -1068,16 +1082,16 @@ function validateExplicitKey(element, parentType) {
|
|
|
1068
1082
|
|
|
1069
1083
|
var childOwner = '';
|
|
1070
1084
|
|
|
1071
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner
|
|
1085
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
1072
1086
|
// Give the component that originally created this child.
|
|
1073
1087
|
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
1074
1088
|
}
|
|
1075
1089
|
|
|
1076
|
-
setCurrentlyValidatingElement
|
|
1090
|
+
setCurrentlyValidatingElement(element);
|
|
1077
1091
|
|
|
1078
1092
|
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
1079
1093
|
|
|
1080
|
-
setCurrentlyValidatingElement
|
|
1094
|
+
setCurrentlyValidatingElement(null);
|
|
1081
1095
|
}
|
|
1082
1096
|
}
|
|
1083
1097
|
/**
|
|
@@ -1093,11 +1107,11 @@ function validateExplicitKey(element, parentType) {
|
|
|
1093
1107
|
|
|
1094
1108
|
function validateChildKeys(node, parentType) {
|
|
1095
1109
|
{
|
|
1096
|
-
if (typeof node !== 'object') {
|
|
1110
|
+
if (typeof node !== 'object' || !node) {
|
|
1097
1111
|
return;
|
|
1098
1112
|
}
|
|
1099
1113
|
|
|
1100
|
-
if (isArray(node)) {
|
|
1114
|
+
if (node.$$typeof === REACT_CLIENT_REFERENCE) ; else if (isArray(node)) {
|
|
1101
1115
|
for (var i = 0; i < node.length; i++) {
|
|
1102
1116
|
var child = node[i];
|
|
1103
1117
|
|
|
@@ -1110,7 +1124,7 @@ function validateChildKeys(node, parentType) {
|
|
|
1110
1124
|
if (node._store) {
|
|
1111
1125
|
node._store.validated = true;
|
|
1112
1126
|
}
|
|
1113
|
-
} else
|
|
1127
|
+
} else {
|
|
1114
1128
|
var iteratorFn = getIteratorFn(node);
|
|
1115
1129
|
|
|
1116
1130
|
if (typeof iteratorFn === 'function') {
|
|
@@ -1146,6 +1160,10 @@ function validatePropTypes(element) {
|
|
|
1146
1160
|
return;
|
|
1147
1161
|
}
|
|
1148
1162
|
|
|
1163
|
+
if (type.$$typeof === REACT_CLIENT_REFERENCE) {
|
|
1164
|
+
return;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1149
1167
|
var propTypes;
|
|
1150
1168
|
|
|
1151
1169
|
if (typeof type === 'function') {
|
|
@@ -1189,25 +1207,26 @@ function validateFragmentProps(fragment) {
|
|
|
1189
1207
|
var key = keys[i];
|
|
1190
1208
|
|
|
1191
1209
|
if (key !== 'children' && key !== 'key') {
|
|
1192
|
-
setCurrentlyValidatingElement
|
|
1210
|
+
setCurrentlyValidatingElement(fragment);
|
|
1193
1211
|
|
|
1194
1212
|
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1195
1213
|
|
|
1196
|
-
setCurrentlyValidatingElement
|
|
1214
|
+
setCurrentlyValidatingElement(null);
|
|
1197
1215
|
break;
|
|
1198
1216
|
}
|
|
1199
1217
|
}
|
|
1200
1218
|
|
|
1201
1219
|
if (fragment.ref !== null) {
|
|
1202
|
-
setCurrentlyValidatingElement
|
|
1220
|
+
setCurrentlyValidatingElement(fragment);
|
|
1203
1221
|
|
|
1204
1222
|
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1205
1223
|
|
|
1206
|
-
setCurrentlyValidatingElement
|
|
1224
|
+
setCurrentlyValidatingElement(null);
|
|
1207
1225
|
}
|
|
1208
1226
|
}
|
|
1209
1227
|
}
|
|
1210
1228
|
|
|
1229
|
+
var didWarnAboutKeySpread = {};
|
|
1211
1230
|
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
1212
1231
|
{
|
|
1213
1232
|
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
@@ -1244,7 +1263,7 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1244
1263
|
error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
1245
1264
|
}
|
|
1246
1265
|
|
|
1247
|
-
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
1266
|
+
var element = jsxDEV$1(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
1248
1267
|
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1249
1268
|
|
|
1250
1269
|
if (element == null) {
|
|
@@ -1278,6 +1297,22 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1278
1297
|
}
|
|
1279
1298
|
}
|
|
1280
1299
|
|
|
1300
|
+
if (hasOwnProperty.call(props, 'key')) {
|
|
1301
|
+
var componentName = getComponentNameFromType(type);
|
|
1302
|
+
var keys = Object.keys(props).filter(function (k) {
|
|
1303
|
+
return k !== 'key';
|
|
1304
|
+
});
|
|
1305
|
+
var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
|
|
1306
|
+
|
|
1307
|
+
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
|
1308
|
+
var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
|
|
1309
|
+
|
|
1310
|
+
error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
|
|
1311
|
+
|
|
1312
|
+
didWarnAboutKeySpread[componentName + beforeExample] = true;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1281
1316
|
if (type === REACT_FRAGMENT_TYPE) {
|
|
1282
1317
|
validateFragmentProps(element);
|
|
1283
1318
|
} else {
|
|
@@ -1288,9 +1323,9 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1288
1323
|
}
|
|
1289
1324
|
} // These two functions exist to still get child warnings in dev
|
|
1290
1325
|
|
|
1291
|
-
var jsxDEV
|
|
1326
|
+
var jsxDEV = jsxWithValidation ;
|
|
1292
1327
|
|
|
1293
1328
|
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
1294
|
-
exports.jsxDEV = jsxDEV
|
|
1329
|
+
exports.jsxDEV = jsxDEV;
|
|
1295
1330
|
})();
|
|
1296
1331
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-dev-runtime.production.min.js
|
|
4
4
|
*
|
|
5
|
-
* Copyright (c)
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-dev-runtime.profiling.min.js
|
|
4
4
|
*
|
|
5
|
-
* Copyright (c)
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|