Permalink
Browse files

Add support for FBReactModule (Wilde) to use jsi/hermes with a bcbundle

Reviewed By: danzimm

Differential Revision: D5983822

fbshipit-source-id: ae09c0a33988cb9c3d51e5a18b875698c19a1ec6
  • Loading branch information...
mhorowitz authored and facebook-github-bot committed Oct 16, 2017
1 parent f71f8a9 commit 0a7d5ab75333b914d478d6027ef111f288e59b25
Showing with 23 additions and 9 deletions.
  1. +10 −0 React/Base/RCTBundleURLProvider.h
  2. +13 −9 React/Base/RCTBundleURLProvider.m
@@ -25,6 +25,16 @@ extern const NSUInteger kRCTBundleURLProviderDefaultPort;
*/
- (void)resetToDefaults;
/**
* Returns the jsBundleURL for a given bundle entrypoint and
* the fallback offline JS bundle if the packager is not running.
* if resourceName or extension are nil, "main" and "jsbundle" will be
* used, respectively.
*/
- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
fallbackResource:(NSString *)resourceName
fallbackExtension:(NSString *)extension;
/**
* Returns the jsBundleURL for a given bundle entrypoint and
* the fallback offline JS bundle if the packager is not running.
@@ -117,22 +117,26 @@ - (NSURL *)packagerServerURL
return host ? serverRootWithHost(host) : nil;
}
- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot fallbackResource:(NSString *)resourceName
- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot fallbackResource:(NSString *)resourceName fallbackExtension:(NSString *)extension
{
resourceName = resourceName ?: @"main";
NSString *packagerServerHost = [self packagerServerHost];
if (!packagerServerHost) {
return [[NSBundle mainBundle] URLForResource:resourceName withExtension:@"jsbundle"];
resourceName = resourceName ?: @"main";
extension = extension ?: @"jsbundle";
return [[NSBundle mainBundle] URLForResource:resourceName withExtension:extension];
} else {
NSString *path = [NSString stringWithFormat:@"/%@.bundle", bundleRoot];
// When we support only iOS 8 and above, use queryItems for a better API.
NSString *query = [NSString stringWithFormat:@"platform=ios&dev=%@&minify=%@",
[self enableDev] ? @"true" : @"false",
[self enableMinification] ? @"true": @"false"];
return [[self class] resourceURLForResourcePath:path packagerHost:packagerServerHost query:query];
return [RCTBundleURLProvider jsBundleURLForBundleRoot:bundleRoot
packagerHost:packagerServerHost
enableDev:[self enableDev]
enableMinification:[self enableMinification]];
}
}
- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot fallbackResource:(NSString *)resourceName
{
return [self jsBundleURLForBundleRoot:bundleRoot fallbackResource:resourceName fallbackExtension:nil];
}
- (NSURL *)resourceURLForResourceRoot:(NSString *)root
resourceName:(NSString *)name
resourceExtension:(NSString *)extension

0 comments on commit 0a7d5ab

Please sign in to comment.