Permalink
Browse files

Share bundled source URL to RN

Differential Revision: D6192988

fbshipit-source-id: efa584ee2340a34156956990d6cd96d37ba4ab60
  • Loading branch information...
Yujie Liu authored and facebook-github-bot committed Nov 8, 2017
1 parent 9ec9567 commit b983de9c5460e24c95a9a67f02695cd1c5f31bc5
Showing with 18 additions and 3 deletions.
  1. +5 −0 React/Base/RCTBridge.h
  2. +5 −0 React/Base/RCTBridge.m
  3. +6 −2 React/CxxBridge/RCTCxxBridge.mm
  4. +2 −1 React/Modules/RCTSourceCode.m
@@ -171,6 +171,11 @@ RCT_EXTERN NSString *RCTBridgeModuleNameForClass(Class bridgeModuleClass);
*/
@property (nonatomic, strong, readonly) NSURL *bundleURL;
/**
* URL of the original script (not necessarily loaded) of the bridge.
*/
@property (nonatomic, strong, readonly) NSURL *bundledSourceURL;
/**
* The class of the executor currently being used. Changes to this value will
* take effect after the bridge is reloaded.
@@ -329,6 +329,11 @@ - (void)setUp
// Sanitize the bundle URL
_bundleURL = [RCTConvert NSURL:_bundleURL.absoluteString];
if ([self.delegate respondsToSelector:@selector(bundledSourceURLForBridge:)]) {
_bundledSourceURL = [self.delegate bundledSourceURLForBridge:self];
_bundledSourceURL = [RCTConvert NSURL:_bundledSourceURL.absoluteString];
}
self.batchedBridge = [[bridgeClass alloc] initWithParentBridge:self];
[self.batchedBridge start];
@@ -175,10 +175,11 @@ @implementation RCTCxxBridge
std::shared_ptr<Instance> _reactInstance;
}
@synthesize bridgeDescription = _bridgeDescription;
@synthesize loading = _loading;
@synthesize valid = _valid;
@synthesize bundledSourceURL = _bundledSourceURL;
@synthesize performanceLogger = _performanceLogger;
@synthesize bridgeDescription = _bridgeDescription;
@synthesize valid = _valid;
+ (void)initialize
{
@@ -207,6 +208,9 @@ - (instancetype)initWithParentBridge:(RCTBridge *)bridge
launchOptions:bridge.launchOptions])) {
_parentBridge = bridge;
_performanceLogger = [bridge performanceLogger];
if ([bridge.delegate respondsToSelector:@selector(bundledSourceURLForBridge:)]) {
_bundledSourceURL = [bridge.delegate bundledSourceURLForBridge:bridge];
}
registerPerformanceLoggerHooks(_performanceLogger);
@@ -25,7 +25,8 @@ + (BOOL)requiresMainQueueSetup
- (NSDictionary<NSString *, id> *)constantsToExport
{
return @{
@"scriptURL": self.bridge.bundleURL.absoluteString ?: @""
@"scriptURL": self.bridge.bundleURL.absoluteString ?: @"",
@"bundledScriptURL": self.bridge.bundledSourceURL.absoluteString ?: @""
};
}

0 comments on commit b983de9

Please sign in to comment.