Delete more redundant JSX code (#28276)

Found another redundant implementation of JSX code. Not being used
anywhere so safe to delete.

DiffTrain build for commit https://github.com/facebook/react/commit/d3def47935e8912c197f78c78c97c2476fa1a77a.
This commit is contained in:
acdlite
2024-02-08 16:08:41 +00:00
parent f72fad0c14
commit 4e9b256a6d
7 changed files with 333 additions and 332 deletions
@@ -25670,7 +25670,7 @@ if (__DEV__) {
return root;
}
var ReactVersion = "18.3.0-canary-b229f540e-20240208";
var ReactVersion = "18.3.0-canary-d3def4793-20240208";
// Might add PROFILE later.
@@ -9152,7 +9152,7 @@ var devToolsConfig$jscomp$inline_1011 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-b229f540e-20240208",
version: "18.3.0-canary-d3def4793-20240208",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1189 = {
@@ -9183,7 +9183,7 @@ var internals$jscomp$inline_1189 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-b229f540e-20240208"
reconcilerVersion: "18.3.0-canary-d3def4793-20240208"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1190 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -9580,7 +9580,7 @@ var devToolsConfig$jscomp$inline_1053 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-b229f540e-20240208",
version: "18.3.0-canary-d3def4793-20240208",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1230 = {
@@ -9611,7 +9611,7 @@ var internals$jscomp$inline_1230 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-b229f540e-20240208"
reconcilerVersion: "18.3.0-canary-d3def4793-20240208"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1231 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<a5c4bb9a8fd2ccf90d2a03b031b104d0>>
* @generated SignedSource<<0dd9a827f64fd255297b65cbaecd6c33>>
*/
"use strict";
@@ -24,7 +24,7 @@ if (__DEV__) {
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
var ReactVersion = "18.3.0-canary-b229f540e-20240208";
var ReactVersion = "18.3.0-canary-d3def4793-20240208";
// ATTENTION
// When adding new symbols to this file,
@@ -1306,274 +1306,6 @@ if (__DEV__) {
}
}
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
var specialPropKeyWarningShown;
var specialPropRefWarningShown;
var didWarnAboutStringRefs;
{
didWarnAboutStringRefs = {};
}
function hasValidRef(config) {
{
if (hasOwnProperty.call(config, "ref")) {
var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
if (getter && getter.isReactWarning) {
return false;
}
}
}
return config.ref !== undefined;
}
function hasValidKey(config) {
{
if (hasOwnProperty.call(config, "key")) {
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
if (getter && getter.isReactWarning) {
return false;
}
}
}
return config.key !== undefined;
}
function warnIfStringRefCannotBeAutoConverted(config, self) {
{
if (
typeof config.ref === "string" &&
ReactCurrentOwner$1.current &&
self &&
ReactCurrentOwner$1.current.stateNode !== self
) {
var componentName = getComponentNameFromType(
ReactCurrentOwner$1.current.type
);
if (!didWarnAboutStringRefs[componentName]) {
error(
'Component "%s" contains the string ref "%s". ' +
"Support for string refs will be removed in a future major release. " +
"This case cannot be automatically converted to an arrow function. " +
"We ask you to manually fix this case by using useRef() or createRef() instead. " +
"Learn more about using refs safely here: " +
"https://reactjs.org/link/strict-mode-string-ref",
getComponentNameFromType(ReactCurrentOwner$1.current.type),
config.ref
);
didWarnAboutStringRefs[componentName] = true;
}
}
}
}
function defineKeyPropWarningGetter(props, displayName) {
{
var warnAboutAccessingKey = function () {
if (!specialPropKeyWarningShown) {
specialPropKeyWarningShown = true;
error(
"%s: `key` is not a prop. Trying to access it will result " +
"in `undefined` being returned. If you need to access the same " +
"value within the child component, you should pass it as a different " +
"prop. (https://reactjs.org/link/special-props)",
displayName
);
}
};
warnAboutAccessingKey.isReactWarning = true;
Object.defineProperty(props, "key", {
get: warnAboutAccessingKey,
configurable: true
});
}
}
function defineRefPropWarningGetter(props, displayName) {
{
var warnAboutAccessingRef = function () {
if (!specialPropRefWarningShown) {
specialPropRefWarningShown = true;
error(
"%s: `ref` is not a prop. Trying to access it will result " +
"in `undefined` being returned. If you need to access the same " +
"value within the child component, you should pass it as a different " +
"prop. (https://reactjs.org/link/special-props)",
displayName
);
}
};
warnAboutAccessingRef.isReactWarning = true;
Object.defineProperty(props, "ref", {
get: warnAboutAccessingRef,
configurable: true
});
}
}
/**
* Factory method to create a new React element. This no longer adheres to
* the class pattern, so do not use new to call it. Also, instanceof check
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
* if something is a React Element.
*
* @param {*} type
* @param {*} props
* @param {*} key
* @param {string|object} ref
* @param {*} owner
* @param {*} self A *temporary* helper to detect places where `this` is
* different from the `owner` when React.createElement is called, so that we
* can warn. We want to get rid of owner and replace string `ref`s with arrow
* functions, and as long as `this` and owner are the same, there will be no
* change in behavior.
* @param {*} source An annotation object (added by a transpiler or otherwise)
* indicating filename, line number, and/or other information.
* @internal
*/
function ReactElement(type, key, ref, self, source, owner, props) {
var element = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: REACT_ELEMENT_TYPE,
// Built-in properties that belong on the element
type: type,
key: key,
ref: ref,
props: props,
// Record the component responsible for creating this element.
_owner: owner
};
{
// The validation flag is currently mutative. We put it on
// an external backing store so that we can freeze the whole object.
// This can be replaced with a WeakMap once they are implemented in
// commonly used development environments.
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
// the validation flag non-enumerable (where possible, which should
// include every environment we run tests in), so the test framework
// ignores it.
Object.defineProperty(element._store, "validated", {
configurable: false,
enumerable: false,
writable: true,
value: false
}); // debugInfo contains Server Component debug information.
Object.defineProperty(element, "_debugInfo", {
configurable: false,
enumerable: false,
writable: true,
value: null
});
if (Object.freeze) {
Object.freeze(element.props);
Object.freeze(element);
}
}
return element;
}
/**
* https://github.com/reactjs/rfcs/pull/107
* @param {*} type
* @param {object} props
* @param {string} key
*/
function jsxDEV$1(type, config, maybeKey, source, self) {
{
var propName; // Reserved names are extracted
var props = {};
var key = null;
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
// but as an intermediary step, we will use jsxDEV for everything except
// <div {...props} key="Hi" />, because we aren't currently able to tell if
// key is explicitly declared to be undefined or not.
if (maybeKey !== undefined) {
{
checkKeyStringCoercion(maybeKey);
}
key = "" + maybeKey;
}
if (hasValidKey(config)) {
{
checkKeyStringCoercion(config.key);
}
key = "" + config.key;
}
if (hasValidRef(config)) {
ref = config.ref;
warnIfStringRefCannotBeAutoConverted(config, self);
} // Remaining properties are added to a new props object
for (propName in config) {
if (
hasOwnProperty.call(config, propName) && // Skip over reserved prop names
propName !== "key" && // TODO: `ref` will no longer be reserved in the next major
propName !== "ref"
) {
props[propName] = config[propName];
}
} // Resolve default props
if (type && type.defaultProps) {
var defaultProps = type.defaultProps;
for (propName in defaultProps) {
if (props[propName] === undefined) {
props[propName] = defaultProps[propName];
}
}
}
if (key || ref) {
var displayName =
typeof type === "function"
? type.displayName || type.name || "Unknown"
: type;
if (key) {
defineKeyPropWarningGetter(props, displayName);
}
if (ref) {
defineRefPropWarningGetter(props, displayName);
}
}
return ReactElement(
type,
key,
ref,
self,
source,
ReactCurrentOwner$1.current,
props
);
}
}
var REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference");
function setCurrentlyValidatingElement$1(element) {
@@ -1850,6 +1582,7 @@ if (__DEV__) {
}
}
}
function createElementWithValidation(type, props, children) {
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
// succeed and there will likely be errors in render.
@@ -3272,6 +3005,274 @@ if (__DEV__) {
only: onlyChild
};
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
var specialPropKeyWarningShown;
var specialPropRefWarningShown;
var didWarnAboutStringRefs;
{
didWarnAboutStringRefs = {};
}
function hasValidRef(config) {
{
if (hasOwnProperty.call(config, "ref")) {
var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
if (getter && getter.isReactWarning) {
return false;
}
}
}
return config.ref !== undefined;
}
function hasValidKey(config) {
{
if (hasOwnProperty.call(config, "key")) {
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
if (getter && getter.isReactWarning) {
return false;
}
}
}
return config.key !== undefined;
}
function warnIfStringRefCannotBeAutoConverted(config, self) {
{
if (
typeof config.ref === "string" &&
ReactCurrentOwner$1.current &&
self &&
ReactCurrentOwner$1.current.stateNode !== self
) {
var componentName = getComponentNameFromType(
ReactCurrentOwner$1.current.type
);
if (!didWarnAboutStringRefs[componentName]) {
error(
'Component "%s" contains the string ref "%s". ' +
"Support for string refs will be removed in a future major release. " +
"This case cannot be automatically converted to an arrow function. " +
"We ask you to manually fix this case by using useRef() or createRef() instead. " +
"Learn more about using refs safely here: " +
"https://reactjs.org/link/strict-mode-string-ref",
getComponentNameFromType(ReactCurrentOwner$1.current.type),
config.ref
);
didWarnAboutStringRefs[componentName] = true;
}
}
}
}
function defineKeyPropWarningGetter(props, displayName) {
{
var warnAboutAccessingKey = function () {
if (!specialPropKeyWarningShown) {
specialPropKeyWarningShown = true;
error(
"%s: `key` is not a prop. Trying to access it will result " +
"in `undefined` being returned. If you need to access the same " +
"value within the child component, you should pass it as a different " +
"prop. (https://reactjs.org/link/special-props)",
displayName
);
}
};
warnAboutAccessingKey.isReactWarning = true;
Object.defineProperty(props, "key", {
get: warnAboutAccessingKey,
configurable: true
});
}
}
function defineRefPropWarningGetter(props, displayName) {
{
var warnAboutAccessingRef = function () {
if (!specialPropRefWarningShown) {
specialPropRefWarningShown = true;
error(
"%s: `ref` is not a prop. Trying to access it will result " +
"in `undefined` being returned. If you need to access the same " +
"value within the child component, you should pass it as a different " +
"prop. (https://reactjs.org/link/special-props)",
displayName
);
}
};
warnAboutAccessingRef.isReactWarning = true;
Object.defineProperty(props, "ref", {
get: warnAboutAccessingRef,
configurable: true
});
}
}
/**
* Factory method to create a new React element. This no longer adheres to
* the class pattern, so do not use new to call it. Also, instanceof check
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
* if something is a React Element.
*
* @param {*} type
* @param {*} props
* @param {*} key
* @param {string|object} ref
* @param {*} owner
* @param {*} self A *temporary* helper to detect places where `this` is
* different from the `owner` when React.createElement is called, so that we
* can warn. We want to get rid of owner and replace string `ref`s with arrow
* functions, and as long as `this` and owner are the same, there will be no
* change in behavior.
* @param {*} source An annotation object (added by a transpiler or otherwise)
* indicating filename, line number, and/or other information.
* @internal
*/
function ReactElement(type, key, ref, self, source, owner, props) {
var element = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: REACT_ELEMENT_TYPE,
// Built-in properties that belong on the element
type: type,
key: key,
ref: ref,
props: props,
// Record the component responsible for creating this element.
_owner: owner
};
{
// The validation flag is currently mutative. We put it on
// an external backing store so that we can freeze the whole object.
// This can be replaced with a WeakMap once they are implemented in
// commonly used development environments.
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
// the validation flag non-enumerable (where possible, which should
// include every environment we run tests in), so the test framework
// ignores it.
Object.defineProperty(element._store, "validated", {
configurable: false,
enumerable: false,
writable: true,
value: false
}); // debugInfo contains Server Component debug information.
Object.defineProperty(element, "_debugInfo", {
configurable: false,
enumerable: false,
writable: true,
value: null
});
if (Object.freeze) {
Object.freeze(element.props);
Object.freeze(element);
}
}
return element;
}
/**
* https://github.com/reactjs/rfcs/pull/107
* @param {*} type
* @param {object} props
* @param {string} key
*/
function jsxDEV$1(type, config, maybeKey, source, self) {
{
var propName; // Reserved names are extracted
var props = {};
var key = null;
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
// but as an intermediary step, we will use jsxDEV for everything except
// <div {...props} key="Hi" />, because we aren't currently able to tell if
// key is explicitly declared to be undefined or not.
if (maybeKey !== undefined) {
{
checkKeyStringCoercion(maybeKey);
}
key = "" + maybeKey;
}
if (hasValidKey(config)) {
{
checkKeyStringCoercion(config.key);
}
key = "" + config.key;
}
if (hasValidRef(config)) {
ref = config.ref;
warnIfStringRefCannotBeAutoConverted(config, self);
} // Remaining properties are added to a new props object
for (propName in config) {
if (
hasOwnProperty.call(config, propName) && // Skip over reserved prop names
propName !== "key" && // TODO: `ref` will no longer be reserved in the next major
propName !== "ref"
) {
props[propName] = config[propName];
}
} // Resolve default props
if (type && type.defaultProps) {
var defaultProps = type.defaultProps;
for (propName in defaultProps) {
if (props[propName] === undefined) {
props[propName] = defaultProps[propName];
}
}
}
if (key || ref) {
var displayName =
typeof type === "function"
? type.displayName || type.name || "Unknown"
: type;
if (key) {
defineKeyPropWarningGetter(props, displayName);
}
if (ref) {
defineRefPropWarningGetter(props, displayName);
}
}
return ReactElement(
type,
key,
ref,
self,
source,
ReactCurrentOwner$1.current,
props
);
}
}
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<bc49f7cc6bb91f204e6c74435a3de461>>
* @generated SignedSource<<bfea370d77b8a2763632472a0306ca34>>
*/
"use strict";
@@ -145,33 +145,7 @@ var ReactCurrentDispatcher = { current: null },
ReactCurrentCache: ReactCurrentCache,
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
ReactCurrentOwner: ReactCurrentOwner$1
},
ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
function jsx$1(type, config, maybeKey) {
var propName,
props = {},
key = null,
ref = null;
void 0 !== maybeKey && (key = "" + maybeKey);
void 0 !== config.key && (key = "" + config.key);
void 0 !== config.ref && (ref = config.ref);
for (propName in config)
hasOwnProperty.call(config, propName) &&
"key" !== propName &&
"ref" !== propName &&
(props[propName] = config[propName]);
if (type && type.defaultProps)
for (propName in ((config = type.defaultProps), config))
void 0 === props[propName] && (props[propName] = config[propName]);
return {
$$typeof: REACT_ELEMENT_TYPE,
type: type,
key: key,
ref: ref,
props: props,
_owner: ReactCurrentOwner.current
};
}
function escape(key) {
var escaperLookup = { "=": "=0", ":": "=2" };
return (
@@ -313,6 +287,32 @@ function lazyInitializer(payload) {
: function (error) {
console.error(error);
};
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
function jsx$1(type, config, maybeKey) {
var propName,
props = {},
key = null,
ref = null;
void 0 !== maybeKey && (key = "" + maybeKey);
void 0 !== config.key && (key = "" + config.key);
void 0 !== config.ref && (ref = config.ref);
for (propName in config)
hasOwnProperty.call(config, propName) &&
"key" !== propName &&
"ref" !== propName &&
(props[propName] = config[propName]);
if (type && type.defaultProps)
for (propName in ((config = type.defaultProps), config))
void 0 === props[propName] && (props[propName] = config[propName]);
return {
$$typeof: REACT_ELEMENT_TYPE,
type: type,
key: key,
ref: ref,
props: props,
_owner: ReactCurrentOwner.current
};
}
exports.Children = {
map: mapChildren,
forEach: function (children, forEachFunc, forEachContext) {
@@ -543,4 +543,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-b229f540e-20240208";
exports.version = "18.3.0-canary-d3def4793-20240208";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<23832d51c94136ac844a128209687342>>
* @generated SignedSource<<ed24a17f92681cf29d086121949cb6ee>>
*/
"use strict";
@@ -120,33 +120,7 @@ var ReactCurrentDispatcher = { current: null },
ReactCurrentCache: ReactCurrentCache,
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
ReactCurrentOwner: ReactCurrentOwner$1
},
ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
function jsx$1(type, config, maybeKey) {
var propName,
props = {},
key = null,
ref = null;
void 0 !== maybeKey && (key = "" + maybeKey);
void 0 !== config.key && (key = "" + config.key);
void 0 !== config.ref && (ref = config.ref);
for (propName in config)
hasOwnProperty.call(config, propName) &&
"key" !== propName &&
"ref" !== propName &&
(props[propName] = config[propName]);
if (type && type.defaultProps)
for (propName in ((config = type.defaultProps), config))
void 0 === props[propName] && (props[propName] = config[propName]);
return {
$$typeof: REACT_ELEMENT_TYPE,
type: type,
key: key,
ref: ref,
props: props,
_owner: ReactCurrentOwner.current
};
}
function escape(key) {
var escaperLookup = { "=": "=0", ":": "=2" };
return (
@@ -288,6 +262,32 @@ function lazyInitializer(payload) {
: function (error) {
console.error(error);
};
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
function jsx$1(type, config, maybeKey) {
var propName,
props = {},
key = null,
ref = null;
void 0 !== maybeKey && (key = "" + maybeKey);
void 0 !== config.key && (key = "" + config.key);
void 0 !== config.ref && (ref = config.ref);
for (propName in config)
hasOwnProperty.call(config, propName) &&
"key" !== propName &&
"ref" !== propName &&
(props[propName] = config[propName]);
if (type && type.defaultProps)
for (propName in ((config = type.defaultProps), config))
void 0 === props[propName] && (props[propName] = config[propName]);
return {
$$typeof: REACT_ELEMENT_TYPE,
type: type,
key: key,
ref: ref,
props: props,
_owner: ReactCurrentOwner.current
};
}
exports.Children = {
map: mapChildren,
forEach: function (children, forEachFunc, forEachContext) {
@@ -539,7 +539,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-b229f540e-20240208";
exports.version = "18.3.0-canary-d3def4793-20240208";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -1 +1 @@
b229f540e2da91370611945f9875e00a96196df6
d3def47935e8912c197f78c78c97c2476fa1a77a