From 7778c9dd2c6e6a22aed8a55524f5753c874dc717 Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Fri, 28 Aug 2026 02:00:00 -0700 Subject: [PATCH 1/2] Cover `jserrorhandler` with Stable API guards Summary: Classifies `jserrorhandler:jserrorhandler` as a "for frameworks" target under the C++ stable API three-tier visibility model. Adds `#include ` to the module's three exported headers (`ErrorUtils.h`, `JsErrorHandler.h`, `StackTraceParser.h`), and wires the guard dependency into BUCK, CMake and CocoaPods. Consumers that opt into `RN_STRICT_API` now get a warning if they include these headers directly, which they can acknowledge with `RN_ALLOW_FRAMEWORKS`; without that flag the guards are inert, so no existing build changes behaviour. Changelog: [Internal] Differential Revision: D117842041 --- .../ReactCommon/jserrorhandler/CMakeLists.txt | 1 + .../react-native/ReactCommon/jserrorhandler/ErrorUtils.h | 2 ++ .../ReactCommon/jserrorhandler/JsErrorHandler.h | 2 ++ .../jserrorhandler/React-jserrorhandler.podspec | 8 ++++++++ .../ReactCommon/jserrorhandler/StackTraceParser.h | 2 ++ 5 files changed, 15 insertions(+) diff --git a/packages/react-native/ReactCommon/jserrorhandler/CMakeLists.txt b/packages/react-native/ReactCommon/jserrorhandler/CMakeLists.txt index d569e15d5c7c..8cdc80401168 100644 --- a/packages/react-native/ReactCommon/jserrorhandler/CMakeLists.txt +++ b/packages/react-native/ReactCommon/jserrorhandler/CMakeLists.txt @@ -21,6 +21,7 @@ target_link_libraries(jserrorhandler callinvoker folly_runtime ${mapbufferjni} + react_cxxstableapi react_featureflags ) target_compile_reactnative_options(jserrorhandler PRIVATE) diff --git a/packages/react-native/ReactCommon/jserrorhandler/ErrorUtils.h b/packages/react-native/ReactCommon/jserrorhandler/ErrorUtils.h index f71377e3a9a6..31e1894641c9 100644 --- a/packages/react-native/ReactCommon/jserrorhandler/ErrorUtils.h +++ b/packages/react-native/ReactCommon/jserrorhandler/ErrorUtils.h @@ -7,6 +7,8 @@ #pragma once +#include + #include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/jserrorhandler/JsErrorHandler.h b/packages/react-native/ReactCommon/jserrorhandler/JsErrorHandler.h index 40d61f442f2a..d1fdf0f2c2eb 100644 --- a/packages/react-native/ReactCommon/jserrorhandler/JsErrorHandler.h +++ b/packages/react-native/ReactCommon/jserrorhandler/JsErrorHandler.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/packages/react-native/ReactCommon/jserrorhandler/React-jserrorhandler.podspec b/packages/react-native/ReactCommon/jserrorhandler/React-jserrorhandler.podspec index 41b1b9eb20e5..c0fb2e9c0d61 100644 --- a/packages/react-native/ReactCommon/jserrorhandler/React-jserrorhandler.podspec +++ b/packages/react-native/ReactCommon/jserrorhandler/React-jserrorhandler.podspec @@ -18,6 +18,12 @@ end react_native_path = ".." +header_search_paths = [] + +if ENV['USE_FRAMEWORKS'] + header_search_paths << "\"$(PODS_TARGET_SRCROOT)/..\"" # ReactCommon, for +end + Pod::Spec.new do |s| s.name = "React-jserrorhandler" s.version = version @@ -30,6 +36,7 @@ Pod::Spec.new do |s| s.header_dir = "jserrorhandler" s.source_files = podspec_sources(["ErrorUtils.{cpp,h}", "JsErrorHandler.{cpp,h}", "StackTraceParser.{cpp,h}"], ["ErrorUtils.h", "JsErrorHandler.h", "StackTraceParser.h"]) s.pod_target_xcconfig = { + "HEADER_SEARCH_PATHS" => header_search_paths.join(' '), "USE_HEADERMAP" => "YES", "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard() } @@ -38,6 +45,7 @@ Pod::Spec.new do |s| s.dependency "React-jsi" s.dependency "React-bridging" + s.dependency "React-cxxstableapi" add_dependency(s, "React-featureflags") add_dependency(s, "React-debug") diff --git a/packages/react-native/ReactCommon/jserrorhandler/StackTraceParser.h b/packages/react-native/ReactCommon/jserrorhandler/StackTraceParser.h index 92436c4c60c0..d5ecce8fa03c 100644 --- a/packages/react-native/ReactCommon/jserrorhandler/StackTraceParser.h +++ b/packages/react-native/ReactCommon/jserrorhandler/StackTraceParser.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include "JsErrorHandler.h" From dc5179900c5946a13011aa21ff5bbe87c6c94d98 Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Fri, 28 Aug 2026 02:00:00 -0700 Subject: [PATCH 2/2] Remove dead include from RCTInstance.h Summary: Under the C++ Stable API RFC, `jserrorhandler:jserrorhandler` is a "for frameworks" module, but it was still reached from a public header: - The iOS and macOS `RCTInstance.h` included `react/runtime/ReactInstance.h`, which in turn includes `jserrorhandler/JsErrorHandler.h`. Neither `RCTInstance.h` names `ReactInstance` or `JsErrorHandler`; the only C++ types they use are `JSRuntimeFactory` and `jsinspector_modern::HostTarget`, both already included directly. The include is dead and is simply removed. - `RCTInstance.mm` does name both types and was relying on the include transitively, so `react/runtime/ReactInstance.h` and `jserrorhandler/JsErrorHandler.h` move to the implementation file on both platforms. Changelog: [Internal] Differential Revision: D117842042 --- .../react/runtime/platform/ios/ReactCommon/RCTInstance.h | 1 - .../react/runtime/platform/ios/ReactCommon/RCTInstance.mm | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.h b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.h index 72b7585184e6..d27b7e3ff907 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.h +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.h @@ -11,7 +11,6 @@ #import #import #import -#import #import "RCTContextContainerHandling.h" diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm index 036551395323..b5bbe391277c 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm @@ -37,11 +37,13 @@ #import #import #import +#import #import #import #import #import #import +#import #import #import #import