react 19.0.0-rc-4c2e457c7c-20240522 → 19.0.0-rc-6f23540c7d-20240528
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-compiler-runtime.development.js +28 -12
- package/cjs/react-jsx-dev-runtime.development.js +65 -80
- package/cjs/react-jsx-dev-runtime.react-server.development.js +67 -82
- package/cjs/react-jsx-runtime.development.js +64 -89
- package/cjs/react-jsx-runtime.react-server.development.js +67 -82
- package/cjs/react.development.js +103 -122
- package/cjs/react.production.js +11 -11
- package/cjs/react.react-server.development.js +101 -121
- package/cjs/react.react-server.production.js +10 -10
- package/package.json +1 -1
package/cjs/react.development.js
CHANGED
@@ -20,7 +20,7 @@ if (
|
|
20
20
|
) {
|
21
21
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
22
22
|
}
|
23
|
-
var ReactVersion = '19.0.0-rc-
|
23
|
+
var ReactVersion = '19.0.0-rc-6f23540c7d-20240528';
|
24
24
|
|
25
25
|
// -----------------------------------------------------------------------------
|
26
26
|
|
@@ -78,7 +78,8 @@ function getIteratorFn(maybeIterable) {
|
|
78
78
|
var ReactSharedInternals = {
|
79
79
|
H: null,
|
80
80
|
A: null,
|
81
|
-
T: null
|
81
|
+
T: null,
|
82
|
+
S: null
|
82
83
|
};
|
83
84
|
|
84
85
|
{
|
@@ -86,32 +87,9 @@ var ReactSharedInternals = {
|
|
86
87
|
ReactSharedInternals.isBatchingLegacy = false;
|
87
88
|
ReactSharedInternals.didScheduleLegacyUpdate = false;
|
88
89
|
ReactSharedInternals.didUsePromise = false;
|
89
|
-
ReactSharedInternals.thrownErrors = [];
|
90
|
-
var currentExtraStackFrame = null;
|
91
|
-
|
92
|
-
ReactSharedInternals.setExtraStackFrame = function (stack) {
|
93
|
-
currentExtraStackFrame = stack;
|
94
|
-
}; // Stack implementation injected by the current renderer.
|
95
|
-
|
90
|
+
ReactSharedInternals.thrownErrors = []; // Stack implementation injected by the current renderer.
|
96
91
|
|
97
92
|
ReactSharedInternals.getCurrentStack = null;
|
98
|
-
|
99
|
-
ReactSharedInternals.getStackAddendum = function () {
|
100
|
-
var stack = ''; // Add an extra top frame while an element is being validated
|
101
|
-
|
102
|
-
if (currentExtraStackFrame) {
|
103
|
-
stack += currentExtraStackFrame;
|
104
|
-
} // Delegate to the injected renderer-specific implementation
|
105
|
-
|
106
|
-
|
107
|
-
var impl = ReactSharedInternals.getCurrentStack;
|
108
|
-
|
109
|
-
if (impl) {
|
110
|
-
stack += impl() || '';
|
111
|
-
}
|
112
|
-
|
113
|
-
return stack;
|
114
|
-
};
|
115
93
|
}
|
116
94
|
|
117
95
|
// by calls to these methods by a Babel plugin.
|
@@ -140,29 +118,45 @@ function error(format) {
|
|
140
118
|
printWarning('error', format, args);
|
141
119
|
}
|
142
120
|
}
|
143
|
-
}
|
121
|
+
} // eslint-disable-next-line react-internal/no-production-logging
|
144
122
|
|
145
123
|
function printWarning(level, format, args) {
|
146
124
|
// When changing this logic, you might want to also
|
147
125
|
// update consoleWithStackDev.www.js as well.
|
148
126
|
{
|
149
|
-
var
|
150
|
-
|
151
|
-
if (stack !== '') {
|
152
|
-
format += '%s';
|
153
|
-
args = args.concat([stack]);
|
154
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
127
|
+
var isErrorLogger = format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n';
|
155
128
|
|
129
|
+
if (ReactSharedInternals.getCurrentStack) {
|
130
|
+
// We only add the current stack to the console when createTask is not supported.
|
131
|
+
// Since createTask requires DevTools to be open to work, this means that stacks
|
132
|
+
// can be lost while DevTools isn't open but we can't detect this.
|
133
|
+
var stack = ReactSharedInternals.getCurrentStack();
|
156
134
|
|
157
|
-
|
158
|
-
|
159
|
-
|
135
|
+
if (stack !== '') {
|
136
|
+
format += '%s';
|
137
|
+
args = args.concat([stack]);
|
138
|
+
}
|
139
|
+
}
|
160
140
|
|
161
|
-
|
141
|
+
if (isErrorLogger) {
|
142
|
+
// Don't prefix our default logging formatting in ReactFiberErrorLoggger.
|
143
|
+
// Don't toString the arguments.
|
144
|
+
args.unshift(format);
|
145
|
+
} else {
|
146
|
+
// TODO: Remove this prefix and stop toStringing in the wrapper and
|
147
|
+
// instead do it at each callsite as needed.
|
148
|
+
// Careful: RN currently depends on this prefix
|
149
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
150
|
+
args = args.map(function (item) {
|
151
|
+
return String(item);
|
152
|
+
});
|
153
|
+
args.unshift('Warning: ' + format);
|
154
|
+
} // We intentionally don't use spread (or .apply) directly because it
|
162
155
|
// breaks IE9: https://github.com/facebook/react/issues/13610
|
163
156
|
// eslint-disable-next-line react-internal/no-production-logging
|
164
157
|
|
165
|
-
|
158
|
+
|
159
|
+
Function.prototype.apply.call(console[level], console, args);
|
166
160
|
}
|
167
161
|
}
|
168
162
|
|
@@ -583,7 +577,9 @@ function getComponentNameFromType(type) {
|
|
583
577
|
// $FlowFixMe[method-unbinding]
|
584
578
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
585
579
|
|
586
|
-
var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference');
|
580
|
+
var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference'); // This function is deprecated. Don't use. Only the renderer knows what a valid type is.
|
581
|
+
// TODO: Delete this when enableOwnerStacks ships.
|
582
|
+
|
587
583
|
function isValidElementType(type) {
|
588
584
|
if (typeof type === 'string' || typeof type === 'function') {
|
589
585
|
return true;
|
@@ -975,7 +971,8 @@ function describeFunctionComponentFrame(fn) {
|
|
975
971
|
function shouldConstruct(Component) {
|
976
972
|
var prototype = Component.prototype;
|
977
973
|
return !!(prototype && prototype.isReactComponent);
|
978
|
-
}
|
974
|
+
} // TODO: Delete this once the key warning no longer uses it. I.e. when enableOwnerStacks ship.
|
975
|
+
|
979
976
|
|
980
977
|
function describeUnknownElementTypeFrameInDEV(type) {
|
981
978
|
|
@@ -1207,7 +1204,7 @@ function ReactElement(type, key, _ref, self, source, owner, props, debugStack, d
|
|
1207
1204
|
configurable: false,
|
1208
1205
|
enumerable: false,
|
1209
1206
|
writable: true,
|
1210
|
-
value:
|
1207
|
+
value: 0
|
1211
1208
|
}); // debugInfo contains Server Component debug information.
|
1212
1209
|
|
1213
1210
|
Object.defineProperty(element, '_debugInfo', {
|
@@ -1230,9 +1227,15 @@ function ReactElement(type, key, _ref, self, source, owner, props, debugStack, d
|
|
1230
1227
|
* See https://reactjs.org/docs/react-api.html#createelement
|
1231
1228
|
*/
|
1232
1229
|
|
1230
|
+
|
1233
1231
|
function createElement(type, config, children) {
|
1234
1232
|
{
|
1235
1233
|
if (!isValidElementType(type)) {
|
1234
|
+
// This is just an optimistic check that provides a better stack trace before
|
1235
|
+
// owner stacks. It's really up to the renderer if it's a valid element type.
|
1236
|
+
// When owner stacks are enabled, we instead warn in the renderer and it'll
|
1237
|
+
// have the stack trace of the JSX element anyway.
|
1238
|
+
//
|
1236
1239
|
// This is an invalid element type.
|
1237
1240
|
//
|
1238
1241
|
// We warn in this case but don't throw. We expect the element creation to
|
@@ -1359,13 +1362,7 @@ function createElement(type, config, children) {
|
|
1359
1362
|
}
|
1360
1363
|
}
|
1361
1364
|
|
1362
|
-
|
1363
|
-
|
1364
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
1365
|
-
validateFragmentProps(element);
|
1366
|
-
}
|
1367
|
-
|
1368
|
-
return element;
|
1365
|
+
return ReactElement(type, key, ref, undefined, undefined, getOwner(), props);
|
1369
1366
|
}
|
1370
1367
|
function cloneAndReplaceKey(oldElement, newKey) {
|
1371
1368
|
return ReactElement(oldElement.type, newKey, // When enableRefAsProp is on, this argument is ignored. This check only
|
@@ -1449,22 +1446,6 @@ function cloneElement(element, config, children) {
|
|
1449
1446
|
|
1450
1447
|
return clonedElement;
|
1451
1448
|
}
|
1452
|
-
|
1453
|
-
function getDeclarationErrorAddendum() {
|
1454
|
-
{
|
1455
|
-
var owner = getOwner();
|
1456
|
-
|
1457
|
-
if (owner) {
|
1458
|
-
var name = getComponentNameFromType(owner.type);
|
1459
|
-
|
1460
|
-
if (name) {
|
1461
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
1462
|
-
}
|
1463
|
-
}
|
1464
|
-
|
1465
|
-
return '';
|
1466
|
-
}
|
1467
|
-
}
|
1468
1449
|
/**
|
1469
1450
|
* Ensure that every element either is passed in a static location, in an
|
1470
1451
|
* array with an explicit keys property defined, or in an object literal
|
@@ -1475,7 +1456,6 @@ function getDeclarationErrorAddendum() {
|
|
1475
1456
|
* @param {*} parentType node's parent's type.
|
1476
1457
|
*/
|
1477
1458
|
|
1478
|
-
|
1479
1459
|
function validateChildKeys(node, parentType) {
|
1480
1460
|
{
|
1481
1461
|
if (typeof node !== 'object' || !node) {
|
@@ -1493,7 +1473,7 @@ function validateChildKeys(node, parentType) {
|
|
1493
1473
|
} else if (isValidElement(node)) {
|
1494
1474
|
// This element was passed in a valid location.
|
1495
1475
|
if (node._store) {
|
1496
|
-
node._store.validated =
|
1476
|
+
node._store.validated = 1;
|
1497
1477
|
}
|
1498
1478
|
} else {
|
1499
1479
|
var iteratorFn = getIteratorFn(node);
|
@@ -1544,12 +1524,13 @@ var ownerHasKeyUseWarning = {};
|
|
1544
1524
|
*/
|
1545
1525
|
|
1546
1526
|
function validateExplicitKey(element, parentType) {
|
1527
|
+
|
1547
1528
|
{
|
1548
1529
|
if (!element._store || element._store.validated || element.key != null) {
|
1549
1530
|
return;
|
1550
1531
|
}
|
1551
1532
|
|
1552
|
-
element._store.validated =
|
1533
|
+
element._store.validated = 1;
|
1553
1534
|
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
1554
1535
|
|
1555
1536
|
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
@@ -1575,28 +1556,37 @@ function validateExplicitKey(element, parentType) {
|
|
1575
1556
|
childOwner = " It was passed a child from " + ownerName + ".";
|
1576
1557
|
}
|
1577
1558
|
|
1578
|
-
|
1559
|
+
var prevGetCurrentStack = ReactSharedInternals.getCurrentStack;
|
1579
1560
|
|
1580
|
-
|
1561
|
+
ReactSharedInternals.getCurrentStack = function () {
|
1581
1562
|
|
1582
|
-
|
1583
|
-
}
|
1584
|
-
}
|
1563
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type); // Delegate to the injected renderer-specific implementation
|
1585
1564
|
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
}
|
1592
|
-
|
1593
|
-
|
1565
|
+
if (prevGetCurrentStack) {
|
1566
|
+
stack += prevGetCurrentStack() || '';
|
1567
|
+
}
|
1568
|
+
|
1569
|
+
return stack;
|
1570
|
+
};
|
1571
|
+
|
1572
|
+
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
1573
|
+
|
1574
|
+
ReactSharedInternals.getCurrentStack = prevGetCurrentStack;
|
1594
1575
|
}
|
1595
1576
|
}
|
1596
1577
|
|
1597
1578
|
function getCurrentComponentErrorInfo(parentType) {
|
1598
1579
|
{
|
1599
|
-
var info =
|
1580
|
+
var info = '';
|
1581
|
+
var owner = getOwner();
|
1582
|
+
|
1583
|
+
if (owner) {
|
1584
|
+
var name = getComponentNameFromType(owner.type);
|
1585
|
+
|
1586
|
+
if (name) {
|
1587
|
+
info = '\n\nCheck the render method of `' + name + '`.';
|
1588
|
+
}
|
1589
|
+
}
|
1600
1590
|
|
1601
1591
|
if (!info) {
|
1602
1592
|
var parentName = getComponentNameFromType(parentType);
|
@@ -1609,31 +1599,6 @@ function getCurrentComponentErrorInfo(parentType) {
|
|
1609
1599
|
return info;
|
1610
1600
|
}
|
1611
1601
|
}
|
1612
|
-
/**
|
1613
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
1614
|
-
* @param {ReactElement} fragment
|
1615
|
-
*/
|
1616
|
-
|
1617
|
-
|
1618
|
-
function validateFragmentProps(fragment) {
|
1619
|
-
// TODO: Move this to render phase instead of at element creation.
|
1620
|
-
{
|
1621
|
-
var keys = Object.keys(fragment.props);
|
1622
|
-
|
1623
|
-
for (var i = 0; i < keys.length; i++) {
|
1624
|
-
var key = keys[i];
|
1625
|
-
|
1626
|
-
if (key !== 'children' && key !== 'key') {
|
1627
|
-
setCurrentlyValidatingElement(fragment);
|
1628
|
-
|
1629
|
-
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
1630
|
-
|
1631
|
-
setCurrentlyValidatingElement(null);
|
1632
|
-
break;
|
1633
|
-
}
|
1634
|
-
}
|
1635
|
-
}
|
1636
|
-
}
|
1637
1602
|
|
1638
1603
|
var SEPARATOR = '.';
|
1639
1604
|
var SUBSEPARATOR = ':';
|
@@ -1817,17 +1782,32 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
1817
1782
|
// The `if` statement here prevents auto-disabling of the safe
|
1818
1783
|
// coercion ESLint rule, so we must manually disable it below.
|
1819
1784
|
// $FlowFixMe[incompatible-type] Flow incorrectly thinks React.Portal doesn't have a key
|
1820
|
-
if (mappedChild.key
|
1821
|
-
|
1785
|
+
if (mappedChild.key != null) {
|
1786
|
+
if (!_child || _child.key !== mappedChild.key) {
|
1787
|
+
checkKeyStringCoercion(mappedChild.key);
|
1788
|
+
}
|
1822
1789
|
}
|
1823
1790
|
}
|
1824
1791
|
|
1825
|
-
|
1792
|
+
var newChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
|
1826
1793
|
// traverseAllChildren used to do for objects as children
|
1827
1794
|
escapedPrefix + ( // $FlowFixMe[incompatible-type] Flow incorrectly thinks React.Portal doesn't have a key
|
1828
|
-
mappedChild.key && (!_child || _child.key !== mappedChild.key) ? escapeUserProvidedKey( // $FlowFixMe[unsafe-addition]
|
1795
|
+
mappedChild.key != null && (!_child || _child.key !== mappedChild.key) ? escapeUserProvidedKey( // $FlowFixMe[unsafe-addition]
|
1829
1796
|
'' + mappedChild.key // eslint-disable-line react-internal/safe-string-coercion
|
1830
1797
|
) + '/' : '') + childKey);
|
1798
|
+
|
1799
|
+
{
|
1800
|
+
if (nameSoFar !== '' && mappedChild.key == null) {
|
1801
|
+
// We need to validate that this child should have had a key before assigning it one.
|
1802
|
+
if (!newChild._store.validated) {
|
1803
|
+
// We mark this child as having failed validation but we let the actual renderer
|
1804
|
+
// print the warning later.
|
1805
|
+
newChild._store.validated = 2;
|
1806
|
+
}
|
1807
|
+
}
|
1808
|
+
}
|
1809
|
+
|
1810
|
+
mappedChild = newChild;
|
1831
1811
|
}
|
1832
1812
|
|
1833
1813
|
array.push(mappedChild);
|
@@ -2145,7 +2125,9 @@ function forwardRef(render) {
|
|
2145
2125
|
// This kind of inner function is not used elsewhere so the side effect is okay.
|
2146
2126
|
|
2147
2127
|
if (!render.name && !render.displayName) {
|
2148
|
-
render
|
2128
|
+
Object.defineProperty(render, 'name', {
|
2129
|
+
value: name
|
2130
|
+
});
|
2149
2131
|
}
|
2150
2132
|
}
|
2151
2133
|
});
|
@@ -2185,7 +2167,9 @@ function memo(type, compare) {
|
|
2185
2167
|
// This kind of inner function is not used elsewhere so the side effect is okay.
|
2186
2168
|
|
2187
2169
|
if (!type.name && !type.displayName) {
|
2188
|
-
type
|
2170
|
+
Object.defineProperty(type, 'name', {
|
2171
|
+
value: name
|
2172
|
+
});
|
2189
2173
|
}
|
2190
2174
|
}
|
2191
2175
|
});
|
@@ -2350,13 +2334,8 @@ reportError : function (error) {
|
|
2350
2334
|
};
|
2351
2335
|
|
2352
2336
|
function startTransition(scope, options) {
|
2353
|
-
var prevTransition = ReactSharedInternals.T;
|
2354
|
-
|
2355
|
-
|
2356
|
-
var callbacks = new Set();
|
2357
|
-
var transition = {
|
2358
|
-
_callbacks: callbacks
|
2359
|
-
};
|
2337
|
+
var prevTransition = ReactSharedInternals.T;
|
2338
|
+
var transition = {};
|
2360
2339
|
ReactSharedInternals.T = transition;
|
2361
2340
|
var currentTransition = ReactSharedInternals.T;
|
2362
2341
|
|
@@ -2367,11 +2346,13 @@ function startTransition(scope, options) {
|
|
2367
2346
|
{
|
2368
2347
|
try {
|
2369
2348
|
var returnValue = scope();
|
2349
|
+
var onStartTransitionFinish = ReactSharedInternals.S;
|
2350
|
+
|
2351
|
+
if (onStartTransitionFinish !== null) {
|
2352
|
+
onStartTransitionFinish(transition, returnValue);
|
2353
|
+
}
|
2370
2354
|
|
2371
2355
|
if (typeof returnValue === 'object' && returnValue !== null && typeof returnValue.then === 'function') {
|
2372
|
-
callbacks.forEach(function (callback) {
|
2373
|
-
return callback(currentTransition, returnValue);
|
2374
|
-
});
|
2375
2356
|
returnValue.then(noop, reportGlobalError);
|
2376
2357
|
}
|
2377
2358
|
} catch (error) {
|
package/cjs/react.production.js
CHANGED
@@ -72,7 +72,7 @@ pureComponentPrototype.constructor = PureComponent;
|
|
72
72
|
assign(pureComponentPrototype, Component.prototype);
|
73
73
|
pureComponentPrototype.isPureReactComponent = !0;
|
74
74
|
var isArrayImpl = Array.isArray,
|
75
|
-
ReactSharedInternals = { H: null, A: null, T: null },
|
75
|
+
ReactSharedInternals = { H: null, A: null, T: null, S: null },
|
76
76
|
hasOwnProperty = Object.prototype.hasOwnProperty;
|
77
77
|
function ReactElement(type, key, _ref, self, source, owner, props) {
|
78
78
|
_ref = props.ref;
|
@@ -199,7 +199,8 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
199
199
|
(callback = cloneAndReplaceKey(
|
200
200
|
callback,
|
201
201
|
escapedPrefix +
|
202
|
-
(
|
202
|
+
(null == callback.key ||
|
203
|
+
(children && children.key === callback.key)
|
203
204
|
? ""
|
204
205
|
: ("" + callback.key).replace(
|
205
206
|
userProvidedKeyEscapeRegex,
|
@@ -455,18 +456,17 @@ exports.memo = function (type, compare) {
|
|
455
456
|
};
|
456
457
|
exports.startTransition = function (scope) {
|
457
458
|
var prevTransition = ReactSharedInternals.T,
|
458
|
-
|
459
|
-
ReactSharedInternals.T =
|
460
|
-
var currentTransition = ReactSharedInternals.T;
|
459
|
+
transition = {};
|
460
|
+
ReactSharedInternals.T = transition;
|
461
461
|
try {
|
462
|
-
var returnValue = scope()
|
462
|
+
var returnValue = scope(),
|
463
|
+
onStartTransitionFinish = ReactSharedInternals.S;
|
464
|
+
null !== onStartTransitionFinish &&
|
465
|
+
onStartTransitionFinish(transition, returnValue);
|
463
466
|
"object" === typeof returnValue &&
|
464
467
|
null !== returnValue &&
|
465
468
|
"function" === typeof returnValue.then &&
|
466
|
-
|
467
|
-
return callback(currentTransition, returnValue);
|
468
|
-
}),
|
469
|
-
returnValue.then(noop, reportGlobalError));
|
469
|
+
returnValue.then(noop, reportGlobalError);
|
470
470
|
} catch (error) {
|
471
471
|
reportGlobalError(error);
|
472
472
|
} finally {
|
@@ -536,4 +536,4 @@ exports.useSyncExternalStore = function (
|
|
536
536
|
exports.useTransition = function () {
|
537
537
|
return ReactSharedInternals.H.useTransition();
|
538
538
|
};
|
539
|
-
exports.version = "19.0.0-rc-
|
539
|
+
exports.version = "19.0.0-rc-6f23540c7d-20240528";
|