diff --git a/packages/react-native/Libraries/Utilities/NativeDevSplitBundleLoader.js b/packages/react-native/Libraries/Utilities/NativeDevSplitBundleLoader.js deleted file mode 100644 index 8b23595b9eee55..00000000000000 --- a/packages/react-native/Libraries/Utilities/NativeDevSplitBundleLoader.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * 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. - * - * @flow strict - * @format - */ - -import type {TurboModule} from '../TurboModule/RCTExport'; - -import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; - -export interface Spec extends TurboModule { - +loadBundle: (bundlePath: string) => Promise; -} - -export default (TurboModuleRegistry.get('DevSplitBundleLoader'): ?Spec); diff --git a/packages/react-native/React/CoreModules/BUCK b/packages/react-native/React/CoreModules/BUCK index dec99e70172ec9..3aece1b87d474f 100644 --- a/packages/react-native/React/CoreModules/BUCK +++ b/packages/react-native/React/CoreModules/BUCK @@ -110,9 +110,6 @@ rn_apple_library( ) + react_module_plugin_providers( name = "DevLoadingView", native_class_func = "RCTDevLoadingViewCls", - ) + react_module_plugin_providers( - name = "DevSplitBundleLoader", - native_class_func = "RCTDevSplitBundleLoaderCls", ) + react_module_plugin_providers( name = "EventDispatcher", native_class_func = "RCTEventDispatcherCls", diff --git a/packages/react-native/React/CoreModules/CoreModulesPlugins.h b/packages/react-native/React/CoreModules/CoreModulesPlugins.h index e2a02a4e335bdf..f84955e063fb06 100644 --- a/packages/react-native/React/CoreModules/CoreModulesPlugins.h +++ b/packages/react-native/React/CoreModules/CoreModulesPlugins.h @@ -51,7 +51,6 @@ Class RCTLogBoxCls(void) __attribute__((used)); Class RCTWebSocketExecutorCls(void) __attribute__((used)); Class RCTWebSocketModuleCls(void) __attribute__((used)); Class RCTDevLoadingViewCls(void) __attribute__((used)); -Class RCTDevSplitBundleLoaderCls(void) __attribute__((used)); Class RCTEventDispatcherCls(void) __attribute__((used)); Class RCTBlobManagerCls(void) __attribute__((used)); diff --git a/packages/react-native/React/CoreModules/CoreModulesPlugins.mm b/packages/react-native/React/CoreModules/CoreModulesPlugins.mm index a782326e676af6..05fc3c4597e8cc 100644 --- a/packages/react-native/React/CoreModules/CoreModulesPlugins.mm +++ b/packages/react-native/React/CoreModules/CoreModulesPlugins.mm @@ -41,7 +41,6 @@ Class RCTCoreModulesClassProvider(const char *name) { {"WebSocketExecutor", RCTWebSocketExecutorCls}, {"WebSocketModule", RCTWebSocketModuleCls}, {"DevLoadingView", RCTDevLoadingViewCls}, - {"DevSplitBundleLoader", RCTDevSplitBundleLoaderCls}, {"EventDispatcher", RCTEventDispatcherCls}, {"BlobModule", RCTBlobManagerCls}, }; diff --git a/packages/react-native/React/CoreModules/RCTDevSplitBundleLoader.h b/packages/react-native/React/CoreModules/RCTDevSplitBundleLoader.h deleted file mode 100644 index c5a1efc3f5eb72..00000000000000 --- a/packages/react-native/React/CoreModules/RCTDevSplitBundleLoader.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * 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. - */ - -#import -#import -#import - -@interface RCTDevSplitBundleLoader : NSObject -@end diff --git a/packages/react-native/React/CoreModules/RCTDevSplitBundleLoader.mm b/packages/react-native/React/CoreModules/RCTDevSplitBundleLoader.mm deleted file mode 100644 index 9dd1b0ebd3ebf2..00000000000000 --- a/packages/react-native/React/CoreModules/RCTDevSplitBundleLoader.mm +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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. - */ - -#import - -#import -#import -#import -#import -#import -#import -#import - -#import "CoreModulesPlugins.h" - -using namespace facebook::react; - -@interface RCTDevSplitBundleLoader () -@end - -#if RCT_DEV_MENU | RCT_PACKAGER_LOADING_FUNCTIONALITY - -@implementation RCTDevSplitBundleLoader - -@synthesize bridge = _bridge; -@synthesize loadScript = _loadScript; -@synthesize moduleRegistry = _moduleRegistry; - -RCT_EXPORT_MODULE() - -+ (BOOL)requiresMainQueueSetup -{ - return NO; -} - -RCT_EXPORT_METHOD(loadBundle - : (NSString *)bundlePath resolve - : (RCTPromiseResolveBlock)resolve reject - : (RCTPromiseRejectBlock)reject) -{ - NSURL *sourceURL = [[RCTBundleURLProvider sharedSettings] jsBundleURLForSplitBundleRoot:bundlePath]; - if (_bridge) { - [_bridge loadAndExecuteSplitBundleURL:sourceURL - onError:^(NSError *error) { - reject(@"E_BUNDLE_LOAD_ERROR", [error localizedDescription], error); - } - onComplete:^() { - resolve(@YES); - }]; - } else { - __weak __typeof(self) weakSelf = self; - [RCTJavaScriptLoader loadBundleAtURL:sourceURL - onProgress:^(RCTLoadingProgress *progressData) { - // TODO: Setup loading bar. - } - onComplete:^(NSError *error, RCTSource *source) { - if (error) { - reject(@"E_BUNDLE_LOAD_ERROR", [error localizedDescription], error); - return; - } - __typeof(self) strongSelf = weakSelf; - if (strongSelf) { - strongSelf->_loadScript(source); - RCTDevSettings *devSettings = [strongSelf->_moduleRegistry moduleForName:"RCTDevSettings"]; - [devSettings setupHMRClientWithAdditionalBundleURL:source.url]; - resolve(@YES); - } - }]; - } -} - -- (std::shared_ptr)getTurboModule:(const ObjCTurboModule::InitParams &)params -{ - return std::make_shared(params); -} - -@end - -#else - -@implementation RCTDevSplitBundleLoader - -@synthesize loadScript = _loadScript; - -+ (NSString *)moduleName -{ - return nil; -} -- (void)loadBundle:(NSString *)bundlePath resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject; -{ -} -- (std::shared_ptr)getTurboModule:(const ObjCTurboModule::InitParams &)params -{ - return std::make_shared(params); -} - -@end - -#endif - -Class RCTDevSplitBundleLoaderCls(void) -{ - return RCTDevSplitBundleLoader.class; -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/BUCK b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/BUCK index 4d800183de2a21..0c327fd5a43c59 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/BUCK +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/BUCK @@ -39,7 +39,6 @@ rn_android_library( react_native_target("java/com/facebook/react/module/model:model"), react_native_target("java/com/facebook/react/modules/appearance:appearance"), react_native_target("java/com/facebook/react/modules/appregistry:appregistry"), - react_native_target("java/com/facebook/react/modules/bundleloader:bundleloader"), react_native_target("java/com/facebook/react/modules/debug:debug"), react_native_target("java/com/facebook/react/modules/debug:interfaces"), react_native_target("java/com/facebook/react/modules/deviceinfo:deviceinfo"), diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java index 464346b068800d..2c2fc48831c0d9 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java @@ -21,7 +21,6 @@ import com.facebook.react.module.annotations.ReactModuleList; import com.facebook.react.module.model.ReactModuleInfo; import com.facebook.react.module.model.ReactModuleInfoProvider; -import com.facebook.react.modules.bundleloader.NativeDevSplitBundleLoaderModule; import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; import com.facebook.react.modules.core.DeviceEventManagerModule; import com.facebook.react.modules.core.ExceptionsManagerModule; @@ -57,7 +56,6 @@ SourceCodeModule.class, TimingModule.class, UIManagerModule.class, - NativeDevSplitBundleLoaderModule.class, }) public class CoreModulesPackage extends TurboReactPackage implements ReactPackageLogger { @@ -103,7 +101,6 @@ public ReactModuleInfoProvider getReactModuleInfoProvider() { SourceCodeModule.class, TimingModule.class, UIManagerModule.class, - NativeDevSplitBundleLoaderModule.class, }; final Map reactModuleInfoMap = new HashMap<>(); @@ -160,9 +157,6 @@ public NativeModule getModule(String name, ReactApplicationContext reactContext) return createUIManager(reactContext); case DeviceInfoModule.NAME: return new DeviceInfoModule(reactContext); - case NativeDevSplitBundleLoaderModule.NAME: - return new NativeDevSplitBundleLoaderModule( - reactContext, mReactInstanceManager.getDevSupportManager()); default: throw new IllegalArgumentException( "In CoreModulesPackage, could not find Native module for " + name); diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/bundleloader/BUCK b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/bundleloader/BUCK deleted file mode 100644 index 3b4dc8a95b3ee6..00000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/bundleloader/BUCK +++ /dev/null @@ -1,22 +0,0 @@ -load("//tools/build_defs/oss:rn_defs.bzl", "react_native_dep", "react_native_root_target", "react_native_target", "rn_android_library") - -rn_android_library( - name = "bundleloader", - srcs = glob(["*.java"]), - autoglob = False, - labels = [ - "pfh:ReactNative_CommonInfrastructurePlaceholder", - ], - language = "JAVA", - visibility = [ - "PUBLIC", - ], - deps = [ - react_native_dep("third-party/android/androidx:annotation"), - react_native_target("java/com/facebook/react/bridge:bridge"), - react_native_target("java/com/facebook/react/common:common"), - react_native_target("java/com/facebook/react/devsupport:interfaces"), - react_native_target("java/com/facebook/react/module/annotations:annotations"), - ], - exported_deps = [react_native_root_target(":FBReactNativeSpec")], -) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/bundleloader/NativeDevSplitBundleLoaderModule.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/bundleloader/NativeDevSplitBundleLoaderModule.java deleted file mode 100644 index bd53892b17691c..00000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/bundleloader/NativeDevSplitBundleLoaderModule.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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. - */ - -package com.facebook.react.modules.bundleloader; - -import com.facebook.fbreact.specs.NativeDevSplitBundleLoaderSpec; -import com.facebook.react.bridge.Promise; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.common.DebugServerException; -import com.facebook.react.devsupport.interfaces.DevSplitBundleCallback; -import com.facebook.react.devsupport.interfaces.DevSupportManager; -import com.facebook.react.module.annotations.ReactModule; - -@ReactModule(name = NativeDevSplitBundleLoaderSpec.NAME) -public class NativeDevSplitBundleLoaderModule extends NativeDevSplitBundleLoaderSpec { - private static final String REJECTION_CODE = "E_BUNDLE_LOAD_ERROR"; - - private final DevSupportManager mDevSupportManager; - - public NativeDevSplitBundleLoaderModule( - ReactApplicationContext reactContext, DevSupportManager devSupportManager) { - super(reactContext); - mDevSupportManager = devSupportManager; - } - - @Override - public void loadBundle(String bundlePath, final Promise promise) { - mDevSupportManager.loadSplitBundleFromServer( - bundlePath, - new DevSplitBundleCallback() { - @Override - public void onSuccess() { - promise.resolve(true); - } - - @Override - public void onError(String url, Throwable cause) { - String message = - cause instanceof DebugServerException - ? ((DebugServerException) cause).getOriginalMessage() - : "Unknown error fetching '" + url + "'."; - promise.reject(REJECTION_CODE, message, cause); - } - }); - } -}