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
@@ -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.
|
@@ -91,29 +68,45 @@ function error(format) {
|
|
91
68
|
printWarning('error', format, args);
|
92
69
|
}
|
93
70
|
}
|
94
|
-
}
|
71
|
+
} // eslint-disable-next-line react-internal/no-production-logging
|
95
72
|
|
96
73
|
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
|
-
|
105
|
-
|
79
|
+
if (ReactSharedInternals.getCurrentStack) {
|
80
|
+
// We only add the current stack to the console when createTask is not supported.
|
81
|
+
// Since createTask requires DevTools to be open to work, this means that stacks
|
82
|
+
// can be lost while DevTools isn't open but we can't detect this.
|
83
|
+
var stack = ReactSharedInternals.getCurrentStack();
|
106
84
|
|
85
|
+
if (stack !== '') {
|
86
|
+
format += '%s';
|
87
|
+
args = args.concat([stack]);
|
88
|
+
}
|
89
|
+
}
|
107
90
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
91
|
+
if (isErrorLogger) {
|
92
|
+
// Don't prefix our default logging formatting in ReactFiberErrorLoggger.
|
93
|
+
// Don't toString the arguments.
|
94
|
+
args.unshift(format);
|
95
|
+
} else {
|
96
|
+
// TODO: Remove this prefix and stop toStringing in the wrapper and
|
97
|
+
// instead do it at each callsite as needed.
|
98
|
+
// Careful: RN currently depends on this prefix
|
99
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
100
|
+
args = args.map(function (item) {
|
101
|
+
return String(item);
|
102
|
+
});
|
103
|
+
args.unshift('Warning: ' + format);
|
104
|
+
} // We intentionally don't use spread (or .apply) directly because it
|
113
105
|
// breaks IE9: https://github.com/facebook/react/issues/13610
|
114
106
|
// eslint-disable-next-line react-internal/no-production-logging
|
115
107
|
|
116
|
-
|
108
|
+
|
109
|
+
Function.prototype.apply.call(console[level], console, args);
|
117
110
|
}
|
118
111
|
}
|
119
112
|
|
@@ -341,7 +334,9 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
341
334
|
|
342
335
|
var assign = Object.assign;
|
343
336
|
|
344
|
-
var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference');
|
337
|
+
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.
|
338
|
+
// TODO: Delete this when enableOwnerStacks ships.
|
339
|
+
|
345
340
|
function isValidElementType(type) {
|
346
341
|
if (typeof type === 'string' || typeof type === 'function') {
|
347
342
|
return true;
|
@@ -733,7 +728,8 @@ function describeFunctionComponentFrame(fn) {
|
|
733
728
|
function shouldConstruct(Component) {
|
734
729
|
var prototype = Component.prototype;
|
735
730
|
return !!(prototype && prototype.isReactComponent);
|
736
|
-
}
|
731
|
+
} // TODO: Delete this once the key warning no longer uses it. I.e. when enableOwnerStacks ship.
|
732
|
+
|
737
733
|
|
738
734
|
function describeUnknownElementTypeFrameInDEV(type) {
|
739
735
|
|
@@ -965,7 +961,7 @@ function ReactElement(type, key, _ref, self, source, owner, props, debugStack, d
|
|
965
961
|
configurable: false,
|
966
962
|
enumerable: false,
|
967
963
|
writable: true,
|
968
|
-
value:
|
964
|
+
value: 0
|
969
965
|
}); // debugInfo contains Server Component debug information.
|
970
966
|
|
971
967
|
Object.defineProperty(element, '_debugInfo', {
|
@@ -988,9 +984,15 @@ function ReactElement(type, key, _ref, self, source, owner, props, debugStack, d
|
|
988
984
|
* See https://reactjs.org/docs/react-api.html#createelement
|
989
985
|
*/
|
990
986
|
|
987
|
+
|
991
988
|
function createElement(type, config, children) {
|
992
989
|
{
|
993
990
|
if (!isValidElementType(type)) {
|
991
|
+
// This is just an optimistic check that provides a better stack trace before
|
992
|
+
// owner stacks. It's really up to the renderer if it's a valid element type.
|
993
|
+
// When owner stacks are enabled, we instead warn in the renderer and it'll
|
994
|
+
// have the stack trace of the JSX element anyway.
|
995
|
+
//
|
994
996
|
// This is an invalid element type.
|
995
997
|
//
|
996
998
|
// We warn in this case but don't throw. We expect the element creation to
|
@@ -1117,13 +1119,7 @@ function createElement(type, config, children) {
|
|
1117
1119
|
}
|
1118
1120
|
}
|
1119
1121
|
|
1120
|
-
|
1121
|
-
|
1122
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
1123
|
-
validateFragmentProps(element);
|
1124
|
-
}
|
1125
|
-
|
1126
|
-
return element;
|
1122
|
+
return ReactElement(type, key, ref, undefined, undefined, getOwner(), props);
|
1127
1123
|
}
|
1128
1124
|
function cloneAndReplaceKey(oldElement, newKey) {
|
1129
1125
|
return ReactElement(oldElement.type, newKey, // When enableRefAsProp is on, this argument is ignored. This check only
|
@@ -1207,22 +1203,6 @@ function cloneElement(element, config, children) {
|
|
1207
1203
|
|
1208
1204
|
return clonedElement;
|
1209
1205
|
}
|
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
1206
|
/**
|
1227
1207
|
* Ensure that every element either is passed in a static location, in an
|
1228
1208
|
* array with an explicit keys property defined, or in an object literal
|
@@ -1233,7 +1213,6 @@ function getDeclarationErrorAddendum() {
|
|
1233
1213
|
* @param {*} parentType node's parent's type.
|
1234
1214
|
*/
|
1235
1215
|
|
1236
|
-
|
1237
1216
|
function validateChildKeys(node, parentType) {
|
1238
1217
|
{
|
1239
1218
|
if (typeof node !== 'object' || !node) {
|
@@ -1251,7 +1230,7 @@ function validateChildKeys(node, parentType) {
|
|
1251
1230
|
} else if (isValidElement(node)) {
|
1252
1231
|
// This element was passed in a valid location.
|
1253
1232
|
if (node._store) {
|
1254
|
-
node._store.validated =
|
1233
|
+
node._store.validated = 1;
|
1255
1234
|
}
|
1256
1235
|
} else {
|
1257
1236
|
var iteratorFn = getIteratorFn(node);
|
@@ -1302,12 +1281,13 @@ var ownerHasKeyUseWarning = {};
|
|
1302
1281
|
*/
|
1303
1282
|
|
1304
1283
|
function validateExplicitKey(element, parentType) {
|
1284
|
+
|
1305
1285
|
{
|
1306
1286
|
if (!element._store || element._store.validated || element.key != null) {
|
1307
1287
|
return;
|
1308
1288
|
}
|
1309
1289
|
|
1310
|
-
element._store.validated =
|
1290
|
+
element._store.validated = 1;
|
1311
1291
|
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
1312
1292
|
|
1313
1293
|
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
@@ -1333,28 +1313,37 @@ function validateExplicitKey(element, parentType) {
|
|
1333
1313
|
childOwner = " It was passed a child from " + ownerName + ".";
|
1334
1314
|
}
|
1335
1315
|
|
1336
|
-
|
1316
|
+
var prevGetCurrentStack = ReactSharedInternals.getCurrentStack;
|
1337
1317
|
|
1338
|
-
|
1318
|
+
ReactSharedInternals.getCurrentStack = function () {
|
1339
1319
|
|
1340
|
-
|
1341
|
-
}
|
1342
|
-
}
|
1320
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type); // Delegate to the injected renderer-specific implementation
|
1343
1321
|
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
}
|
1350
|
-
|
1351
|
-
|
1322
|
+
if (prevGetCurrentStack) {
|
1323
|
+
stack += prevGetCurrentStack() || '';
|
1324
|
+
}
|
1325
|
+
|
1326
|
+
return stack;
|
1327
|
+
};
|
1328
|
+
|
1329
|
+
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);
|
1330
|
+
|
1331
|
+
ReactSharedInternals.getCurrentStack = prevGetCurrentStack;
|
1352
1332
|
}
|
1353
1333
|
}
|
1354
1334
|
|
1355
1335
|
function getCurrentComponentErrorInfo(parentType) {
|
1356
1336
|
{
|
1357
|
-
var info =
|
1337
|
+
var info = '';
|
1338
|
+
var owner = getOwner();
|
1339
|
+
|
1340
|
+
if (owner) {
|
1341
|
+
var name = getComponentNameFromType(owner.type);
|
1342
|
+
|
1343
|
+
if (name) {
|
1344
|
+
info = '\n\nCheck the render method of `' + name + '`.';
|
1345
|
+
}
|
1346
|
+
}
|
1358
1347
|
|
1359
1348
|
if (!info) {
|
1360
1349
|
var parentName = getComponentNameFromType(parentType);
|
@@ -1367,31 +1356,6 @@ function getCurrentComponentErrorInfo(parentType) {
|
|
1367
1356
|
return info;
|
1368
1357
|
}
|
1369
1358
|
}
|
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
1359
|
|
1396
1360
|
var SEPARATOR = '.';
|
1397
1361
|
var SUBSEPARATOR = ':';
|
@@ -1575,17 +1539,32 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
1575
1539
|
// The `if` statement here prevents auto-disabling of the safe
|
1576
1540
|
// coercion ESLint rule, so we must manually disable it below.
|
1577
1541
|
// $FlowFixMe[incompatible-type] Flow incorrectly thinks React.Portal doesn't have a key
|
1578
|
-
if (mappedChild.key
|
1579
|
-
|
1542
|
+
if (mappedChild.key != null) {
|
1543
|
+
if (!_child || _child.key !== mappedChild.key) {
|
1544
|
+
checkKeyStringCoercion(mappedChild.key);
|
1545
|
+
}
|
1580
1546
|
}
|
1581
1547
|
}
|
1582
1548
|
|
1583
|
-
|
1549
|
+
var newChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
|
1584
1550
|
// traverseAllChildren used to do for objects as children
|
1585
1551
|
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]
|
1552
|
+
mappedChild.key != null && (!_child || _child.key !== mappedChild.key) ? escapeUserProvidedKey( // $FlowFixMe[unsafe-addition]
|
1587
1553
|
'' + mappedChild.key // eslint-disable-line react-internal/safe-string-coercion
|
1588
1554
|
) + '/' : '') + childKey);
|
1555
|
+
|
1556
|
+
{
|
1557
|
+
if (nameSoFar !== '' && mappedChild.key == null) {
|
1558
|
+
// We need to validate that this child should have had a key before assigning it one.
|
1559
|
+
if (!newChild._store.validated) {
|
1560
|
+
// We mark this child as having failed validation but we let the actual renderer
|
1561
|
+
// print the warning later.
|
1562
|
+
newChild._store.validated = 2;
|
1563
|
+
}
|
1564
|
+
}
|
1565
|
+
}
|
1566
|
+
|
1567
|
+
mappedChild = newChild;
|
1589
1568
|
}
|
1590
1569
|
|
1591
1570
|
array.push(mappedChild);
|
@@ -1847,7 +1826,9 @@ function forwardRef(render) {
|
|
1847
1826
|
// This kind of inner function is not used elsewhere so the side effect is okay.
|
1848
1827
|
|
1849
1828
|
if (!render.name && !render.displayName) {
|
1850
|
-
render
|
1829
|
+
Object.defineProperty(render, 'name', {
|
1830
|
+
value: name
|
1831
|
+
});
|
1851
1832
|
}
|
1852
1833
|
}
|
1853
1834
|
});
|
@@ -1964,7 +1945,9 @@ function memo(type, compare) {
|
|
1964
1945
|
// This kind of inner function is not used elsewhere so the side effect is okay.
|
1965
1946
|
|
1966
1947
|
if (!type.name && !type.displayName) {
|
1967
|
-
type
|
1948
|
+
Object.defineProperty(type, 'name', {
|
1949
|
+
value: name
|
1950
|
+
});
|
1968
1951
|
}
|
1969
1952
|
}
|
1970
1953
|
});
|
@@ -2109,13 +2092,8 @@ reportError : function (error) {
|
|
2109
2092
|
};
|
2110
2093
|
|
2111
2094
|
function startTransition(scope, options) {
|
2112
|
-
var prevTransition = ReactSharedInternals.T;
|
2113
|
-
|
2114
|
-
|
2115
|
-
var callbacks = new Set();
|
2116
|
-
var transition = {
|
2117
|
-
_callbacks: callbacks
|
2118
|
-
};
|
2095
|
+
var prevTransition = ReactSharedInternals.T;
|
2096
|
+
var transition = {};
|
2119
2097
|
ReactSharedInternals.T = transition;
|
2120
2098
|
var currentTransition = ReactSharedInternals.T;
|
2121
2099
|
|
@@ -2126,11 +2104,13 @@ function startTransition(scope, options) {
|
|
2126
2104
|
{
|
2127
2105
|
try {
|
2128
2106
|
var returnValue = scope();
|
2107
|
+
var onStartTransitionFinish = ReactSharedInternals.S;
|
2108
|
+
|
2109
|
+
if (onStartTransitionFinish !== null) {
|
2110
|
+
onStartTransitionFinish(transition, returnValue);
|
2111
|
+
}
|
2129
2112
|
|
2130
2113
|
if (typeof returnValue === 'object' && returnValue !== null && typeof returnValue.then === 'function') {
|
2131
|
-
callbacks.forEach(function (callback) {
|
2132
|
-
return callback(currentTransition, returnValue);
|
2133
|
-
});
|
2134
2114
|
returnValue.then(noop, reportGlobalError);
|
2135
2115
|
}
|
2136
2116
|
} catch (error) {
|
@@ -2158,7 +2138,7 @@ function warnAboutTransitionSubscriptions(prevTransition, currentTransition) {
|
|
2158
2138
|
|
2159
2139
|
function noop() {}
|
2160
2140
|
|
2161
|
-
var ReactVersion = '19.0.0-rc-
|
2141
|
+
var ReactVersion = '19.0.0-rc-6f23540c7d-20240528';
|
2162
2142
|
|
2163
2143
|
var Children = {
|
2164
2144
|
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-6f23540c7d-20240528";
|