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
@@ -83,23 +83,36 @@ function printWarning(level, format, args) {
|
|
83
83
|
// When changing this logic, you might want to also
|
84
84
|
// update consoleWithStackDev.www.js as well.
|
85
85
|
{
|
86
|
-
var
|
86
|
+
var isErrorLogger = format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n';
|
87
87
|
|
88
|
-
if (
|
89
|
-
|
90
|
-
args = args.concat([stack]);
|
91
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
88
|
+
if (ReactSharedInternals.getCurrentStack) {
|
89
|
+
var stack = ReactSharedInternals.getCurrentStack();
|
92
90
|
|
91
|
+
if (stack !== '') {
|
92
|
+
format += '%s';
|
93
|
+
args = args.concat([stack]);
|
94
|
+
}
|
95
|
+
}
|
93
96
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
97
|
+
if (isErrorLogger) {
|
98
|
+
// Don't prefix our default logging formatting in ReactFiberErrorLoggger.
|
99
|
+
// Don't toString the arguments.
|
100
|
+
args.unshift(format);
|
101
|
+
} else {
|
102
|
+
// TODO: Remove this prefix and stop toStringing in the wrapper and
|
103
|
+
// instead do it at each callsite as needed.
|
104
|
+
// Careful: RN currently depends on this prefix
|
105
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
106
|
+
args = args.map(function (item) {
|
107
|
+
return String(item);
|
108
|
+
});
|
109
|
+
args.unshift('Warning: ' + format);
|
110
|
+
} // We intentionally don't use spread (or .apply) directly because it
|
99
111
|
// breaks IE9: https://github.com/facebook/react/issues/13610
|
100
112
|
// eslint-disable-next-line react-internal/no-production-logging
|
101
113
|
|
102
|
-
|
114
|
+
|
115
|
+
Function.prototype.apply.call(console[level], console, args);
|
103
116
|
}
|
104
117
|
}
|
105
118
|
|
@@ -290,7 +303,9 @@ function checkKeyStringCoercion(value) {
|
|
290
303
|
}
|
291
304
|
}
|
292
305
|
|
293
|
-
var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference');
|
306
|
+
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.
|
307
|
+
// TODO: Delete this when enableOwnerStacks ships.
|
308
|
+
|
294
309
|
function isValidElementType(type) {
|
295
310
|
if (typeof type === 'string' || typeof type === 'function') {
|
296
311
|
return true;
|
@@ -688,7 +703,8 @@ function describeFunctionComponentFrame(fn) {
|
|
688
703
|
function shouldConstruct(Component) {
|
689
704
|
var prototype = Component.prototype;
|
690
705
|
return !!(prototype && prototype.isReactComponent);
|
691
|
-
}
|
706
|
+
} // TODO: Delete this once the key warning no longer uses it. I.e. when enableOwnerStacks ship.
|
707
|
+
|
692
708
|
|
693
709
|
function describeUnknownElementTypeFrameInDEV(type) {
|
694
710
|
|
@@ -919,7 +935,7 @@ function ReactElement(type, key, _ref, self, source, owner, props, debugStack, d
|
|
919
935
|
configurable: false,
|
920
936
|
enumerable: false,
|
921
937
|
writable: true,
|
922
|
-
value:
|
938
|
+
value: 0
|
923
939
|
}); // debugInfo contains Server Component debug information.
|
924
940
|
|
925
941
|
Object.defineProperty(element, '_debugInfo', {
|
@@ -1104,29 +1120,7 @@ function jsxDEV(type, config, maybeKey, isStaticChildren, source, self) {
|
|
1104
1120
|
}
|
1105
1121
|
}
|
1106
1122
|
|
1107
|
-
|
1108
|
-
|
1109
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
1110
|
-
validateFragmentProps(element);
|
1111
|
-
}
|
1112
|
-
|
1113
|
-
return element;
|
1114
|
-
}
|
1115
|
-
}
|
1116
|
-
|
1117
|
-
function getDeclarationErrorAddendum() {
|
1118
|
-
{
|
1119
|
-
var owner = getOwner();
|
1120
|
-
|
1121
|
-
if (owner) {
|
1122
|
-
var name = getComponentNameFromType(owner.type);
|
1123
|
-
|
1124
|
-
if (name) {
|
1125
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
1126
|
-
}
|
1127
|
-
}
|
1128
|
-
|
1129
|
-
return '';
|
1123
|
+
return ReactElement(type, key, ref, self, source, getOwner(), props);
|
1130
1124
|
}
|
1131
1125
|
}
|
1132
1126
|
/**
|
@@ -1139,7 +1133,6 @@ function getDeclarationErrorAddendum() {
|
|
1139
1133
|
* @param {*} parentType node's parent's type.
|
1140
1134
|
*/
|
1141
1135
|
|
1142
|
-
|
1143
1136
|
function validateChildKeys(node, parentType) {
|
1144
1137
|
{
|
1145
1138
|
if (typeof node !== 'object' || !node) {
|
@@ -1157,7 +1150,7 @@ function validateChildKeys(node, parentType) {
|
|
1157
1150
|
} else if (isValidElement(node)) {
|
1158
1151
|
// This element was passed in a valid location.
|
1159
1152
|
if (node._store) {
|
1160
|
-
node._store.validated =
|
1153
|
+
node._store.validated = 1;
|
1161
1154
|
}
|
1162
1155
|
} else {
|
1163
1156
|
var iteratorFn = getIteratorFn(node);
|
@@ -1208,12 +1201,13 @@ var ownerHasKeyUseWarning = {};
|
|
1208
1201
|
*/
|
1209
1202
|
|
1210
1203
|
function validateExplicitKey(element, parentType) {
|
1204
|
+
|
1211
1205
|
{
|
1212
1206
|
if (!element._store || element._store.validated || element.key != null) {
|
1213
1207
|
return;
|
1214
1208
|
}
|
1215
1209
|
|
1216
|
-
element._store.validated =
|
1210
|
+
element._store.validated = 1;
|
1217
1211
|
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
1218
1212
|
|
1219
1213
|
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
@@ -1239,28 +1233,37 @@ function validateExplicitKey(element, parentType) {
|
|
1239
1233
|
childOwner = " It was passed a child from " + ownerName + ".";
|
1240
1234
|
}
|
1241
1235
|
|
1242
|
-
|
1236
|
+
var prevGetCurrentStack = ReactSharedInternals.getCurrentStack;
|
1243
1237
|
|
1244
|
-
|
1238
|
+
ReactSharedInternals.getCurrentStack = function () {
|
1245
1239
|
|
1246
|
-
|
1247
|
-
}
|
1248
|
-
}
|
1240
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type); // Delegate to the injected renderer-specific implementation
|
1249
1241
|
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
}
|
1256
|
-
|
1257
|
-
|
1242
|
+
if (prevGetCurrentStack) {
|
1243
|
+
stack += prevGetCurrentStack() || '';
|
1244
|
+
}
|
1245
|
+
|
1246
|
+
return stack;
|
1247
|
+
};
|
1248
|
+
|
1249
|
+
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);
|
1250
|
+
|
1251
|
+
ReactSharedInternals.getCurrentStack = prevGetCurrentStack;
|
1258
1252
|
}
|
1259
1253
|
}
|
1260
1254
|
|
1261
1255
|
function getCurrentComponentErrorInfo(parentType) {
|
1262
1256
|
{
|
1263
|
-
var info =
|
1257
|
+
var info = '';
|
1258
|
+
var owner = getOwner();
|
1259
|
+
|
1260
|
+
if (owner) {
|
1261
|
+
var name = getComponentNameFromType(owner.type);
|
1262
|
+
|
1263
|
+
if (name) {
|
1264
|
+
info = '\n\nCheck the render method of `' + name + '`.';
|
1265
|
+
}
|
1266
|
+
}
|
1264
1267
|
|
1265
1268
|
if (!info) {
|
1266
1269
|
var parentName = getComponentNameFromType(parentType);
|
@@ -1273,31 +1276,6 @@ function getCurrentComponentErrorInfo(parentType) {
|
|
1273
1276
|
return info;
|
1274
1277
|
}
|
1275
1278
|
}
|
1276
|
-
/**
|
1277
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
1278
|
-
* @param {ReactElement} fragment
|
1279
|
-
*/
|
1280
|
-
|
1281
|
-
|
1282
|
-
function validateFragmentProps(fragment) {
|
1283
|
-
// TODO: Move this to render phase instead of at element creation.
|
1284
|
-
{
|
1285
|
-
var keys = Object.keys(fragment.props);
|
1286
|
-
|
1287
|
-
for (var i = 0; i < keys.length; i++) {
|
1288
|
-
var key = keys[i];
|
1289
|
-
|
1290
|
-
if (key !== 'children' && key !== 'key') {
|
1291
|
-
setCurrentlyValidatingElement(fragment);
|
1292
|
-
|
1293
|
-
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
1294
|
-
|
1295
|
-
setCurrentlyValidatingElement(null);
|
1296
|
-
break;
|
1297
|
-
}
|
1298
|
-
}
|
1299
|
-
}
|
1300
|
-
}
|
1301
1279
|
|
1302
1280
|
var jsx = jsxProdSignatureRunningInDevWithDynamicChildren ; // we may want to special case jsxs internally to take advantage of static children.
|
1303
1281
|
// for now we can ship identical prod functions
|
@@ -88,23 +88,36 @@ function printWarning(level, format, args) {
|
|
88
88
|
// When changing this logic, you might want to also
|
89
89
|
// update consoleWithStackDev.www.js as well.
|
90
90
|
{
|
91
|
-
var
|
91
|
+
var isErrorLogger = format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n';
|
92
92
|
|
93
|
-
if (
|
94
|
-
|
95
|
-
args = args.concat([stack]);
|
96
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
93
|
+
if (ReactSharedInternalsServer.getCurrentStack) {
|
94
|
+
var stack = ReactSharedInternalsServer.getCurrentStack();
|
97
95
|
|
96
|
+
if (stack !== '') {
|
97
|
+
format += '%s';
|
98
|
+
args = args.concat([stack]);
|
99
|
+
}
|
100
|
+
}
|
98
101
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
102
|
+
if (isErrorLogger) {
|
103
|
+
// Don't prefix our default logging formatting in ReactFiberErrorLoggger.
|
104
|
+
// Don't toString the arguments.
|
105
|
+
args.unshift(format);
|
106
|
+
} else {
|
107
|
+
// TODO: Remove this prefix and stop toStringing in the wrapper and
|
108
|
+
// instead do it at each callsite as needed.
|
109
|
+
// Careful: RN currently depends on this prefix
|
110
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
111
|
+
args = args.map(function (item) {
|
112
|
+
return String(item);
|
113
|
+
});
|
114
|
+
args.unshift('Warning: ' + format);
|
115
|
+
} // We intentionally don't use spread (or .apply) directly because it
|
104
116
|
// breaks IE9: https://github.com/facebook/react/issues/13610
|
105
117
|
// eslint-disable-next-line react-internal/no-production-logging
|
106
118
|
|
107
|
-
|
119
|
+
|
120
|
+
Function.prototype.apply.call(console[level], console, args);
|
108
121
|
}
|
109
122
|
}
|
110
123
|
|
@@ -295,7 +308,9 @@ function checkKeyStringCoercion(value) {
|
|
295
308
|
}
|
296
309
|
}
|
297
310
|
|
298
|
-
var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference');
|
311
|
+
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.
|
312
|
+
// TODO: Delete this when enableOwnerStacks ships.
|
313
|
+
|
299
314
|
function isValidElementType(type) {
|
300
315
|
if (typeof type === 'string' || typeof type === 'function') {
|
301
316
|
return true;
|
@@ -693,7 +708,8 @@ function describeFunctionComponentFrame(fn) {
|
|
693
708
|
function shouldConstruct(Component) {
|
694
709
|
var prototype = Component.prototype;
|
695
710
|
return !!(prototype && prototype.isReactComponent);
|
696
|
-
}
|
711
|
+
} // TODO: Delete this once the key warning no longer uses it. I.e. when enableOwnerStacks ship.
|
712
|
+
|
697
713
|
|
698
714
|
function describeUnknownElementTypeFrameInDEV(type) {
|
699
715
|
|
@@ -924,7 +940,7 @@ function ReactElement(type, key, _ref, self, source, owner, props, debugStack, d
|
|
924
940
|
configurable: false,
|
925
941
|
enumerable: false,
|
926
942
|
writable: true,
|
927
|
-
value:
|
943
|
+
value: 0
|
928
944
|
}); // debugInfo contains Server Component debug information.
|
929
945
|
|
930
946
|
Object.defineProperty(element, '_debugInfo', {
|
@@ -1109,29 +1125,7 @@ function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) {
|
|
1109
1125
|
}
|
1110
1126
|
}
|
1111
1127
|
|
1112
|
-
|
1113
|
-
|
1114
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
1115
|
-
validateFragmentProps(element);
|
1116
|
-
}
|
1117
|
-
|
1118
|
-
return element;
|
1119
|
-
}
|
1120
|
-
}
|
1121
|
-
|
1122
|
-
function getDeclarationErrorAddendum() {
|
1123
|
-
{
|
1124
|
-
var owner = getOwner();
|
1125
|
-
|
1126
|
-
if (owner) {
|
1127
|
-
var name = getComponentNameFromType(owner.type);
|
1128
|
-
|
1129
|
-
if (name) {
|
1130
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
1131
|
-
}
|
1132
|
-
}
|
1133
|
-
|
1134
|
-
return '';
|
1128
|
+
return ReactElement(type, key, ref, self, source, getOwner(), props);
|
1135
1129
|
}
|
1136
1130
|
}
|
1137
1131
|
/**
|
@@ -1144,7 +1138,6 @@ function getDeclarationErrorAddendum() {
|
|
1144
1138
|
* @param {*} parentType node's parent's type.
|
1145
1139
|
*/
|
1146
1140
|
|
1147
|
-
|
1148
1141
|
function validateChildKeys(node, parentType) {
|
1149
1142
|
{
|
1150
1143
|
if (typeof node !== 'object' || !node) {
|
@@ -1162,7 +1155,7 @@ function validateChildKeys(node, parentType) {
|
|
1162
1155
|
} else if (isValidElement(node)) {
|
1163
1156
|
// This element was passed in a valid location.
|
1164
1157
|
if (node._store) {
|
1165
|
-
node._store.validated =
|
1158
|
+
node._store.validated = 1;
|
1166
1159
|
}
|
1167
1160
|
} else {
|
1168
1161
|
var iteratorFn = getIteratorFn(node);
|
@@ -1213,12 +1206,13 @@ var ownerHasKeyUseWarning = {};
|
|
1213
1206
|
*/
|
1214
1207
|
|
1215
1208
|
function validateExplicitKey(element, parentType) {
|
1209
|
+
|
1216
1210
|
{
|
1217
1211
|
if (!element._store || element._store.validated || element.key != null) {
|
1218
1212
|
return;
|
1219
1213
|
}
|
1220
1214
|
|
1221
|
-
element._store.validated =
|
1215
|
+
element._store.validated = 1;
|
1222
1216
|
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
1223
1217
|
|
1224
1218
|
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
@@ -1244,28 +1238,37 @@ function validateExplicitKey(element, parentType) {
|
|
1244
1238
|
childOwner = " It was passed a child from " + ownerName + ".";
|
1245
1239
|
}
|
1246
1240
|
|
1247
|
-
|
1241
|
+
var prevGetCurrentStack = ReactSharedInternalsServer.getCurrentStack;
|
1248
1242
|
|
1249
|
-
|
1243
|
+
ReactSharedInternalsServer.getCurrentStack = function () {
|
1250
1244
|
|
1251
|
-
|
1252
|
-
}
|
1253
|
-
}
|
1245
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type); // Delegate to the injected renderer-specific implementation
|
1254
1246
|
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
}
|
1261
|
-
|
1262
|
-
|
1247
|
+
if (prevGetCurrentStack) {
|
1248
|
+
stack += prevGetCurrentStack() || '';
|
1249
|
+
}
|
1250
|
+
|
1251
|
+
return stack;
|
1252
|
+
};
|
1253
|
+
|
1254
|
+
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);
|
1255
|
+
|
1256
|
+
ReactSharedInternalsServer.getCurrentStack = prevGetCurrentStack;
|
1263
1257
|
}
|
1264
1258
|
}
|
1265
1259
|
|
1266
1260
|
function getCurrentComponentErrorInfo(parentType) {
|
1267
1261
|
{
|
1268
|
-
var info =
|
1262
|
+
var info = '';
|
1263
|
+
var owner = getOwner();
|
1264
|
+
|
1265
|
+
if (owner) {
|
1266
|
+
var name = getComponentNameFromType(owner.type);
|
1267
|
+
|
1268
|
+
if (name) {
|
1269
|
+
info = '\n\nCheck the render method of `' + name + '`.';
|
1270
|
+
}
|
1271
|
+
}
|
1269
1272
|
|
1270
1273
|
if (!info) {
|
1271
1274
|
var parentName = getComponentNameFromType(parentType);
|
@@ -1278,31 +1281,6 @@ function getCurrentComponentErrorInfo(parentType) {
|
|
1278
1281
|
return info;
|
1279
1282
|
}
|
1280
1283
|
}
|
1281
|
-
/**
|
1282
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
1283
|
-
* @param {ReactElement} fragment
|
1284
|
-
*/
|
1285
|
-
|
1286
|
-
|
1287
|
-
function validateFragmentProps(fragment) {
|
1288
|
-
// TODO: Move this to render phase instead of at element creation.
|
1289
|
-
{
|
1290
|
-
var keys = Object.keys(fragment.props);
|
1291
|
-
|
1292
|
-
for (var i = 0; i < keys.length; i++) {
|
1293
|
-
var key = keys[i];
|
1294
|
-
|
1295
|
-
if (key !== 'children' && key !== 'key') {
|
1296
|
-
setCurrentlyValidatingElement(fragment);
|
1297
|
-
|
1298
|
-
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
1299
|
-
|
1300
|
-
setCurrentlyValidatingElement(null);
|
1301
|
-
break;
|
1302
|
-
}
|
1303
|
-
}
|
1304
|
-
}
|
1305
|
-
}
|
1306
1284
|
|
1307
1285
|
var jsx = jsxProdSignatureRunningInDevWithDynamicChildren ; // we may want to special case jsxs internally to take advantage of static children.
|
1308
1286
|
// for now we can ship identical prod functions
|