feat(compiler): Implement constant propagation for template literals (#33139)

New take on #29716

## Summary
Template literals consisting entirely of constant values will be inlined
to a string literal, effectively replacing the backticks with a double
quote.

This is done primarily to make the resulting instruction a string
literal, so it can be processed further in constant propatation. So this
is now correctly simplified to `true`:
```js
`` === "" // now true
`a${1}` === "a1" // now true
```

If a template string literal can only partially be comptime-evaluated,
it is not that useful for dead code elimination or further constant
folding steps and thus, is left as-is in that case. Same is true if the
literal contains an array, object, symbol or function.

## How did you test this change?

See added tests.

DiffTrain build for [ac06829246](https://github.com/facebook/react/commit/ac06829246287751e6b74bd99cd1b39d1aeba06a)
This commit is contained in:
josephsavona
2025-05-08 09:31:02 -07:00
parent 8bf45a64d3
commit 49d9f3fc49
26 changed files with 181 additions and 89 deletions
+1 -1
View File
@@ -1 +1 @@
19.2.0-native-fb-38ef6550-20250508
19.2.0-native-fb-ac068292-20250508
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<bf136fe6d5dfc8d633a0f613585ff932>>
* @generated SignedSource<<0f0cdbc0ee2edcb4b4b9aa1388adab0b>>
*/
"use strict";
@@ -404,5 +404,5 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-38ef6550-20250508";
exports.version = "19.2.0-native-fb-ac068292-20250508";
})();
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<8662139ea2bf9515a221cba116f4a38a>>
* @generated SignedSource<<d449cb4e74f571609a3d37ce1f13673f>>
*/
"use strict";
@@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-38ef6550-20250508";
exports.version = "19.2.0-native-fb-ac068292-20250508";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<8662139ea2bf9515a221cba116f4a38a>>
* @generated SignedSource<<d449cb4e74f571609a3d37ce1f13673f>>
*/
"use strict";
@@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-38ef6550-20250508";
exports.version = "19.2.0-native-fb-ac068292-20250508";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<ad08e1590373068e712038fe4c8862e4>>
* @generated SignedSource<<51e9111c659f59f5093882ab323a900c>>
*/
/*
@@ -26973,11 +26973,11 @@ __DEV__ &&
};
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-38ef6550-20250508" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-ac068292-20250508" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.2.0-native-fb-38ef6550-20250508\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.2.0-native-fb-ac068292-20250508\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
@@ -27014,10 +27014,10 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-38ef6550-20250508",
version: "19.2.0-native-fb-ac068292-20250508",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-38ef6550-20250508"
reconcilerVersion: "19.2.0-native-fb-ac068292-20250508"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -27161,5 +27161,5 @@ __DEV__ &&
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.2.0-native-fb-38ef6550-20250508";
exports.version = "19.2.0-native-fb-ac068292-20250508";
})();
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<b9c235ea8a8d61041cc3c38cb8d6a9f6>>
* @generated SignedSource<<fdd3c5a312c8af31f5da81b868897481>>
*/
/*
@@ -17069,14 +17069,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_2013 = React.version;
if (
"19.2.0-native-fb-38ef6550-20250508" !==
"19.2.0-native-fb-ac068292-20250508" !==
isomorphicReactPackageVersion$jscomp$inline_2013
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_2013,
"19.2.0-native-fb-38ef6550-20250508"
"19.2.0-native-fb-ac068292-20250508"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17098,10 +17098,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2532 = {
bundleType: 0,
version: "19.2.0-native-fb-38ef6550-20250508",
version: "19.2.0-native-fb-ac068292-20250508",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-38ef6550-20250508"
reconcilerVersion: "19.2.0-native-fb-ac068292-20250508"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2533 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -17205,4 +17205,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.2.0-native-fb-38ef6550-20250508";
exports.version = "19.2.0-native-fb-ac068292-20250508";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<2ab97ce4fd0575f5c88e4f812d1b5a41>>
* @generated SignedSource<<1f9b996163be6768b9380267e581a634>>
*/
/*
@@ -17779,14 +17779,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_2116 = React.version;
if (
"19.2.0-native-fb-38ef6550-20250508" !==
"19.2.0-native-fb-ac068292-20250508" !==
isomorphicReactPackageVersion$jscomp$inline_2116
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_2116,
"19.2.0-native-fb-38ef6550-20250508"
"19.2.0-native-fb-ac068292-20250508"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17808,10 +17808,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2123 = {
bundleType: 0,
version: "19.2.0-native-fb-38ef6550-20250508",
version: "19.2.0-native-fb-ac068292-20250508",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-38ef6550-20250508",
reconcilerVersion: "19.2.0-native-fb-ac068292-20250508",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$313 = 0;
@@ -17930,4 +17930,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.2.0-native-fb-38ef6550-20250508";
exports.version = "19.2.0-native-fb-ac068292-20250508";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<7e0dd3ea54c5ac2f8e3fb7e8db73a191>>
* @generated SignedSource<<55b6d4a17ded6af6b3899a62acb7077d>>
*/
/*
@@ -27034,11 +27034,11 @@ __DEV__ &&
};
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-38ef6550-20250508" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-ac068292-20250508" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.2.0-native-fb-38ef6550-20250508\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.2.0-native-fb-ac068292-20250508\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
@@ -27075,10 +27075,10 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-38ef6550-20250508",
version: "19.2.0-native-fb-ac068292-20250508",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-38ef6550-20250508"
reconcilerVersion: "19.2.0-native-fb-ac068292-20250508"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -27538,7 +27538,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-38ef6550-20250508";
exports.version = "19.2.0-native-fb-ac068292-20250508";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<acd10792cd4c98f5df3f1f82b37f2ff8>>
* @generated SignedSource<<f6636d3cf7f601e015ac4a1a33e3d9e8>>
*/
/*
@@ -17080,14 +17080,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_2014 = React.version;
if (
"19.2.0-native-fb-38ef6550-20250508" !==
"19.2.0-native-fb-ac068292-20250508" !==
isomorphicReactPackageVersion$jscomp$inline_2014
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_2014,
"19.2.0-native-fb-38ef6550-20250508"
"19.2.0-native-fb-ac068292-20250508"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17109,10 +17109,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2535 = {
bundleType: 0,
version: "19.2.0-native-fb-38ef6550-20250508",
version: "19.2.0-native-fb-ac068292-20250508",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-38ef6550-20250508"
reconcilerVersion: "19.2.0-native-fb-ac068292-20250508"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2536 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -17370,4 +17370,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-38ef6550-20250508";
exports.version = "19.2.0-native-fb-ac068292-20250508";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<7ce7b954fd069055f6881dff74e49e07>>
* @generated SignedSource<<3be605dcb9ae3379544766421df9b7e5>>
*/
/*
@@ -17794,14 +17794,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_2117 = React.version;
if (
"19.2.0-native-fb-38ef6550-20250508" !==
"19.2.0-native-fb-ac068292-20250508" !==
isomorphicReactPackageVersion$jscomp$inline_2117
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_2117,
"19.2.0-native-fb-38ef6550-20250508"
"19.2.0-native-fb-ac068292-20250508"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17823,10 +17823,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2124 = {
bundleType: 0,
version: "19.2.0-native-fb-38ef6550-20250508",
version: "19.2.0-native-fb-ac068292-20250508",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-38ef6550-20250508",
reconcilerVersion: "19.2.0-native-fb-ac068292-20250508",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$313 = 0;
@@ -18099,7 +18099,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-38ef6550-20250508";
exports.version = "19.2.0-native-fb-ac068292-20250508";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<5351ad1e776f88b320150ad862abbc78>>
* @generated SignedSource<<fdbcfcf7495df7c50f62cf5900fb08f5>>
*/
"use strict";
@@ -15653,10 +15653,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-38ef6550-20250508",
version: "19.2.0-native-fb-ac068292-20250508",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-38ef6550-20250508"
reconcilerVersion: "19.2.0-native-fb-ac068292-20250508"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -15801,5 +15801,5 @@ __DEV__ &&
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.2.0-native-fb-38ef6550-20250508";
exports.version = "19.2.0-native-fb-ac068292-20250508";
})();
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<9d1c1c6cc0a7fb94fd48869098398de1>>
* @generated SignedSource<<1ba432414a4dea396bc2b2c34a8345c0>>
*/
"use strict";
@@ -9893,10 +9893,10 @@ function wrapFiber(fiber) {
}
var internals$jscomp$inline_1445 = {
bundleType: 0,
version: "19.2.0-native-fb-38ef6550-20250508",
version: "19.2.0-native-fb-ac068292-20250508",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-38ef6550-20250508"
reconcilerVersion: "19.2.0-native-fb-ac068292-20250508"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1446 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -10032,4 +10032,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.2.0-native-fb-38ef6550-20250508";
exports.version = "19.2.0-native-fb-ac068292-20250508";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<21f523693ec3c8d22c0f059169bf3b5c>>
* @generated SignedSource<<01362a487fa1ab5a5e2bd1b95ca21253>>
*/
"use strict";
@@ -10513,10 +10513,10 @@ function wrapFiber(fiber) {
}
var internals$jscomp$inline_1253 = {
bundleType: 0,
version: "19.2.0-native-fb-38ef6550-20250508",
version: "19.2.0-native-fb-ac068292-20250508",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-38ef6550-20250508",
reconcilerVersion: "19.2.0-native-fb-ac068292-20250508",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$155 = 0;
@@ -10667,4 +10667,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.2.0-native-fb-38ef6550-20250508";
exports.version = "19.2.0-native-fb-ac068292-20250508";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<7a7b34128c9dbbc307bf75f02e977572>>
* @generated SignedSource<<ea439fb6b4ec10df6efe8ab2d5fd2817>>
*/
"use strict";
@@ -1412,7 +1412,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.2.0-native-fb-38ef6550-20250508";
exports.version = "19.2.0-native-fb-ac068292-20250508";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<cfdf223cecf9407595b67bf7596a5a3c>>
* @generated SignedSource<<777c362a35b5b907131a46cc68bb556f>>
*/
"use strict";
@@ -587,4 +587,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.2.0-native-fb-38ef6550-20250508";
exports.version = "19.2.0-native-fb-ac068292-20250508";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<4d385f63f7a94706579387bbf2b1d5d4>>
* @generated SignedSource<<a159f68ea0d06ef4d2b9bcab56c38500>>
*/
"use strict";
@@ -591,7 +591,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.2.0-native-fb-38ef6550-20250508";
exports.version = "19.2.0-native-fb-ac068292-20250508";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -1 +1 @@
38ef6550a88f7744f5dcd4a3de7af6f13a540be5
ac06829246287751e6b74bd99cd1b39d1aeba06a
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<996cf3a88b1a5a7e17629e45e8e4ba4f>>
* @generated SignedSource<<7f70495ee005aac73dd152f90fff72da>>
*/
"use strict";
@@ -17517,10 +17517,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-38ef6550-20250508",
version: "19.2.0-native-fb-ac068292-20250508",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-38ef6550-20250508"
reconcilerVersion: "19.2.0-native-fb-ac068292-20250508"
};
null !== extraDevToolsConfig &&
(internals.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<d377ff23ebe9915affad87547e3338a6>>
* @generated SignedSource<<008e4197ca6133cfdb2372f1fb8fd9cb>>
*/
"use strict";
@@ -11235,10 +11235,10 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1254 = {
bundleType: 0,
version: "19.2.0-native-fb-38ef6550-20250508",
version: "19.2.0-native-fb-ac068292-20250508",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-38ef6550-20250508"
reconcilerVersion: "19.2.0-native-fb-ac068292-20250508"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1254.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<26ea81f988afc11cad57cddec441a844>>
* @generated SignedSource<<8d8168b3809cfc422dcecbda37fcc381>>
*/
"use strict";
@@ -11939,10 +11939,10 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1355 = {
bundleType: 0,
version: "19.2.0-native-fb-38ef6550-20250508",
version: "19.2.0-native-fb-ac068292-20250508",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-38ef6550-20250508"
reconcilerVersion: "19.2.0-native-fb-ac068292-20250508"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1355.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<ba6822f9afaf1620fc28e06906d1a7db>>
* @generated SignedSource<<cb28e044821ce83250926ec0bcacff73>>
*/
"use strict";
@@ -17645,11 +17645,11 @@ __DEV__ &&
shouldSuspendImpl = newShouldSuspendImpl;
};
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-38ef6550-20250508" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-ac068292-20250508" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.2.0-native-fb-38ef6550-20250508\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.2.0-native-fb-ac068292-20250508\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
@@ -17675,10 +17675,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-38ef6550-20250508",
version: "19.2.0-native-fb-ac068292-20250508",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-38ef6550-20250508"
reconcilerVersion: "19.2.0-native-fb-ac068292-20250508"
};
null !== extraDevToolsConfig &&
(internals.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<3757868a594c3ad196d8a2103ff0dbc0>>
* @generated SignedSource<<37b5cc6bf48f32b8476df22e53e57ff4>>
*/
"use strict";
@@ -11250,11 +11250,11 @@ function updateContainer(element, container, parentComponent, callback) {
return lane;
}
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-38ef6550-20250508" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-ac068292-20250508" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.2.0-native-fb-38ef6550-20250508\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.2.0-native-fb-ac068292-20250508\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
@@ -11303,10 +11303,10 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1305 = {
bundleType: 0,
version: "19.2.0-native-fb-38ef6550-20250508",
version: "19.2.0-native-fb-ac068292-20250508",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-38ef6550-20250508"
reconcilerVersion: "19.2.0-native-fb-ac068292-20250508"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1305.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<20b007a57c95f80fc30c5fbc9002b662>>
* @generated SignedSource<<8e694740266a64d38cc4840c83f93b92>>
*/
"use strict";
@@ -11952,11 +11952,11 @@ function updateContainer(element, container, parentComponent, callback) {
return lane;
}
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-38ef6550-20250508" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-ac068292-20250508" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.2.0-native-fb-38ef6550-20250508\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.2.0-native-fb-ac068292-20250508\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
@@ -12005,10 +12005,10 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1406 = {
bundleType: 0,
version: "19.2.0-native-fb-38ef6550-20250508",
version: "19.2.0-native-fb-ac068292-20250508",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-38ef6550-20250508"
reconcilerVersion: "19.2.0-native-fb-ac068292-20250508"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1406.rendererConfig = extraDevToolsConfig);
@@ -12,7 +12,7 @@
* @lightSyntaxTransform
* @preventMunge
* @oncall react_core
* @generated SignedSource<<bf2a3cfe044d5b450ecff7cc37899393>>
* @generated SignedSource<<970edb4f23f75a12c8642233f59a88ae>>
*/
'use strict';
@@ -40447,6 +40447,52 @@ function evaluateInstruction(constants, instr) {
}
return null;
}
case 'TemplateLiteral': {
if (value.subexprs.length === 0) {
const result = {
kind: 'Primitive',
value: value.quasis.map(q => q.cooked).join(''),
loc: value.loc,
};
instr.value = result;
return result;
}
if (value.subexprs.length !== value.quasis.length - 1) {
return null;
}
if (value.quasis.some(q => q.cooked === undefined)) {
return null;
}
let quasiIndex = 0;
let resultString = value.quasis[quasiIndex].cooked;
++quasiIndex;
for (const subExpr of value.subexprs) {
const subExprValue = read(constants, subExpr);
if (!subExprValue || subExprValue.kind !== 'Primitive') {
return null;
}
const expressionValue = subExprValue.value;
if (typeof expressionValue !== 'number' &&
typeof expressionValue !== 'string' &&
typeof expressionValue !== 'boolean' &&
!(typeof expressionValue === 'object' && expressionValue === null)) {
return null;
}
const suffix = value.quasis[quasiIndex].cooked;
++quasiIndex;
if (suffix === undefined) {
return null;
}
resultString = resultString.concat(expressionValue, suffix);
}
const result = {
kind: 'Primitive',
value: resultString,
loc: value.loc,
};
instr.value = result;
return result;
}
case 'LoadLocal': {
const placeValue = read(constants, value.place);
if (placeValue !== null) {
@@ -6,7 +6,7 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @generated SignedSource<<5ea520dda276f0aed8050f583b9ccdc4>>
* @generated SignedSource<<1c918198659002c1074bc65f3beaa988>>
*/
'use strict';
@@ -40226,6 +40226,52 @@ function evaluateInstruction(constants, instr) {
}
return null;
}
case 'TemplateLiteral': {
if (value.subexprs.length === 0) {
const result = {
kind: 'Primitive',
value: value.quasis.map(q => q.cooked).join(''),
loc: value.loc,
};
instr.value = result;
return result;
}
if (value.subexprs.length !== value.quasis.length - 1) {
return null;
}
if (value.quasis.some(q => q.cooked === undefined)) {
return null;
}
let quasiIndex = 0;
let resultString = value.quasis[quasiIndex].cooked;
++quasiIndex;
for (const subExpr of value.subexprs) {
const subExprValue = read(constants, subExpr);
if (!subExprValue || subExprValue.kind !== 'Primitive') {
return null;
}
const expressionValue = subExprValue.value;
if (typeof expressionValue !== 'number' &&
typeof expressionValue !== 'string' &&
typeof expressionValue !== 'boolean' &&
!(typeof expressionValue === 'object' && expressionValue === null)) {
return null;
}
const suffix = value.quasis[quasiIndex].cooked;
++quasiIndex;
if (suffix === undefined) {
return null;
}
resultString = resultString.concat(expressionValue, suffix);
}
const result = {
kind: 'Primitive',
value: resultString,
loc: value.loc,
};
instr.value = result;
return result;
}
case 'LoadLocal': {
const placeValue = read(constants, value.place);
if (placeValue !== null) {
@@ -1,7 +1,7 @@
{
"name": "eslint-plugin-react-hooks",
"description": "ESLint rules for React Hooks",
"version": "0.0.0-experimental-38ef6550-20250508",
"version": "0.0.0-experimental-ac068292-20250508",
"repository": {
"type": "git",
"url": "https://github.com/facebook/react.git",