Modularlize RCTBridgeModule.h 1/n - Move RCTBundleManager.h to its own file in ReactInternal target

Summary:
Changelog: [Internal][iOS] Modularlize RCTBridgeModule.h 1/n -  Move RCTBundleManager.h to its own file in ReactInternal target

# Why clean up RCTBridgeModule.h?
Clean up one unnecessary import of RCTBridgeModule.h.

RCTBridgeModule includes a lot of header files, and this header is imported everywhere. The ultimate goal is that files (especially React Native infra files) should only import only what they need and not import the entirely of RCTBridgeModule.h whenever possible.

This way, certain headers that are Bridge-only can be compiled out of the new architecture with a flag.

The other benefit of splitting up the headers like this is that it'll be much easier for developers to navigate between the .h and .mm files.

Reviewed By: philIip

Differential Revision: D38943262

fbshipit-source-id: 90876324de9fae25bf33c7aef820a32d7c6ce2f8
This commit is contained in:
Paige Sun
2022-08-26 17:56:51 -07:00
committed by Facebook GitHub Bot
parent e653f2fd15
commit 4230de0f58
5 changed files with 30 additions and 20 deletions
+1
View File
@@ -255,6 +255,7 @@ REACT_PUBLIC_HEADERS = {
"React/RCTBridgeMethod.h": RCTBASE_PATH + "RCTBridgeMethod.h",
"React/RCTBridgeModule.h": RCTBASE_PATH + "RCTBridgeModule.h",
"React/RCTBridgeModuleDecorator.h": RCTBASE_PATH + "RCTBridgeModuleDecorator.h",
"React/RCTBundleManager.h": RCTBASE_PATH + "Modules/RCTBundleManager.h",
"React/RCTBundleURLProvider.h": RCTBASE_PATH + "RCTBundleURLProvider.h",
"React/RCTComponent.h": RCTVIEWS_PATH + "RCTComponent.h",
"React/RCTComponentData.h": RCTVIEWS_PATH + "RCTComponentData.h",
+23
View File
@@ -0,0 +1,23 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
@class RCTBridge;
typedef NSURL * (^RCTBridgelessBundleURLGetter)(void);
typedef void (^RCTBridgelessBundleURLSetter)(NSURL *bundleURL);
/**
* A class that allows NativeModules/TurboModules to read/write the bundleURL, with or without the bridge.
*/
@interface RCTBundleManager : NSObject
- (void)setBridge:(RCTBridge *)bridge;
- (void)setBridgelessBundleURLGetter:(RCTBridgelessBundleURLGetter)getter
andSetter:(RCTBridgelessBundleURLSetter)setter
andDefaultGetter:(RCTBridgelessBundleURLGetter)defaultGetter;
- (void)resetBundleURL;
@property NSURL *bundleURL;
@end
@@ -5,10 +5,10 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTBundleManager.h"
#import "RCTAssert.h"
#import "RCTBridge+Private.h"
#import "RCTBridge.h"
#import "RCTBridgeModule.h"
@implementation RCTBundleManager {
__weak RCTBridge *_bridge;
+2 -16
View File
@@ -15,9 +15,10 @@
@protocol RCTBridgeMethod;
@class RCTModuleRegistry;
@class RCTViewRegistry;
@class RCTBundleManager;
@class RCTCallableJSModules;
#import "Modules/RCTBundleManager.h"
/**
* The type of a block that is capable of sending a response to a bridged
* operation. Use this for returning callback methods to JS.
@@ -420,21 +421,6 @@ RCT_EXTERN_C_END
- (id)moduleForName:(const char *)moduleName lazilyLoadIfNecessary:(BOOL)lazilyLoad;
@end
typedef void (^RCTBridgelessBundleURLSetter)(NSURL *bundleURL);
typedef NSURL * (^RCTBridgelessBundleURLGetter)(void);
/**
* A class that allows NativeModules/TurboModules to read/write the bundleURL, with or without the bridge.
*/
@interface RCTBundleManager : NSObject
- (void)setBridge:(RCTBridge *)bridge;
- (void)setBridgelessBundleURLGetter:(RCTBridgelessBundleURLGetter)getter
andSetter:(RCTBridgelessBundleURLSetter)setter
andDefaultGetter:(RCTBridgelessBundleURLGetter)defaultGetter;
- (void)resetBundleURL;
@property NSURL *bundleURL;
@end
typedef UIView * (^RCTBridgelessComponentViewProvider)(NSNumber *);
typedef void (^RCTViewRegistryUIBlock)(RCTViewRegistry *viewRegistry);
+3 -3
View File
@@ -918,13 +918,13 @@ SPEC CHECKSUMS:
RCTRequired: 1c8808cf84569265784a6c33984bbb506ada8c6e
RCTTypeSafety: b6dcb5036a808864ee8cad66ca15f263c24661cc
React: 8d809d414723bb5763093ddec7658066a21ccabc
React-bridging: cc10a051eff1f03306a1d7659593d8aac3242bc3
React-bridging: c8806159f8ef90f27443857eed1efdb8c85940e1
React-callinvoker: 5f16202ad4e45f0607b1fae0f6955a8f7c87eef1
React-Codegen: 5adf19af97eb37a7d441c040521191e446255086
React-Core: ce4282fb714ffbe444b84d296d1728eaee4d0e9f
React-CoreModules: 675170bccf156da3a3348e04e2036ce401b2010d
React-cxxreact: 7276467c246302fedf598cc40d7003896ddb20ba
React-Fabric: abfd61dc5498ce165634af85d65fcc42b82b5bf4
React-Fabric: b49c8e76c926b5b6b708802759b27dd6e02bb4bc
React-graphics: 5ccc9cc0d91794fd42bc1c693e9aea207554bbef
React-jsi: a042596cb558abea721ab5e23cb175647610a73d
React-jsiexecutor: f7fbac5dff7e7ff110a66edf2626b4f4f4600ef5
@@ -946,7 +946,7 @@ SPEC CHECKSUMS:
React-RCTVibration: 0386f50996a153b3f39cecbe7d139763ac9a9fdf
React-rncore: 2a6ad37560e94cf7ff32e3f2ae1e708491b4c1f3
React-runtimeexecutor: 97dca9247f4d3cfe0733384b189c6930fbd402b7
ReactCommon: 6cef8ed13ee2a9d7d4cf9660dbe6dd2ea6ba7104
ReactCommon: 8e39c4b24da570ea2b631accbf779b5891befe0c
ScreenshotManager: 71d047abd38a77310985b87f8136b620c5c61e88
SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
Yoga: 1b1a12ff3d86a10565ea7cbe057d42f5e5fb2a07