From abd4b80d40fcc39544c33beace0b9681d11cee9c Mon Sep 17 00:00:00 2001 From: josephsavona Date: Tue, 9 Sep 2025 12:20:27 -0700 Subject: [PATCH] [compiler] Improve name hints for outlined functions (#34434) The previous PR added name hints for anonymous functions, but didn't handle the case of outlined functions. Here we do some cleanup around function `id` and name hints: * Make `HIRFunction.id` a ValidatedIdentifierName, which involved some cleanup of the validation helpers * Add `HIRFunction.nameHint: string` as a place to store the generated name hints which are not valid identifiers * Update Codegen to always use the `id` as the actual function name, and only use nameHint as part of generating the object+property wrapper for debug purposes. This ensures we don't conflate synthesized hints with real function names. Then, we also update OutlineFunctions to use the function name _or_ the nameHint as the input to generating a unique identifier. This isn't quite as nice as the object form since we lose our formatting, but it's a simple step that gives more context to the developer than `_temp` does. Switching to output the object+property lookup form for outlined functions is a bit more involved, let's do that in a follow-up. DiffTrain build for [665de2ed283205fccecda649ae2d66f62983f15f](https://github.com/facebook/react/commit/665de2ed283205fccecda649ae2d66f62983f15f) --- compiled-rn/VERSION_NATIVE_FB | 2 +- .../react/react-dom/cjs/ReactDOM-dev.js | 4 +- .../react/react-dom/cjs/ReactDOM-prod.js | 4 +- .../react/react-dom/cjs/ReactDOM-profiling.js | 4 +- .../react/react-dom/cjs/ReactDOMClient-dev.js | 12 +- .../react-dom/cjs/ReactDOMClient-prod.js | 12 +- .../react-dom/cjs/ReactDOMClient-profiling.js | 12 +- .../react-dom/cjs/ReactDOMProfiling-dev.js | 12 +- .../react-dom/cjs/ReactDOMProfiling-prod.js | 12 +- .../cjs/ReactDOMProfiling-profiling.js | 12 +- .../cjs/ReactTestRenderer-dev.js | 8 +- .../cjs/ReactTestRenderer-prod.js | 8 +- .../cjs/ReactTestRenderer-profiling.js | 8 +- .../vendor/react/react/cjs/React-dev.js | 4 +- .../vendor/react/react/cjs/React-prod.js | 4 +- .../vendor/react/react/cjs/React-profiling.js | 4 +- .../Libraries/Renderer/REVISION | 2 +- .../implementations/ReactFabric-dev.fb.js | 6 +- .../implementations/ReactFabric-prod.fb.js | 6 +- .../ReactFabric-profiling.fb.js | 6 +- .../ReactNativeRenderer-dev.fb.js | 10 +- .../ReactNativeRenderer-prod.fb.js | 10 +- .../ReactNativeRenderer-profiling.fb.js | 10 +- .../eslint-plugin-react-hooks.development.js | 114 ++++++++++-------- .../eslint-plugin-react-hooks.production.js | 114 ++++++++++-------- .../eslint-plugin-react-hooks/package.json | 2 +- 26 files changed, 213 insertions(+), 189 deletions(-) diff --git a/compiled-rn/VERSION_NATIVE_FB b/compiled-rn/VERSION_NATIVE_FB index 9e9d957bc4..010ab194f9 100644 --- a/compiled-rn/VERSION_NATIVE_FB +++ b/compiled-rn/VERSION_NATIVE_FB @@ -1 +1 @@ -19.2.0-native-fb-eda778b8-20250909 \ No newline at end of file +19.2.0-native-fb-665de2ed-20250909 \ No newline at end of file diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js index d4202439f9..56c33e7657 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<63996db77ac8b3cfaade56b1ecd62ecf>> + * @generated SignedSource<<4eec5811e289a0cc9597753f42d814e6>> */ "use strict"; @@ -404,5 +404,5 @@ __DEV__ && exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.2.0-native-fb-eda778b8-20250909"; + exports.version = "19.2.0-native-fb-665de2ed-20250909"; })(); diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js index dc78476600..75e82a7d01 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<114adfe24e5ff7db94c10c8751b8e702>> */ "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-eda778b8-20250909"; +exports.version = "19.2.0-native-fb-665de2ed-20250909"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js index dc78476600..75e82a7d01 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<114adfe24e5ff7db94c10c8751b8e702>> */ "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-eda778b8-20250909"; +exports.version = "19.2.0-native-fb-665de2ed-20250909"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js index d034924b9b..ff65dcf849 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<8283f5909d9518bf936f9009ae20f199>> */ /* @@ -29580,11 +29580,11 @@ __DEV__ && }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-native-fb-eda778b8-20250909" !== isomorphicReactPackageVersion) + if ("19.2.0-native-fb-665de2ed-20250909" !== 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-eda778b8-20250909\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-native-fb-665de2ed-20250909\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -29621,10 +29621,10 @@ __DEV__ && !(function () { var internals = { bundleType: 1, - version: "19.2.0-native-fb-eda778b8-20250909", + version: "19.2.0-native-fb-665de2ed-20250909", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909" + reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -29773,5 +29773,5 @@ __DEV__ && listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; - exports.version = "19.2.0-native-fb-eda778b8-20250909"; + exports.version = "19.2.0-native-fb-665de2ed-20250909"; })(); diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js index 5385898f9c..e3b6e85b77 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<91c15ea4a928cebf1d14a8e95a10db84>> + * @generated SignedSource<<47fe53605b0e750c7434d295233dd627>> */ /* @@ -17388,14 +17388,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_2057 = React.version; if ( - "19.2.0-native-fb-eda778b8-20250909" !== + "19.2.0-native-fb-665de2ed-20250909" !== isomorphicReactPackageVersion$jscomp$inline_2057 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_2057, - "19.2.0-native-fb-eda778b8-20250909" + "19.2.0-native-fb-665de2ed-20250909" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -17417,10 +17417,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2630 = { bundleType: 0, - version: "19.2.0-native-fb-eda778b8-20250909", + version: "19.2.0-native-fb-665de2ed-20250909", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909" + reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2631 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -17527,4 +17527,4 @@ exports.hydrateRoot = function (container, initialChildren, options) { listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.2.0-native-fb-eda778b8-20250909"; +exports.version = "19.2.0-native-fb-665de2ed-20250909"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-profiling.js index 3892dc1bfc..992e5e4457 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<06ded55c7bf6ff384642a96c765ea32f>> */ /* @@ -19398,14 +19398,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_2308 = React.version; if ( - "19.2.0-native-fb-eda778b8-20250909" !== + "19.2.0-native-fb-665de2ed-20250909" !== isomorphicReactPackageVersion$jscomp$inline_2308 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_2308, - "19.2.0-native-fb-eda778b8-20250909" + "19.2.0-native-fb-665de2ed-20250909" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -19427,10 +19427,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2315 = { bundleType: 0, - version: "19.2.0-native-fb-eda778b8-20250909", + version: "19.2.0-native-fb-665de2ed-20250909", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909", + reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909", getLaneLabelMap: function () { for ( var map = new Map(), lane = 1, index$324 = 0; @@ -19553,4 +19553,4 @@ exports.hydrateRoot = function (container, initialChildren, options) { listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.2.0-native-fb-eda778b8-20250909"; +exports.version = "19.2.0-native-fb-665de2ed-20250909"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-dev.js index df1ead1df2..67d15d1588 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<45ee4505ee1b5773958a9b13551faa02>> */ /* @@ -29636,11 +29636,11 @@ __DEV__ && }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-native-fb-eda778b8-20250909" !== isomorphicReactPackageVersion) + if ("19.2.0-native-fb-665de2ed-20250909" !== 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-eda778b8-20250909\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-native-fb-665de2ed-20250909\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -29677,10 +29677,10 @@ __DEV__ && !(function () { var internals = { bundleType: 1, - version: "19.2.0-native-fb-eda778b8-20250909", + version: "19.2.0-native-fb-665de2ed-20250909", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909" + reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -30145,7 +30145,7 @@ __DEV__ && exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.2.0-native-fb-eda778b8-20250909"; + exports.version = "19.2.0-native-fb-665de2ed-20250909"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-prod.js index 9a00f984bf..0c94d967e6 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<2d6207a0e2841f0d8ecf263361edcdb4>> */ /* @@ -17399,14 +17399,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_2058 = React.version; if ( - "19.2.0-native-fb-eda778b8-20250909" !== + "19.2.0-native-fb-665de2ed-20250909" !== isomorphicReactPackageVersion$jscomp$inline_2058 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_2058, - "19.2.0-native-fb-eda778b8-20250909" + "19.2.0-native-fb-665de2ed-20250909" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -17428,10 +17428,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2633 = { bundleType: 0, - version: "19.2.0-native-fb-eda778b8-20250909", + version: "19.2.0-native-fb-665de2ed-20250909", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909" + reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2634 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -17691,4 +17691,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.2.0-native-fb-eda778b8-20250909"; +exports.version = "19.2.0-native-fb-665de2ed-20250909"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-profiling.js index 6361744d6b..742bd07fea 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<1112946c2dda066c6cbcc5b9b953b1ba>> */ /* @@ -19413,14 +19413,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_2309 = React.version; if ( - "19.2.0-native-fb-eda778b8-20250909" !== + "19.2.0-native-fb-665de2ed-20250909" !== isomorphicReactPackageVersion$jscomp$inline_2309 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_2309, - "19.2.0-native-fb-eda778b8-20250909" + "19.2.0-native-fb-665de2ed-20250909" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -19442,10 +19442,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2316 = { bundleType: 0, - version: "19.2.0-native-fb-eda778b8-20250909", + version: "19.2.0-native-fb-665de2ed-20250909", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909", + reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909", getLaneLabelMap: function () { for ( var map = new Map(), lane = 1, index$324 = 0; @@ -19721,7 +19721,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.2.0-native-fb-eda778b8-20250909"; +exports.version = "19.2.0-native-fb-665de2ed-20250909"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js index 76a6e38cb5..03168e5d60 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ "use strict"; @@ -15881,10 +15881,10 @@ __DEV__ && (function () { var internals = { bundleType: 1, - version: "19.2.0-native-fb-eda778b8-20250909", + version: "19.2.0-native-fb-665de2ed-20250909", rendererPackageName: "react-test-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909" + reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -16029,5 +16029,5 @@ __DEV__ && flushSyncWorkAcrossRoots_impl(0, !0)); } }; - exports.version = "19.2.0-native-fb-eda778b8-20250909"; + exports.version = "19.2.0-native-fb-665de2ed-20250909"; })(); diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js index a78b6e34c3..4c6f5eeabe 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<9b046a330bffb18311e3f407181bda59>> + * @generated SignedSource<<14668f2a88027c74e036af72f81cec51>> */ "use strict"; @@ -10045,10 +10045,10 @@ function wrapFiber(fiber) { } var internals$jscomp$inline_1469 = { bundleType: 0, - version: "19.2.0-native-fb-eda778b8-20250909", + version: "19.2.0-native-fb-665de2ed-20250909", rendererPackageName: "react-test-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909" + reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1470 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -10184,4 +10184,4 @@ exports.unstable_batchedUpdates = function (fn, a) { flushSyncWorkAcrossRoots_impl(0, !0)); } }; -exports.version = "19.2.0-native-fb-eda778b8-20250909"; +exports.version = "19.2.0-native-fb-665de2ed-20250909"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js index d4738a738d..0ff028b0f9 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<737be23caa297936837cf0aacdc9f27e>> + * @generated SignedSource<> */ "use strict"; @@ -10666,10 +10666,10 @@ function wrapFiber(fiber) { } var internals$jscomp$inline_1260 = { bundleType: 0, - version: "19.2.0-native-fb-eda778b8-20250909", + version: "19.2.0-native-fb-665de2ed-20250909", rendererPackageName: "react-test-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909", + reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909", getLaneLabelMap: function () { for ( var map = new Map(), lane = 1, index$145 = 0; @@ -10820,4 +10820,4 @@ exports.unstable_batchedUpdates = function (fn, a) { flushSyncWorkAcrossRoots_impl(0, !0)); } }; -exports.version = "19.2.0-native-fb-eda778b8-20250909"; +exports.version = "19.2.0-native-fb-665de2ed-20250909"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-dev.js index a21f715a04..04e9dfcfff 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<99bc04bc8603f51115b5ccb8ca2369a8>> + * @generated SignedSource<<937d95fd9642a70729b4fe29e8e4e5ba>> */ "use strict"; @@ -1397,7 +1397,7 @@ __DEV__ && exports.useTransition = function () { return resolveDispatcher().useTransition(); }; - exports.version = "19.2.0-native-fb-eda778b8-20250909"; + exports.version = "19.2.0-native-fb-665de2ed-20250909"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-prod.js index 0e2241e480..eb1cf1ff3b 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<30acab9cc3593087f175e0f8bf7657f1>> */ "use strict"; @@ -579,4 +579,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.2.0-native-fb-eda778b8-20250909"; +exports.version = "19.2.0-native-fb-665de2ed-20250909"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-profiling.js index 4a1b2306e3..1c54ab6bdb 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ "use strict"; @@ -583,7 +583,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.2.0-native-fb-eda778b8-20250909"; +exports.version = "19.2.0-native-fb-665de2ed-20250909"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION index 44db0304f2..8f5cc50709 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION @@ -1 +1 @@ -eda778b8ae1698fec5fc84ca2530727df8b557b5 +665de2ed283205fccecda649ae2d66f62983f15f diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js index 28915e1474..a1c08decd9 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<330eda6a0b3ea0bc958740f3a9df6bfc>> + * @generated SignedSource<> */ "use strict"; @@ -19705,10 +19705,10 @@ __DEV__ && (function () { var internals = { bundleType: 1, - version: "19.2.0-native-fb-eda778b8-20250909", + version: "19.2.0-native-fb-665de2ed-20250909", rendererPackageName: "react-native-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909" + reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909" }; null !== extraDevToolsConfig && (internals.rendererConfig = extraDevToolsConfig); diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js index f4c0446e29..72760edf20 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<91de8b0793c434edc1ca7d702cb7ba1a>> */ "use strict"; @@ -11211,10 +11211,10 @@ batchedUpdatesImpl = function (fn, a) { var roots = new Map(), internals$jscomp$inline_1281 = { bundleType: 0, - version: "19.2.0-native-fb-eda778b8-20250909", + version: "19.2.0-native-fb-665de2ed-20250909", rendererPackageName: "react-native-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909" + reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909" }; null !== extraDevToolsConfig && (internals$jscomp$inline_1281.rendererConfig = extraDevToolsConfig); diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js index 7f8d55c257..3c85b47c92 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<6ec391ecfd55c67e692dc92f60b10609>> + * @generated SignedSource<> */ "use strict"; @@ -13162,10 +13162,10 @@ batchedUpdatesImpl = function (fn, a) { var roots = new Map(), internals$jscomp$inline_1525 = { bundleType: 0, - version: "19.2.0-native-fb-eda778b8-20250909", + version: "19.2.0-native-fb-665de2ed-20250909", rendererPackageName: "react-native-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909" + reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909" }; null !== extraDevToolsConfig && (internals$jscomp$inline_1525.rendererConfig = extraDevToolsConfig); diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js index 527bf24806..2b6f1c2f50 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<3cc83dbec0b55ccaa36d7c1ba1bf27ce>> */ "use strict"; @@ -19985,11 +19985,11 @@ __DEV__ && shouldSuspendImpl = newShouldSuspendImpl; }; var isomorphicReactPackageVersion = React.version; - if ("19.2.0-native-fb-eda778b8-20250909" !== isomorphicReactPackageVersion) + if ("19.2.0-native-fb-665de2ed-20250909" !== 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-eda778b8-20250909\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-native-renderer: 19.2.0-native-fb-665de2ed-20250909\nLearn more: https://react.dev/warnings/version-mismatch") ); if ( "function" !== @@ -20015,10 +20015,10 @@ __DEV__ && (function () { var internals = { bundleType: 1, - version: "19.2.0-native-fb-eda778b8-20250909", + version: "19.2.0-native-fb-665de2ed-20250909", rendererPackageName: "react-native-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909" + reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909" }; null !== extraDevToolsConfig && (internals.rendererConfig = extraDevToolsConfig); diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js index 43a5727a6c..eee2476ce2 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<4fb30a55685d773037015b4f3faf3665>> */ "use strict"; @@ -11370,11 +11370,11 @@ function updateContainer(element, container, parentComponent, callback) { return lane; } var isomorphicReactPackageVersion = React.version; -if ("19.2.0-native-fb-eda778b8-20250909" !== isomorphicReactPackageVersion) +if ("19.2.0-native-fb-665de2ed-20250909" !== 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-eda778b8-20250909\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-native-renderer: 19.2.0-native-fb-665de2ed-20250909\nLearn more: https://react.dev/warnings/version-mismatch") ); if ( "function" !== @@ -11424,10 +11424,10 @@ batchedUpdatesImpl = function (fn, a) { var roots = new Map(), internals$jscomp$inline_1312 = { bundleType: 0, - version: "19.2.0-native-fb-eda778b8-20250909", + version: "19.2.0-native-fb-665de2ed-20250909", rendererPackageName: "react-native-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909" + reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909" }; null !== extraDevToolsConfig && (internals$jscomp$inline_1312.rendererConfig = extraDevToolsConfig); diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js index 0341b294b9..185ec8374c 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<8258415aeb55102aae5d3d750a926aac>> + * @generated SignedSource<> */ "use strict"; @@ -13311,11 +13311,11 @@ function updateContainer(element, container, parentComponent, callback) { return lane; } var isomorphicReactPackageVersion = React.version; -if ("19.2.0-native-fb-eda778b8-20250909" !== isomorphicReactPackageVersion) +if ("19.2.0-native-fb-665de2ed-20250909" !== 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-eda778b8-20250909\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-native-renderer: 19.2.0-native-fb-665de2ed-20250909\nLearn more: https://react.dev/warnings/version-mismatch") ); if ( "function" !== @@ -13365,10 +13365,10 @@ batchedUpdatesImpl = function (fn, a) { var roots = new Map(), internals$jscomp$inline_1556 = { bundleType: 0, - version: "19.2.0-native-fb-eda778b8-20250909", + version: "19.2.0-native-fb-665de2ed-20250909", rendererPackageName: "react-native-renderer", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909" + reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909" }; null !== extraDevToolsConfig && (internals$jscomp$inline_1556.rendererConfig = extraDevToolsConfig); diff --git a/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js b/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js index 3326c269b6..6da4b04aee 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js +++ b/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js @@ -12,7 +12,7 @@ * @lightSyntaxTransform * @preventMunge * @oncall react_core - * @generated SignedSource<> + * @generated SignedSource<<86801b386ac250b9135b01fcdf6eceba>> */ 'use strict'; @@ -18616,38 +18616,40 @@ function forkTemporaryIdentifier(id, source) { return Object.assign(Object.assign({}, source), { mutableRange: { start: makeInstructionId(0), end: makeInstructionId(0) }, id }); } function validateIdentifierName(name) { - if (isReservedWord(name) || !libExports$1.isValidIdentifier(name)) { - return Err(null); - } - return Ok(makeIdentifierName(name).value); -} -function makeIdentifierName(name) { if (isReservedWord(name)) { - CompilerError.throwInvalidJS({ + const error = new CompilerError(); + error.pushDiagnostic(CompilerDiagnostic.create({ + category: ErrorCategory.Syntax, reason: 'Expected a non-reserved identifier name', - loc: GeneratedSource, description: `\`${name}\` is a reserved word in JavaScript and cannot be used as an identifier name`, suggestions: null, - }); + }).withDetails({ + kind: 'error', + loc: GeneratedSource, + message: 'reserved word', + })); + return Err(error); } - else { - CompilerError.invariant(libExports$1.isValidIdentifier(name), { + else if (!libExports$1.isValidIdentifier(name)) { + const error = new CompilerError(); + error.pushDiagnostic(CompilerDiagnostic.create({ + category: ErrorCategory.Syntax, reason: `Expected a valid identifier name`, description: `\`${name}\` is not a valid JavaScript identifier`, - details: [ - { - kind: 'error', - loc: GeneratedSource, - message: null, - }, - ], suggestions: null, - }); + }).withDetails({ + kind: 'error', + loc: GeneratedSource, + message: 'reserved word', + })); } - return { + return Ok({ kind: 'named', value: name, - }; + }); +} +function makeIdentifierName(name) { + return validateIdentifierName(name).unwrap(); } function promoteTemporary(identifier) { CompilerError.invariant(identifier.name === null, { @@ -19032,6 +19034,9 @@ function printFunction(fn) { else { definition += '<>'; } + if (fn.nameHint != null) { + definition += ` ${fn.nameHint}`; + } if (fn.params.length !== 0) { definition += '(' + @@ -23034,6 +23039,16 @@ function lower(func, env, bindings = null, capturedRefs = new Map()) { message: 'Expected a block statement or expression', })); } + let validatedId = null; + if (id != null) { + const idResult = validateIdentifierName(id); + if (idResult.isErr()) { + builder.errors.merge(idResult.unwrapErr()); + } + else { + validatedId = idResult.unwrap().value; + } + } if (builder.errors.hasAnyErrors()) { return Err(builder.errors); } @@ -23050,7 +23065,8 @@ function lower(func, env, bindings = null, capturedRefs = new Map()) { effects: null, }, null); return Ok({ - id, + id: validatedId, + nameHint: null, params, fnType: bindings == null ? env.fnType : 'Other', returnTypeAnnotation: null, @@ -25849,23 +25865,17 @@ function trimJsxText(original) { } } function lowerFunctionToValue(builder, expr) { - var _a, _b, _c, _d, _e, _f, _g; + var _a; const exprNode = expr.node; const exprLoc = (_a = exprNode.loc) !== null && _a !== void 0 ? _a : GeneratedSource; - let name = null; - if (expr.isFunctionExpression()) { - name = (_d = (_c = (_b = expr.get('id')) === null || _b === void 0 ? void 0 : _b.node) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : null; - } - else if (expr.isFunctionDeclaration()) { - name = (_g = (_f = (_e = expr.get('id')) === null || _e === void 0 ? void 0 : _e.node) === null || _f === void 0 ? void 0 : _f.name) !== null && _g !== void 0 ? _g : null; - } const loweredFunc = lowerFunction(builder, expr); if (!loweredFunc) { return { kind: 'UnsupportedNode', node: exprNode, loc: exprLoc }; } return { kind: 'FunctionExpression', - name, + name: loweredFunc.func.id, + nameHint: null, type: expr.node.type, loc: exprLoc, loweredFunc, @@ -35803,6 +35813,7 @@ function buildReactiveFunction(fn) { return { loc: fn.loc, id: fn.id, + nameHint: fn.nameHint, params: fn.params, generator: fn.generator, async: fn.async, @@ -37399,6 +37410,7 @@ function codegenReactiveFunction(cx, fn) { type: 'CodegenFunction', loc: fn.loc, id: fn.id !== null ? libExports$1.identifier(fn.id) : null, + nameHint: fn.nameHint, params, body, generator: fn.generator, @@ -38786,9 +38798,6 @@ function codegenInstructionValue(cx, instrValue) { pruneUnusedLValues(reactiveFunction); pruneHoistedContexts(reactiveFunction); const fn = codegenReactiveFunction(new Context$2(cx.env, (_g = reactiveFunction.id) !== null && _g !== void 0 ? _g : '[[ anonymous ]]', cx.uniqueIdentifiers, cx.fbtOperands, cx.temp), reactiveFunction).unwrap(); - const validatedName = instrValue.name != null - ? validateIdentifierName(instrValue.name) - : Err(null); if (instrValue.type === 'ArrowFunctionExpression') { let body = fn.body; if (body.body.length === 1 && loweredFunc.directives.length == 0) { @@ -38800,14 +38809,12 @@ function codegenInstructionValue(cx, instrValue) { value = libExports$1.arrowFunctionExpression(fn.params, body, fn.async); } else { - value = libExports$1.functionExpression(validatedName - .map(name => libExports$1.identifier(name)) - .unwrapOr(null), fn.params, fn.body, fn.generator, fn.async); + value = libExports$1.functionExpression(instrValue.name != null ? libExports$1.identifier(instrValue.name) : null, fn.params, fn.body, fn.generator, fn.async); } if (cx.env.config.enableNameAnonymousFunctions && - validatedName.isErr() && - instrValue.name != null) { - const name = instrValue.name; + instrValue.name == null && + instrValue.nameHint != null) { + const name = instrValue.nameHint; value = libExports$1.memberExpression(libExports$1.objectExpression([libExports$1.objectProperty(libExports$1.stringLiteral(name), value)]), libExports$1.stringLiteral(name), true, false); } break; @@ -50302,6 +50309,7 @@ function getContextReassignment(fn, contextVariables, isFunctionExpression, isAs } function outlineFunctions(fn, fbtOperands) { + var _a; for (const [, block] of fn.body.blocks) { for (const instr of block.instructions) { const { value, lvalue } = instr; @@ -50314,7 +50322,7 @@ function outlineFunctions(fn, fbtOperands) { value.loweredFunc.func.id === null && !fbtOperands.has(lvalue.identifier.id)) { const loweredFunc = value.loweredFunc.func; - const id = fn.env.generateGloballyUniqueIdentifierName(loweredFunc.id); + const id = fn.env.generateGloballyUniqueIdentifierName((_a = loweredFunc.id) !== null && _a !== void 0 ? _a : loweredFunc.nameHint); loweredFunc.id = id.value; fn.env.outlineFunction(loweredFunc, null); instr.value = { @@ -50495,6 +50503,7 @@ function emitSelectorFn(env, keys) { const fn = { loc: GeneratedSource, id: null, + nameHint: null, fnType: 'Other', env, params: [obj], @@ -50519,6 +50528,7 @@ function emitSelectorFn(env, keys) { value: { kind: 'FunctionExpression', name: null, + nameHint: null, loweredFunc: { func: fn, }, @@ -50927,6 +50937,7 @@ function emitOutlinedFn(env, jsx, oldProps, globals) { const fn = { loc: GeneratedSource, id: null, + nameHint: null, fnType: 'Other', env, params: [propsObj], @@ -51870,7 +51881,8 @@ function nameAnonymousFunctions(fn) { var _a, _b; if (node.generatedName != null) { const name = `${prefix}${node.generatedName}]`; - node.fn.name = name; + node.fn.nameHint = name; + node.fn.loweredFunc.func.nameHint = name; } const nextPrefix = `${prefix}${(_b = (_a = node.generatedName) !== null && _a !== void 0 ? _a : node.fn.name) !== null && _b !== void 0 ? _b : ''} > `; for (const inner of node.inner) { @@ -52130,6 +52142,14 @@ function runWithEnvironment(func, env) { if (env.config.enableJsxOutlining) { outlineJSX(hir); } + if (env.config.enableNameAnonymousFunctions) { + nameAnonymousFunctions(hir); + log({ + kind: 'hir', + name: 'NameAnonymousFunctions', + value: hir, + }); + } if (env.config.enableFunctionOutlining) { outlineFunctions(hir, fbtOperands); log({ kind: 'hir', name: 'OutlineFunctions', value: hir }); @@ -52208,14 +52228,6 @@ function runWithEnvironment(func, env) { value: hir, }); } - if (env.config.enableNameAnonymousFunctions) { - nameAnonymousFunctions(hir); - log({ - kind: 'hir', - name: 'NameAnonymougFunctions', - value: hir, - }); - } const reactiveFunction = buildReactiveFunction(hir); log({ kind: 'reactive', diff --git a/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js b/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js index fb03f1c671..5e65d6304e 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js +++ b/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js @@ -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<> + * @generated SignedSource<> */ 'use strict'; @@ -18601,38 +18601,40 @@ function forkTemporaryIdentifier(id, source) { return Object.assign(Object.assign({}, source), { mutableRange: { start: makeInstructionId(0), end: makeInstructionId(0) }, id }); } function validateIdentifierName(name) { - if (isReservedWord(name) || !libExports$1.isValidIdentifier(name)) { - return Err(null); - } - return Ok(makeIdentifierName(name).value); -} -function makeIdentifierName(name) { if (isReservedWord(name)) { - CompilerError.throwInvalidJS({ + const error = new CompilerError(); + error.pushDiagnostic(CompilerDiagnostic.create({ + category: ErrorCategory.Syntax, reason: 'Expected a non-reserved identifier name', - loc: GeneratedSource, description: `\`${name}\` is a reserved word in JavaScript and cannot be used as an identifier name`, suggestions: null, - }); + }).withDetails({ + kind: 'error', + loc: GeneratedSource, + message: 'reserved word', + })); + return Err(error); } - else { - CompilerError.invariant(libExports$1.isValidIdentifier(name), { + else if (!libExports$1.isValidIdentifier(name)) { + const error = new CompilerError(); + error.pushDiagnostic(CompilerDiagnostic.create({ + category: ErrorCategory.Syntax, reason: `Expected a valid identifier name`, description: `\`${name}\` is not a valid JavaScript identifier`, - details: [ - { - kind: 'error', - loc: GeneratedSource, - message: null, - }, - ], suggestions: null, - }); + }).withDetails({ + kind: 'error', + loc: GeneratedSource, + message: 'reserved word', + })); } - return { + return Ok({ kind: 'named', value: name, - }; + }); +} +function makeIdentifierName(name) { + return validateIdentifierName(name).unwrap(); } function promoteTemporary(identifier) { CompilerError.invariant(identifier.name === null, { @@ -19017,6 +19019,9 @@ function printFunction(fn) { else { definition += '<>'; } + if (fn.nameHint != null) { + definition += ` ${fn.nameHint}`; + } if (fn.params.length !== 0) { definition += '(' + @@ -23019,6 +23024,16 @@ function lower(func, env, bindings = null, capturedRefs = new Map()) { message: 'Expected a block statement or expression', })); } + let validatedId = null; + if (id != null) { + const idResult = validateIdentifierName(id); + if (idResult.isErr()) { + builder.errors.merge(idResult.unwrapErr()); + } + else { + validatedId = idResult.unwrap().value; + } + } if (builder.errors.hasAnyErrors()) { return Err(builder.errors); } @@ -23035,7 +23050,8 @@ function lower(func, env, bindings = null, capturedRefs = new Map()) { effects: null, }, null); return Ok({ - id, + id: validatedId, + nameHint: null, params, fnType: bindings == null ? env.fnType : 'Other', returnTypeAnnotation: null, @@ -25834,23 +25850,17 @@ function trimJsxText(original) { } } function lowerFunctionToValue(builder, expr) { - var _a, _b, _c, _d, _e, _f, _g; + var _a; const exprNode = expr.node; const exprLoc = (_a = exprNode.loc) !== null && _a !== void 0 ? _a : GeneratedSource; - let name = null; - if (expr.isFunctionExpression()) { - name = (_d = (_c = (_b = expr.get('id')) === null || _b === void 0 ? void 0 : _b.node) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : null; - } - else if (expr.isFunctionDeclaration()) { - name = (_g = (_f = (_e = expr.get('id')) === null || _e === void 0 ? void 0 : _e.node) === null || _f === void 0 ? void 0 : _f.name) !== null && _g !== void 0 ? _g : null; - } const loweredFunc = lowerFunction(builder, expr); if (!loweredFunc) { return { kind: 'UnsupportedNode', node: exprNode, loc: exprLoc }; } return { kind: 'FunctionExpression', - name, + name: loweredFunc.func.id, + nameHint: null, type: expr.node.type, loc: exprLoc, loweredFunc, @@ -35582,6 +35592,7 @@ function buildReactiveFunction(fn) { return { loc: fn.loc, id: fn.id, + nameHint: fn.nameHint, params: fn.params, generator: fn.generator, async: fn.async, @@ -37178,6 +37189,7 @@ function codegenReactiveFunction(cx, fn) { type: 'CodegenFunction', loc: fn.loc, id: fn.id !== null ? libExports$1.identifier(fn.id) : null, + nameHint: fn.nameHint, params, body, generator: fn.generator, @@ -38565,9 +38577,6 @@ function codegenInstructionValue(cx, instrValue) { pruneUnusedLValues(reactiveFunction); pruneHoistedContexts(reactiveFunction); const fn = codegenReactiveFunction(new Context$2(cx.env, (_g = reactiveFunction.id) !== null && _g !== void 0 ? _g : '[[ anonymous ]]', cx.uniqueIdentifiers, cx.fbtOperands, cx.temp), reactiveFunction).unwrap(); - const validatedName = instrValue.name != null - ? validateIdentifierName(instrValue.name) - : Err(null); if (instrValue.type === 'ArrowFunctionExpression') { let body = fn.body; if (body.body.length === 1 && loweredFunc.directives.length == 0) { @@ -38579,14 +38588,12 @@ function codegenInstructionValue(cx, instrValue) { value = libExports$1.arrowFunctionExpression(fn.params, body, fn.async); } else { - value = libExports$1.functionExpression(validatedName - .map(name => libExports$1.identifier(name)) - .unwrapOr(null), fn.params, fn.body, fn.generator, fn.async); + value = libExports$1.functionExpression(instrValue.name != null ? libExports$1.identifier(instrValue.name) : null, fn.params, fn.body, fn.generator, fn.async); } if (cx.env.config.enableNameAnonymousFunctions && - validatedName.isErr() && - instrValue.name != null) { - const name = instrValue.name; + instrValue.name == null && + instrValue.nameHint != null) { + const name = instrValue.nameHint; value = libExports$1.memberExpression(libExports$1.objectExpression([libExports$1.objectProperty(libExports$1.stringLiteral(name), value)]), libExports$1.stringLiteral(name), true, false); } break; @@ -50081,6 +50088,7 @@ function getContextReassignment(fn, contextVariables, isFunctionExpression, isAs } function outlineFunctions(fn, fbtOperands) { + var _a; for (const [, block] of fn.body.blocks) { for (const instr of block.instructions) { const { value, lvalue } = instr; @@ -50093,7 +50101,7 @@ function outlineFunctions(fn, fbtOperands) { value.loweredFunc.func.id === null && !fbtOperands.has(lvalue.identifier.id)) { const loweredFunc = value.loweredFunc.func; - const id = fn.env.generateGloballyUniqueIdentifierName(loweredFunc.id); + const id = fn.env.generateGloballyUniqueIdentifierName((_a = loweredFunc.id) !== null && _a !== void 0 ? _a : loweredFunc.nameHint); loweredFunc.id = id.value; fn.env.outlineFunction(loweredFunc, null); instr.value = { @@ -50274,6 +50282,7 @@ function emitSelectorFn(env, keys) { const fn = { loc: GeneratedSource, id: null, + nameHint: null, fnType: 'Other', env, params: [obj], @@ -50298,6 +50307,7 @@ function emitSelectorFn(env, keys) { value: { kind: 'FunctionExpression', name: null, + nameHint: null, loweredFunc: { func: fn, }, @@ -50706,6 +50716,7 @@ function emitOutlinedFn(env, jsx, oldProps, globals) { const fn = { loc: GeneratedSource, id: null, + nameHint: null, fnType: 'Other', env, params: [propsObj], @@ -51649,7 +51660,8 @@ function nameAnonymousFunctions(fn) { var _a, _b; if (node.generatedName != null) { const name = `${prefix}${node.generatedName}]`; - node.fn.name = name; + node.fn.nameHint = name; + node.fn.loweredFunc.func.nameHint = name; } const nextPrefix = `${prefix}${(_b = (_a = node.generatedName) !== null && _a !== void 0 ? _a : node.fn.name) !== null && _b !== void 0 ? _b : ''} > `; for (const inner of node.inner) { @@ -51909,6 +51921,14 @@ function runWithEnvironment(func, env) { if (env.config.enableJsxOutlining) { outlineJSX(hir); } + if (env.config.enableNameAnonymousFunctions) { + nameAnonymousFunctions(hir); + log({ + kind: 'hir', + name: 'NameAnonymousFunctions', + value: hir, + }); + } if (env.config.enableFunctionOutlining) { outlineFunctions(hir, fbtOperands); log({ kind: 'hir', name: 'OutlineFunctions', value: hir }); @@ -51987,14 +52007,6 @@ function runWithEnvironment(func, env) { value: hir, }); } - if (env.config.enableNameAnonymousFunctions) { - nameAnonymousFunctions(hir); - log({ - kind: 'hir', - name: 'NameAnonymougFunctions', - value: hir, - }); - } const reactiveFunction = buildReactiveFunction(hir); log({ kind: 'reactive', diff --git a/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/package.json b/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/package.json index b63a20ee99..b4d9504de9 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/package.json +++ b/compiled-rn/facebook-fbsource/xplat/js/tools/eslint-plugin-react-hooks/package.json @@ -1,7 +1,7 @@ { "name": "eslint-plugin-react-hooks", "description": "ESLint rules for React Hooks", - "version": "0.0.0-experimental-eda778b8-20250909", + "version": "0.0.0-experimental-665de2ed-20250909", "repository": { "type": "git", "url": "https://github.com/facebook/react.git",