react 19.0.0-rc-f994737d14-20240522 → 19.0.0-rc-935180c7e0-20240524
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 +24 -11
- package/cjs/react-jsx-dev-runtime.development.js +57 -79
- package/cjs/react-jsx-dev-runtime.react-server.development.js +57 -79
- package/cjs/react-jsx-runtime.development.js +57 -79
- package/cjs/react-jsx-runtime.react-server.development.js +57 -79
- package/cjs/react.development.js +92 -119
- package/cjs/react.production.js +11 -11
- package/cjs/react.react-server.development.js +90 -118
- package/cjs/react.react-server.production.js +10 -10
- package/package.json +1 -1
@@ -38,31 +38,8 @@ var ReactSharedInternals = {
|
|
38
38
|
};
|
39
39
|
|
40
40
|
{
|
41
|
-
|
42
|
-
|
43
|
-
ReactSharedInternals.setExtraStackFrame = function (stack) {
|
44
|
-
currentExtraStackFrame = stack;
|
45
|
-
}; // Stack implementation injected by the current renderer.
|
46
|
-
|
47
|
-
|
41
|
+
// Stack implementation injected by the current renderer.
|
48
42
|
ReactSharedInternals.getCurrentStack = null;
|
49
|
-
|
50
|
-
ReactSharedInternals.getStackAddendum = function () {
|
51
|
-
var stack = ''; // Add an extra top frame while an element is being validated
|
52
|
-
|
53
|
-
if (currentExtraStackFrame) {
|
54
|
-
stack += currentExtraStackFrame;
|
55
|
-
} // Delegate to the injected renderer-specific implementation
|
56
|
-
|
57
|
-
|
58
|
-
var impl = ReactSharedInternals.getCurrentStack;
|
59
|
-
|
60
|
-
if (impl) {
|
61
|
-
stack += impl() || '';
|
62
|
-
}
|
63
|
-
|
64
|
-
return stack;
|
65
|
-
};
|
66
43
|
}
|
67
44
|
|
68
45
|
// by calls to these methods by a Babel plugin.
|
@@ -97,23 +74,36 @@ function printWarning(level, format, args) {
|
|
97
74
|
// When changing this logic, you might want to also
|
98
75
|
// update consoleWithStackDev.www.js as well.
|
99
76
|
{
|
100
|
-
var
|
77
|
+
var isErrorLogger = format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n';
|
101
78
|
|
102
|
-
if (
|
103
|
-
|
104
|
-
args = args.concat([stack]);
|
105
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
79
|
+
if (ReactSharedInternals.getCurrentStack) {
|
80
|
+
var stack = ReactSharedInternals.getCurrentStack();
|
106
81
|
|
82
|
+
if (stack !== '') {
|
83
|
+
format += '%s';
|
84
|
+
args = args.concat([stack]);
|
85
|
+
}
|
86
|
+
}
|
107
87
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
88
|
+
if (isErrorLogger) {
|
89
|
+
// Don't prefix our default logging formatting in ReactFiberErrorLoggger.
|
90
|
+
// Don't toString the arguments.
|
91
|
+
args.unshift(format);
|
92
|
+
} else {
|
93
|
+
// TODO: Remove this prefix and stop toStringing in the wrapper and
|
94
|
+
// instead do it at each callsite as needed.
|
95
|
+
// Careful: RN currently depends on this prefix
|
96
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
97
|
+
args = args.map(function (item) {
|
98
|
+
return String(item);
|
99
|
+
});
|
100
|
+
args.unshift('Warning: ' + format);
|
101
|
+
} // We intentionally don't use spread (or .apply) directly because it
|
113
102
|
// breaks IE9: https://github.com/facebook/react/issues/13610
|
114
103
|
// eslint-disable-next-line react-internal/no-production-logging
|
115
104
|
|
116
|
-
|
105
|
+
|
106
|
+
Function.prototype.apply.call(console[level], console, args);
|
117
107
|
}
|
118
108
|
}
|
119
109
|
|
@@ -341,7 +331,9 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
341
331
|
|
342
332
|
var assign = Object.assign;
|
343
333
|
|
344
|
-
var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference');
|
334
|
+
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.
|
335
|
+
// TODO: Delete this when enableOwnerStacks ships.
|
336
|
+
|
345
337
|
function isValidElementType(type) {
|
346
338
|
if (typeof type === 'string' || typeof type === 'function') {
|
347
339
|
return true;
|
@@ -733,7 +725,8 @@ function describeFunctionComponentFrame(fn) {
|
|
733
725
|
function shouldConstruct(Component) {
|
734
726
|
var prototype = Component.prototype;
|
735
727
|
return !!(prototype && prototype.isReactComponent);
|
736
|
-
}
|
728
|
+
} // TODO: Delete this once the key warning no longer uses it. I.e. when enableOwnerStacks ship.
|
729
|
+
|
737
730
|
|
738
731
|
function describeUnknownElementTypeFrameInDEV(type) {
|
739
732
|
|
@@ -965,7 +958,7 @@ function ReactElement(type, key, _ref, self, source, owner, props, debugStack, d
|
|
965
958
|
configurable: false,
|
966
959
|
enumerable: false,
|
967
960
|
writable: true,
|
968
|
-
value:
|
961
|
+
value: 0
|
969
962
|
}); // debugInfo contains Server Component debug information.
|
970
963
|
|
971
964
|
Object.defineProperty(element, '_debugInfo', {
|
@@ -991,6 +984,11 @@ function ReactElement(type, key, _ref, self, source, owner, props, debugStack, d
|
|
991
984
|
function createElement(type, config, children) {
|
992
985
|
{
|
993
986
|
if (!isValidElementType(type)) {
|
987
|
+
// This is just an optimistic check that provides a better stack trace before
|
988
|
+
// owner stacks. It's really up to the renderer if it's a valid element type.
|
989
|
+
// When owner stacks are enabled, we instead warn in the renderer and it'll
|
990
|
+
// have the stack trace of the JSX element anyway.
|
991
|
+
//
|
994
992
|
// This is an invalid element type.
|
995
993
|
//
|
996
994
|
// We warn in this case but don't throw. We expect the element creation to
|
@@ -1117,13 +1115,7 @@ function createElement(type, config, children) {
|
|
1117
1115
|
}
|
1118
1116
|
}
|
1119
1117
|
|
1120
|
-
|
1121
|
-
|
1122
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
1123
|
-
validateFragmentProps(element);
|
1124
|
-
}
|
1125
|
-
|
1126
|
-
return element;
|
1118
|
+
return ReactElement(type, key, ref, undefined, undefined, getOwner(), props);
|
1127
1119
|
}
|
1128
1120
|
function cloneAndReplaceKey(oldElement, newKey) {
|
1129
1121
|
return ReactElement(oldElement.type, newKey, // When enableRefAsProp is on, this argument is ignored. This check only
|
@@ -1207,22 +1199,6 @@ function cloneElement(element, config, children) {
|
|
1207
1199
|
|
1208
1200
|
return clonedElement;
|
1209
1201
|
}
|
1210
|
-
|
1211
|
-
function getDeclarationErrorAddendum() {
|
1212
|
-
{
|
1213
|
-
var owner = getOwner();
|
1214
|
-
|
1215
|
-
if (owner) {
|
1216
|
-
var name = getComponentNameFromType(owner.type);
|
1217
|
-
|
1218
|
-
if (name) {
|
1219
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
1220
|
-
}
|
1221
|
-
}
|
1222
|
-
|
1223
|
-
return '';
|
1224
|
-
}
|
1225
|
-
}
|
1226
1202
|
/**
|
1227
1203
|
* Ensure that every element either is passed in a static location, in an
|
1228
1204
|
* array with an explicit keys property defined, or in an object literal
|
@@ -1233,7 +1209,6 @@ function getDeclarationErrorAddendum() {
|
|
1233
1209
|
* @param {*} parentType node's parent's type.
|
1234
1210
|
*/
|
1235
1211
|
|
1236
|
-
|
1237
1212
|
function validateChildKeys(node, parentType) {
|
1238
1213
|
{
|
1239
1214
|
if (typeof node !== 'object' || !node) {
|
@@ -1251,7 +1226,7 @@ function validateChildKeys(node, parentType) {
|
|
1251
1226
|
} else if (isValidElement(node)) {
|
1252
1227
|
// This element was passed in a valid location.
|
1253
1228
|
if (node._store) {
|
1254
|
-
node._store.validated =
|
1229
|
+
node._store.validated = 1;
|
1255
1230
|
}
|
1256
1231
|
} else {
|
1257
1232
|
var iteratorFn = getIteratorFn(node);
|
@@ -1302,12 +1277,13 @@ var ownerHasKeyUseWarning = {};
|
|
1302
1277
|
*/
|
1303
1278
|
|
1304
1279
|
function validateExplicitKey(element, parentType) {
|
1280
|
+
|
1305
1281
|
{
|
1306
1282
|
if (!element._store || element._store.validated || element.key != null) {
|
1307
1283
|
return;
|
1308
1284
|
}
|
1309
1285
|
|
1310
|
-
element._store.validated =
|
1286
|
+
element._store.validated = 1;
|
1311
1287
|
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
1312
1288
|
|
1313
1289
|
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
@@ -1333,28 +1309,37 @@ function validateExplicitKey(element, parentType) {
|
|
1333
1309
|
childOwner = " It was passed a child from " + ownerName + ".";
|
1334
1310
|
}
|
1335
1311
|
|
1336
|
-
|
1312
|
+
var prevGetCurrentStack = ReactSharedInternals.getCurrentStack;
|
1337
1313
|
|
1338
|
-
|
1314
|
+
ReactSharedInternals.getCurrentStack = function () {
|
1339
1315
|
|
1340
|
-
|
1341
|
-
}
|
1342
|
-
}
|
1316
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type); // Delegate to the injected renderer-specific implementation
|
1343
1317
|
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
}
|
1350
|
-
|
1351
|
-
|
1318
|
+
if (prevGetCurrentStack) {
|
1319
|
+
stack += prevGetCurrentStack() || '';
|
1320
|
+
}
|
1321
|
+
|
1322
|
+
return stack;
|
1323
|
+
};
|
1324
|
+
|
1325
|
+
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);
|
1326
|
+
|
1327
|
+
ReactSharedInternals.getCurrentStack = prevGetCurrentStack;
|
1352
1328
|
}
|
1353
1329
|
}
|
1354
1330
|
|
1355
1331
|
function getCurrentComponentErrorInfo(parentType) {
|
1356
1332
|
{
|
1357
|
-
var info =
|
1333
|
+
var info = '';
|
1334
|
+
var owner = getOwner();
|
1335
|
+
|
1336
|
+
if (owner) {
|
1337
|
+
var name = getComponentNameFromType(owner.type);
|
1338
|
+
|
1339
|
+
if (name) {
|
1340
|
+
info = '\n\nCheck the render method of `' + name + '`.';
|
1341
|
+
}
|
1342
|
+
}
|
1358
1343
|
|
1359
1344
|
if (!info) {
|
1360
1345
|
var parentName = getComponentNameFromType(parentType);
|
@@ -1367,31 +1352,6 @@ function getCurrentComponentErrorInfo(parentType) {
|
|
1367
1352
|
return info;
|
1368
1353
|
}
|
1369
1354
|
}
|
1370
|
-
/**
|
1371
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
1372
|
-
* @param {ReactElement} fragment
|
1373
|
-
*/
|
1374
|
-
|
1375
|
-
|
1376
|
-
function validateFragmentProps(fragment) {
|
1377
|
-
// TODO: Move this to render phase instead of at element creation.
|
1378
|
-
{
|
1379
|
-
var keys = Object.keys(fragment.props);
|
1380
|
-
|
1381
|
-
for (var i = 0; i < keys.length; i++) {
|
1382
|
-
var key = keys[i];
|
1383
|
-
|
1384
|
-
if (key !== 'children' && key !== 'key') {
|
1385
|
-
setCurrentlyValidatingElement(fragment);
|
1386
|
-
|
1387
|
-
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
1388
|
-
|
1389
|
-
setCurrentlyValidatingElement(null);
|
1390
|
-
break;
|
1391
|
-
}
|
1392
|
-
}
|
1393
|
-
}
|
1394
|
-
}
|
1395
1355
|
|
1396
1356
|
var SEPARATOR = '.';
|
1397
1357
|
var SUBSEPARATOR = ':';
|
@@ -1575,17 +1535,32 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
1575
1535
|
// The `if` statement here prevents auto-disabling of the safe
|
1576
1536
|
// coercion ESLint rule, so we must manually disable it below.
|
1577
1537
|
// $FlowFixMe[incompatible-type] Flow incorrectly thinks React.Portal doesn't have a key
|
1578
|
-
if (mappedChild.key
|
1579
|
-
|
1538
|
+
if (mappedChild.key != null) {
|
1539
|
+
if (!_child || _child.key !== mappedChild.key) {
|
1540
|
+
checkKeyStringCoercion(mappedChild.key);
|
1541
|
+
}
|
1580
1542
|
}
|
1581
1543
|
}
|
1582
1544
|
|
1583
|
-
|
1545
|
+
var newChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
|
1584
1546
|
// traverseAllChildren used to do for objects as children
|
1585
1547
|
escapedPrefix + ( // $FlowFixMe[incompatible-type] Flow incorrectly thinks React.Portal doesn't have a key
|
1586
|
-
mappedChild.key && (!_child || _child.key !== mappedChild.key) ? escapeUserProvidedKey( // $FlowFixMe[unsafe-addition]
|
1548
|
+
mappedChild.key != null && (!_child || _child.key !== mappedChild.key) ? escapeUserProvidedKey( // $FlowFixMe[unsafe-addition]
|
1587
1549
|
'' + mappedChild.key // eslint-disable-line react-internal/safe-string-coercion
|
1588
1550
|
) + '/' : '') + childKey);
|
1551
|
+
|
1552
|
+
{
|
1553
|
+
if (nameSoFar !== '' && mappedChild.key == null) {
|
1554
|
+
// We need to validate that this child should have had a key before assigning it one.
|
1555
|
+
if (!newChild._store.validated) {
|
1556
|
+
// We mark this child as having failed validation but we let the actual renderer
|
1557
|
+
// print the warning later.
|
1558
|
+
newChild._store.validated = 2;
|
1559
|
+
}
|
1560
|
+
}
|
1561
|
+
}
|
1562
|
+
|
1563
|
+
mappedChild = newChild;
|
1589
1564
|
}
|
1590
1565
|
|
1591
1566
|
array.push(mappedChild);
|
@@ -2109,13 +2084,8 @@ reportError : function (error) {
|
|
2109
2084
|
};
|
2110
2085
|
|
2111
2086
|
function startTransition(scope, options) {
|
2112
|
-
var prevTransition = ReactSharedInternals.T;
|
2113
|
-
|
2114
|
-
|
2115
|
-
var callbacks = new Set();
|
2116
|
-
var transition = {
|
2117
|
-
_callbacks: callbacks
|
2118
|
-
};
|
2087
|
+
var prevTransition = ReactSharedInternals.T;
|
2088
|
+
var transition = {};
|
2119
2089
|
ReactSharedInternals.T = transition;
|
2120
2090
|
var currentTransition = ReactSharedInternals.T;
|
2121
2091
|
|
@@ -2126,11 +2096,13 @@ function startTransition(scope, options) {
|
|
2126
2096
|
{
|
2127
2097
|
try {
|
2128
2098
|
var returnValue = scope();
|
2099
|
+
var onStartTransitionFinish = ReactSharedInternals.S;
|
2100
|
+
|
2101
|
+
if (onStartTransitionFinish !== null) {
|
2102
|
+
onStartTransitionFinish(transition, returnValue);
|
2103
|
+
}
|
2129
2104
|
|
2130
2105
|
if (typeof returnValue === 'object' && returnValue !== null && typeof returnValue.then === 'function') {
|
2131
|
-
callbacks.forEach(function (callback) {
|
2132
|
-
return callback(currentTransition, returnValue);
|
2133
|
-
});
|
2134
2106
|
returnValue.then(noop, reportGlobalError);
|
2135
2107
|
}
|
2136
2108
|
} catch (error) {
|
@@ -2158,7 +2130,7 @@ function warnAboutTransitionSubscriptions(prevTransition, currentTransition) {
|
|
2158
2130
|
|
2159
2131
|
function noop() {}
|
2160
2132
|
|
2161
|
-
var ReactVersion = '19.0.0-rc-
|
2133
|
+
var ReactVersion = '19.0.0-rc-935180c7e0-20240524';
|
2162
2134
|
|
2163
2135
|
var Children = {
|
2164
2136
|
map: mapChildren,
|
@@ -170,7 +170,8 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
170
170
|
(callback = cloneAndReplaceKey(
|
171
171
|
callback,
|
172
172
|
escapedPrefix +
|
173
|
-
(
|
173
|
+
(null == callback.key ||
|
174
|
+
(children && children.key === callback.key)
|
174
175
|
? ""
|
175
176
|
: ("" + callback.key).replace(
|
176
177
|
userProvidedKeyEscapeRegex,
|
@@ -442,18 +443,17 @@ exports.memo = function (type, compare) {
|
|
442
443
|
};
|
443
444
|
exports.startTransition = function (scope) {
|
444
445
|
var prevTransition = ReactSharedInternals.T,
|
445
|
-
|
446
|
-
ReactSharedInternals.T =
|
447
|
-
var currentTransition = ReactSharedInternals.T;
|
446
|
+
transition = {};
|
447
|
+
ReactSharedInternals.T = transition;
|
448
448
|
try {
|
449
|
-
var returnValue = scope()
|
449
|
+
var returnValue = scope(),
|
450
|
+
onStartTransitionFinish = ReactSharedInternals.S;
|
451
|
+
null !== onStartTransitionFinish &&
|
452
|
+
onStartTransitionFinish(transition, returnValue);
|
450
453
|
"object" === typeof returnValue &&
|
451
454
|
null !== returnValue &&
|
452
455
|
"function" === typeof returnValue.then &&
|
453
|
-
|
454
|
-
return callback(currentTransition, returnValue);
|
455
|
-
}),
|
456
|
-
returnValue.then(noop, reportGlobalError));
|
456
|
+
returnValue.then(noop, reportGlobalError);
|
457
457
|
} catch (error) {
|
458
458
|
reportGlobalError(error);
|
459
459
|
} finally {
|
@@ -476,4 +476,4 @@ exports.useId = function () {
|
|
476
476
|
exports.useMemo = function (create, deps) {
|
477
477
|
return ReactSharedInternals.H.useMemo(create, deps);
|
478
478
|
};
|
479
|
-
exports.version = "19.0.0-rc-
|
479
|
+
exports.version = "19.0.0-rc-935180c7e0-20240524";
|