react
Advanced tools
Comparing version 19.0.0-rc-d3ce0d3ea9-20240520 to 19.0.0-rc-eb259b5d3b-20240605
@@ -28,28 +28,44 @@ /** | ||
printWarning('error', format, args); | ||
printWarning('error', format, args, new Error('react-stack-top-frame')); | ||
} | ||
} | ||
} | ||
} // eslint-disable-next-line react-internal/no-production-logging | ||
function printWarning(level, format, args) { | ||
function printWarning(level, format, args, currentStack) { | ||
// When changing this logic, you might want to also | ||
// update consoleWithStackDev.www.js as well. | ||
{ | ||
var stack = ReactSharedInternals.getStackAddendum(); | ||
var isErrorLogger = format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n'; | ||
if (stack !== '') { | ||
format += '%s'; | ||
args = args.concat([stack]); | ||
} // eslint-disable-next-line react-internal/safe-string-coercion | ||
if (ReactSharedInternals.getCurrentStack) { | ||
// We only add the current stack to the console when createTask is not supported. | ||
// Since createTask requires DevTools to be open to work, this means that stacks | ||
// can be lost while DevTools isn't open but we can't detect this. | ||
var stack = ReactSharedInternals.getCurrentStack(currentStack); | ||
if (stack !== '') { | ||
format += '%s'; | ||
args = args.concat([stack]); | ||
} | ||
} | ||
var argsWithFormat = args.map(function (item) { | ||
return String(item); | ||
}); // Careful: RN currently depends on this prefix | ||
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it | ||
if (isErrorLogger) { | ||
// Don't prefix our default logging formatting in ReactFiberErrorLoggger. | ||
// Don't toString the arguments. | ||
args.unshift(format); | ||
} else { | ||
// TODO: Remove this prefix and stop toStringing in the wrapper and | ||
// instead do it at each callsite as needed. | ||
// Careful: RN currently depends on this prefix | ||
// eslint-disable-next-line react-internal/safe-string-coercion | ||
args = args.map(function (item) { | ||
return String(item); | ||
}); | ||
args.unshift('Warning: ' + format); | ||
} // We intentionally don't use spread (or .apply) directly because it | ||
// breaks IE9: https://github.com/facebook/react/issues/13610 | ||
// eslint-disable-next-line react-internal/no-production-logging | ||
Function.prototype.apply.call(console[level], console, argsWithFormat); | ||
Function.prototype.apply.call(console[level], console, args); | ||
} | ||
@@ -56,0 +72,0 @@ } |
@@ -77,28 +77,44 @@ /** | ||
printWarning('error', format, args); | ||
printWarning('error', format, args, new Error('react-stack-top-frame')); | ||
} | ||
} | ||
} | ||
} // eslint-disable-next-line react-internal/no-production-logging | ||
function printWarning(level, format, args) { | ||
function printWarning(level, format, args, currentStack) { | ||
// When changing this logic, you might want to also | ||
// update consoleWithStackDev.www.js as well. | ||
{ | ||
var stack = ReactSharedInternals.getStackAddendum(); | ||
var isErrorLogger = format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n'; | ||
if (stack !== '') { | ||
format += '%s'; | ||
args = args.concat([stack]); | ||
} // eslint-disable-next-line react-internal/safe-string-coercion | ||
if (ReactSharedInternals.getCurrentStack) { | ||
// We only add the current stack to the console when createTask is not supported. | ||
// Since createTask requires DevTools to be open to work, this means that stacks | ||
// can be lost while DevTools isn't open but we can't detect this. | ||
var stack = ReactSharedInternals.getCurrentStack(currentStack); | ||
if (stack !== '') { | ||
format += '%s'; | ||
args = args.concat([stack]); | ||
} | ||
} | ||
var argsWithFormat = args.map(function (item) { | ||
return String(item); | ||
}); // Careful: RN currently depends on this prefix | ||
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it | ||
if (isErrorLogger) { | ||
// Don't prefix our default logging formatting in ReactFiberErrorLoggger. | ||
// Don't toString the arguments. | ||
args.unshift(format); | ||
} else { | ||
// TODO: Remove this prefix and stop toStringing in the wrapper and | ||
// instead do it at each callsite as needed. | ||
// Careful: RN currently depends on this prefix | ||
// eslint-disable-next-line react-internal/safe-string-coercion | ||
args = args.map(function (item) { | ||
return String(item); | ||
}); | ||
args.unshift('Warning: ' + format); | ||
} // We intentionally don't use spread (or .apply) directly because it | ||
// breaks IE9: https://github.com/facebook/react/issues/13610 | ||
// eslint-disable-next-line react-internal/no-production-logging | ||
Function.prototype.apply.call(console[level], console, argsWithFormat); | ||
Function.prototype.apply.call(console[level], console, args); | ||
} | ||
@@ -294,3 +310,5 @@ } | ||
var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference'); | ||
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. | ||
// TODO: Delete this when enableOwnerStacks ships. | ||
function isValidElementType(type) { | ||
@@ -693,4 +711,5 @@ if (typeof type === 'string' || typeof type === 'function') { | ||
return !!(prototype && prototype.isReactComponent); | ||
} | ||
} // TODO: Delete this once the key warning no longer uses it. I.e. when enableOwnerStacks ship. | ||
function describeUnknownElementTypeFrameInDEV(type) { | ||
@@ -925,3 +944,3 @@ | ||
writable: true, | ||
value: false | ||
value: 0 | ||
}); // debugInfo contains Server Component debug information. | ||
@@ -953,2 +972,6 @@ | ||
function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) { | ||
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self); | ||
} | ||
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self, debugStack, debugTask) { | ||
{ | ||
@@ -1088,27 +1111,5 @@ if (!isValidElementType(type)) { | ||
var element = ReactElement(type, key, ref, self, source, getOwner(), props); | ||
if (type === REACT_FRAGMENT_TYPE) { | ||
validateFragmentProps(element); | ||
} | ||
return element; | ||
return ReactElement(type, key, ref, self, source, getOwner(), props); | ||
} | ||
} | ||
function getDeclarationErrorAddendum() { | ||
{ | ||
var owner = getOwner(); | ||
if (owner) { | ||
var name = getComponentNameFromType(owner.type); | ||
if (name) { | ||
return '\n\nCheck the render method of `' + name + '`.'; | ||
} | ||
} | ||
return ''; | ||
} | ||
} | ||
/** | ||
@@ -1124,3 +1125,2 @@ * Ensure that every element either is passed in a static location, in an | ||
function validateChildKeys(node, parentType) { | ||
@@ -1143,3 +1143,3 @@ { | ||
if (node._store) { | ||
node._store.validated = true; | ||
node._store.validated = 1; | ||
} | ||
@@ -1195,2 +1195,3 @@ } else { | ||
function validateExplicitKey(element, parentType) { | ||
{ | ||
@@ -1201,3 +1202,3 @@ if (!element._store || element._store.validated || element.key != null) { | ||
element._store.validated = true; | ||
element._store.validated = 1; | ||
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); | ||
@@ -1228,25 +1229,34 @@ | ||
setCurrentlyValidatingElement(element); | ||
var prevGetCurrentStack = ReactSharedInternals.getCurrentStack; | ||
ReactSharedInternals.getCurrentStack = function () { | ||
var stack = describeUnknownElementTypeFrameInDEV(element.type); // Delegate to the injected renderer-specific implementation | ||
if (prevGetCurrentStack) { | ||
stack += prevGetCurrentStack() || ''; | ||
} | ||
return stack; | ||
}; | ||
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); | ||
setCurrentlyValidatingElement(null); | ||
ReactSharedInternals.getCurrentStack = prevGetCurrentStack; | ||
} | ||
} | ||
function setCurrentlyValidatingElement(element) { | ||
function getCurrentComponentErrorInfo(parentType) { | ||
{ | ||
if (element) { | ||
var stack = describeUnknownElementTypeFrameInDEV(element.type); | ||
ReactSharedInternals.setExtraStackFrame(stack); | ||
} else { | ||
ReactSharedInternals.setExtraStackFrame(null); | ||
var info = ''; | ||
var owner = getOwner(); | ||
if (owner) { | ||
var name = getComponentNameFromType(owner.type); | ||
if (name) { | ||
info = '\n\nCheck the render method of `' + name + '`.'; | ||
} | ||
} | ||
} | ||
} | ||
function getCurrentComponentErrorInfo(parentType) { | ||
{ | ||
var info = getDeclarationErrorAddendum(); | ||
if (!info) { | ||
@@ -1263,28 +1273,3 @@ var parentName = getComponentNameFromType(parentType); | ||
} | ||
/** | ||
* Given a fragment, validate that it can only be provided with fragment props | ||
* @param {ReactElement} fragment | ||
*/ | ||
function validateFragmentProps(fragment) { | ||
// TODO: Move this to render phase instead of at element creation. | ||
{ | ||
var keys = Object.keys(fragment.props); | ||
for (var i = 0; i < keys.length; i++) { | ||
var key = keys[i]; | ||
if (key !== 'children' && key !== 'key') { | ||
setCurrentlyValidatingElement(fragment); | ||
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); | ||
setCurrentlyValidatingElement(null); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
var jsxDEV = jsxDEV$1 ; | ||
@@ -1291,0 +1276,0 @@ |
@@ -82,28 +82,44 @@ /** | ||
printWarning('error', format, args); | ||
printWarning('error', format, args, new Error('react-stack-top-frame')); | ||
} | ||
} | ||
} | ||
} // eslint-disable-next-line react-internal/no-production-logging | ||
function printWarning(level, format, args) { | ||
function printWarning(level, format, args, currentStack) { | ||
// When changing this logic, you might want to also | ||
// update consoleWithStackDev.www.js as well. | ||
{ | ||
var stack = ReactSharedInternalsServer.getStackAddendum(); | ||
var isErrorLogger = format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n'; | ||
if (stack !== '') { | ||
format += '%s'; | ||
args = args.concat([stack]); | ||
} // eslint-disable-next-line react-internal/safe-string-coercion | ||
if (ReactSharedInternalsServer.getCurrentStack) { | ||
// We only add the current stack to the console when createTask is not supported. | ||
// Since createTask requires DevTools to be open to work, this means that stacks | ||
// can be lost while DevTools isn't open but we can't detect this. | ||
var stack = ReactSharedInternalsServer.getCurrentStack(currentStack); | ||
if (stack !== '') { | ||
format += '%s'; | ||
args = args.concat([stack]); | ||
} | ||
} | ||
var argsWithFormat = args.map(function (item) { | ||
return String(item); | ||
}); // Careful: RN currently depends on this prefix | ||
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it | ||
if (isErrorLogger) { | ||
// Don't prefix our default logging formatting in ReactFiberErrorLoggger. | ||
// Don't toString the arguments. | ||
args.unshift(format); | ||
} else { | ||
// TODO: Remove this prefix and stop toStringing in the wrapper and | ||
// instead do it at each callsite as needed. | ||
// Careful: RN currently depends on this prefix | ||
// eslint-disable-next-line react-internal/safe-string-coercion | ||
args = args.map(function (item) { | ||
return String(item); | ||
}); | ||
args.unshift('Warning: ' + format); | ||
} // We intentionally don't use spread (or .apply) directly because it | ||
// breaks IE9: https://github.com/facebook/react/issues/13610 | ||
// eslint-disable-next-line react-internal/no-production-logging | ||
Function.prototype.apply.call(console[level], console, argsWithFormat); | ||
Function.prototype.apply.call(console[level], console, args); | ||
} | ||
@@ -299,3 +315,5 @@ } | ||
var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference'); | ||
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. | ||
// TODO: Delete this when enableOwnerStacks ships. | ||
function isValidElementType(type) { | ||
@@ -698,4 +716,5 @@ if (typeof type === 'string' || typeof type === 'function') { | ||
return !!(prototype && prototype.isReactComponent); | ||
} | ||
} // TODO: Delete this once the key warning no longer uses it. I.e. when enableOwnerStacks ship. | ||
function describeUnknownElementTypeFrameInDEV(type) { | ||
@@ -930,3 +949,3 @@ | ||
writable: true, | ||
value: false | ||
value: 0 | ||
}); // debugInfo contains Server Component debug information. | ||
@@ -964,3 +983,3 @@ | ||
var isStaticChildren = false; | ||
return jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self); | ||
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self); | ||
} | ||
@@ -971,3 +990,3 @@ } | ||
var isStaticChildren = true; | ||
return jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self); | ||
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self); | ||
} | ||
@@ -984,2 +1003,6 @@ } | ||
function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) { | ||
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self); | ||
} | ||
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self, debugStack, debugTask) { | ||
{ | ||
@@ -1119,27 +1142,5 @@ if (!isValidElementType(type)) { | ||
var element = ReactElement(type, key, ref, self, source, getOwner(), props); | ||
if (type === REACT_FRAGMENT_TYPE) { | ||
validateFragmentProps(element); | ||
} | ||
return element; | ||
return ReactElement(type, key, ref, self, source, getOwner(), props); | ||
} | ||
} | ||
function getDeclarationErrorAddendum() { | ||
{ | ||
var owner = getOwner(); | ||
if (owner) { | ||
var name = getComponentNameFromType(owner.type); | ||
if (name) { | ||
return '\n\nCheck the render method of `' + name + '`.'; | ||
} | ||
} | ||
return ''; | ||
} | ||
} | ||
/** | ||
@@ -1155,3 +1156,2 @@ * Ensure that every element either is passed in a static location, in an | ||
function validateChildKeys(node, parentType) { | ||
@@ -1174,3 +1174,3 @@ { | ||
if (node._store) { | ||
node._store.validated = true; | ||
node._store.validated = 1; | ||
} | ||
@@ -1226,2 +1226,3 @@ } else { | ||
function validateExplicitKey(element, parentType) { | ||
{ | ||
@@ -1232,3 +1233,3 @@ if (!element._store || element._store.validated || element.key != null) { | ||
element._store.validated = true; | ||
element._store.validated = 1; | ||
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); | ||
@@ -1259,25 +1260,34 @@ | ||
setCurrentlyValidatingElement(element); | ||
var prevGetCurrentStack = ReactSharedInternalsServer.getCurrentStack; | ||
ReactSharedInternalsServer.getCurrentStack = function () { | ||
var stack = describeUnknownElementTypeFrameInDEV(element.type); // Delegate to the injected renderer-specific implementation | ||
if (prevGetCurrentStack) { | ||
stack += prevGetCurrentStack() || ''; | ||
} | ||
return stack; | ||
}; | ||
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); | ||
setCurrentlyValidatingElement(null); | ||
ReactSharedInternalsServer.getCurrentStack = prevGetCurrentStack; | ||
} | ||
} | ||
function setCurrentlyValidatingElement(element) { | ||
function getCurrentComponentErrorInfo(parentType) { | ||
{ | ||
if (element) { | ||
var stack = describeUnknownElementTypeFrameInDEV(element.type); | ||
ReactSharedInternalsServer.setExtraStackFrame(stack); | ||
} else { | ||
ReactSharedInternalsServer.setExtraStackFrame(null); | ||
var info = ''; | ||
var owner = getOwner(); | ||
if (owner) { | ||
var name = getComponentNameFromType(owner.type); | ||
if (name) { | ||
info = '\n\nCheck the render method of `' + name + '`.'; | ||
} | ||
} | ||
} | ||
} | ||
function getCurrentComponentErrorInfo(parentType) { | ||
{ | ||
var info = getDeclarationErrorAddendum(); | ||
if (!info) { | ||
@@ -1294,28 +1304,3 @@ var parentName = getComponentNameFromType(parentType); | ||
} | ||
/** | ||
* Given a fragment, validate that it can only be provided with fragment props | ||
* @param {ReactElement} fragment | ||
*/ | ||
function validateFragmentProps(fragment) { | ||
// TODO: Move this to render phase instead of at element creation. | ||
{ | ||
var keys = Object.keys(fragment.props); | ||
for (var i = 0; i < keys.length; i++) { | ||
var key = keys[i]; | ||
if (key !== 'children' && key !== 'key') { | ||
setCurrentlyValidatingElement(fragment); | ||
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); | ||
setCurrentlyValidatingElement(null); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
var jsx = jsxProdSignatureRunningInDevWithDynamicChildren ; // we may want to special case jsxs internally to take advantage of static children. | ||
@@ -1322,0 +1307,0 @@ // for now we can ship identical prod functions |
@@ -77,28 +77,44 @@ /** | ||
printWarning('error', format, args); | ||
printWarning('error', format, args, new Error('react-stack-top-frame')); | ||
} | ||
} | ||
} | ||
} // eslint-disable-next-line react-internal/no-production-logging | ||
function printWarning(level, format, args) { | ||
function printWarning(level, format, args, currentStack) { | ||
// When changing this logic, you might want to also | ||
// update consoleWithStackDev.www.js as well. | ||
{ | ||
var stack = ReactSharedInternals.getStackAddendum(); | ||
var isErrorLogger = format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n'; | ||
if (stack !== '') { | ||
format += '%s'; | ||
args = args.concat([stack]); | ||
} // eslint-disable-next-line react-internal/safe-string-coercion | ||
if (ReactSharedInternals.getCurrentStack) { | ||
// We only add the current stack to the console when createTask is not supported. | ||
// Since createTask requires DevTools to be open to work, this means that stacks | ||
// can be lost while DevTools isn't open but we can't detect this. | ||
var stack = ReactSharedInternals.getCurrentStack(currentStack); | ||
if (stack !== '') { | ||
format += '%s'; | ||
args = args.concat([stack]); | ||
} | ||
} | ||
var argsWithFormat = args.map(function (item) { | ||
return String(item); | ||
}); // Careful: RN currently depends on this prefix | ||
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it | ||
if (isErrorLogger) { | ||
// Don't prefix our default logging formatting in ReactFiberErrorLoggger. | ||
// Don't toString the arguments. | ||
args.unshift(format); | ||
} else { | ||
// TODO: Remove this prefix and stop toStringing in the wrapper and | ||
// instead do it at each callsite as needed. | ||
// Careful: RN currently depends on this prefix | ||
// eslint-disable-next-line react-internal/safe-string-coercion | ||
args = args.map(function (item) { | ||
return String(item); | ||
}); | ||
args.unshift('Warning: ' + format); | ||
} // We intentionally don't use spread (or .apply) directly because it | ||
// breaks IE9: https://github.com/facebook/react/issues/13610 | ||
// eslint-disable-next-line react-internal/no-production-logging | ||
Function.prototype.apply.call(console[level], console, argsWithFormat); | ||
Function.prototype.apply.call(console[level], console, args); | ||
} | ||
@@ -294,3 +310,5 @@ } | ||
var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference'); | ||
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. | ||
// TODO: Delete this when enableOwnerStacks ships. | ||
function isValidElementType(type) { | ||
@@ -693,4 +711,5 @@ if (typeof type === 'string' || typeof type === 'function') { | ||
return !!(prototype && prototype.isReactComponent); | ||
} | ||
} // TODO: Delete this once the key warning no longer uses it. I.e. when enableOwnerStacks ship. | ||
function describeUnknownElementTypeFrameInDEV(type) { | ||
@@ -925,3 +944,3 @@ | ||
writable: true, | ||
value: false | ||
value: 0 | ||
}); // debugInfo contains Server Component debug information. | ||
@@ -959,3 +978,3 @@ | ||
var isStaticChildren = false; | ||
return jsxDEV(type, config, maybeKey, isStaticChildren, source, self); | ||
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self); | ||
} | ||
@@ -966,14 +985,8 @@ } | ||
var isStaticChildren = true; | ||
return jsxDEV(type, config, maybeKey, isStaticChildren, source, self); | ||
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self); | ||
} | ||
} | ||
var didWarnAboutKeySpread = {}; | ||
/** | ||
* https://github.com/reactjs/rfcs/pull/107 | ||
* @param {*} type | ||
* @param {object} props | ||
* @param {string} key | ||
*/ | ||
function jsxDEV(type, config, maybeKey, isStaticChildren, source, self) { | ||
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self, debugStack, debugTask) { | ||
{ | ||
@@ -1113,27 +1126,5 @@ if (!isValidElementType(type)) { | ||
var element = ReactElement(type, key, ref, self, source, getOwner(), props); | ||
if (type === REACT_FRAGMENT_TYPE) { | ||
validateFragmentProps(element); | ||
} | ||
return element; | ||
return ReactElement(type, key, ref, self, source, getOwner(), props); | ||
} | ||
} | ||
function getDeclarationErrorAddendum() { | ||
{ | ||
var owner = getOwner(); | ||
if (owner) { | ||
var name = getComponentNameFromType(owner.type); | ||
if (name) { | ||
return '\n\nCheck the render method of `' + name + '`.'; | ||
} | ||
} | ||
return ''; | ||
} | ||
} | ||
/** | ||
@@ -1149,3 +1140,2 @@ * Ensure that every element either is passed in a static location, in an | ||
function validateChildKeys(node, parentType) { | ||
@@ -1168,3 +1158,3 @@ { | ||
if (node._store) { | ||
node._store.validated = true; | ||
node._store.validated = 1; | ||
} | ||
@@ -1220,2 +1210,3 @@ } else { | ||
function validateExplicitKey(element, parentType) { | ||
{ | ||
@@ -1226,3 +1217,3 @@ if (!element._store || element._store.validated || element.key != null) { | ||
element._store.validated = true; | ||
element._store.validated = 1; | ||
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); | ||
@@ -1253,25 +1244,34 @@ | ||
setCurrentlyValidatingElement(element); | ||
var prevGetCurrentStack = ReactSharedInternals.getCurrentStack; | ||
ReactSharedInternals.getCurrentStack = function () { | ||
var stack = describeUnknownElementTypeFrameInDEV(element.type); // Delegate to the injected renderer-specific implementation | ||
if (prevGetCurrentStack) { | ||
stack += prevGetCurrentStack() || ''; | ||
} | ||
return stack; | ||
}; | ||
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); | ||
setCurrentlyValidatingElement(null); | ||
ReactSharedInternals.getCurrentStack = prevGetCurrentStack; | ||
} | ||
} | ||
function setCurrentlyValidatingElement(element) { | ||
function getCurrentComponentErrorInfo(parentType) { | ||
{ | ||
if (element) { | ||
var stack = describeUnknownElementTypeFrameInDEV(element.type); | ||
ReactSharedInternals.setExtraStackFrame(stack); | ||
} else { | ||
ReactSharedInternals.setExtraStackFrame(null); | ||
var info = ''; | ||
var owner = getOwner(); | ||
if (owner) { | ||
var name = getComponentNameFromType(owner.type); | ||
if (name) { | ||
info = '\n\nCheck the render method of `' + name + '`.'; | ||
} | ||
} | ||
} | ||
} | ||
function getCurrentComponentErrorInfo(parentType) { | ||
{ | ||
var info = getDeclarationErrorAddendum(); | ||
if (!info) { | ||
@@ -1288,28 +1288,3 @@ var parentName = getComponentNameFromType(parentType); | ||
} | ||
/** | ||
* Given a fragment, validate that it can only be provided with fragment props | ||
* @param {ReactElement} fragment | ||
*/ | ||
function validateFragmentProps(fragment) { | ||
// TODO: Move this to render phase instead of at element creation. | ||
{ | ||
var keys = Object.keys(fragment.props); | ||
for (var i = 0; i < keys.length; i++) { | ||
var key = keys[i]; | ||
if (key !== 'children' && key !== 'key') { | ||
setCurrentlyValidatingElement(fragment); | ||
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); | ||
setCurrentlyValidatingElement(null); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
var jsx = jsxProdSignatureRunningInDevWithDynamicChildren ; // we may want to special case jsxs internally to take advantage of static children. | ||
@@ -1316,0 +1291,0 @@ // for now we can ship identical prod functions |
@@ -82,28 +82,44 @@ /** | ||
printWarning('error', format, args); | ||
printWarning('error', format, args, new Error('react-stack-top-frame')); | ||
} | ||
} | ||
} | ||
} // eslint-disable-next-line react-internal/no-production-logging | ||
function printWarning(level, format, args) { | ||
function printWarning(level, format, args, currentStack) { | ||
// When changing this logic, you might want to also | ||
// update consoleWithStackDev.www.js as well. | ||
{ | ||
var stack = ReactSharedInternalsServer.getStackAddendum(); | ||
var isErrorLogger = format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n'; | ||
if (stack !== '') { | ||
format += '%s'; | ||
args = args.concat([stack]); | ||
} // eslint-disable-next-line react-internal/safe-string-coercion | ||
if (ReactSharedInternalsServer.getCurrentStack) { | ||
// We only add the current stack to the console when createTask is not supported. | ||
// Since createTask requires DevTools to be open to work, this means that stacks | ||
// can be lost while DevTools isn't open but we can't detect this. | ||
var stack = ReactSharedInternalsServer.getCurrentStack(currentStack); | ||
if (stack !== '') { | ||
format += '%s'; | ||
args = args.concat([stack]); | ||
} | ||
} | ||
var argsWithFormat = args.map(function (item) { | ||
return String(item); | ||
}); // Careful: RN currently depends on this prefix | ||
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it | ||
if (isErrorLogger) { | ||
// Don't prefix our default logging formatting in ReactFiberErrorLoggger. | ||
// Don't toString the arguments. | ||
args.unshift(format); | ||
} else { | ||
// TODO: Remove this prefix and stop toStringing in the wrapper and | ||
// instead do it at each callsite as needed. | ||
// Careful: RN currently depends on this prefix | ||
// eslint-disable-next-line react-internal/safe-string-coercion | ||
args = args.map(function (item) { | ||
return String(item); | ||
}); | ||
args.unshift('Warning: ' + format); | ||
} // We intentionally don't use spread (or .apply) directly because it | ||
// breaks IE9: https://github.com/facebook/react/issues/13610 | ||
// eslint-disable-next-line react-internal/no-production-logging | ||
Function.prototype.apply.call(console[level], console, argsWithFormat); | ||
Function.prototype.apply.call(console[level], console, args); | ||
} | ||
@@ -299,3 +315,5 @@ } | ||
var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference'); | ||
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. | ||
// TODO: Delete this when enableOwnerStacks ships. | ||
function isValidElementType(type) { | ||
@@ -698,4 +716,5 @@ if (typeof type === 'string' || typeof type === 'function') { | ||
return !!(prototype && prototype.isReactComponent); | ||
} | ||
} // TODO: Delete this once the key warning no longer uses it. I.e. when enableOwnerStacks ship. | ||
function describeUnknownElementTypeFrameInDEV(type) { | ||
@@ -930,3 +949,3 @@ | ||
writable: true, | ||
value: false | ||
value: 0 | ||
}); // debugInfo contains Server Component debug information. | ||
@@ -964,3 +983,3 @@ | ||
var isStaticChildren = false; | ||
return jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self); | ||
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self); | ||
} | ||
@@ -971,3 +990,3 @@ } | ||
var isStaticChildren = true; | ||
return jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self); | ||
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self); | ||
} | ||
@@ -984,2 +1003,6 @@ } | ||
function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) { | ||
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self); | ||
} | ||
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self, debugStack, debugTask) { | ||
{ | ||
@@ -1119,27 +1142,5 @@ if (!isValidElementType(type)) { | ||
var element = ReactElement(type, key, ref, self, source, getOwner(), props); | ||
if (type === REACT_FRAGMENT_TYPE) { | ||
validateFragmentProps(element); | ||
} | ||
return element; | ||
return ReactElement(type, key, ref, self, source, getOwner(), props); | ||
} | ||
} | ||
function getDeclarationErrorAddendum() { | ||
{ | ||
var owner = getOwner(); | ||
if (owner) { | ||
var name = getComponentNameFromType(owner.type); | ||
if (name) { | ||
return '\n\nCheck the render method of `' + name + '`.'; | ||
} | ||
} | ||
return ''; | ||
} | ||
} | ||
/** | ||
@@ -1155,3 +1156,2 @@ * Ensure that every element either is passed in a static location, in an | ||
function validateChildKeys(node, parentType) { | ||
@@ -1174,3 +1174,3 @@ { | ||
if (node._store) { | ||
node._store.validated = true; | ||
node._store.validated = 1; | ||
} | ||
@@ -1226,2 +1226,3 @@ } else { | ||
function validateExplicitKey(element, parentType) { | ||
{ | ||
@@ -1232,3 +1233,3 @@ if (!element._store || element._store.validated || element.key != null) { | ||
element._store.validated = true; | ||
element._store.validated = 1; | ||
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); | ||
@@ -1259,25 +1260,34 @@ | ||
setCurrentlyValidatingElement(element); | ||
var prevGetCurrentStack = ReactSharedInternalsServer.getCurrentStack; | ||
ReactSharedInternalsServer.getCurrentStack = function () { | ||
var stack = describeUnknownElementTypeFrameInDEV(element.type); // Delegate to the injected renderer-specific implementation | ||
if (prevGetCurrentStack) { | ||
stack += prevGetCurrentStack() || ''; | ||
} | ||
return stack; | ||
}; | ||
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); | ||
setCurrentlyValidatingElement(null); | ||
ReactSharedInternalsServer.getCurrentStack = prevGetCurrentStack; | ||
} | ||
} | ||
function setCurrentlyValidatingElement(element) { | ||
function getCurrentComponentErrorInfo(parentType) { | ||
{ | ||
if (element) { | ||
var stack = describeUnknownElementTypeFrameInDEV(element.type); | ||
ReactSharedInternalsServer.setExtraStackFrame(stack); | ||
} else { | ||
ReactSharedInternalsServer.setExtraStackFrame(null); | ||
var info = ''; | ||
var owner = getOwner(); | ||
if (owner) { | ||
var name = getComponentNameFromType(owner.type); | ||
if (name) { | ||
info = '\n\nCheck the render method of `' + name + '`.'; | ||
} | ||
} | ||
} | ||
} | ||
function getCurrentComponentErrorInfo(parentType) { | ||
{ | ||
var info = getDeclarationErrorAddendum(); | ||
if (!info) { | ||
@@ -1294,28 +1304,3 @@ var parentName = getComponentNameFromType(parentType); | ||
} | ||
/** | ||
* Given a fragment, validate that it can only be provided with fragment props | ||
* @param {ReactElement} fragment | ||
*/ | ||
function validateFragmentProps(fragment) { | ||
// TODO: Move this to render phase instead of at element creation. | ||
{ | ||
var keys = Object.keys(fragment.props); | ||
for (var i = 0; i < keys.length; i++) { | ||
var key = keys[i]; | ||
if (key !== 'children' && key !== 'key') { | ||
setCurrentlyValidatingElement(fragment); | ||
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); | ||
setCurrentlyValidatingElement(null); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
var jsx = jsxProdSignatureRunningInDevWithDynamicChildren ; // we may want to special case jsxs internally to take advantage of static children. | ||
@@ -1322,0 +1307,0 @@ // for now we can ship identical prod functions |
@@ -75,3 +75,3 @@ /** | ||
var isArrayImpl = Array.isArray, | ||
ReactSharedInternals = { H: null, A: null, T: null }, | ||
ReactSharedInternals = { H: null, A: null, T: null, S: null }, | ||
hasOwnProperty = Object.prototype.hasOwnProperty; | ||
@@ -203,3 +203,4 @@ function ReactElement(type, key, _ref, self, source, owner, props) { | ||
escapedPrefix + | ||
(!callback.key || (children && children.key === callback.key) | ||
(null == callback.key || | ||
(children && children.key === callback.key) | ||
? "" | ||
@@ -460,14 +461,13 @@ : ("" + callback.key).replace( | ||
var prevTransition = ReactSharedInternals.T, | ||
callbacks = new Set(); | ||
ReactSharedInternals.T = { _callbacks: callbacks }; | ||
var currentTransition = ReactSharedInternals.T; | ||
transition = {}; | ||
ReactSharedInternals.T = transition; | ||
try { | ||
var returnValue = scope(); | ||
var returnValue = scope(), | ||
onStartTransitionFinish = ReactSharedInternals.S; | ||
null !== onStartTransitionFinish && | ||
onStartTransitionFinish(transition, returnValue); | ||
"object" === typeof returnValue && | ||
null !== returnValue && | ||
"function" === typeof returnValue.then && | ||
(callbacks.forEach(function (callback) { | ||
return callback(currentTransition, returnValue); | ||
}), | ||
returnValue.then(noop, reportGlobalError)); | ||
returnValue.then(noop, reportGlobalError); | ||
} catch (error) { | ||
@@ -542,2 +542,2 @@ reportGlobalError(error); | ||
}; | ||
exports.version = "19.0.0-rc-d3ce0d3ea9-20240520"; | ||
exports.version = "19.0.0-rc-eb259b5d3b-20240605"; |
@@ -91,3 +91,3 @@ /** | ||
} | ||
function noop$1() {} | ||
function noop() {} | ||
function resolveThenable(thenable) { | ||
@@ -102,3 +102,3 @@ switch (thenable.status) { | ||
("string" === typeof thenable.status | ||
? thenable.then(noop$1, noop$1) | ||
? thenable.then(noop, noop) | ||
: ((thenable.status = "pending"), | ||
@@ -175,3 +175,4 @@ thenable.then( | ||
escapedPrefix + | ||
(!callback.key || (children && children.key === callback.key) | ||
(null == callback.key || | ||
(children && children.key === callback.key) | ||
? "" | ||
@@ -270,32 +271,2 @@ : ("" + callback.key).replace( | ||
} | ||
var reportGlobalError = | ||
"function" === typeof reportError | ||
? reportError | ||
: function (error) { | ||
if ( | ||
"object" === typeof window && | ||
"function" === typeof window.ErrorEvent | ||
) { | ||
var event = new window.ErrorEvent("error", { | ||
bubbles: !0, | ||
cancelable: !0, | ||
message: | ||
"object" === typeof error && | ||
null !== error && | ||
"string" === typeof error.message | ||
? String(error.message) | ||
: String(error), | ||
error: error | ||
}); | ||
if (!window.dispatchEvent(event)) return; | ||
} else if ( | ||
"object" === typeof process && | ||
"function" === typeof process.emit | ||
) { | ||
process.emit("uncaughtException", error); | ||
return; | ||
} | ||
console.error(error); | ||
}; | ||
function noop() {} | ||
exports.Children = { | ||
@@ -447,28 +418,5 @@ map: mapChildren, | ||
}; | ||
exports.startTransition = function (scope) { | ||
var prevTransition = ReactSharedInternals.T, | ||
callbacks = new Set(); | ||
ReactSharedInternals.T = { _callbacks: callbacks }; | ||
var currentTransition = ReactSharedInternals.T; | ||
try { | ||
var returnValue = scope(); | ||
"object" === typeof returnValue && | ||
null !== returnValue && | ||
"function" === typeof returnValue.then && | ||
(callbacks.forEach(function (callback) { | ||
return callback(currentTransition, returnValue); | ||
}), | ||
returnValue.then(noop, reportGlobalError)); | ||
} catch (error) { | ||
reportGlobalError(error); | ||
} finally { | ||
ReactSharedInternals.T = prevTransition; | ||
} | ||
}; | ||
exports.use = function (usable) { | ||
return ReactSharedInternals.H.use(usable); | ||
}; | ||
exports.useActionState = function (action, initialState, permalink) { | ||
return ReactSharedInternals.H.useActionState(action, initialState, permalink); | ||
}; | ||
exports.useCallback = function (callback, deps) { | ||
@@ -484,2 +432,2 @@ return ReactSharedInternals.H.useCallback(callback, deps); | ||
}; | ||
exports.version = "19.0.0-rc-d3ce0d3ea9-20240520"; | ||
exports.version = "19.0.0-rc-eb259b5d3b-20240605"; |
@@ -7,3 +7,3 @@ { | ||
], | ||
"version": "19.0.0-rc-d3ce0d3ea9-20240520", | ||
"version": "19.0.0-rc-eb259b5d3b-20240605", | ||
"homepage": "https://react.dev/", | ||
@@ -10,0 +10,0 @@ "bugs": "https://github.com/facebook/react/issues", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
379015
9649