mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[compiler] Detect known incompatible libraries (#34027)
A few libraries are known to be incompatible with memoization, whether
manually via `useMemo()` or via React Compiler. This puts us in a tricky
situation. On the one hand, we understand that these libraries were
developed prior to our documenting the [Rules of
React](https://react.dev/reference/rules), and their designs were the
result of trying to deliver a great experience for their users and
balance multiple priorities around DX, performance, etc. At the same
time, using these libraries with memoization — and in particular with
automatic memoization via React Compiler — can break apps by causing the
components using these APIs not to update. Concretely, the APIs have in
common that they return a function which returns different values over
time, but where the function itself does not change. Memoizing the
result on the identity of the function will mean that the value never
changes. Developers reasonable interpret this as "React Compiler broke
my code".
Of course, the best solution is to work with developers of these
libraries to address the root cause, and we're doing that. We've
previously discussed this situation with both of the respective
libraries:
* React Hook Form:
https://github.com/react-hook-form/react-hook-form/issues/11910#issuecomment-2135608761
* TanStack Table:
https://github.com/facebook/react/issues/33057#issuecomment-2840600158
and https://github.com/TanStack/table/issues/5567
In the meantime we need to make sure that React Compiler can work out of
the box as much as possible. This means teaching it about popular
libraries that cannot be memoized. We also can't silently skip
compilation, as this confuses users, so we need these error messages to
be visible to users. To that end, this PR adds:
* A flag to mark functions/hooks as incompatible
* Validation against use of such functions
* A default type provider to provide declarations for two
known-incompatible libraries
Note that Mobx is also incompatible, but the `observable()` function is
called outside of the component itself, so the compiler cannot currently
detect it. We may add validation for such APIs in the future.
Again, we really empathize with the developers of these libraries. We've
tried to word the error message non-judgementally, because we get that
it's hard! We're open to feedback about the error message, please let us
know.
DiffTrain build for [4082b0e7d3](https://github.com/facebook/react/commit/4082b0e7d3c042d49ef8987547b923051936956f)
This commit is contained in:
@@ -1 +1 @@
|
||||
19.2.0-native-fb-872b4fef-20250828
|
||||
19.2.0-native-fb-4082b0e7-20250828
|
||||
Vendored
+2
-2
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<900ad256fe6c3ac39b417274a1e8b35f>>
|
||||
* @generated SignedSource<<4175c435d44f4319000cb9436906673a>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -404,5 +404,5 @@ __DEV__ &&
|
||||
exports.useFormStatus = function () {
|
||||
return resolveDispatcher().useHostTransitionStatus();
|
||||
};
|
||||
exports.version = "19.2.0-native-fb-872b4fef-20250828";
|
||||
exports.version = "19.2.0-native-fb-4082b0e7-20250828";
|
||||
})();
|
||||
|
||||
Vendored
+2
-2
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<9cb135702a4f45635a5a436f02e09003>>
|
||||
* @generated SignedSource<<5d8d1e06786393aa6dee0f4c366443e2>>
|
||||
*/
|
||||
|
||||
"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-872b4fef-20250828";
|
||||
exports.version = "19.2.0-native-fb-4082b0e7-20250828";
|
||||
|
||||
Vendored
+2
-2
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<9cb135702a4f45635a5a436f02e09003>>
|
||||
* @generated SignedSource<<5d8d1e06786393aa6dee0f4c366443e2>>
|
||||
*/
|
||||
|
||||
"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-872b4fef-20250828";
|
||||
exports.version = "19.2.0-native-fb-4082b0e7-20250828";
|
||||
|
||||
Vendored
+6
-6
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<a4c803d2d1c19c8d55e3316161f54c15>>
|
||||
* @generated SignedSource<<ab4680231897c4d1836653d922219a57>>
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -29448,11 +29448,11 @@ __DEV__ &&
|
||||
};
|
||||
(function () {
|
||||
var isomorphicReactPackageVersion = React.version;
|
||||
if ("19.2.0-native-fb-872b4fef-20250828" !== isomorphicReactPackageVersion)
|
||||
if ("19.2.0-native-fb-4082b0e7-20250828" !== 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-872b4fef-20250828\nLearn more: https://react.dev/warnings/version-mismatch")
|
||||
"\n - react-dom: 19.2.0-native-fb-4082b0e7-20250828\nLearn more: https://react.dev/warnings/version-mismatch")
|
||||
);
|
||||
})();
|
||||
("function" === typeof Map &&
|
||||
@@ -29489,10 +29489,10 @@ __DEV__ &&
|
||||
!(function () {
|
||||
var internals = {
|
||||
bundleType: 1,
|
||||
version: "19.2.0-native-fb-872b4fef-20250828",
|
||||
version: "19.2.0-native-fb-4082b0e7-20250828",
|
||||
rendererPackageName: "react-dom",
|
||||
currentDispatcherRef: ReactSharedInternals,
|
||||
reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828"
|
||||
reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828"
|
||||
};
|
||||
internals.overrideHookState = overrideHookState;
|
||||
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
|
||||
@@ -29631,5 +29631,5 @@ __DEV__ &&
|
||||
listenToAllSupportedEvents(container);
|
||||
return new ReactDOMHydrationRoot(initialChildren);
|
||||
};
|
||||
exports.version = "19.2.0-native-fb-872b4fef-20250828";
|
||||
exports.version = "19.2.0-native-fb-4082b0e7-20250828";
|
||||
})();
|
||||
|
||||
compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js
Vendored
+6
-6
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<974ad2eb818dfd4907aab37eccdbab15>>
|
||||
* @generated SignedSource<<8d6d9e793eb29ee9af951fc3851228d5>>
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -17258,14 +17258,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
|
||||
};
|
||||
var isomorphicReactPackageVersion$jscomp$inline_2034 = React.version;
|
||||
if (
|
||||
"19.2.0-native-fb-872b4fef-20250828" !==
|
||||
"19.2.0-native-fb-4082b0e7-20250828" !==
|
||||
isomorphicReactPackageVersion$jscomp$inline_2034
|
||||
)
|
||||
throw Error(
|
||||
formatProdErrorMessage(
|
||||
527,
|
||||
isomorphicReactPackageVersion$jscomp$inline_2034,
|
||||
"19.2.0-native-fb-872b4fef-20250828"
|
||||
"19.2.0-native-fb-4082b0e7-20250828"
|
||||
)
|
||||
);
|
||||
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
|
||||
@@ -17287,10 +17287,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
|
||||
};
|
||||
var internals$jscomp$inline_2565 = {
|
||||
bundleType: 0,
|
||||
version: "19.2.0-native-fb-872b4fef-20250828",
|
||||
version: "19.2.0-native-fb-4082b0e7-20250828",
|
||||
rendererPackageName: "react-dom",
|
||||
currentDispatcherRef: ReactSharedInternals,
|
||||
reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828"
|
||||
reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_2566 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
@@ -17388,4 +17388,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
|
||||
listenToAllSupportedEvents(container);
|
||||
return new ReactDOMHydrationRoot(initialChildren);
|
||||
};
|
||||
exports.version = "19.2.0-native-fb-872b4fef-20250828";
|
||||
exports.version = "19.2.0-native-fb-4082b0e7-20250828";
|
||||
|
||||
+6
-6
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<e4fab2b0fb466a5647a64feca444aa96>>
|
||||
* @generated SignedSource<<02cfe06f045497c2649aed5a9f17bc41>>
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -19268,14 +19268,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
|
||||
};
|
||||
var isomorphicReactPackageVersion$jscomp$inline_2285 = React.version;
|
||||
if (
|
||||
"19.2.0-native-fb-872b4fef-20250828" !==
|
||||
"19.2.0-native-fb-4082b0e7-20250828" !==
|
||||
isomorphicReactPackageVersion$jscomp$inline_2285
|
||||
)
|
||||
throw Error(
|
||||
formatProdErrorMessage(
|
||||
527,
|
||||
isomorphicReactPackageVersion$jscomp$inline_2285,
|
||||
"19.2.0-native-fb-872b4fef-20250828"
|
||||
"19.2.0-native-fb-4082b0e7-20250828"
|
||||
)
|
||||
);
|
||||
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
|
||||
@@ -19297,10 +19297,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
|
||||
};
|
||||
var internals$jscomp$inline_2292 = {
|
||||
bundleType: 0,
|
||||
version: "19.2.0-native-fb-872b4fef-20250828",
|
||||
version: "19.2.0-native-fb-4082b0e7-20250828",
|
||||
rendererPackageName: "react-dom",
|
||||
currentDispatcherRef: ReactSharedInternals,
|
||||
reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828",
|
||||
reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828",
|
||||
getLaneLabelMap: function () {
|
||||
for (
|
||||
var map = new Map(), lane = 1, index$321 = 0;
|
||||
@@ -19414,4 +19414,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
|
||||
listenToAllSupportedEvents(container);
|
||||
return new ReactDOMHydrationRoot(initialChildren);
|
||||
};
|
||||
exports.version = "19.2.0-native-fb-872b4fef-20250828";
|
||||
exports.version = "19.2.0-native-fb-4082b0e7-20250828";
|
||||
|
||||
+6
-6
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<0486a24a2afbb4f15e0f9515e509b97f>>
|
||||
* @generated SignedSource<<c669e12b676113bbd946c795325d626d>>
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -29504,11 +29504,11 @@ __DEV__ &&
|
||||
};
|
||||
(function () {
|
||||
var isomorphicReactPackageVersion = React.version;
|
||||
if ("19.2.0-native-fb-872b4fef-20250828" !== isomorphicReactPackageVersion)
|
||||
if ("19.2.0-native-fb-4082b0e7-20250828" !== 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-872b4fef-20250828\nLearn more: https://react.dev/warnings/version-mismatch")
|
||||
"\n - react-dom: 19.2.0-native-fb-4082b0e7-20250828\nLearn more: https://react.dev/warnings/version-mismatch")
|
||||
);
|
||||
})();
|
||||
("function" === typeof Map &&
|
||||
@@ -29545,10 +29545,10 @@ __DEV__ &&
|
||||
!(function () {
|
||||
var internals = {
|
||||
bundleType: 1,
|
||||
version: "19.2.0-native-fb-872b4fef-20250828",
|
||||
version: "19.2.0-native-fb-4082b0e7-20250828",
|
||||
rendererPackageName: "react-dom",
|
||||
currentDispatcherRef: ReactSharedInternals,
|
||||
reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828"
|
||||
reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828"
|
||||
};
|
||||
internals.overrideHookState = overrideHookState;
|
||||
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
|
||||
@@ -30003,7 +30003,7 @@ __DEV__ &&
|
||||
exports.useFormStatus = function () {
|
||||
return resolveDispatcher().useHostTransitionStatus();
|
||||
};
|
||||
exports.version = "19.2.0-native-fb-872b4fef-20250828";
|
||||
exports.version = "19.2.0-native-fb-4082b0e7-20250828";
|
||||
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
|
||||
"function" ===
|
||||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
|
||||
|
||||
+6
-6
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<e4d11760d01994eb0cae6086ca4b9100>>
|
||||
* @generated SignedSource<<1f8f1c948f52fa4ee6ba9c1236786753>>
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -17269,14 +17269,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
|
||||
};
|
||||
var isomorphicReactPackageVersion$jscomp$inline_2035 = React.version;
|
||||
if (
|
||||
"19.2.0-native-fb-872b4fef-20250828" !==
|
||||
"19.2.0-native-fb-4082b0e7-20250828" !==
|
||||
isomorphicReactPackageVersion$jscomp$inline_2035
|
||||
)
|
||||
throw Error(
|
||||
formatProdErrorMessage(
|
||||
527,
|
||||
isomorphicReactPackageVersion$jscomp$inline_2035,
|
||||
"19.2.0-native-fb-872b4fef-20250828"
|
||||
"19.2.0-native-fb-4082b0e7-20250828"
|
||||
)
|
||||
);
|
||||
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
|
||||
@@ -17298,10 +17298,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
|
||||
};
|
||||
var internals$jscomp$inline_2568 = {
|
||||
bundleType: 0,
|
||||
version: "19.2.0-native-fb-872b4fef-20250828",
|
||||
version: "19.2.0-native-fb-4082b0e7-20250828",
|
||||
rendererPackageName: "react-dom",
|
||||
currentDispatcherRef: ReactSharedInternals,
|
||||
reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828"
|
||||
reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_2569 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
@@ -17552,4 +17552,4 @@ exports.useFormState = function (action, initialState, permalink) {
|
||||
exports.useFormStatus = function () {
|
||||
return ReactSharedInternals.H.useHostTransitionStatus();
|
||||
};
|
||||
exports.version = "19.2.0-native-fb-872b4fef-20250828";
|
||||
exports.version = "19.2.0-native-fb-4082b0e7-20250828";
|
||||
|
||||
+6
-6
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<6953358e513e81e472bfb050e6b0e04a>>
|
||||
* @generated SignedSource<<8fa3c002aca208939e8997eabbefd78e>>
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -19283,14 +19283,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
|
||||
};
|
||||
var isomorphicReactPackageVersion$jscomp$inline_2286 = React.version;
|
||||
if (
|
||||
"19.2.0-native-fb-872b4fef-20250828" !==
|
||||
"19.2.0-native-fb-4082b0e7-20250828" !==
|
||||
isomorphicReactPackageVersion$jscomp$inline_2286
|
||||
)
|
||||
throw Error(
|
||||
formatProdErrorMessage(
|
||||
527,
|
||||
isomorphicReactPackageVersion$jscomp$inline_2286,
|
||||
"19.2.0-native-fb-872b4fef-20250828"
|
||||
"19.2.0-native-fb-4082b0e7-20250828"
|
||||
)
|
||||
);
|
||||
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
|
||||
@@ -19312,10 +19312,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
|
||||
};
|
||||
var internals$jscomp$inline_2293 = {
|
||||
bundleType: 0,
|
||||
version: "19.2.0-native-fb-872b4fef-20250828",
|
||||
version: "19.2.0-native-fb-4082b0e7-20250828",
|
||||
rendererPackageName: "react-dom",
|
||||
currentDispatcherRef: ReactSharedInternals,
|
||||
reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828",
|
||||
reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828",
|
||||
getLaneLabelMap: function () {
|
||||
for (
|
||||
var map = new Map(), lane = 1, index$321 = 0;
|
||||
@@ -19582,7 +19582,7 @@ exports.useFormState = function (action, initialState, permalink) {
|
||||
exports.useFormStatus = function () {
|
||||
return ReactSharedInternals.H.useHostTransitionStatus();
|
||||
};
|
||||
exports.version = "19.2.0-native-fb-872b4fef-20250828";
|
||||
exports.version = "19.2.0-native-fb-4082b0e7-20250828";
|
||||
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
|
||||
"function" ===
|
||||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
|
||||
|
||||
+4
-4
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<7a0a14e45e53136451878b4f30466bd0>>
|
||||
* @generated SignedSource<<d37de0c6be93caaf675e020f8c8c3d0b>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -15758,10 +15758,10 @@ __DEV__ &&
|
||||
(function () {
|
||||
var internals = {
|
||||
bundleType: 1,
|
||||
version: "19.2.0-native-fb-872b4fef-20250828",
|
||||
version: "19.2.0-native-fb-4082b0e7-20250828",
|
||||
rendererPackageName: "react-test-renderer",
|
||||
currentDispatcherRef: ReactSharedInternals,
|
||||
reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828"
|
||||
reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828"
|
||||
};
|
||||
internals.overrideHookState = overrideHookState;
|
||||
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
|
||||
@@ -15906,5 +15906,5 @@ __DEV__ &&
|
||||
flushSyncWorkAcrossRoots_impl(0, !0));
|
||||
}
|
||||
};
|
||||
exports.version = "19.2.0-native-fb-872b4fef-20250828";
|
||||
exports.version = "19.2.0-native-fb-4082b0e7-20250828";
|
||||
})();
|
||||
|
||||
+4
-4
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<2bb0ab8b2fb1e2b4480a51531700a05f>>
|
||||
* @generated SignedSource<<1fe59c8867a3d3ec239a29e0f083b088>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -9924,10 +9924,10 @@ function wrapFiber(fiber) {
|
||||
}
|
||||
var internals$jscomp$inline_1428 = {
|
||||
bundleType: 0,
|
||||
version: "19.2.0-native-fb-872b4fef-20250828",
|
||||
version: "19.2.0-native-fb-4082b0e7-20250828",
|
||||
rendererPackageName: "react-test-renderer",
|
||||
currentDispatcherRef: ReactSharedInternals,
|
||||
reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828"
|
||||
reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_1429 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
@@ -10063,4 +10063,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
|
||||
flushSyncWorkAcrossRoots_impl(0, !0));
|
||||
}
|
||||
};
|
||||
exports.version = "19.2.0-native-fb-872b4fef-20250828";
|
||||
exports.version = "19.2.0-native-fb-4082b0e7-20250828";
|
||||
|
||||
+4
-4
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<d97abaedf1c1212db246db5fdb507b61>>
|
||||
* @generated SignedSource<<f960a815861c875b6d7d3ca3045a739d>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -10544,10 +10544,10 @@ function wrapFiber(fiber) {
|
||||
}
|
||||
var internals$jscomp$inline_1236 = {
|
||||
bundleType: 0,
|
||||
version: "19.2.0-native-fb-872b4fef-20250828",
|
||||
version: "19.2.0-native-fb-4082b0e7-20250828",
|
||||
rendererPackageName: "react-test-renderer",
|
||||
currentDispatcherRef: ReactSharedInternals,
|
||||
reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828",
|
||||
reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828",
|
||||
getLaneLabelMap: function () {
|
||||
for (
|
||||
var map = new Map(), lane = 1, index$142 = 0;
|
||||
@@ -10698,4 +10698,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
|
||||
flushSyncWorkAcrossRoots_impl(0, !0));
|
||||
}
|
||||
};
|
||||
exports.version = "19.2.0-native-fb-872b4fef-20250828";
|
||||
exports.version = "19.2.0-native-fb-4082b0e7-20250828";
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<b4e995dff12e333253a33cb4b1135033>>
|
||||
* @generated SignedSource<<3f38182abeeeea340638c73d9b9838db>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -1388,7 +1388,7 @@ __DEV__ &&
|
||||
exports.useTransition = function () {
|
||||
return resolveDispatcher().useTransition();
|
||||
};
|
||||
exports.version = "19.2.0-native-fb-872b4fef-20250828";
|
||||
exports.version = "19.2.0-native-fb-4082b0e7-20250828";
|
||||
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
|
||||
"function" ===
|
||||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<15623d62d0df693ff1ee07d9932f19cc>>
|
||||
* @generated SignedSource<<240d3e889cb22857ef10b94026622163>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -579,4 +579,4 @@ exports.useSyncExternalStore = function (
|
||||
exports.useTransition = function () {
|
||||
return ReactSharedInternals.H.useTransition();
|
||||
};
|
||||
exports.version = "19.2.0-native-fb-872b4fef-20250828";
|
||||
exports.version = "19.2.0-native-fb-4082b0e7-20250828";
|
||||
|
||||
Vendored
+2
-2
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<7ada3456afade1b983834df82c744a8f>>
|
||||
* @generated SignedSource<<eca1b00432b5ff3feb2cb2193004d3e4>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -583,7 +583,7 @@ exports.useSyncExternalStore = function (
|
||||
exports.useTransition = function () {
|
||||
return ReactSharedInternals.H.useTransition();
|
||||
};
|
||||
exports.version = "19.2.0-native-fb-872b4fef-20250828";
|
||||
exports.version = "19.2.0-native-fb-4082b0e7-20250828";
|
||||
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
|
||||
"function" ===
|
||||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
872b4fef6ded18aa9bda5f7729340384a914ba7b
|
||||
4082b0e7d3c042d49ef8987547b923051936956f
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<a1e33b76e693e892d2bb906d850162f4>>
|
||||
* @generated SignedSource<<802d8abf3b571d4b4620231af2cf2637>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -19594,10 +19594,10 @@ __DEV__ &&
|
||||
(function () {
|
||||
var internals = {
|
||||
bundleType: 1,
|
||||
version: "19.2.0-native-fb-872b4fef-20250828",
|
||||
version: "19.2.0-native-fb-4082b0e7-20250828",
|
||||
rendererPackageName: "react-native-renderer",
|
||||
currentDispatcherRef: ReactSharedInternals,
|
||||
reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828"
|
||||
reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828"
|
||||
};
|
||||
null !== extraDevToolsConfig &&
|
||||
(internals.rendererConfig = extraDevToolsConfig);
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<cba18b495df46fd8100170bb0d9124f5>>
|
||||
* @generated SignedSource<<cb11306a685572243f59e4c0268164ac>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -11108,10 +11108,10 @@ batchedUpdatesImpl = function (fn, a) {
|
||||
var roots = new Map(),
|
||||
internals$jscomp$inline_1260 = {
|
||||
bundleType: 0,
|
||||
version: "19.2.0-native-fb-872b4fef-20250828",
|
||||
version: "19.2.0-native-fb-4082b0e7-20250828",
|
||||
rendererPackageName: "react-native-renderer",
|
||||
currentDispatcherRef: ReactSharedInternals,
|
||||
reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828"
|
||||
reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828"
|
||||
};
|
||||
null !== extraDevToolsConfig &&
|
||||
(internals$jscomp$inline_1260.rendererConfig = extraDevToolsConfig);
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<997358f9bcaeaa0bbd650d779cfb8a68>>
|
||||
* @generated SignedSource<<66d00cd75c1b7aa7223aedb7febad749>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -13059,10 +13059,10 @@ batchedUpdatesImpl = function (fn, a) {
|
||||
var roots = new Map(),
|
||||
internals$jscomp$inline_1504 = {
|
||||
bundleType: 0,
|
||||
version: "19.2.0-native-fb-872b4fef-20250828",
|
||||
version: "19.2.0-native-fb-4082b0e7-20250828",
|
||||
rendererPackageName: "react-native-renderer",
|
||||
currentDispatcherRef: ReactSharedInternals,
|
||||
reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828"
|
||||
reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828"
|
||||
};
|
||||
null !== extraDevToolsConfig &&
|
||||
(internals$jscomp$inline_1504.rendererConfig = extraDevToolsConfig);
|
||||
|
||||
+5
-5
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<79059deab65e0a9850cc284ec4eabbcd>>
|
||||
* @generated SignedSource<<f028f13813499d1b1b5ad935111e7122>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -19878,11 +19878,11 @@ __DEV__ &&
|
||||
shouldSuspendImpl = newShouldSuspendImpl;
|
||||
};
|
||||
var isomorphicReactPackageVersion = React.version;
|
||||
if ("19.2.0-native-fb-872b4fef-20250828" !== isomorphicReactPackageVersion)
|
||||
if ("19.2.0-native-fb-4082b0e7-20250828" !== 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-872b4fef-20250828\nLearn more: https://react.dev/warnings/version-mismatch")
|
||||
"\n - react-native-renderer: 19.2.0-native-fb-4082b0e7-20250828\nLearn more: https://react.dev/warnings/version-mismatch")
|
||||
);
|
||||
if (
|
||||
"function" !==
|
||||
@@ -19908,10 +19908,10 @@ __DEV__ &&
|
||||
(function () {
|
||||
var internals = {
|
||||
bundleType: 1,
|
||||
version: "19.2.0-native-fb-872b4fef-20250828",
|
||||
version: "19.2.0-native-fb-4082b0e7-20250828",
|
||||
rendererPackageName: "react-native-renderer",
|
||||
currentDispatcherRef: ReactSharedInternals,
|
||||
reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828"
|
||||
reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828"
|
||||
};
|
||||
null !== extraDevToolsConfig &&
|
||||
(internals.rendererConfig = extraDevToolsConfig);
|
||||
|
||||
+5
-5
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<7cb77220def7085e1d783c6255e46685>>
|
||||
* @generated SignedSource<<5fbd7821bced8c658cde79fbabf122d0>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -11254,11 +11254,11 @@ function updateContainer(element, container, parentComponent, callback) {
|
||||
return lane;
|
||||
}
|
||||
var isomorphicReactPackageVersion = React.version;
|
||||
if ("19.2.0-native-fb-872b4fef-20250828" !== isomorphicReactPackageVersion)
|
||||
if ("19.2.0-native-fb-4082b0e7-20250828" !== 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-872b4fef-20250828\nLearn more: https://react.dev/warnings/version-mismatch")
|
||||
"\n - react-native-renderer: 19.2.0-native-fb-4082b0e7-20250828\nLearn more: https://react.dev/warnings/version-mismatch")
|
||||
);
|
||||
if (
|
||||
"function" !==
|
||||
@@ -11308,10 +11308,10 @@ batchedUpdatesImpl = function (fn, a) {
|
||||
var roots = new Map(),
|
||||
internals$jscomp$inline_1290 = {
|
||||
bundleType: 0,
|
||||
version: "19.2.0-native-fb-872b4fef-20250828",
|
||||
version: "19.2.0-native-fb-4082b0e7-20250828",
|
||||
rendererPackageName: "react-native-renderer",
|
||||
currentDispatcherRef: ReactSharedInternals,
|
||||
reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828"
|
||||
reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828"
|
||||
};
|
||||
null !== extraDevToolsConfig &&
|
||||
(internals$jscomp$inline_1290.rendererConfig = extraDevToolsConfig);
|
||||
|
||||
+5
-5
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<e0dfb11f7998350860472a157b646747>>
|
||||
* @generated SignedSource<<e6fdc4d9567ddc65c5456183e982b4a2>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -13194,11 +13194,11 @@ function updateContainer(element, container, parentComponent, callback) {
|
||||
return lane;
|
||||
}
|
||||
var isomorphicReactPackageVersion = React.version;
|
||||
if ("19.2.0-native-fb-872b4fef-20250828" !== isomorphicReactPackageVersion)
|
||||
if ("19.2.0-native-fb-4082b0e7-20250828" !== 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-872b4fef-20250828\nLearn more: https://react.dev/warnings/version-mismatch")
|
||||
"\n - react-native-renderer: 19.2.0-native-fb-4082b0e7-20250828\nLearn more: https://react.dev/warnings/version-mismatch")
|
||||
);
|
||||
if (
|
||||
"function" !==
|
||||
@@ -13248,10 +13248,10 @@ batchedUpdatesImpl = function (fn, a) {
|
||||
var roots = new Map(),
|
||||
internals$jscomp$inline_1534 = {
|
||||
bundleType: 0,
|
||||
version: "19.2.0-native-fb-872b4fef-20250828",
|
||||
version: "19.2.0-native-fb-4082b0e7-20250828",
|
||||
rendererPackageName: "react-native-renderer",
|
||||
currentDispatcherRef: ReactSharedInternals,
|
||||
reconcilerVersion: "19.2.0-native-fb-872b4fef-20250828"
|
||||
reconcilerVersion: "19.2.0-native-fb-4082b0e7-20250828"
|
||||
};
|
||||
null !== extraDevToolsConfig &&
|
||||
(internals$jscomp$inline_1534.rendererConfig = extraDevToolsConfig);
|
||||
|
||||
+94
-13
@@ -12,7 +12,7 @@
|
||||
* @lightSyntaxTransform
|
||||
* @preventMunge
|
||||
* @oncall react_core
|
||||
* @generated SignedSource<<be66197fc160b3b2770f1e922e8384a0>>
|
||||
* @generated SignedSource<<92021fc3beead9e56f852b5daa23438d>>
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@@ -17653,6 +17653,7 @@ var ErrorSeverity;
|
||||
ErrorSeverity["InvalidReact"] = "InvalidReact";
|
||||
ErrorSeverity["InvalidConfig"] = "InvalidConfig";
|
||||
ErrorSeverity["CannotPreserveMemoization"] = "CannotPreserveMemoization";
|
||||
ErrorSeverity["IncompatibleLibrary"] = "IncompatibleLibrary";
|
||||
ErrorSeverity["Todo"] = "Todo";
|
||||
ErrorSeverity["Invariant"] = "Invariant";
|
||||
})(ErrorSeverity || (ErrorSeverity = {}));
|
||||
@@ -17919,7 +17920,8 @@ class CompilerError extends Error {
|
||||
case ErrorSeverity.InvalidJS:
|
||||
case ErrorSeverity.InvalidReact:
|
||||
case ErrorSeverity.InvalidConfig:
|
||||
case ErrorSeverity.UnsupportedJS: {
|
||||
case ErrorSeverity.UnsupportedJS:
|
||||
case ErrorSeverity.IncompatibleLibrary: {
|
||||
return true;
|
||||
}
|
||||
case ErrorSeverity.CannotPreserveMemoization:
|
||||
@@ -17957,8 +17959,9 @@ function printErrorSummary(severity, message) {
|
||||
severityCategory = 'Error';
|
||||
break;
|
||||
}
|
||||
case ErrorSeverity.IncompatibleLibrary:
|
||||
case ErrorSeverity.CannotPreserveMemoization: {
|
||||
severityCategory = 'Memoization';
|
||||
severityCategory = 'Compilation Skipped';
|
||||
break;
|
||||
}
|
||||
case ErrorSeverity.Invariant: {
|
||||
@@ -17983,6 +17986,7 @@ var ErrorCategory;
|
||||
ErrorCategory["UseMemo"] = "UseMemo";
|
||||
ErrorCategory["Factories"] = "Factories";
|
||||
ErrorCategory["PreserveManualMemo"] = "PreserveManualMemo";
|
||||
ErrorCategory["IncompatibleLibrary"] = "IncompatibleLibrary";
|
||||
ErrorCategory["Immutability"] = "Immutability";
|
||||
ErrorCategory["Globals"] = "Globals";
|
||||
ErrorCategory["Refs"] = "Refs";
|
||||
@@ -18215,6 +18219,14 @@ function getRuleForCategoryImpl(category) {
|
||||
recommended: true,
|
||||
};
|
||||
}
|
||||
case ErrorCategory.IncompatibleLibrary: {
|
||||
return {
|
||||
category,
|
||||
name: 'incompatible-library',
|
||||
description: 'Validates against usage of libraries which are incompatible with memoization (manual or automatic)',
|
||||
recommended: true,
|
||||
};
|
||||
}
|
||||
default: {
|
||||
assertExhaustive$1(category, `Unsupported category ${category}`);
|
||||
}
|
||||
@@ -30842,7 +30854,7 @@ for (const [name, type_] of TYPED_GLOBALS) {
|
||||
DEFAULT_GLOBALS.set('globalThis', addObject(DEFAULT_SHAPES, 'globalThis', TYPED_GLOBALS));
|
||||
DEFAULT_GLOBALS.set('global', addObject(DEFAULT_SHAPES, 'global', TYPED_GLOBALS));
|
||||
function installTypeConfig(globals, shapes, typeConfig, moduleName, loc) {
|
||||
var _a, _b, _c, _d;
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
switch (typeConfig.kind) {
|
||||
case 'type': {
|
||||
switch (typeConfig.name) {
|
||||
@@ -30876,22 +30888,24 @@ function installTypeConfig(globals, shapes, typeConfig, moduleName, loc) {
|
||||
noAlias: typeConfig.noAlias === true,
|
||||
mutableOnlyIfOperandsAreMutable: typeConfig.mutableOnlyIfOperandsAreMutable === true,
|
||||
aliasing: typeConfig.aliasing,
|
||||
knownIncompatible: (_a = typeConfig.knownIncompatible) !== null && _a !== void 0 ? _a : null,
|
||||
});
|
||||
}
|
||||
case 'hook': {
|
||||
return addHook(shapes, {
|
||||
hookKind: 'Custom',
|
||||
positionalParams: (_a = typeConfig.positionalParams) !== null && _a !== void 0 ? _a : [],
|
||||
restParam: (_b = typeConfig.restParam) !== null && _b !== void 0 ? _b : Effect.Freeze,
|
||||
positionalParams: (_b = typeConfig.positionalParams) !== null && _b !== void 0 ? _b : [],
|
||||
restParam: (_c = typeConfig.restParam) !== null && _c !== void 0 ? _c : Effect.Freeze,
|
||||
calleeEffect: Effect.Read,
|
||||
returnType: installTypeConfig(globals, shapes, typeConfig.returnType, moduleName, loc),
|
||||
returnValueKind: (_c = typeConfig.returnValueKind) !== null && _c !== void 0 ? _c : ValueKind.Frozen,
|
||||
returnValueKind: (_d = typeConfig.returnValueKind) !== null && _d !== void 0 ? _d : ValueKind.Frozen,
|
||||
noAlias: typeConfig.noAlias === true,
|
||||
aliasing: typeConfig.aliasing,
|
||||
knownIncompatible: (_e = typeConfig.knownIncompatible) !== null && _e !== void 0 ? _e : null,
|
||||
});
|
||||
}
|
||||
case 'object': {
|
||||
return addObject(shapes, null, Object.entries((_d = typeConfig.properties) !== null && _d !== void 0 ? _d : {}).map(([key, value]) => {
|
||||
return addObject(shapes, null, Object.entries((_f = typeConfig.properties) !== null && _f !== void 0 ? _f : {}).map(([key, value]) => {
|
||||
var _a;
|
||||
const type = installTypeConfig(globals, shapes, value, moduleName, loc);
|
||||
const expectHook = isHookName$2(key);
|
||||
@@ -31092,6 +31106,7 @@ const FunctionTypeSchema = zod.z.object({
|
||||
impure: zod.z.boolean().nullable().optional(),
|
||||
canonicalName: zod.z.string().nullable().optional(),
|
||||
aliasing: AliasingSignatureSchema.nullable().optional(),
|
||||
knownIncompatible: zod.z.string().nullable().optional(),
|
||||
});
|
||||
const HookTypeSchema = zod.z.object({
|
||||
kind: zod.z.literal('hook'),
|
||||
@@ -31101,6 +31116,7 @@ const HookTypeSchema = zod.z.object({
|
||||
returnValueKind: ValueKindSchema.nullable().optional(),
|
||||
noAlias: zod.z.boolean().nullable().optional(),
|
||||
aliasing: AliasingSignatureSchema.nullable().optional(),
|
||||
knownIncompatible: zod.z.string().nullable().optional(),
|
||||
});
|
||||
const BuiltInTypeSchema = zod.z.union([
|
||||
zod.z.literal('Any'),
|
||||
@@ -31602,6 +31618,50 @@ const Resolved = Object.assign(Object.assign({}, Primitives), { nullable(type, p
|
||||
};
|
||||
} });
|
||||
|
||||
function defaultModuleTypeProvider(moduleName) {
|
||||
switch (moduleName) {
|
||||
case 'react-hook-form': {
|
||||
return {
|
||||
kind: 'object',
|
||||
properties: {
|
||||
useForm: {
|
||||
kind: 'hook',
|
||||
returnType: {
|
||||
kind: 'object',
|
||||
properties: {
|
||||
watch: {
|
||||
kind: 'function',
|
||||
positionalParams: [],
|
||||
restParam: Effect.Read,
|
||||
calleeEffect: Effect.Read,
|
||||
returnType: { kind: 'type', name: 'Any' },
|
||||
returnValueKind: ValueKind.Mutable,
|
||||
knownIncompatible: `React Hook Form's \`useForm()\` API returns a \`watch()\` function which cannot be memoized safely.`,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
case '@tanstack/react-table': {
|
||||
return {
|
||||
kind: 'object',
|
||||
properties: {
|
||||
useReactTable: {
|
||||
kind: 'hook',
|
||||
positionalParams: [],
|
||||
restParam: Effect.Read,
|
||||
returnType: { kind: 'type', name: 'Any' },
|
||||
knownIncompatible: `TanStack Table's \`useReactTable()\` API returns functions that cannot be memoized safely`,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
var _Environment_instances, _Environment_globals, _Environment_shapes, _Environment_moduleTypes, _Environment_nextIdentifer, _Environment_nextBlock, _Environment_nextScope, _Environment_scope, _Environment_outlinedFunctions, _Environment_contextIdentifiers, _Environment_hoistedIdentifiers, _Environment_flowTypeEnvironment, _Environment_resolveModuleType, _Environment_isKnownReactModule, _Environment_getCustomHookType;
|
||||
const ReactElementSymbolSchema = zod.z.object({
|
||||
elementSymbol: zod.z.union([
|
||||
@@ -31964,12 +32024,14 @@ class Environment {
|
||||
}
|
||||
}
|
||||
_Environment_globals = new WeakMap(), _Environment_shapes = new WeakMap(), _Environment_moduleTypes = new WeakMap(), _Environment_nextIdentifer = new WeakMap(), _Environment_nextBlock = new WeakMap(), _Environment_nextScope = new WeakMap(), _Environment_scope = new WeakMap(), _Environment_outlinedFunctions = new WeakMap(), _Environment_contextIdentifiers = new WeakMap(), _Environment_hoistedIdentifiers = new WeakMap(), _Environment_flowTypeEnvironment = new WeakMap(), _Environment_instances = new WeakSet(), _Environment_resolveModuleType = function _Environment_resolveModuleType(moduleName, loc) {
|
||||
var _a;
|
||||
let moduleType = __classPrivateFieldGet(this, _Environment_moduleTypes, "f").get(moduleName);
|
||||
if (moduleType === undefined) {
|
||||
if (this.config.moduleTypeProvider == null) {
|
||||
const moduleTypeProvider = (_a = this.config.moduleTypeProvider) !== null && _a !== void 0 ? _a : defaultModuleTypeProvider;
|
||||
if (moduleTypeProvider == null) {
|
||||
return null;
|
||||
}
|
||||
const unparsedModuleConfig = this.config.moduleTypeProvider(moduleName);
|
||||
const unparsedModuleConfig = moduleTypeProvider(moduleName);
|
||||
if (unparsedModuleConfig != null) {
|
||||
const parsedModuleConfig = TypeSchema.safeParse(unparsedModuleConfig);
|
||||
if (!parsedModuleConfig.success) {
|
||||
@@ -40777,6 +40839,25 @@ function computeEffectsForLegacySignature(state, signature, lvalue, receiver, ar
|
||||
}),
|
||||
});
|
||||
}
|
||||
if (signature.knownIncompatible != null && state.env.isInferredMemoEnabled) {
|
||||
const errors = new CompilerError();
|
||||
errors.pushDiagnostic(CompilerDiagnostic.create({
|
||||
category: ErrorCategory.IncompatibleLibrary,
|
||||
severity: ErrorSeverity.IncompatibleLibrary,
|
||||
reason: 'Use of incompatible library',
|
||||
description: [
|
||||
'This API returns functions which cannot be memoized without leading to stale UI. ' +
|
||||
'To prevent this, by default React Compiler will skip memoizing this component/hook. ' +
|
||||
'However, you may see issues if values from this API are passed to other components/hooks that are ' +
|
||||
'memoized.',
|
||||
].join(''),
|
||||
}).withDetail({
|
||||
kind: 'error',
|
||||
loc: receiver.loc,
|
||||
message: signature.knownIncompatible,
|
||||
}));
|
||||
throw errors;
|
||||
}
|
||||
const stores = [];
|
||||
const captures = [];
|
||||
function visit(place, effect) {
|
||||
@@ -48254,7 +48335,7 @@ function validateInferredDep(dep, temporaries, declsWithinMemoBlock, validDepsIn
|
||||
errorState.pushDiagnostic(CompilerDiagnostic.create({
|
||||
category: ErrorCategory.PreserveManualMemo,
|
||||
severity: ErrorSeverity.CannotPreserveMemoization,
|
||||
reason: 'Compilation skipped because existing memoization could not be preserved',
|
||||
reason: 'Existing memoization could not be preserved',
|
||||
description: [
|
||||
'React Compiler has skipped optimizing this component because the existing manual memoization could not be preserved. ',
|
||||
'The inferred dependencies did not match the manually specified dependencies, which could cause the value to change more or less frequently than expected. ',
|
||||
@@ -48415,7 +48496,7 @@ class Visitor extends ReactiveFunctionVisitor {
|
||||
state.errors.pushDiagnostic(CompilerDiagnostic.create({
|
||||
category: ErrorCategory.PreserveManualMemo,
|
||||
severity: ErrorSeverity.CannotPreserveMemoization,
|
||||
reason: 'Compilation skipped because existing memoization could not be preserved',
|
||||
reason: 'Existing memoization could not be preserved',
|
||||
description: [
|
||||
'React Compiler has skipped optimizing this component because the existing manual memoization could not be preserved. ',
|
||||
'This dependency may be mutated later, which could cause the value to change unexpectedly.',
|
||||
@@ -48452,7 +48533,7 @@ class Visitor extends ReactiveFunctionVisitor {
|
||||
state.errors.pushDiagnostic(CompilerDiagnostic.create({
|
||||
category: ErrorCategory.PreserveManualMemo,
|
||||
severity: ErrorSeverity.CannotPreserveMemoization,
|
||||
reason: 'Compilation skipped because existing memoization could not be preserved',
|
||||
reason: 'Existing memoization could not be preserved',
|
||||
description: [
|
||||
'React Compiler has skipped optimizing this component because the existing manual memoization could not be preserved. This value was memoized in source but not in compilation output. ',
|
||||
'',
|
||||
|
||||
+94
-13
@@ -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<<0cf4d579071cd6361df2fa74ba2aa318>>
|
||||
* @generated SignedSource<<99d6960a9525c443d8865ab7661a6fcc>>
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@@ -17638,6 +17638,7 @@ var ErrorSeverity;
|
||||
ErrorSeverity["InvalidReact"] = "InvalidReact";
|
||||
ErrorSeverity["InvalidConfig"] = "InvalidConfig";
|
||||
ErrorSeverity["CannotPreserveMemoization"] = "CannotPreserveMemoization";
|
||||
ErrorSeverity["IncompatibleLibrary"] = "IncompatibleLibrary";
|
||||
ErrorSeverity["Todo"] = "Todo";
|
||||
ErrorSeverity["Invariant"] = "Invariant";
|
||||
})(ErrorSeverity || (ErrorSeverity = {}));
|
||||
@@ -17904,7 +17905,8 @@ class CompilerError extends Error {
|
||||
case ErrorSeverity.InvalidJS:
|
||||
case ErrorSeverity.InvalidReact:
|
||||
case ErrorSeverity.InvalidConfig:
|
||||
case ErrorSeverity.UnsupportedJS: {
|
||||
case ErrorSeverity.UnsupportedJS:
|
||||
case ErrorSeverity.IncompatibleLibrary: {
|
||||
return true;
|
||||
}
|
||||
case ErrorSeverity.CannotPreserveMemoization:
|
||||
@@ -17942,8 +17944,9 @@ function printErrorSummary(severity, message) {
|
||||
severityCategory = 'Error';
|
||||
break;
|
||||
}
|
||||
case ErrorSeverity.IncompatibleLibrary:
|
||||
case ErrorSeverity.CannotPreserveMemoization: {
|
||||
severityCategory = 'Memoization';
|
||||
severityCategory = 'Compilation Skipped';
|
||||
break;
|
||||
}
|
||||
case ErrorSeverity.Invariant: {
|
||||
@@ -17968,6 +17971,7 @@ var ErrorCategory;
|
||||
ErrorCategory["UseMemo"] = "UseMemo";
|
||||
ErrorCategory["Factories"] = "Factories";
|
||||
ErrorCategory["PreserveManualMemo"] = "PreserveManualMemo";
|
||||
ErrorCategory["IncompatibleLibrary"] = "IncompatibleLibrary";
|
||||
ErrorCategory["Immutability"] = "Immutability";
|
||||
ErrorCategory["Globals"] = "Globals";
|
||||
ErrorCategory["Refs"] = "Refs";
|
||||
@@ -18200,6 +18204,14 @@ function getRuleForCategoryImpl(category) {
|
||||
recommended: true,
|
||||
};
|
||||
}
|
||||
case ErrorCategory.IncompatibleLibrary: {
|
||||
return {
|
||||
category,
|
||||
name: 'incompatible-library',
|
||||
description: 'Validates against usage of libraries which are incompatible with memoization (manual or automatic)',
|
||||
recommended: true,
|
||||
};
|
||||
}
|
||||
default: {
|
||||
assertExhaustive$1(category, `Unsupported category ${category}`);
|
||||
}
|
||||
@@ -30621,7 +30633,7 @@ for (const [name, type_] of TYPED_GLOBALS) {
|
||||
DEFAULT_GLOBALS.set('globalThis', addObject(DEFAULT_SHAPES, 'globalThis', TYPED_GLOBALS));
|
||||
DEFAULT_GLOBALS.set('global', addObject(DEFAULT_SHAPES, 'global', TYPED_GLOBALS));
|
||||
function installTypeConfig(globals, shapes, typeConfig, moduleName, loc) {
|
||||
var _a, _b, _c, _d;
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
switch (typeConfig.kind) {
|
||||
case 'type': {
|
||||
switch (typeConfig.name) {
|
||||
@@ -30655,22 +30667,24 @@ function installTypeConfig(globals, shapes, typeConfig, moduleName, loc) {
|
||||
noAlias: typeConfig.noAlias === true,
|
||||
mutableOnlyIfOperandsAreMutable: typeConfig.mutableOnlyIfOperandsAreMutable === true,
|
||||
aliasing: typeConfig.aliasing,
|
||||
knownIncompatible: (_a = typeConfig.knownIncompatible) !== null && _a !== void 0 ? _a : null,
|
||||
});
|
||||
}
|
||||
case 'hook': {
|
||||
return addHook(shapes, {
|
||||
hookKind: 'Custom',
|
||||
positionalParams: (_a = typeConfig.positionalParams) !== null && _a !== void 0 ? _a : [],
|
||||
restParam: (_b = typeConfig.restParam) !== null && _b !== void 0 ? _b : Effect.Freeze,
|
||||
positionalParams: (_b = typeConfig.positionalParams) !== null && _b !== void 0 ? _b : [],
|
||||
restParam: (_c = typeConfig.restParam) !== null && _c !== void 0 ? _c : Effect.Freeze,
|
||||
calleeEffect: Effect.Read,
|
||||
returnType: installTypeConfig(globals, shapes, typeConfig.returnType, moduleName, loc),
|
||||
returnValueKind: (_c = typeConfig.returnValueKind) !== null && _c !== void 0 ? _c : ValueKind.Frozen,
|
||||
returnValueKind: (_d = typeConfig.returnValueKind) !== null && _d !== void 0 ? _d : ValueKind.Frozen,
|
||||
noAlias: typeConfig.noAlias === true,
|
||||
aliasing: typeConfig.aliasing,
|
||||
knownIncompatible: (_e = typeConfig.knownIncompatible) !== null && _e !== void 0 ? _e : null,
|
||||
});
|
||||
}
|
||||
case 'object': {
|
||||
return addObject(shapes, null, Object.entries((_d = typeConfig.properties) !== null && _d !== void 0 ? _d : {}).map(([key, value]) => {
|
||||
return addObject(shapes, null, Object.entries((_f = typeConfig.properties) !== null && _f !== void 0 ? _f : {}).map(([key, value]) => {
|
||||
var _a;
|
||||
const type = installTypeConfig(globals, shapes, value, moduleName, loc);
|
||||
const expectHook = isHookName$2(key);
|
||||
@@ -30871,6 +30885,7 @@ const FunctionTypeSchema = zod.z.object({
|
||||
impure: zod.z.boolean().nullable().optional(),
|
||||
canonicalName: zod.z.string().nullable().optional(),
|
||||
aliasing: AliasingSignatureSchema.nullable().optional(),
|
||||
knownIncompatible: zod.z.string().nullable().optional(),
|
||||
});
|
||||
const HookTypeSchema = zod.z.object({
|
||||
kind: zod.z.literal('hook'),
|
||||
@@ -30880,6 +30895,7 @@ const HookTypeSchema = zod.z.object({
|
||||
returnValueKind: ValueKindSchema.nullable().optional(),
|
||||
noAlias: zod.z.boolean().nullable().optional(),
|
||||
aliasing: AliasingSignatureSchema.nullable().optional(),
|
||||
knownIncompatible: zod.z.string().nullable().optional(),
|
||||
});
|
||||
const BuiltInTypeSchema = zod.z.union([
|
||||
zod.z.literal('Any'),
|
||||
@@ -31381,6 +31397,50 @@ const Resolved = Object.assign(Object.assign({}, Primitives), { nullable(type, p
|
||||
};
|
||||
} });
|
||||
|
||||
function defaultModuleTypeProvider(moduleName) {
|
||||
switch (moduleName) {
|
||||
case 'react-hook-form': {
|
||||
return {
|
||||
kind: 'object',
|
||||
properties: {
|
||||
useForm: {
|
||||
kind: 'hook',
|
||||
returnType: {
|
||||
kind: 'object',
|
||||
properties: {
|
||||
watch: {
|
||||
kind: 'function',
|
||||
positionalParams: [],
|
||||
restParam: Effect.Read,
|
||||
calleeEffect: Effect.Read,
|
||||
returnType: { kind: 'type', name: 'Any' },
|
||||
returnValueKind: ValueKind.Mutable,
|
||||
knownIncompatible: `React Hook Form's \`useForm()\` API returns a \`watch()\` function which cannot be memoized safely.`,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
case '@tanstack/react-table': {
|
||||
return {
|
||||
kind: 'object',
|
||||
properties: {
|
||||
useReactTable: {
|
||||
kind: 'hook',
|
||||
positionalParams: [],
|
||||
restParam: Effect.Read,
|
||||
returnType: { kind: 'type', name: 'Any' },
|
||||
knownIncompatible: `TanStack Table's \`useReactTable()\` API returns functions that cannot be memoized safely`,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
var _Environment_instances, _Environment_globals, _Environment_shapes, _Environment_moduleTypes, _Environment_nextIdentifer, _Environment_nextBlock, _Environment_nextScope, _Environment_scope, _Environment_outlinedFunctions, _Environment_contextIdentifiers, _Environment_hoistedIdentifiers, _Environment_flowTypeEnvironment, _Environment_resolveModuleType, _Environment_isKnownReactModule, _Environment_getCustomHookType;
|
||||
const ReactElementSymbolSchema = zod.z.object({
|
||||
elementSymbol: zod.z.union([
|
||||
@@ -31743,12 +31803,14 @@ class Environment {
|
||||
}
|
||||
}
|
||||
_Environment_globals = new WeakMap(), _Environment_shapes = new WeakMap(), _Environment_moduleTypes = new WeakMap(), _Environment_nextIdentifer = new WeakMap(), _Environment_nextBlock = new WeakMap(), _Environment_nextScope = new WeakMap(), _Environment_scope = new WeakMap(), _Environment_outlinedFunctions = new WeakMap(), _Environment_contextIdentifiers = new WeakMap(), _Environment_hoistedIdentifiers = new WeakMap(), _Environment_flowTypeEnvironment = new WeakMap(), _Environment_instances = new WeakSet(), _Environment_resolveModuleType = function _Environment_resolveModuleType(moduleName, loc) {
|
||||
var _a;
|
||||
let moduleType = __classPrivateFieldGet(this, _Environment_moduleTypes, "f").get(moduleName);
|
||||
if (moduleType === undefined) {
|
||||
if (this.config.moduleTypeProvider == null) {
|
||||
const moduleTypeProvider = (_a = this.config.moduleTypeProvider) !== null && _a !== void 0 ? _a : defaultModuleTypeProvider;
|
||||
if (moduleTypeProvider == null) {
|
||||
return null;
|
||||
}
|
||||
const unparsedModuleConfig = this.config.moduleTypeProvider(moduleName);
|
||||
const unparsedModuleConfig = moduleTypeProvider(moduleName);
|
||||
if (unparsedModuleConfig != null) {
|
||||
const parsedModuleConfig = TypeSchema.safeParse(unparsedModuleConfig);
|
||||
if (!parsedModuleConfig.success) {
|
||||
@@ -40556,6 +40618,25 @@ function computeEffectsForLegacySignature(state, signature, lvalue, receiver, ar
|
||||
}),
|
||||
});
|
||||
}
|
||||
if (signature.knownIncompatible != null && state.env.isInferredMemoEnabled) {
|
||||
const errors = new CompilerError();
|
||||
errors.pushDiagnostic(CompilerDiagnostic.create({
|
||||
category: ErrorCategory.IncompatibleLibrary,
|
||||
severity: ErrorSeverity.IncompatibleLibrary,
|
||||
reason: 'Use of incompatible library',
|
||||
description: [
|
||||
'This API returns functions which cannot be memoized without leading to stale UI. ' +
|
||||
'To prevent this, by default React Compiler will skip memoizing this component/hook. ' +
|
||||
'However, you may see issues if values from this API are passed to other components/hooks that are ' +
|
||||
'memoized.',
|
||||
].join(''),
|
||||
}).withDetail({
|
||||
kind: 'error',
|
||||
loc: receiver.loc,
|
||||
message: signature.knownIncompatible,
|
||||
}));
|
||||
throw errors;
|
||||
}
|
||||
const stores = [];
|
||||
const captures = [];
|
||||
function visit(place, effect) {
|
||||
@@ -48033,7 +48114,7 @@ function validateInferredDep(dep, temporaries, declsWithinMemoBlock, validDepsIn
|
||||
errorState.pushDiagnostic(CompilerDiagnostic.create({
|
||||
category: ErrorCategory.PreserveManualMemo,
|
||||
severity: ErrorSeverity.CannotPreserveMemoization,
|
||||
reason: 'Compilation skipped because existing memoization could not be preserved',
|
||||
reason: 'Existing memoization could not be preserved',
|
||||
description: [
|
||||
'React Compiler has skipped optimizing this component because the existing manual memoization could not be preserved. ',
|
||||
'The inferred dependencies did not match the manually specified dependencies, which could cause the value to change more or less frequently than expected. ',
|
||||
@@ -48194,7 +48275,7 @@ class Visitor extends ReactiveFunctionVisitor {
|
||||
state.errors.pushDiagnostic(CompilerDiagnostic.create({
|
||||
category: ErrorCategory.PreserveManualMemo,
|
||||
severity: ErrorSeverity.CannotPreserveMemoization,
|
||||
reason: 'Compilation skipped because existing memoization could not be preserved',
|
||||
reason: 'Existing memoization could not be preserved',
|
||||
description: [
|
||||
'React Compiler has skipped optimizing this component because the existing manual memoization could not be preserved. ',
|
||||
'This dependency may be mutated later, which could cause the value to change unexpectedly.',
|
||||
@@ -48231,7 +48312,7 @@ class Visitor extends ReactiveFunctionVisitor {
|
||||
state.errors.pushDiagnostic(CompilerDiagnostic.create({
|
||||
category: ErrorCategory.PreserveManualMemo,
|
||||
severity: ErrorSeverity.CannotPreserveMemoization,
|
||||
reason: 'Compilation skipped because existing memoization could not be preserved',
|
||||
reason: 'Existing memoization could not be preserved',
|
||||
description: [
|
||||
'React Compiler has skipped optimizing this component because the existing manual memoization could not be preserved. This value was memoized in source but not in compilation output. ',
|
||||
'',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "eslint-plugin-react-hooks",
|
||||
"description": "ESLint rules for React Hooks",
|
||||
"version": "0.0.0-experimental-872b4fef-20250828",
|
||||
"version": "0.0.0-experimental-4082b0e7-20250828",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/react.git",
|
||||
|
||||
Reference in New Issue
Block a user