From cfcf3a3f95dccfa208a93a8559c3f48c4ec42038 Mon Sep 17 00:00:00 2001 From: Phillip Pan Date: Mon, 22 Jan 2024 19:44:20 -0800 Subject: [PATCH] unpin SocketRocket from startup (#42410) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/42410 Changelog: [Internal] Properly compiling these files out so we don't need to pull in SocketRocket to startup Long term, we need to lift DevSupport and Inspector directories out of ReactInternal target Reviewed By: fkgozali Differential Revision: D52890707 fbshipit-source-id: efe59092d8f5487ab3f62ffb4ebd2b8aa58399fe --- .../RCTCxxInspectorPackagerConnectionDelegate.h | 6 ++++++ .../RCTCxxInspectorPackagerConnectionDelegate.mm | 4 ++++ .../React/Inspector/RCTCxxInspectorWebSocketAdapter.h | 6 ++++++ .../React/Inspector/RCTCxxInspectorWebSocketAdapter.mm | 9 ++++++--- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/packages/react-native/React/Inspector/RCTCxxInspectorPackagerConnectionDelegate.h b/packages/react-native/React/Inspector/RCTCxxInspectorPackagerConnectionDelegate.h index 79929126125..56e5f51c161 100644 --- a/packages/react-native/React/Inspector/RCTCxxInspectorPackagerConnectionDelegate.h +++ b/packages/react-native/React/Inspector/RCTCxxInspectorPackagerConnectionDelegate.h @@ -5,6 +5,10 @@ * LICENSE file in the root directory of this source tree. */ +#import + +#if RCT_DEV || RCT_REMOTE_PROFILE + #import "RCTCxxInspectorWebSocketAdapter.h" #import @@ -39,3 +43,5 @@ class RCTCxxInspectorPackagerConnectionDelegate std::chrono::milliseconds delayMs) override; }; } // namespace facebook::react::jsinspector_modern + +#endif diff --git a/packages/react-native/React/Inspector/RCTCxxInspectorPackagerConnectionDelegate.mm b/packages/react-native/React/Inspector/RCTCxxInspectorPackagerConnectionDelegate.mm index 6fa537dfd19..d6fb7b32d11 100644 --- a/packages/react-native/React/Inspector/RCTCxxInspectorPackagerConnectionDelegate.mm +++ b/packages/react-native/React/Inspector/RCTCxxInspectorPackagerConnectionDelegate.mm @@ -7,6 +7,8 @@ #import "RCTCxxInspectorPackagerConnectionDelegate.h" +#if RCT_DEV || RCT_REMOTE_PROFILE + #import namespace facebook::react::jsinspector_modern { @@ -42,3 +44,5 @@ void RCTCxxInspectorPackagerConnectionDelegate::scheduleCallback( }); } } // namespace facebook::react::jsinspector_modern + +#endif diff --git a/packages/react-native/React/Inspector/RCTCxxInspectorWebSocketAdapter.h b/packages/react-native/React/Inspector/RCTCxxInspectorWebSocketAdapter.h index a06d83413c6..8520d88d013 100644 --- a/packages/react-native/React/Inspector/RCTCxxInspectorWebSocketAdapter.h +++ b/packages/react-native/React/Inspector/RCTCxxInspectorWebSocketAdapter.h @@ -5,6 +5,10 @@ * LICENSE file in the root directory of this source tree. */ +#import + +#if RCT_DEV || RCT_REMOTE_PROFILE + #import #import #import @@ -15,3 +19,5 @@ - (void)send:(std::string_view)message; - (void)close; @end + +#endif diff --git a/packages/react-native/React/Inspector/RCTCxxInspectorWebSocketAdapter.mm b/packages/react-native/React/Inspector/RCTCxxInspectorWebSocketAdapter.mm index 95a039c61d4..ad4d1f6fb98 100644 --- a/packages/react-native/React/Inspector/RCTCxxInspectorWebSocketAdapter.mm +++ b/packages/react-native/React/Inspector/RCTCxxInspectorWebSocketAdapter.mm @@ -5,16 +5,17 @@ * LICENSE file in the root directory of this source tree. */ -#import +#import "RCTCxxInspectorWebSocketAdapter.h" + +#if RCT_DEV || RCT_REMOTE_PROFILE -#import #import +#import #import #import #import #import #import -#import "RCTCxxInspectorWebSocketAdapter.h" using namespace facebook::react::jsinspector_modern; @@ -87,3 +88,5 @@ NSString *NSStringFromUTF8StringView(std::string_view view) } @end + +#endif