Add support for FBReactModule (Wilde) to use jsi/hermes with a bcbundle
Reviewed By: danzimm Differential Revision: D5983822 fbshipit-source-id: ae09c0a33988cb9c3d51e5a18b875698c19a1ec6
This commit is contained in:
parent
f71f8a936b
commit
0a7d5ab753
|
@ -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 @@ static NSURL *serverRootWithHost(NSString *host)
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue