From 5464221ab83537973ca93fea14a7db73793ee35a Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Wed, 9 Sep 2026 07:33:01 -0700 Subject: [PATCH] Cover cxxreact:bridge with Stable API guards (#58404) Summary: Pull Request resolved: https://github.com/react/react-native/pull/58404 Classifies `cxxreact:bridge` as a private target under the three-tier C++ stable API visibility model. Consumers that opt into `RN_STRICT_API` now get an error if they include its headers directly; without that flag the guards are inert, so no existing build changes behaviour. `ReactNativeVersion.h` is a generated file, so its guard also goes into `scripts/releases/templates/ReactNativeVersion.h-template.js`; without that the next version stamp would rewrite the header and silently drop the guard from every release and nightly artifact. Changelog: [Internal] Reviewed By: javache Differential Revision: D119163927 fbshipit-source-id: 9d436770753079448173e3bcb8d4d5e9c13ae8e3 --- packages/react-native/ReactCommon/cxxreact/CxxNativeModule.h | 2 ++ packages/react-native/ReactCommon/cxxreact/Instance.h | 2 ++ packages/react-native/ReactCommon/cxxreact/JSExecutor.h | 2 ++ .../react-native/ReactCommon/cxxreact/JSModulesUnbundle.h | 2 ++ packages/react-native/ReactCommon/cxxreact/MethodCall.h | 2 ++ packages/react-native/ReactCommon/cxxreact/ModuleRegistry.h | 2 ++ packages/react-native/ReactCommon/cxxreact/NativeModule.h | 2 ++ packages/react-native/ReactCommon/cxxreact/NativeToJsBridge.h | 2 ++ .../react-native/ReactCommon/cxxreact/RAMBundleRegistry.h | 2 ++ .../react-native/ReactCommon/cxxreact/ReactNativeVersion.h | 2 ++ packages/react-native/ReactCommon/cxxreact/RecoverableError.h | 2 ++ .../__snapshots__/set-rn-artifacts-version-test.js.snap | 4 ++++ scripts/releases/templates/ReactNativeVersion.h-template.js | 2 ++ 13 files changed, 28 insertions(+) diff --git a/packages/react-native/ReactCommon/cxxreact/CxxNativeModule.h b/packages/react-native/ReactCommon/cxxreact/CxxNativeModule.h index 7b42f6d9f89..22d2f749302 100644 --- a/packages/react-native/ReactCommon/cxxreact/CxxNativeModule.h +++ b/packages/react-native/ReactCommon/cxxreact/CxxNativeModule.h @@ -7,6 +7,8 @@ #pragma once +#include + #ifndef RCT_REMOVE_LEGACY_ARCH #include diff --git a/packages/react-native/ReactCommon/cxxreact/Instance.h b/packages/react-native/ReactCommon/cxxreact/Instance.h index a8026d0aaec..7748abbcd32 100644 --- a/packages/react-native/ReactCommon/cxxreact/Instance.h +++ b/packages/react-native/ReactCommon/cxxreact/Instance.h @@ -7,6 +7,8 @@ #pragma once +#include + #ifndef RCT_REMOVE_LEGACY_ARCH #include diff --git a/packages/react-native/ReactCommon/cxxreact/JSExecutor.h b/packages/react-native/ReactCommon/cxxreact/JSExecutor.h index e6959416834..b27600b84fb 100644 --- a/packages/react-native/ReactCommon/cxxreact/JSExecutor.h +++ b/packages/react-native/ReactCommon/cxxreact/JSExecutor.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include diff --git a/packages/react-native/ReactCommon/cxxreact/JSModulesUnbundle.h b/packages/react-native/ReactCommon/cxxreact/JSModulesUnbundle.h index 7abea636d56..a839ca69328 100644 --- a/packages/react-native/ReactCommon/cxxreact/JSModulesUnbundle.h +++ b/packages/react-native/ReactCommon/cxxreact/JSModulesUnbundle.h @@ -7,6 +7,8 @@ #pragma once +#include + #ifndef RCT_REMOVE_LEGACY_ARCH #include diff --git a/packages/react-native/ReactCommon/cxxreact/MethodCall.h b/packages/react-native/ReactCommon/cxxreact/MethodCall.h index bf2aa8eb556..8804b40821d 100644 --- a/packages/react-native/ReactCommon/cxxreact/MethodCall.h +++ b/packages/react-native/ReactCommon/cxxreact/MethodCall.h @@ -7,6 +7,8 @@ #pragma once +#include + #ifndef RCT_REMOVE_LEGACY_ARCH #include diff --git a/packages/react-native/ReactCommon/cxxreact/ModuleRegistry.h b/packages/react-native/ReactCommon/cxxreact/ModuleRegistry.h index 831a69e62bb..4bb2fabe7d9 100644 --- a/packages/react-native/ReactCommon/cxxreact/ModuleRegistry.h +++ b/packages/react-native/ReactCommon/cxxreact/ModuleRegistry.h @@ -7,6 +7,8 @@ #pragma once +#include + #ifndef RCT_REMOVE_LEGACY_ARCH #include diff --git a/packages/react-native/ReactCommon/cxxreact/NativeModule.h b/packages/react-native/ReactCommon/cxxreact/NativeModule.h index d8f49eabd0c..dc9fa55beb4 100644 --- a/packages/react-native/ReactCommon/cxxreact/NativeModule.h +++ b/packages/react-native/ReactCommon/cxxreact/NativeModule.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include diff --git a/packages/react-native/ReactCommon/cxxreact/NativeToJsBridge.h b/packages/react-native/ReactCommon/cxxreact/NativeToJsBridge.h index ac0d3a0c05b..28d0623e028 100644 --- a/packages/react-native/ReactCommon/cxxreact/NativeToJsBridge.h +++ b/packages/react-native/ReactCommon/cxxreact/NativeToJsBridge.h @@ -7,6 +7,8 @@ #pragma once +#include + #ifndef RCT_REMOVE_LEGACY_ARCH #include diff --git a/packages/react-native/ReactCommon/cxxreact/RAMBundleRegistry.h b/packages/react-native/ReactCommon/cxxreact/RAMBundleRegistry.h index 16ce66943ed..45c8e502b31 100644 --- a/packages/react-native/ReactCommon/cxxreact/RAMBundleRegistry.h +++ b/packages/react-native/ReactCommon/cxxreact/RAMBundleRegistry.h @@ -7,6 +7,8 @@ #pragma once +#include + #ifndef RCT_REMOVE_LEGACY_ARCH #include diff --git a/packages/react-native/ReactCommon/cxxreact/ReactNativeVersion.h b/packages/react-native/ReactCommon/cxxreact/ReactNativeVersion.h index 25468f63f05..c428a7827fc 100644 --- a/packages/react-native/ReactCommon/cxxreact/ReactNativeVersion.h +++ b/packages/react-native/ReactCommon/cxxreact/ReactNativeVersion.h @@ -9,6 +9,8 @@ #pragma once +#include + #include #include diff --git a/packages/react-native/ReactCommon/cxxreact/RecoverableError.h b/packages/react-native/ReactCommon/cxxreact/RecoverableError.h index 980f6ce76f0..f8c74ec5733 100644 --- a/packages/react-native/ReactCommon/cxxreact/RecoverableError.h +++ b/packages/react-native/ReactCommon/cxxreact/RecoverableError.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/scripts/releases/__tests__/__snapshots__/set-rn-artifacts-version-test.js.snap b/scripts/releases/__tests__/__snapshots__/set-rn-artifacts-version-test.js.snap index bd30713aa4a..d190036c2ef 100644 --- a/scripts/releases/__tests__/__snapshots__/set-rn-artifacts-version-test.js.snap +++ b/scripts/releases/__tests__/__snapshots__/set-rn-artifacts-version-test.js.snap @@ -129,6 +129,8 @@ exports[`updateReactNativeArtifacts should set nightly version: packages/react-n #pragma once +#include + #include #include @@ -286,6 +288,8 @@ exports[`updateReactNativeArtifacts should set release version: packages/react-n #pragma once +#include + #include #include diff --git a/scripts/releases/templates/ReactNativeVersion.h-template.js b/scripts/releases/templates/ReactNativeVersion.h-template.js index f100ddd15f9..51febd41af1 100644 --- a/scripts/releases/templates/ReactNativeVersion.h-template.js +++ b/scripts/releases/templates/ReactNativeVersion.h-template.js @@ -23,6 +23,8 @@ module.exports = ({version} /*: {version: Version} */) /*: string */ => `/** #pragma once +#include + #include #include