Add support for rendering BigInt (#24580)

DiffTrain build for commit https://github.com/facebook/react/commit/2f240c91ed54900adee213565cb2039e161629e9.
This commit is contained in:
eps1lon
2024-02-26 18:23:22 +00:00
parent 908dcaf6c5
commit d2778ef6e7
9 changed files with 75 additions and 51 deletions
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<cef9df27ccdfbbffd9d4f74c26147558>>
* @generated SignedSource<<2e02ad0f633511d087c31638317ef702>>
*/
"use strict";
@@ -148,6 +148,7 @@ if (__DEV__) {
var enableLegacyHidden = false;
var enableAsyncActions = true;
var alwaysThrottleRetries = true;
var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version.
var FunctionComponent = 0;
var ClassComponent = 1;
@@ -5538,12 +5539,14 @@ if (__DEV__) {
function createChild(returnFiber, newChild, lanes, debugInfo) {
if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
// Text nodes don't have keys. If the previous node is implicitly keyed
// we can continue to replace it without aborting even if it is not a text
// node.
var created = createFiberFromText(
// $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
returnFiber.mode,
lanes
@@ -5671,7 +5674,8 @@ if (__DEV__) {
if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
// Text nodes don't have keys. If the previous node is implicitly keyed
// we can continue to replace it without aborting even if it is not a text
@@ -5682,7 +5686,7 @@ if (__DEV__) {
return updateTextNode(
returnFiber,
oldFiber,
oldFiber, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
lanes,
debugInfo
@@ -5797,14 +5801,15 @@ if (__DEV__) {
) {
if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
// Text nodes don't have keys, so we neither have to check the old nor
// new node for the key. If both are text nodes, they match.
var matchedFiber = existingChildren.get(newIdx) || null;
return updateTextNode(
returnFiber,
matchedFiber,
matchedFiber, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
lanes,
debugInfo
@@ -6645,12 +6650,13 @@ if (__DEV__) {
if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
return placeSingleChild(
reconcileSingleTextNode(
returnFiber,
currentFirstChild,
currentFirstChild, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
lanes
)
@@ -25727,7 +25733,7 @@ if (__DEV__) {
return root;
}
var ReactVersion = "18.3.0-canary-6c3b8dbfe-20240226";
var ReactVersion = "18.3.0-canary-2f240c91e-20240226";
// Might add PROFILE later.
@@ -9171,7 +9171,7 @@ var devToolsConfig$jscomp$inline_1014 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-6c3b8dbfe-20240226",
version: "18.3.0-canary-2f240c91e-20240226",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1195 = {
@@ -9202,7 +9202,7 @@ var internals$jscomp$inline_1195 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-6c3b8dbfe-20240226"
reconcilerVersion: "18.3.0-canary-2f240c91e-20240226"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1196 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -9599,7 +9599,7 @@ var devToolsConfig$jscomp$inline_1056 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-6c3b8dbfe-20240226",
version: "18.3.0-canary-2f240c91e-20240226",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1236 = {
@@ -9630,7 +9630,7 @@ var internals$jscomp$inline_1236 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-6c3b8dbfe-20240226"
reconcilerVersion: "18.3.0-canary-2f240c91e-20240226"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1237 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<44c5c601c5193aa81af150ccb4208604>>
* @generated SignedSource<<11b286062c8512965799ad8e36092d6b>>
*/
"use strict";
@@ -26,7 +26,7 @@ if (__DEV__) {
}
var dynamicFlags = require("ReactNativeInternalFeatureFlags");
var ReactVersion = "18.3.0-canary-6c3b8dbfe-20240226";
var ReactVersion = "18.3.0-canary-2f240c91e-20240226";
// ATTENTION
// When adding new symbols to this file,
@@ -490,6 +490,21 @@ if (__DEV__) {
return isArrayImpl(a);
}
// NOTE: There are no flags, currently. Uncomment the stuff below if we add one.
// the exports object every time a flag is read.
var enableComponentStackLocations =
dynamicFlags.enableComponentStackLocations;
// The rest of the flags are static for better dead code elimination.
var enableDebugTracing = false;
var enableScopeAPI = false;
var enableRenderableContext = false;
var enableLegacyHidden = false;
var enableTransitionTracing = false;
// because JSX is an extremely hot path.
var enableRefAsProp = false;
/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
@@ -564,21 +579,6 @@ if (__DEV__) {
}
}
// NOTE: There are no flags, currently. Uncomment the stuff below if we add one.
// the exports object every time a flag is read.
var enableComponentStackLocations =
dynamicFlags.enableComponentStackLocations;
// The rest of the flags are static for better dead code elimination.
var enableDebugTracing = false;
var enableScopeAPI = false;
var enableRenderableContext = false;
var enableLegacyHidden = false;
var enableTransitionTracing = false;
// because JSX is an extremely hot path.
var enableRefAsProp = false;
function getWrappedName(outerType, innerType, wrapperName) {
var displayName = outerType.displayName;
@@ -2309,6 +2309,12 @@ if (__DEV__) {
invokeCallback = true;
} else {
switch (type) {
case "bigint": {
break;
}
// fallthrough for enabled BigInt support
case "string":
case "number":
invokeCallback = true;
@@ -598,4 +598,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-6c3b8dbfe-20240226";
exports.version = "18.3.0-canary-2f240c91e-20240226";
@@ -594,7 +594,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-6c3b8dbfe-20240226";
exports.version = "18.3.0-canary-2f240c91e-20240226";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -1 +1 @@
6c3b8dbfed6f879440f484bd0bf801fac67ec684
2f240c91ed54900adee213565cb2039e161629e9
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<575cc3b40a7c3dee749cf6fb176a4449>>
* @generated SignedSource<<36563f58fdb8036d760d09bb1e80c450>>
*/
"use strict";
@@ -3248,6 +3248,7 @@ to return true:wantsResponderID| |
var enableLazyContextPropagation = false;
var enableLegacyHidden = false;
var enableAsyncActions = false;
var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version.
var NoFlags$1 =
/* */
@@ -9445,12 +9446,14 @@ to return true:wantsResponderID| |
function createChild(returnFiber, newChild, lanes, debugInfo) {
if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
// Text nodes don't have keys. If the previous node is implicitly keyed
// we can continue to replace it without aborting even if it is not a text
// node.
var created = createFiberFromText(
// $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
returnFiber.mode,
lanes
@@ -9578,7 +9581,8 @@ to return true:wantsResponderID| |
if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
// Text nodes don't have keys. If the previous node is implicitly keyed
// we can continue to replace it without aborting even if it is not a text
@@ -9589,7 +9593,7 @@ to return true:wantsResponderID| |
return updateTextNode(
returnFiber,
oldFiber,
oldFiber, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
lanes,
debugInfo
@@ -9704,14 +9708,15 @@ to return true:wantsResponderID| |
) {
if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
// Text nodes don't have keys, so we neither have to check the old nor
// new node for the key. If both are text nodes, they match.
var matchedFiber = existingChildren.get(newIdx) || null;
return updateTextNode(
returnFiber,
matchedFiber,
matchedFiber, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
lanes,
debugInfo
@@ -10552,12 +10557,13 @@ to return true:wantsResponderID| |
if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
return placeSingleChild(
reconcileSingleTextNode(
returnFiber,
currentFirstChild,
currentFirstChild, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
lanes
)
@@ -28034,7 +28040,7 @@ to return true:wantsResponderID| |
return root;
}
var ReactVersion = "18.3.0-canary-6032fc8f";
var ReactVersion = "18.3.0-canary-49d61be7";
function createPortal$1(
children,
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<50e7f5f201ab5dea1513a63712db8d3a>>
* @generated SignedSource<<bb8c0cb2abf7c0fc68f3b99c4c5c1b42>>
*/
"use strict";
@@ -2955,6 +2955,7 @@ to return true:wantsResponderID| |
var enableLazyContextPropagation = false;
var enableLegacyHidden = false;
var enableAsyncActions = false;
var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version.
// ATTENTION
// When adding new symbols to this file,
@@ -9716,12 +9717,14 @@ to return true:wantsResponderID| |
function createChild(returnFiber, newChild, lanes, debugInfo) {
if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
// Text nodes don't have keys. If the previous node is implicitly keyed
// we can continue to replace it without aborting even if it is not a text
// node.
var created = createFiberFromText(
// $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
returnFiber.mode,
lanes
@@ -9849,7 +9852,8 @@ to return true:wantsResponderID| |
if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
// Text nodes don't have keys. If the previous node is implicitly keyed
// we can continue to replace it without aborting even if it is not a text
@@ -9860,7 +9864,7 @@ to return true:wantsResponderID| |
return updateTextNode(
returnFiber,
oldFiber,
oldFiber, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
lanes,
debugInfo
@@ -9975,14 +9979,15 @@ to return true:wantsResponderID| |
) {
if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
// Text nodes don't have keys, so we neither have to check the old nor
// new node for the key. If both are text nodes, they match.
var matchedFiber = existingChildren.get(newIdx) || null;
return updateTextNode(
returnFiber,
matchedFiber,
matchedFiber, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
lanes,
debugInfo
@@ -10823,12 +10828,13 @@ to return true:wantsResponderID| |
if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
return placeSingleChild(
reconcileSingleTextNode(
returnFiber,
currentFirstChild,
currentFirstChild, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
lanes
)
@@ -28474,7 +28480,7 @@ to return true:wantsResponderID| |
return root;
}
var ReactVersion = "18.3.0-canary-0d6ee362";
var ReactVersion = "18.3.0-canary-a86eeb93";
function createPortal$1(
children,