From 1b4bd356cfcdeb63fc2700821fcd718b710df14a Mon Sep 17 00:00:00 2001 From: Dratwas Date: Mon, 17 Jun 2019 21:55:56 +0200 Subject: [PATCH 1/9] WIP --- React/Base/RCTFileBundleLoader.h | 33 +++ React/Base/RCTFileBundleLoader.mm | 118 ++++++++++ React/Base/RCTJavaScriptLoader.mm | 12 +- React/Base/RCTNetworkBundleLoader.h | 28 +++ React/Base/RCTNetworkBundleLoader.mm | 120 ++++++++++ React/CxxBridge/RCTCxxBridge.mm | 49 +++-- React/CxxBridge/RCTObjcExecutor.mm | 17 +- React/React.xcodeproj/project.pbxproj | 207 ++++++++++++------ ReactCommon/cxxreact/JSExecutor.h | 1 - ReactCommon/cxxreact/RAMBundle.h | 1 - .../jsiexecutor/jsireact/JSIExecutor.cpp | 3 +- 11 files changed, 479 insertions(+), 110 deletions(-) create mode 100644 React/Base/RCTFileBundleLoader.h create mode 100644 React/Base/RCTFileBundleLoader.mm create mode 100644 React/Base/RCTNetworkBundleLoader.h create mode 100644 React/Base/RCTNetworkBundleLoader.mm diff --git a/React/Base/RCTFileBundleLoader.h b/React/Base/RCTFileBundleLoader.h new file mode 100644 index 000000000000..fc875e508151 --- /dev/null +++ b/React/Base/RCTFileBundleLoader.h @@ -0,0 +1,33 @@ +#pragma once + +#import +#import +#import +#import + +NS_ENUM(NSInteger) { + RCTFileBundleLoaderErrorNoScriptURL = 1, + RCTFileBundleLoaderErrorFailedOpeningFile = 2, + RCTFileBundleLoaderErrorFailedReadingFile = 3, + RCTFileBundleLoaderErrorFailedStatingFile = 3, + RCTFileBundleLoaderErrorBCVersion = 4, + RCTFileBundleLoaderErrorBCNotSupported = 4, + RCTFileBundleLoaderErrorCannotBeLoadedSynchronously = 1000, +}; + +namespace facebook { + namespace react { + + class RCTFileBundleLoader : public BundleLoader { + public: + + RCTFileBundleLoader() {}; + ~RCTFileBundleLoader() {} + + std::unique_ptr getBundle(std::string bundleURL) const override; + std::string getBundleURLFromName(std::string bundleName) const override; + + }; + + } // namespace react +} // namespace facebook diff --git a/React/Base/RCTFileBundleLoader.mm b/React/Base/RCTFileBundleLoader.mm new file mode 100644 index 000000000000..8d82eb452585 --- /dev/null +++ b/React/Base/RCTFileBundleLoader.mm @@ -0,0 +1,118 @@ +#import "RCTFileBundleLoader.h" + +#import + +#import +#import +#import "NSDataBigString.h" + + +NSString *const RCTFileBundleLoaderErrorDomain = @"RCTFileBundleLoaderErrorDomain"; +static const int32_t JSNoBytecodeFileFormatVersion = -1; + +//TODO FIGURE OUT ERRORS +namespace facebook { + namespace react { + + std::unique_ptr RCTFileBundleLoader::getBundle(std::string bundleURL) const { + const uint32_t runtimeBCVersion = JSNoBytecodeFileFormatVersion; + NSError *error; + FILE *bundle = fopen(bundleURL.c_str(), "r"); + if (!bundle) { + if (error) { + error = [NSError errorWithDomain:RCTFileBundleLoaderErrorDomain + code:RCTFileBundleLoaderErrorFailedOpeningFile + userInfo:@{NSLocalizedDescriptionKey: + [NSString stringWithFormat:@"Error opening bundle %s", bundleURL.c_str()]}]; + } + } + facebook::react::BundleHeader header; + size_t readResult = fread(&header, sizeof(header), 1, bundle); + fclose(bundle); + if (readResult != 1) { + if (error) { + error = [NSError errorWithDomain:RCTFileBundleLoaderErrorDomain + code:RCTFileBundleLoaderErrorFailedReadingFile + userInfo:@{NSLocalizedDescriptionKey: + [NSString stringWithFormat:@"Error reading bundle %s", bundleURL.c_str()]}]; + } + return nil; + } + facebook::react::BundleType tag = facebook::react::Bundle::parseTypeFromHeader(header); + switch (tag) { + case facebook::react::BundleType::IndexedRAMBundle: { + struct stat statInfo; + if (stat(bundleURL.c_str(), &statInfo) != 0) { + if (error) { + error = [NSError errorWithDomain:RCTFileBundleLoaderErrorDomain + code:RCTFileBundleLoaderErrorFailedStatingFile + userInfo:@{NSLocalizedDescriptionKey: + [NSString stringWithFormat:@"Error stating bundle %s", bundleURL.c_str()]}]; + } + return nil; + } + + return std::make_unique(bundleURL.c_str(), bundleURL.c_str()); + } + break; + case facebook::react::BundleType::DeltaBundle: + case facebook::react::BundleType::FileRAMBundle: + // Not sure if delta or file RAM bundles are supported on iOS + return nil; + case facebook::react::BundleType::BasicBundle: { +#if RCT_ENABLE_INSPECTOR + NSData *source = [NSData dataWithContentsOfFile:bundleURL + options:NSDataReadingMappedIfSafe + error:error]; + if (sourceLength && source != nil) { + *sourceLength = source.length; + } + std::unique_ptr script = std::make_unique(source); + std::unique_ptr = std::make_unique(std::move(script), bundleURL); + return ; +#else + if (error) { + error = [NSError errorWithDomain:RCTFileBundleLoaderErrorDomain + code:RCTFileBundleLoaderErrorCannotBeLoadedSynchronously + userInfo:@{NSLocalizedDescriptionKey: + @"Cannot load text/javascript files synchronously"}]; + } + return nil; +#endif + } + // WHAT IS IT FOR? + case facebook::react::BundleType::BCBundle:{ + if (runtimeBCVersion == JSNoBytecodeFileFormatVersion || runtimeBCVersion < 0) { + if (error) { + error = [NSError errorWithDomain:RCTFileBundleLoaderErrorDomain + code:RCTFileBundleLoaderErrorBCNotSupported + userInfo:@{NSLocalizedDescriptionKey: + @"Bytecode bundles are not supported by this runtime."}]; + } + return nil; + } + else if ((uint32_t)runtimeBCVersion != header.version) { + if (error) { + NSString *errDesc = + [NSString stringWithFormat:@"BC Version Mismatch. Expect: %d, Actual: %u", + runtimeBCVersion, header.version]; + + error = [NSError errorWithDomain:RCTFileBundleLoaderErrorDomain + code:RCTFileBundleLoaderErrorBCVersion + userInfo:@{NSLocalizedDescriptionKey: errDesc}]; + } + return nil; + } + break; + } + } + } + + std::string RCTFileBundleLoader::getBundleURLFromName(std::string bundleName) const { + //TODO +// return bundlesContainer_->getSourceURLByName(bundleName); + return "index"; + } + + } // namespace react +} // namespace facebook diff --git a/React/Base/RCTJavaScriptLoader.mm b/React/Base/RCTJavaScriptLoader.mm index 5f14bd22ac4d..2a7cf5c8594f 100755 --- a/React/Base/RCTJavaScriptLoader.mm +++ b/React/Base/RCTJavaScriptLoader.mm @@ -9,7 +9,7 @@ #import -#import +#import #import "RCTBridge.h" #import "RCTConvert.h" @@ -151,12 +151,14 @@ + (NSData *)attemptSynchronousLoadOfBundleAtURL:(NSURL *)scriptURL return nil; } - facebook::react::ScriptTag tag = facebook::react::parseTypeFromHeader(header); + facebook::react::BundleType tag = facebook::react::Bundle::parseTypeFromHeader(header); switch (tag) { - case facebook::react::ScriptTag::RAMBundle: + case facebook::react::BundleType::IndexedRAMBundle: + case facebook::react::BundleType::FileRAMBundle: + case facebook::react::BundleType::DeltaBundle: break; - case facebook::react::ScriptTag::String: { + case facebook::react::BundleType::BasicBundle: { #if RCT_ENABLE_INSPECTOR NSData *source = [NSData dataWithContentsOfFile:scriptURL.path options:NSDataReadingMappedIfSafe @@ -175,7 +177,7 @@ + (NSData *)attemptSynchronousLoadOfBundleAtURL:(NSURL *)scriptURL return nil; #endif } - case facebook::react::ScriptTag::BCBundle: + case facebook::react::BundleType::BCBundle: if (runtimeBCVersion == JSNoBytecodeFileFormatVersion || runtimeBCVersion < 0) { if (error) { *error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain diff --git a/React/Base/RCTNetworkBundleLoader.h b/React/Base/RCTNetworkBundleLoader.h new file mode 100644 index 000000000000..7e4876e5fdfa --- /dev/null +++ b/React/Base/RCTNetworkBundleLoader.h @@ -0,0 +1,28 @@ +#pragma once + +#import +#import +#import + +#import + +NS_ENUM(NSInteger) { + RCTNetworkBundleLoaderErrorURLLoadFailed = 3, +}; + +namespace facebook { + namespace react { + + class RCTNetworkBundleLoader : public BundleLoader { + public: + + RCTNetworkBundleLoader(//TODO //) {}; + ~RCTNetworkBundleLoader() {} + + std::unique_ptr getBundle(std::string bundleURL) const override; + std::string getBundleURLFromName(std::string bundleName) const override; + + }; + + } // namespace react +} // namespace facebook diff --git a/React/Base/RCTNetworkBundleLoader.mm b/React/Base/RCTNetworkBundleLoader.mm new file mode 100644 index 000000000000..9b3918af5265 --- /dev/null +++ b/React/Base/RCTNetworkBundleLoader.mm @@ -0,0 +1,120 @@ +#import "RCTNetworkBundleLoader.h" + +#import "RCTMultipartDataTask.h" +#import +#import +#import +#import "RCTUtils.h" + +NSString *const RCTNetworkBundleLoaderErrorDomain = @"RCTNetworkBundleLoaderErrorDomain"; + + +namespace facebook { + namespace react { + + static NSDictionary *userInfoForRawResponse(NSString *rawText) + { + NSDictionary *parsedResponse = RCTJSONParse(rawText, nil); + if (![parsedResponse isKindOfClass:[NSDictionary class]]) { + return @{NSLocalizedDescriptionKey: rawText}; + } + NSArray *errors = parsedResponse[@"errors"]; + if (![errors isKindOfClass:[NSArray class]]) { + return @{NSLocalizedDescriptionKey: rawText}; + } + NSMutableArray *fakeStack = [NSMutableArray new]; + for (NSDictionary *err in errors) { + [fakeStack addObject: @{ + @"methodName": err[@"description"] ?: @"", + @"file": err[@"filename"] ?: @"", + @"lineNumber": err[@"lineNumber"] ?: @0 + }]; + } + return @{NSLocalizedDescriptionKey: parsedResponse[@"message"] ?: @"No message provided", @"stack": [fakeStack copy]}; + } + + std::unique_ptr RCTNetworkBundleLoader::getBundle(std::string bundleURL) const { + NSURL *sourceURL = [[NSURL alloc] initWithString:[NSString stringWithUTF8String:bundleURL.c_str()]]; + RCTMultipartDataTask *task = [[RCTMultipartDataTask alloc] initWithURL:sourceURL partHandler:^(NSInteger statusCode, NSDictionary *headers, NSData *data, NSError *error, BOOL done) { + if (!done) { +// if (onProgress) { +// onProgress(progressEventFromData(data)); +// } + return; + } + + // Handle general request errors + if (error) { + if ([error.domain isEqualToString:NSURLErrorDomain]) { + error = [NSError errorWithDomain:RCTNetworkBundleLoaderErrorDomain + code:RCTNetworkBundleLoaderErrorURLLoadFailed + userInfo: + @{ + NSLocalizedDescriptionKey: + [@"Could not connect to development server.\n\n" + "Ensure the following:\n" + "- Node server is running and available on the same network - run 'npm start' from react-native root\n" + "- Node server URL is correctly set in AppDelegate\n" + "- WiFi is enabled and connected to the same network as the Node Server\n\n" + "URL: " stringByAppendingString:sourceURL.absoluteString], + NSLocalizedFailureReasonErrorKey: error.localizedDescription, + NSUnderlyingErrorKey: error, + }]; + } +// onComplete(error, nil); + return; + } + + // For multipart responses packager sets X-Http-Status header in case HTTP status code + // is different from 200 OK + NSString *statusCodeHeader = headers[@"X-Http-Status"]; + if (statusCodeHeader) { + statusCode = [statusCodeHeader integerValue]; + } + + if (statusCode != 200) { + error = [NSError errorWithDomain:@"JSServer" + code:statusCode + userInfo:userInfoForRawResponse([[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding])]; +// onComplete(error, nil); + return; + } + + // Validate that the packager actually returned javascript. + NSString *contentType = headers[@"Content-Type"]; + NSString *mimeType = [[contentType componentsSeparatedByString:@";"] firstObject]; + if (![mimeType isEqualToString:@"application/javascript"] && + ![mimeType isEqualToString:@"text/javascript"]) { + NSString *description = [NSString stringWithFormat:@"Expected MIME-Type to be 'application/javascript' or 'text/javascript', but got '%@'.", mimeType]; + error = [NSError errorWithDomain:@"JSServer" + code:NSURLErrorCannotParseResponse + userInfo:@{ + NSLocalizedDescriptionKey: description, + @"headers": headers, + @"data": data + }]; +// onComplete(error, nil); + return; + } + +// RCTSource *source = RCTSourceCreate(scriptURL, data, data.length); +// parseHeaders(headers, source); +// onComplete(nil, source); + } progressHandler:^(NSDictionary *headers, NSNumber *loaded, NSNumber *total) { + // Only care about download progress events for the javascript bundle part. + if ([headers[@"Content-Type"] isEqualToString:@"application/javascript"]) { +// onProgress(progressEventFromDownloadProgress(loaded, total)); + } + }]; + + [task startTask]; + } + + std::string RCTNetworkBundleLoader::getBundleURLFromName(std::string bundleName) const { + //TODO + // return bundlesContainer_->getSourceURLByName(bundleName); + return "index"; + } + + } // namespace react +} // namespace facebook diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index 194b06c96c90..c8f3cbf2be10 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -26,12 +26,14 @@ #import #import #import +#import #import #import -#import -#import +#import +#import +#import #import -#import +#import #import #import @@ -40,6 +42,7 @@ #import "RCTMessageThread.h" #import "RCTObjcExecutor.h" + #ifdef WITH_FBSYSTRACE #import #endif @@ -93,12 +96,6 @@ typedef NS_ENUM(NSUInteger, RCTBridgeFields) { } -static bool isRAMBundle(NSData *script) { - BundleHeader header; - [script getBytes:&header length:sizeof(header)]; - return parseTypeFromHeader(header) == ScriptTag::RAMBundle; -} - static void registerPerformanceLoggerHooks(RCTPerformanceLogger *performanceLogger) { __weak RCTPerformanceLogger *weakPerformanceLogger = performanceLogger; ReactMarker::logTaggedMarker = [weakPerformanceLogger](const ReactMarker::ReactMarkerId markerId, const char *tag) { @@ -1286,20 +1283,26 @@ - (void)executeApplicationScript:(NSData *)script [[NSNotificationCenter defaultCenter] postNotificationName:RCTJavaScriptWillStartExecutingNotification object:self->_parentBridge userInfo:@{@"bridge": self}]; - if (isRAMBundle(script)) { + if (url.isFileURL) { + std::unique_ptr loader = std::make_unique(); + } else { + + //TODO create bundle loader + } + if (IndexedRAMBundle::isIndexedRAMBundle(sourceUrlStr.UTF8String)) { [self->_performanceLogger markStartForTag:RCTPLRAMBundleLoad]; - auto ramBundle = std::make_unique(sourceUrlStr.UTF8String); - std::unique_ptr scriptStr = ramBundle->getStartupCode(); + auto ramBundle = std::make_unique(sourceUrlStr.UTF8String, sourceUrlStr.UTF8String); + std::unique_ptr scriptStr = ramBundle->getStartupScript(); [self->_performanceLogger markStopForTag:RCTPLRAMBundleLoad]; [self->_performanceLogger setValue:scriptStr->size() forTag:RCTPLRAMStartupCodeSize]; if (self->_reactInstance) { - auto registry = RAMBundleRegistry::multipleBundlesRegistry(std::move(ramBundle), JSIndexedRAMBundle::buildFactory()); - self->_reactInstance->loadRAMBundle(std::move(registry), std::move(scriptStr), - sourceUrlStr.UTF8String, !async); +// auto registry = RAMBundleRegistry::multipleBundlesRegistry(std::move(ramBundle), JSIndexedRAMBundle::buildFactory()); +// self->_reactInstance->loadRAMBundle(std::move(registry), std::move(scriptStr), +// sourceUrlStr.UTF8String, !async); } } else if (self->_reactInstance) { - self->_reactInstance->loadScriptFromString(std::make_unique(script), - sourceUrlStr.UTF8String, !async); +// self->_reactInstance->loadScriptFromString(std::make_unique(script), +// sourceUrlStr.UTF8String, !async); } else { std::string methodName = async ? "loadApplicationScript" : "loadApplicationScriptSync"; throw std::logic_error("Attempt to call " + methodName + ": on uninitialized bridge"); @@ -1307,12 +1310,12 @@ - (void)executeApplicationScript:(NSData *)script }]; } -- (void)registerSegmentWithId:(NSUInteger)segmentId path:(NSString *)path -{ - if (_reactInstance) { - _reactInstance->registerBundle(static_cast(segmentId), path.UTF8String); - } -} +//- (void)registerSegmentWithId:(NSUInteger)segmentId path:(NSString *)path +//{ +// if (_reactInstance) { +// _reactInstance->registerBundle(static_cast(segmentId), path.UTF8String); +// } +//} #pragma mark - Payload Processing diff --git a/React/CxxBridge/RCTObjcExecutor.mm b/React/CxxBridge/RCTObjcExecutor.mm index 448562f5935e..257f59ef9bde 100644 --- a/React/CxxBridge/RCTObjcExecutor.mm +++ b/React/CxxBridge/RCTObjcExecutor.mm @@ -17,7 +17,7 @@ #import #import #import -#import +#import #import namespace facebook { @@ -74,7 +74,7 @@ std::make_unique(folly::toJson(config))); } - void loadApplicationScript( + void loadScript( std::unique_ptr script, std::string sourceURL) override { RCTProfileBeginFlowEvent(); @@ -92,14 +92,11 @@ void loadApplicationScript( [m_jse flushedQueue:m_jsCallback]; }]; } - - void setBundleRegistry(std::unique_ptr) override { - RCTAssert(NO, @"RAM bundles are not supported in RCTObjcExecutor"); - } - - void registerBundle(uint32_t bundleId, const std::string &bundlePath) override { - RCTAssert(NO, @"RAM bundles are not supported in RCTObjcExecutor"); - } + + void setupEnvironment(std::function loadBundle, + std::function getModule) override { + + }; void callFunction(const std::string &module, const std::string &method, const folly::dynamic &arguments) override { diff --git a/React/React.xcodeproj/project.pbxproj b/React/React.xcodeproj/project.pbxproj index 28fcfe85b171..ffb72f896f63 100644 --- a/React/React.xcodeproj/project.pbxproj +++ b/React/React.xcodeproj/project.pbxproj @@ -123,15 +123,12 @@ 13F8875A1E2971D400C3C7A1 /* Unicode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13F887541E2971C500C3C7A1 /* Unicode.cpp */; }; 13F8876E1E29726200C3C7A1 /* CxxNativeModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0A81E03699D0018521A /* CxxNativeModule.cpp */; }; 13F887701E29726200C3C7A1 /* Instance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0AE1E03699D0018521A /* Instance.cpp */; }; - 13F887711E29726200C3C7A1 /* JSBundleType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC70D2EB1DE48A22002E6351 /* JSBundleType.cpp */; }; - 13F8877B1E29726200C3C7A1 /* JSIndexedRAMBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0C61E03699D0018521A /* JSIndexedRAMBundle.cpp */; }; 13F8877C1E29726200C3C7A1 /* MethodCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CA1E03699D0018521A /* MethodCall.cpp */; }; 13F8877D1E29726200C3C7A1 /* ModuleRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CC1E03699D0018521A /* ModuleRegistry.cpp */; }; 13F8877E1E29726200C3C7A1 /* NativeToJsBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CF1E03699D0018521A /* NativeToJsBridge.cpp */; }; 13F887801E29726200C3C7A1 /* SampleCxxModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0D31E03699D0018521A /* SampleCxxModule.cpp */; }; 13F887821E29726300C3C7A1 /* CxxNativeModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0A81E03699D0018521A /* CxxNativeModule.cpp */; }; 13F887841E29726300C3C7A1 /* Instance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0AE1E03699D0018521A /* Instance.cpp */; }; - 13F8878E1E29726300C3C7A1 /* JSIndexedRAMBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0C61E03699D0018521A /* JSIndexedRAMBundle.cpp */; }; 13F8878F1E29726300C3C7A1 /* MethodCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CA1E03699D0018521A /* MethodCall.cpp */; }; 13F887901E29726300C3C7A1 /* ModuleRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CC1E03699D0018521A /* ModuleRegistry.cpp */; }; 13F887911E29726300C3C7A1 /* NativeToJsBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CF1E03699D0018521A /* NativeToJsBridge.cpp */; }; @@ -168,7 +165,6 @@ 27595AA91E575C7800CCE2B1 /* Instance.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AF1E03699D0018521A /* Instance.h */; }; 27595AAA1E575C7800CCE2B1 /* JsArgumentHelpers-inl.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */; }; 27595AAB1E575C7800CCE2B1 /* JsArgumentHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */; }; - 27595AB51E575C7800CCE2B1 /* JSIndexedRAMBundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C71E03699D0018521A /* JSIndexedRAMBundle.h */; }; 27595AB61E575C7800CCE2B1 /* MessageQueueThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C91E03699D0018521A /* MessageQueueThread.h */; }; 27595AB71E575C7800CCE2B1 /* MethodCall.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CB1E03699D0018521A /* MethodCall.h */; }; 27595AB81E575C7800CCE2B1 /* ModuleRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CD1E03699D0018521A /* ModuleRegistry.h */; }; @@ -182,7 +178,6 @@ 27595AC41E575C7800CCE2B1 /* Instance.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AF1E03699D0018521A /* Instance.h */; }; 27595AC51E575C7800CCE2B1 /* JsArgumentHelpers-inl.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */; }; 27595AC61E575C7800CCE2B1 /* JsArgumentHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */; }; - 27595AD01E575C7800CCE2B1 /* JSIndexedRAMBundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C71E03699D0018521A /* JSIndexedRAMBundle.h */; }; 27595AD11E575C7800CCE2B1 /* MessageQueueThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C91E03699D0018521A /* MessageQueueThread.h */; }; 27595AD21E575C7800CCE2B1 /* MethodCall.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CB1E03699D0018521A /* MethodCall.h */; }; 27595AD31E575C7800CCE2B1 /* ModuleRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CD1E03699D0018521A /* ModuleRegistry.h */; }; @@ -370,7 +365,6 @@ 3D302F9A1DF828F800D6DDAE /* RCTViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E0674D1A70F44B002CDEE1 /* RCTViewManager.h */; }; 3D302F9D1DF828F800D6DDAE /* RCTWrapperViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 13B080231A694A8400A75B9A /* RCTWrapperViewController.h */; }; 3D302F9F1DF828F800D6DDAE /* UIView+React.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E067531A70F44B002CDEE1 /* UIView+React.h */; }; - 3D3030221DF8294C00D6DDAE /* JSBundleType.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D3CD8F51DE5FB2300167DC4 /* JSBundleType.h */; }; 3D37B5821D522B190042D5B5 /* RCTFont.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D37B5811D522B190042D5B5 /* RCTFont.mm */; }; 3D383D1F1EBD27A8005632C8 /* RCTBridge+Private.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14A43DB81C1F849600794BC8 /* RCTBridge+Private.h */; }; 3D383D201EBD27AF005632C8 /* RCTBridge+Private.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14A43DB81C1F849600794BC8 /* RCTBridge+Private.h */; }; @@ -418,11 +412,8 @@ 3D383D6F1EBD2940005632C8 /* libthird-party.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139D7ECE1E25DB7D00323FB7 /* libthird-party.a */; }; 3D383D721EBD2949005632C8 /* libthird-party.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D383D3C1EBD27B6005632C8 /* libthird-party.a */; }; 3D3CD9411DE5FC5300167DC4 /* libcxxreact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D3CD9251DE5FBEC00167DC4 /* libcxxreact.a */; }; - 3D3CD9451DE5FC7100167DC4 /* JSBundleType.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D3CD8F51DE5FB2300167DC4 /* JSBundleType.h */; }; 3D74547C1E54758900E74ADD /* JSBigString.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7454781E54757500E74ADD /* JSBigString.h */; }; 3D74547D1E54758900E74ADD /* JSBigString.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7454781E54757500E74ADD /* JSBigString.h */; }; - 3D74547E1E54759A00E74ADD /* JSModulesUnbundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C81E03699D0018521A /* JSModulesUnbundle.h */; }; - 3D74547F1E54759E00E74ADD /* JSModulesUnbundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C81E03699D0018521A /* JSModulesUnbundle.h */; }; 3D7454801E5475AF00E74ADD /* RecoverableError.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7454791E54757500E74ADD /* RecoverableError.h */; }; 3D7454811E5475AF00E74ADD /* RecoverableError.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7454791E54757500E74ADD /* RecoverableError.h */; }; 3D7749441DC1065C007EC8D8 /* RCTPlatform.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D7749431DC1065C007EC8D8 /* RCTPlatform.m */; }; @@ -445,7 +436,6 @@ 3D7BFD311EA8E41F008DFB7A /* RCTPackagerClient.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7BFD0B1EA8E351008DFB7A /* RCTPackagerClient.h */; }; 3D7BFD331EA8E433008DFB7A /* RCTPackagerClient.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7BFD0B1EA8E351008DFB7A /* RCTPackagerClient.h */; }; 3D7BFD351EA8E43F008DFB7A /* RCTDevSettings.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 130E3D861E6A082100ACE484 /* RCTDevSettings.h */; }; - 3D80D9181DF6F7A80028D040 /* JSBundleType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC70D2EB1DE48A22002E6351 /* JSBundleType.cpp */; }; 3D80D91B1DF6F8200028D040 /* RCTPlatform.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D7749431DC1065C007EC8D8 /* RCTPlatform.m */; }; 3D80D91F1DF6FA890028D040 /* RCTImageLoader.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA0831DE4F3A000E03CC6 /* RCTImageLoader.h */; }; 3D80D9201DF6FA890028D040 /* RCTImageStoreManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA0841DE4F3A000E03CC6 /* RCTImageStoreManager.h */; }; @@ -651,9 +641,6 @@ 3DA981A61E5B0E34004F2374 /* JsArgumentHelpers-inl.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */; }; 3DA981A71E5B0E34004F2374 /* JsArgumentHelpers.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */; }; 3DA981A81E5B0E34004F2374 /* JSBigString.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7454781E54757500E74ADD /* JSBigString.h */; }; - 3DA981A91E5B0E34004F2374 /* JSBundleType.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D3CD8F51DE5FB2300167DC4 /* JSBundleType.h */; }; - 3DA981B31E5B0E34004F2374 /* JSIndexedRAMBundle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C71E03699D0018521A /* JSIndexedRAMBundle.h */; }; - 3DA981B41E5B0E34004F2374 /* JSModulesUnbundle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C81E03699D0018521A /* JSModulesUnbundle.h */; }; 3DA981B51E5B0E34004F2374 /* MessageQueueThread.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C91E03699D0018521A /* MessageQueueThread.h */; }; 3DA981B61E5B0E34004F2374 /* MethodCall.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CB1E03699D0018521A /* MethodCall.h */; }; 3DA981B71E5B0E34004F2374 /* ModuleRegistry.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CD1E03699D0018521A /* ModuleRegistry.h */; }; @@ -762,9 +749,6 @@ 3DA982411E5B1053004F2374 /* JsArgumentHelpers-inl.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */; }; 3DA982421E5B1053004F2374 /* JsArgumentHelpers.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */; }; 3DA982431E5B1053004F2374 /* JSBigString.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7454781E54757500E74ADD /* JSBigString.h */; }; - 3DA982441E5B1053004F2374 /* JSBundleType.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D3CD8F51DE5FB2300167DC4 /* JSBundleType.h */; }; - 3DA9824E1E5B1053004F2374 /* JSIndexedRAMBundle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C71E03699D0018521A /* JSIndexedRAMBundle.h */; }; - 3DA9824F1E5B1053004F2374 /* JSModulesUnbundle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C81E03699D0018521A /* JSModulesUnbundle.h */; }; 3DA982501E5B1053004F2374 /* MessageQueueThread.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C91E03699D0018521A /* MessageQueueThread.h */; }; 3DA982511E5B1053004F2374 /* MethodCall.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CB1E03699D0018521A /* MethodCall.h */; }; 3DA982521E5B1053004F2374 /* ModuleRegistry.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CD1E03699D0018521A /* ModuleRegistry.h */; }; @@ -891,7 +875,6 @@ 597633371F4E021D005BE8A4 /* RCTShadowView+Internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 597633341F4E021D005BE8A4 /* RCTShadowView+Internal.m */; }; 597633381F4E021D005BE8A4 /* RCTShadowView+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 597633351F4E021D005BE8A4 /* RCTShadowView+Internal.h */; }; 597633391F4E021D005BE8A4 /* RCTShadowView+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 597633351F4E021D005BE8A4 /* RCTShadowView+Internal.h */; }; - 598FD1921F816A2A006C54CB /* RAMBundleRegistry.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = C6D380181F71D75B00621378 /* RAMBundleRegistry.h */; }; 598FD1951F817335006C54CB /* RCTModalManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 91076A881F743AB00081B4FA /* RCTModalManager.h */; }; 598FD1961F817335006C54CB /* RCTModalManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 91076A871F743AB00081B4FA /* RCTModalManager.m */; }; 598FD1971F817336006C54CB /* RCTModalManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 91076A881F743AB00081B4FA /* RCTModalManager.h */; }; @@ -1007,6 +990,55 @@ 66CD94B71F1045E700CB3C7C /* RCTMaskedViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 66CD94B01F1045E700CB3C7C /* RCTMaskedViewManager.m */; }; 66CD94B81F1045E700CB3C7C /* RCTMaskedViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 66CD94B01F1045E700CB3C7C /* RCTMaskedViewManager.m */; }; 68EFE4EE1CF6EB3900A1DE13 /* RCTBundleURLProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 68EFE4ED1CF6EB3900A1DE13 /* RCTBundleURLProvider.m */; }; + 690D491922B79FFB0039D9D6 /* RCTNetworkBundleLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 690D491822B79FFB0039D9D6 /* RCTNetworkBundleLoader.h */; }; + 690D491A22B79FFB0039D9D6 /* RCTNetworkBundleLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 690D491822B79FFB0039D9D6 /* RCTNetworkBundleLoader.h */; }; + 690D491C22B7A0560039D9D6 /* RCTNetworkBundleLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 690D491B22B7A0560039D9D6 /* RCTNetworkBundleLoader.mm */; }; + 690D491D22B7A0560039D9D6 /* RCTNetworkBundleLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 690D491B22B7A0560039D9D6 /* RCTNetworkBundleLoader.mm */; }; + 697ACDB122B2B303003C13DF /* BasicBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697ACDA022B2A3D7003C13DF /* BasicBundle.cpp */; }; + 697ACDB222B2B309003C13DF /* BasicBundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9322B2A3D6003C13DF /* BasicBundle.h */; }; + 697ACDB322B2B31C003C13DF /* Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697ACD9622B2A3D6003C13DF /* Bundle.cpp */; }; + 697ACDB422B2B31C003C13DF /* Bundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9822B2A3D6003C13DF /* Bundle.h */; }; + 697ACDB522B2B31C003C13DF /* BundleLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9422B2A3D6003C13DF /* BundleLoader.h */; }; + 697ACDB622B2B31C003C13DF /* BundleRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697ACD9122B2A3D6003C13DF /* BundleRegistry.cpp */; }; + 697ACDB722B2B31C003C13DF /* BundleRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9522B2A3D6003C13DF /* BundleRegistry.h */; }; + 697ACDB822B2B31C003C13DF /* DeltaBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697ACD9F22B2A3D7003C13DF /* DeltaBundle.cpp */; }; + 697ACDB922B2B31C003C13DF /* DeltaBundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9B22B2A3D6003C13DF /* DeltaBundle.h */; }; + 697ACDBA22B2B31C003C13DF /* DeltaBundleClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697ACD9222B2A3D6003C13DF /* DeltaBundleClient.cpp */; }; + 697ACDBB22B2B31C003C13DF /* DeltaBundleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9722B2A3D6003C13DF /* DeltaBundleClient.h */; }; + 697ACDBC22B2B31C003C13DF /* DeltaBundleLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697ACD9D22B2A3D7003C13DF /* DeltaBundleLoader.cpp */; }; + 697ACDBD22B2B31C003C13DF /* DeltaBundleLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9C22B2A3D6003C13DF /* DeltaBundleLoader.h */; }; + 697ACDBE22B2B31C003C13DF /* IndexedRAMBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697ACD9E22B2A3D7003C13DF /* IndexedRAMBundle.cpp */; }; + 697ACDBF22B2B31C003C13DF /* IndexedRAMBundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9922B2A3D6003C13DF /* IndexedRAMBundle.h */; }; + 697ACDC022B2B31E003C13DF /* Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697ACD9622B2A3D6003C13DF /* Bundle.cpp */; }; + 697ACDC122B2B31E003C13DF /* Bundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9822B2A3D6003C13DF /* Bundle.h */; }; + 697ACDC222B2B31E003C13DF /* BundleLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9422B2A3D6003C13DF /* BundleLoader.h */; }; + 697ACDC322B2B31E003C13DF /* BundleRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697ACD9122B2A3D6003C13DF /* BundleRegistry.cpp */; }; + 697ACDC422B2B31E003C13DF /* BundleRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9522B2A3D6003C13DF /* BundleRegistry.h */; }; + 697ACDC522B2B31E003C13DF /* DeltaBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697ACD9F22B2A3D7003C13DF /* DeltaBundle.cpp */; }; + 697ACDC622B2B31E003C13DF /* DeltaBundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9B22B2A3D6003C13DF /* DeltaBundle.h */; }; + 697ACDC722B2B31E003C13DF /* DeltaBundleClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697ACD9222B2A3D6003C13DF /* DeltaBundleClient.cpp */; }; + 697ACDC822B2B31E003C13DF /* DeltaBundleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9722B2A3D6003C13DF /* DeltaBundleClient.h */; }; + 697ACDC922B2B31E003C13DF /* DeltaBundleLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697ACD9D22B2A3D7003C13DF /* DeltaBundleLoader.cpp */; }; + 697ACDCA22B2B31E003C13DF /* DeltaBundleLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9C22B2A3D6003C13DF /* DeltaBundleLoader.h */; }; + 697ACDCB22B2B31E003C13DF /* IndexedRAMBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697ACD9E22B2A3D7003C13DF /* IndexedRAMBundle.cpp */; }; + 697ACDCC22B2B31E003C13DF /* IndexedRAMBundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9922B2A3D6003C13DF /* IndexedRAMBundle.h */; }; + 697ACDCD22B2B322003C13DF /* RAMBundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9A22B2A3D6003C13DF /* RAMBundle.h */; }; + 697ACDCE22B2B322003C13DF /* RAMBundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9A22B2A3D6003C13DF /* RAMBundle.h */; }; + 697ACDCF22B2B32B003C13DF /* BasicBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697ACDA022B2A3D7003C13DF /* BasicBundle.cpp */; }; + 697ACDD022B2B32E003C13DF /* BasicBundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9322B2A3D6003C13DF /* BasicBundle.h */; }; + 697ACDD222B2B40D003C13DF /* BasicBundle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9322B2A3D6003C13DF /* BasicBundle.h */; }; + 697ACDD422B2B40D003C13DF /* Bundle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9822B2A3D6003C13DF /* Bundle.h */; }; + 697ACDD522B2B40D003C13DF /* BundleLoader.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9422B2A3D6003C13DF /* BundleLoader.h */; }; + 697ACDD722B2B40D003C13DF /* BundleRegistry.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9522B2A3D6003C13DF /* BundleRegistry.h */; }; + 697ACDD922B2B40D003C13DF /* DeltaBundle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9B22B2A3D6003C13DF /* DeltaBundle.h */; }; + 697ACDDB22B2B40D003C13DF /* DeltaBundleClient.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9722B2A3D6003C13DF /* DeltaBundleClient.h */; }; + 697ACDDD22B2B40D003C13DF /* DeltaBundleLoader.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9C22B2A3D6003C13DF /* DeltaBundleLoader.h */; }; + 697ACDDF22B2B40D003C13DF /* IndexedRAMBundle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9922B2A3D6003C13DF /* IndexedRAMBundle.h */; }; + 697ACDE022B2B40D003C13DF /* RAMBundle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9A22B2A3D6003C13DF /* RAMBundle.h */; }; + 699C526722B4F1E4000608CC /* RCTFileBundleLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACDED22B395E9003C13DF /* RCTFileBundleLoader.h */; }; + 699C526822B4F24C000608CC /* RCTFileBundleLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACDED22B395E9003C13DF /* RCTFileBundleLoader.h */; }; + 69CF112222B53DCB000075E3 /* RCTFileBundleLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 69CF112122B53DCB000075E3 /* RCTFileBundleLoader.mm */; }; + 69CF112322B53DCB000075E3 /* RCTFileBundleLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 69CF112122B53DCB000075E3 /* RCTFileBundleLoader.mm */; }; 830A229E1A66C68A008503DA /* RCTRootView.m in Sources */ = {isa = PBXBuildFile; fileRef = 830A229D1A66C68A008503DA /* RCTRootView.m */; }; 83281384217EB70900574D55 /* MallocImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83281383217EB70800574D55 /* MallocImpl.cpp */; }; 83281385217EB71200574D55 /* MallocImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83281383217EB70800574D55 /* MallocImpl.cpp */; }; @@ -1074,7 +1106,6 @@ B233E6EA1D2D845D00BC68BA /* RCTI18nManager.m in Sources */ = {isa = PBXBuildFile; fileRef = B233E6E91D2D845D00BC68BA /* RCTI18nManager.m */; }; B95154321D1B34B200FE7B80 /* RCTActivityIndicatorView.m in Sources */ = {isa = PBXBuildFile; fileRef = B95154311D1B34B200FE7B80 /* RCTActivityIndicatorView.m */; }; BA0501AD2109DCF200A6BBC4 /* ReactMarker.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13DA8A2F2097A90A00276ED4 /* ReactMarker.h */; }; - BA0501AE2109DD0600A6BBC4 /* JSExecutor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E223624320875A8000108244 /* JSExecutor.cpp */; }; BA0501B02109DD1800A6BBC4 /* YGConfig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CE2080020772F7C009A43B3 /* YGConfig.cpp */; }; C60128AB1F3D1258009DF9FF /* RCTCxxConvert.h in Headers */ = {isa = PBXBuildFile; fileRef = C60128A91F3D1258009DF9FF /* RCTCxxConvert.h */; }; C60128AC1F3D1258009DF9FF /* RCTCxxConvert.h in Headers */ = {isa = PBXBuildFile; fileRef = C60128A91F3D1258009DF9FF /* RCTCxxConvert.h */; }; @@ -1086,16 +1117,10 @@ C60669371F3CCF1B00E67165 /* RCTManagedPointer.mm in Sources */ = {isa = PBXBuildFile; fileRef = C60669351F3CCF1B00E67165 /* RCTManagedPointer.mm */; }; C654505E1F3BD9280090799B /* RCTManagedPointer.h in Headers */ = {isa = PBXBuildFile; fileRef = C654505D1F3BD9280090799B /* RCTManagedPointer.h */; }; C654505F1F3BD9280090799B /* RCTManagedPointer.h in Headers */ = {isa = PBXBuildFile; fileRef = C654505D1F3BD9280090799B /* RCTManagedPointer.h */; }; - C669D8981F72E3DE006748EB /* RAMBundleRegistry.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = C6D380181F71D75B00621378 /* RAMBundleRegistry.h */; }; - C6D3801A1F71D76100621378 /* RAMBundleRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = C6D380181F71D75B00621378 /* RAMBundleRegistry.h */; }; - C6D3801B1F71D76200621378 /* RAMBundleRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = C6D380181F71D75B00621378 /* RAMBundleRegistry.h */; }; - C6D3801C1F71D76700621378 /* RAMBundleRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6D380191F71D75B00621378 /* RAMBundleRegistry.cpp */; }; - C6D3801D1F71D76800621378 /* RAMBundleRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6D380191F71D75B00621378 /* RAMBundleRegistry.cpp */; }; CF2731C01E7B8DE40044CA4F /* RCTDeviceInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = CF2731BE1E7B8DE40044CA4F /* RCTDeviceInfo.h */; }; CF2731C11E7B8DE40044CA4F /* RCTDeviceInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = CF2731BF1E7B8DE40044CA4F /* RCTDeviceInfo.m */; }; CF2731C21E7B8DEF0044CA4F /* RCTDeviceInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = CF2731BE1E7B8DE40044CA4F /* RCTDeviceInfo.h */; }; CF2731C31E7B8DF30044CA4F /* RCTDeviceInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = CF2731BF1E7B8DE40044CA4F /* RCTDeviceInfo.m */; }; - E223624420875A8000108244 /* JSExecutor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E223624320875A8000108244 /* JSExecutor.cpp */; }; E9B20B7B1B500126007A2DA7 /* RCTAccessibilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E9B20B7A1B500126007A2DA7 /* RCTAccessibilityManager.m */; }; EBF21BBC1FC498270052F4D5 /* InspectorInterfaces.h in Headers */ = {isa = PBXBuildFile; fileRef = EBF21BBA1FC498270052F4D5 /* InspectorInterfaces.h */; }; EBF21BBE1FC498630052F4D5 /* InspectorInterfaces.h in Headers */ = {isa = PBXBuildFile; fileRef = EBF21BBA1FC498270052F4D5 /* InspectorInterfaces.h */; }; @@ -1497,7 +1522,6 @@ dstSubfolderSpec = 16; files = ( BA0501AD2109DCF200A6BBC4 /* ReactMarker.h in Copy Headers */, - 598FD1921F816A2A006C54CB /* RAMBundleRegistry.h in Copy Headers */, 3DA9823B1E5B1053004F2374 /* CxxModule.h in Copy Headers */, 3DA9823C1E5B1053004F2374 /* CxxNativeModule.h in Copy Headers */, 3DA9823D1E5B1053004F2374 /* JSExecutor.h in Copy Headers */, @@ -1505,9 +1529,6 @@ 3DA982411E5B1053004F2374 /* JsArgumentHelpers-inl.h in Copy Headers */, 3DA982421E5B1053004F2374 /* JsArgumentHelpers.h in Copy Headers */, 3DA982431E5B1053004F2374 /* JSBigString.h in Copy Headers */, - 3DA982441E5B1053004F2374 /* JSBundleType.h in Copy Headers */, - 3DA9824E1E5B1053004F2374 /* JSIndexedRAMBundle.h in Copy Headers */, - 3DA9824F1E5B1053004F2374 /* JSModulesUnbundle.h in Copy Headers */, 3DA982501E5B1053004F2374 /* MessageQueueThread.h in Copy Headers */, 3DA982511E5B1053004F2374 /* MethodCall.h in Copy Headers */, 3DA982521E5B1053004F2374 /* ModuleRegistry.h in Copy Headers */, @@ -1693,8 +1714,16 @@ dstPath = include/cxxreact; dstSubfolderSpec = 16; files = ( + 697ACDD222B2B40D003C13DF /* BasicBundle.h in Copy Headers */, + 697ACDD422B2B40D003C13DF /* Bundle.h in Copy Headers */, + 697ACDD522B2B40D003C13DF /* BundleLoader.h in Copy Headers */, + 697ACDD722B2B40D003C13DF /* BundleRegistry.h in Copy Headers */, + 697ACDD922B2B40D003C13DF /* DeltaBundle.h in Copy Headers */, + 697ACDDB22B2B40D003C13DF /* DeltaBundleClient.h in Copy Headers */, + 697ACDDD22B2B40D003C13DF /* DeltaBundleLoader.h in Copy Headers */, + 697ACDDF22B2B40D003C13DF /* IndexedRAMBundle.h in Copy Headers */, + 697ACDE022B2B40D003C13DF /* RAMBundle.h in Copy Headers */, 133EA4E52098F6E30035B1D8 /* ReactMarker.h in Copy Headers */, - C669D8981F72E3DE006748EB /* RAMBundleRegistry.h in Copy Headers */, 3DA981A01E5B0E34004F2374 /* CxxModule.h in Copy Headers */, 3DA981A11E5B0E34004F2374 /* CxxNativeModule.h in Copy Headers */, 3DA981A21E5B0E34004F2374 /* JSExecutor.h in Copy Headers */, @@ -1702,9 +1731,6 @@ 3DA981A61E5B0E34004F2374 /* JsArgumentHelpers-inl.h in Copy Headers */, 3DA981A71E5B0E34004F2374 /* JsArgumentHelpers.h in Copy Headers */, 3DA981A81E5B0E34004F2374 /* JSBigString.h in Copy Headers */, - 3DA981A91E5B0E34004F2374 /* JSBundleType.h in Copy Headers */, - 3DA981B31E5B0E34004F2374 /* JSIndexedRAMBundle.h in Copy Headers */, - 3DA981B41E5B0E34004F2374 /* JSModulesUnbundle.h in Copy Headers */, 3DA981B51E5B0E34004F2374 /* MessageQueueThread.h in Copy Headers */, 3DA981B61E5B0E34004F2374 /* MethodCall.h in Copy Headers */, 3DA981B71E5B0E34004F2374 /* ModuleRegistry.h in Copy Headers */, @@ -2014,7 +2040,6 @@ 3D383D621EBD27B9005632C8 /* libdouble-conversion.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libdouble-conversion.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 3D3C059A1DE3340900C268FA /* libyoga.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libyoga.a; sourceTree = BUILT_PRODUCTS_DIR; }; 3D3C06751DE3340C00C268FA /* libyoga.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libyoga.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 3D3CD8F51DE5FB2300167DC4 /* JSBundleType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBundleType.h; sourceTree = ""; }; 3D3CD9251DE5FBEC00167DC4 /* libcxxreact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libcxxreact.a; sourceTree = BUILT_PRODUCTS_DIR; }; 3D3CD9321DE5FBEE00167DC4 /* libcxxreact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libcxxreact.a; sourceTree = BUILT_PRODUCTS_DIR; }; 3D7454781E54757500E74ADD /* JSBigString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBigString.h; sourceTree = ""; }; @@ -2038,9 +2063,6 @@ 3D92B0AF1E03699D0018521A /* Instance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Instance.h; sourceTree = ""; }; 3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JsArgumentHelpers-inl.h"; sourceTree = ""; }; 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JsArgumentHelpers.h; sourceTree = ""; }; - 3D92B0C61E03699D0018521A /* JSIndexedRAMBundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIndexedRAMBundle.cpp; sourceTree = ""; }; - 3D92B0C71E03699D0018521A /* JSIndexedRAMBundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIndexedRAMBundle.h; sourceTree = ""; }; - 3D92B0C81E03699D0018521A /* JSModulesUnbundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSModulesUnbundle.h; sourceTree = ""; }; 3D92B0C91E03699D0018521A /* MessageQueueThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageQueueThread.h; sourceTree = ""; }; 3D92B0CA1E03699D0018521A /* MethodCall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MethodCall.cpp; sourceTree = ""; }; 3D92B0CB1E03699D0018521A /* MethodCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MethodCall.h; sourceTree = ""; }; @@ -2149,6 +2171,26 @@ 66CD94B01F1045E700CB3C7C /* RCTMaskedViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMaskedViewManager.m; sourceTree = ""; }; 68EFE4EC1CF6EB3000A1DE13 /* RCTBundleURLProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBundleURLProvider.h; sourceTree = ""; }; 68EFE4ED1CF6EB3900A1DE13 /* RCTBundleURLProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBundleURLProvider.m; sourceTree = ""; }; + 690D491822B79FFB0039D9D6 /* RCTNetworkBundleLoader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTNetworkBundleLoader.h; sourceTree = ""; }; + 690D491B22B7A0560039D9D6 /* RCTNetworkBundleLoader.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTNetworkBundleLoader.mm; sourceTree = ""; }; + 697ACD9122B2A3D6003C13DF /* BundleRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BundleRegistry.cpp; sourceTree = ""; }; + 697ACD9222B2A3D6003C13DF /* DeltaBundleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeltaBundleClient.cpp; sourceTree = ""; }; + 697ACD9322B2A3D6003C13DF /* BasicBundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BasicBundle.h; sourceTree = ""; }; + 697ACD9422B2A3D6003C13DF /* BundleLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BundleLoader.h; sourceTree = ""; }; + 697ACD9522B2A3D6003C13DF /* BundleRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BundleRegistry.h; sourceTree = ""; }; + 697ACD9622B2A3D6003C13DF /* Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Bundle.cpp; sourceTree = ""; }; + 697ACD9722B2A3D6003C13DF /* DeltaBundleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeltaBundleClient.h; sourceTree = ""; }; + 697ACD9822B2A3D6003C13DF /* Bundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bundle.h; sourceTree = ""; }; + 697ACD9922B2A3D6003C13DF /* IndexedRAMBundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexedRAMBundle.h; sourceTree = ""; }; + 697ACD9A22B2A3D6003C13DF /* RAMBundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAMBundle.h; sourceTree = ""; }; + 697ACD9B22B2A3D6003C13DF /* DeltaBundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeltaBundle.h; sourceTree = ""; }; + 697ACD9C22B2A3D6003C13DF /* DeltaBundleLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeltaBundleLoader.h; sourceTree = ""; }; + 697ACD9D22B2A3D7003C13DF /* DeltaBundleLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeltaBundleLoader.cpp; sourceTree = ""; }; + 697ACD9E22B2A3D7003C13DF /* IndexedRAMBundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IndexedRAMBundle.cpp; sourceTree = ""; }; + 697ACD9F22B2A3D7003C13DF /* DeltaBundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeltaBundle.cpp; sourceTree = ""; }; + 697ACDA022B2A3D7003C13DF /* BasicBundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BasicBundle.cpp; sourceTree = ""; }; + 697ACDED22B395E9003C13DF /* RCTFileBundleLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTFileBundleLoader.h; sourceTree = ""; }; + 69CF112122B53DCB000075E3 /* RCTFileBundleLoader.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTFileBundleLoader.mm; sourceTree = ""; }; 6A15FB0C1BDF663500531DFB /* RCTRootViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRootViewInternal.h; sourceTree = ""; }; 830213F31A654E0800B993E6 /* RCTBridgeModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTBridgeModule.h; sourceTree = ""; }; 830A229C1A66C68A008503DA /* RCTRootView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRootView.h; sourceTree = ""; }; @@ -2198,7 +2240,6 @@ AC6B69E121B1467C00B2B68A /* YGValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGValue.cpp; sourceTree = ""; }; AC6B69E221B1467C00B2B68A /* YGValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGValue.h; sourceTree = ""; }; AC70D2E81DE489E4002E6351 /* RCTJavaScriptLoader.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTJavaScriptLoader.mm; sourceTree = ""; }; - AC70D2EB1DE48A22002E6351 /* JSBundleType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBundleType.cpp; sourceTree = ""; }; AC8360CC21B0256A00FC46B9 /* YGMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGMarker.h; sourceTree = ""; }; AC90463D21C91CC2005B24B3 /* CompactValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompactValue.h; sourceTree = ""; }; ACDD3FDA1BC7430D00E7DE33 /* RCTBorderStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBorderStyle.h; sourceTree = ""; }; @@ -2211,11 +2252,8 @@ C606692D1F3CC60500E67165 /* RCTModuleMethod.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTModuleMethod.mm; sourceTree = ""; }; C60669351F3CCF1B00E67165 /* RCTManagedPointer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTManagedPointer.mm; sourceTree = ""; }; C654505D1F3BD9280090799B /* RCTManagedPointer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTManagedPointer.h; sourceTree = ""; }; - C6D380181F71D75B00621378 /* RAMBundleRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RAMBundleRegistry.h; sourceTree = ""; }; - C6D380191F71D75B00621378 /* RAMBundleRegistry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RAMBundleRegistry.cpp; sourceTree = ""; }; CF2731BE1E7B8DE40044CA4F /* RCTDeviceInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDeviceInfo.h; sourceTree = ""; }; CF2731BF1E7B8DE40044CA4F /* RCTDeviceInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDeviceInfo.m; sourceTree = ""; }; - E223624320875A8000108244 /* JSExecutor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSExecutor.cpp; sourceTree = ""; }; E3BBC8EB1ADE6F47001BBD81 /* RCTTextDecorationLineType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTTextDecorationLineType.h; sourceTree = ""; }; E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAccessibilityManager.h; sourceTree = ""; }; E9B20B7A1B500126007A2DA7 /* RCTAccessibilityManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAccessibilityManager.m; sourceTree = ""; }; @@ -2241,8 +2279,6 @@ EDEBC6E1214B3F6800DD5AC8 /* jsi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsi.h; sourceTree = ""; }; EDEBC73B214B45A300DD5AC8 /* libjsiexecutor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libjsiexecutor.a; sourceTree = BUILT_PRODUCTS_DIR; }; EDEBC740214B463000DD5AC8 /* BUCK */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BUCK; sourceTree = ""; }; - EDEBC750214B47E100DD5AC8 /* JSDeltaBundleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeltaBundleClient.cpp; sourceTree = ""; }; - EDEBC751214B47E100DD5AC8 /* JSDeltaBundleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDeltaBundleClient.h; sourceTree = ""; }; EDEBC752214B47E100DD5AC8 /* SharedProxyCxxModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedProxyCxxModule.h; sourceTree = ""; }; EDEBC757214C284000DD5AC8 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; F1EFDA4E201F660F00EE6E4C /* RCTUIUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIUtils.m; sourceTree = ""; }; @@ -2915,6 +2951,10 @@ 83CBBA631A601ECA00E9B192 /* RCTJavaScriptExecutor.h */, 14200DA81AC179B3008EE6BA /* RCTJavaScriptLoader.h */, AC70D2E81DE489E4002E6351 /* RCTJavaScriptLoader.mm */, + 697ACDED22B395E9003C13DF /* RCTFileBundleLoader.h */, + 690D491822B79FFB0039D9D6 /* RCTNetworkBundleLoader.h */, + 69CF112122B53DCB000075E3 /* RCTFileBundleLoader.mm */, + 690D491B22B7A0560039D9D6 /* RCTNetworkBundleLoader.mm */, 008341F51D1DB34400876D9A /* RCTJSStackFrame.h */, 008341F41D1DB34400876D9A /* RCTJSStackFrame.m */, 13A1F71C1A75392D00D3D453 /* RCTKeyCommands.h */, @@ -2966,12 +3006,25 @@ AC70D2EA1DE489FC002E6351 /* cxxreact */ = { isa = PBXGroup; children = ( - EDEBC750214B47E100DD5AC8 /* JSDeltaBundleClient.cpp */, - EDEBC751214B47E100DD5AC8 /* JSDeltaBundleClient.h */, + 697ACDA022B2A3D7003C13DF /* BasicBundle.cpp */, + 697ACD9322B2A3D6003C13DF /* BasicBundle.h */, + 697ACD9622B2A3D6003C13DF /* Bundle.cpp */, + 697ACD9822B2A3D6003C13DF /* Bundle.h */, + 697ACD9422B2A3D6003C13DF /* BundleLoader.h */, + 697ACD9122B2A3D6003C13DF /* BundleRegistry.cpp */, + 697ACD9522B2A3D6003C13DF /* BundleRegistry.h */, + 697ACD9F22B2A3D7003C13DF /* DeltaBundle.cpp */, + 697ACD9B22B2A3D6003C13DF /* DeltaBundle.h */, + 697ACD9222B2A3D6003C13DF /* DeltaBundleClient.cpp */, + 697ACD9722B2A3D6003C13DF /* DeltaBundleClient.h */, + 697ACD9D22B2A3D7003C13DF /* DeltaBundleLoader.cpp */, + 697ACD9C22B2A3D6003C13DF /* DeltaBundleLoader.h */, + 697ACD9E22B2A3D7003C13DF /* IndexedRAMBundle.cpp */, + 697ACD9922B2A3D6003C13DF /* IndexedRAMBundle.h */, + 697ACD9A22B2A3D6003C13DF /* RAMBundle.h */, EDEBC752214B47E100DD5AC8 /* SharedProxyCxxModule.h */, 13DA8A302097A90B00276ED4 /* ReactMarker.cpp */, 13DA8A2F2097A90A00276ED4 /* ReactMarker.h */, - E223624320875A8000108244 /* JSExecutor.cpp */, 3D92B0A71E03699D0018521A /* CxxModule.h */, 3D92B0A81E03699D0018521A /* CxxNativeModule.cpp */, 3D92B0A91E03699D0018521A /* CxxNativeModule.h */, @@ -2981,12 +3034,7 @@ 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */, 27B958731E57587D0096647A /* JSBigString.cpp */, 3D7454781E54757500E74ADD /* JSBigString.h */, - AC70D2EB1DE48A22002E6351 /* JSBundleType.cpp */, - 3D3CD8F51DE5FB2300167DC4 /* JSBundleType.h */, 3D92B0AB1E03699D0018521A /* JSExecutor.h */, - 3D92B0C61E03699D0018521A /* JSIndexedRAMBundle.cpp */, - 3D92B0C71E03699D0018521A /* JSIndexedRAMBundle.h */, - 3D92B0C81E03699D0018521A /* JSModulesUnbundle.h */, 3D92B0C91E03699D0018521A /* MessageQueueThread.h */, 3D92B0CA1E03699D0018521A /* MethodCall.cpp */, 3D92B0CB1E03699D0018521A /* MethodCall.h */, @@ -2995,8 +3043,6 @@ 3D92B0CE1E03699D0018521A /* NativeModule.h */, 3D92B0CF1E03699D0018521A /* NativeToJsBridge.cpp */, 3D92B0D01E03699D0018521A /* NativeToJsBridge.h */, - C6D380191F71D75B00621378 /* RAMBundleRegistry.cpp */, - C6D380181F71D75B00621378 /* RAMBundleRegistry.h */, 3D7454791E54757500E74ADD /* RecoverableError.h */, 3D92B0D31E03699D0018521A /* SampleCxxModule.cpp */, 3D92B0D41E03699D0018521A /* SampleCxxModule.h */, @@ -3100,6 +3146,7 @@ 3D302F251DF828F800D6DDAE /* RCTImageStoreManager.h in Headers */, C60128AC1F3D1258009DF9FF /* RCTCxxConvert.h in Headers */, 3D302F261DF828F800D6DDAE /* RCTResizeMode.h in Headers */, + 690D491A22B79FFB0039D9D6 /* RCTNetworkBundleLoader.h in Headers */, 3D302F271DF828F800D6DDAE /* RCTLinkingManager.h in Headers */, 3D7BFD161EA8E351008DFB7A /* RCTPackagerClient.h in Headers */, 3D302F281DF828F800D6DDAE /* RCTNetworking.h in Headers */, @@ -3188,6 +3235,7 @@ 3D302F681DF828F800D6DDAE /* RCTMacros.h in Headers */, 3D302F691DF828F800D6DDAE /* RCTProfile.h in Headers */, 3D302F6A1DF828F800D6DDAE /* RCTActivityIndicatorView.h in Headers */, + 699C526822B4F24C000608CC /* RCTFileBundleLoader.h in Headers */, 3D302F6B1DF828F800D6DDAE /* RCTActivityIndicatorViewManager.h in Headers */, 3D7BFD301EA8E3FA008DFB7A /* RCTSRWebSocket.h in Headers */, 59EDBCA81FDF4E0C003573DE /* RCTScrollableProtocol.h in Headers */, @@ -3268,23 +3316,28 @@ buildActionMask = 2147483647; files = ( 13DA8A322097A90B00276ED4 /* ReactMarker.h in Headers */, - 3D74547E1E54759A00E74ADD /* JSModulesUnbundle.h in Headers */, - C6D3801B1F71D76200621378 /* RAMBundleRegistry.h in Headers */, + 697ACDC822B2B31E003C13DF /* DeltaBundleClient.h in Headers */, 27595AD51E575C7800CCE2B1 /* NativeToJsBridge.h in Headers */, 27595AC41E575C7800CCE2B1 /* Instance.h in Headers */, 27595AD11E575C7800CCE2B1 /* MessageQueueThread.h in Headers */, + 697ACDD022B2B32E003C13DF /* BasicBundle.h in Headers */, 3D7454811E5475AF00E74ADD /* RecoverableError.h in Headers */, + 697ACDC122B2B31E003C13DF /* Bundle.h in Headers */, 27595AC51E575C7800CCE2B1 /* JsArgumentHelpers-inl.h in Headers */, + 697ACDC222B2B31E003C13DF /* BundleLoader.h in Headers */, 27595AD81E575C7800CCE2B1 /* SystraceSection.h in Headers */, + 697ACDCA22B2B31E003C13DF /* DeltaBundleLoader.h in Headers */, + 697ACDCE22B2B322003C13DF /* RAMBundle.h in Headers */, 27595AC61E575C7800CCE2B1 /* JsArgumentHelpers.h in Headers */, 27595AD71E575C7800CCE2B1 /* SampleCxxModule.h in Headers */, + 697ACDCC22B2B31E003C13DF /* IndexedRAMBundle.h in Headers */, 27595AD21E575C7800CCE2B1 /* MethodCall.h in Headers */, - 3D3030221DF8294C00D6DDAE /* JSBundleType.h in Headers */, 3D74547D1E54758900E74ADD /* JSBigString.h in Headers */, + 697ACDC422B2B31E003C13DF /* BundleRegistry.h in Headers */, 27595ABF1E575C7800CCE2B1 /* CxxModule.h in Headers */, + 697ACDC622B2B31E003C13DF /* DeltaBundle.h in Headers */, 27595AD41E575C7800CCE2B1 /* NativeModule.h in Headers */, 27595AC01E575C7800CCE2B1 /* CxxNativeModule.h in Headers */, - 27595AD01E575C7800CCE2B1 /* JSIndexedRAMBundle.h in Headers */, 27595AD31E575C7800CCE2B1 /* ModuleRegistry.h in Headers */, 27595AC11E575C7800CCE2B1 /* JSExecutor.h in Headers */, ); @@ -3334,8 +3387,6 @@ buildActionMask = 2147483647; files = ( 13DA8A312097A90B00276ED4 /* ReactMarker.h in Headers */, - 3D74547F1E54759E00E74ADD /* JSModulesUnbundle.h in Headers */, - C6D3801A1F71D76100621378 /* RAMBundleRegistry.h in Headers */, 27595ABA1E575C7800CCE2B1 /* NativeToJsBridge.h in Headers */, 27595AA91E575C7800CCE2B1 /* Instance.h in Headers */, 27595AB61E575C7800CCE2B1 /* MessageQueueThread.h in Headers */, @@ -3344,15 +3395,22 @@ 27595ABD1E575C7800CCE2B1 /* SystraceSection.h in Headers */, 27595AAB1E575C7800CCE2B1 /* JsArgumentHelpers.h in Headers */, 27595ABC1E575C7800CCE2B1 /* SampleCxxModule.h in Headers */, + 697ACDB222B2B309003C13DF /* BasicBundle.h in Headers */, + 697ACDB922B2B31C003C13DF /* DeltaBundle.h in Headers */, + 697ACDBF22B2B31C003C13DF /* IndexedRAMBundle.h in Headers */, 27595AB71E575C7800CCE2B1 /* MethodCall.h in Headers */, 3D74547C1E54758900E74ADD /* JSBigString.h in Headers */, + 697ACDB522B2B31C003C13DF /* BundleLoader.h in Headers */, + 697ACDB722B2B31C003C13DF /* BundleRegistry.h in Headers */, 27595AA41E575C7800CCE2B1 /* CxxModule.h in Headers */, 27595AB91E575C7800CCE2B1 /* NativeModule.h in Headers */, - 3D3CD9451DE5FC7100167DC4 /* JSBundleType.h in Headers */, + 697ACDBD22B2B31C003C13DF /* DeltaBundleLoader.h in Headers */, + 697ACDB422B2B31C003C13DF /* Bundle.h in Headers */, 27595AA51E575C7800CCE2B1 /* CxxNativeModule.h in Headers */, - 27595AB51E575C7800CCE2B1 /* JSIndexedRAMBundle.h in Headers */, 27595AB81E575C7800CCE2B1 /* ModuleRegistry.h in Headers */, + 697ACDBB22B2B31C003C13DF /* DeltaBundleClient.h in Headers */, 27595AA61E575C7800CCE2B1 /* JSExecutor.h in Headers */, + 697ACDCD22B2B322003C13DF /* RAMBundle.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3389,6 +3447,7 @@ 3D80DA291DF820620028D040 /* RCTDisplayLink.h in Headers */, 597633381F4E021D005BE8A4 /* RCTShadowView+Internal.h in Headers */, 3D80DA2A1DF820620028D040 /* RCTErrorCustomizer.h in Headers */, + 690D491922B79FFB0039D9D6 /* RCTNetworkBundleLoader.h in Headers */, 3D80DA2B1DF820620028D040 /* RCTErrorInfo.h in Headers */, 1384E2081E806D4E00545659 /* RCTNativeModule.h in Headers */, 50E98FED21460B0D00CD9289 /* RCTWKWebViewManager.h in Headers */, @@ -3477,6 +3536,7 @@ 59EDBCAD1FDF4E0C003573DE /* RCTScrollContentView.h in Headers */, 59EDBCA71FDF4E0C003573DE /* RCTScrollableProtocol.h in Headers */, 591F78DC202ADB22004A668C /* RCTLayout.h in Headers */, + 699C526722B4F1E4000608CC /* RCTFileBundleLoader.h in Headers */, 5CE2080320772F7D009A43B3 /* YGConfig.h in Headers */, 3D80DA631DF820620028D040 /* RCTBorderDrawing.h in Headers */, 3D80DA641DF820620028D040 /* RCTBorderStyle.h in Headers */, @@ -3937,6 +3997,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -4179,6 +4240,7 @@ 2D3B5EAE1D9B08F800451313 /* RCTEventEmitter.m in Sources */, 2D3B5ECA1D9B095F00451313 /* RCTComponentData.m in Sources */, 2D3B5EA31D9B08BE00451313 /* RCTParserUtils.m in Sources */, + 690D491D22B7A0560039D9D6 /* RCTNetworkBundleLoader.mm in Sources */, 59500D461F71C63F00B122B7 /* RCTUIManagerUtils.m in Sources */, 599FAA4D1FB274980058CCF6 /* RCTSurfaceView.mm in Sources */, 59EDBCB41FDF4E0C003573DE /* (null) in Sources */, @@ -4240,6 +4302,7 @@ 59D031F01F8353D3008361F0 /* RCTSafeAreaShadowView.m in Sources */, 5925356B20084D0600DD584B /* RCTSurfaceSizeMeasureMode.mm in Sources */, 3D05745A1DE5FFF500184BB4 /* RCTJavaScriptLoader.mm in Sources */, + 69CF112322B53DCB000075E3 /* RCTFileBundleLoader.mm in Sources */, 2D3B5EA41D9B08C200451313 /* RCTPerformanceLogger.m in Sources */, 3DCE53251FEAB1E000613583 /* RCTShadowView.m in Sources */, 2D3B5E9E1D9B08AD00451313 /* RCTJSStackFrame.m in Sources */, @@ -4372,17 +4435,21 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 697ACDB822B2B31C003C13DF /* DeltaBundle.cpp in Sources */, + 697ACDBC22B2B31C003C13DF /* DeltaBundleLoader.cpp in Sources */, 3DC159E51E83E1E9007B1282 /* JSBigString.cpp in Sources */, - 13F8877B1E29726200C3C7A1 /* JSIndexedRAMBundle.cpp in Sources */, + 697ACDB622B2B31C003C13DF /* BundleRegistry.cpp in Sources */, 13F8877D1E29726200C3C7A1 /* ModuleRegistry.cpp in Sources */, - C6D3801C1F71D76700621378 /* RAMBundleRegistry.cpp in Sources */, 13F8876E1E29726200C3C7A1 /* CxxNativeModule.cpp in Sources */, + 697ACDB122B2B303003C13DF /* BasicBundle.cpp in Sources */, 13DA8A332097A90B00276ED4 /* ReactMarker.cpp in Sources */, - 13F887711E29726200C3C7A1 /* JSBundleType.cpp in Sources */, + 697ACDB322B2B31C003C13DF /* Bundle.cpp in Sources */, + 697ACDBA22B2B31C003C13DF /* DeltaBundleClient.cpp in Sources */, 13F8877C1E29726200C3C7A1 /* MethodCall.cpp in Sources */, 13F887701E29726200C3C7A1 /* Instance.cpp in Sources */, 13F8877E1E29726200C3C7A1 /* NativeToJsBridge.cpp in Sources */, 13F887801E29726200C3C7A1 /* SampleCxxModule.cpp in Sources */, + 697ACDBE22B2B31C003C13DF /* IndexedRAMBundle.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -4390,17 +4457,20 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - BA0501AE2109DD0600A6BBC4 /* JSExecutor.cpp in Sources */, + 697ACDCF22B2B32B003C13DF /* BasicBundle.cpp in Sources */, 3DC159E61E83E1FA007B1282 /* JSBigString.cpp in Sources */, - 13F8878E1E29726300C3C7A1 /* JSIndexedRAMBundle.cpp in Sources */, + 697ACDC722B2B31E003C13DF /* DeltaBundleClient.cpp in Sources */, 13F887901E29726300C3C7A1 /* ModuleRegistry.cpp in Sources */, - C6D3801D1F71D76800621378 /* RAMBundleRegistry.cpp in Sources */, + 697ACDC922B2B31E003C13DF /* DeltaBundleLoader.cpp in Sources */, + 697ACDC322B2B31E003C13DF /* BundleRegistry.cpp in Sources */, + 697ACDC022B2B31E003C13DF /* Bundle.cpp in Sources */, 13DA8A342097A90B00276ED4 /* ReactMarker.cpp in Sources */, + 697ACDC522B2B31E003C13DF /* DeltaBundle.cpp in Sources */, 13F887841E29726300C3C7A1 /* Instance.cpp in Sources */, - 3D80D9181DF6F7A80028D040 /* JSBundleType.cpp in Sources */, 13F8878F1E29726300C3C7A1 /* MethodCall.cpp in Sources */, 13F887911E29726300C3C7A1 /* NativeToJsBridge.cpp in Sources */, 13F887821E29726300C3C7A1 /* CxxNativeModule.cpp in Sources */, + 697ACDCB22B2B31E003C13DF /* IndexedRAMBundle.cpp in Sources */, 13F887931E29726300C3C7A1 /* SampleCxxModule.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -4410,7 +4480,6 @@ buildActionMask = 2147483647; files = ( 13134C9A1E296B2A00B9F3CB /* RCTCxxMethod.mm in Sources */, - E223624420875A8000108244 /* JSExecutor.cpp in Sources */, 59500D451F71C63F00B122B7 /* RCTUIManagerUtils.m in Sources */, 597633361F4E021D005BE8A4 /* RCTShadowView+Internal.m in Sources */, 13723B501A82FD3C00F88898 /* RCTStatusBarManager.m in Sources */, @@ -4498,6 +4567,7 @@ 142014191B32094000CC17BA /* RCTPerformanceLogger.m in Sources */, 83CBBA981A6020BB00E9B192 /* RCTTouchHandler.m in Sources */, 3EDCA8A51D3591E700450C31 /* RCTErrorInfo.m in Sources */, + 69CF112222B53DCB000075E3 /* RCTFileBundleLoader.mm in Sources */, 83CBBA521A601E3B00E9B192 /* RCTLog.mm in Sources */, 13A6E20E1C19AA0C00845B82 /* RCTParserUtils.m in Sources */, 59D031F71F8353D3008361F0 /* RCTSafeAreaViewLocalData.m in Sources */, @@ -4530,6 +4600,7 @@ 657734911EE8354A00A0E9EA /* RCTInspectorPackagerConnection.m in Sources */, 68EFE4EE1CF6EB3900A1DE13 /* RCTBundleURLProvider.m in Sources */, B95154321D1B34B200FE7B80 /* RCTActivityIndicatorView.m in Sources */, + 690D491C22B7A0560039D9D6 /* RCTNetworkBundleLoader.mm in Sources */, 5960C1BB1F0804A00066FD5B /* RCTLayoutAnimationGroup.m in Sources */, 13F17A851B8493E5007D4C75 /* RCTRedBox.m in Sources */, 59D031F31F8353D3008361F0 /* RCTSafeAreaView.m in Sources */, diff --git a/ReactCommon/cxxreact/JSExecutor.h b/ReactCommon/cxxreact/JSExecutor.h index aa5a61929c19..9f0c34a017b4 100644 --- a/ReactCommon/cxxreact/JSExecutor.h +++ b/ReactCommon/cxxreact/JSExecutor.h @@ -19,7 +19,6 @@ namespace facebook { namespace react { -class JSBigString; class JSExecutor; class MessageQueueThread; class ModuleRegistry; diff --git a/ReactCommon/cxxreact/RAMBundle.h b/ReactCommon/cxxreact/RAMBundle.h index dcacd4442b0d..a548f2bb7ae4 100644 --- a/ReactCommon/cxxreact/RAMBundle.h +++ b/ReactCommon/cxxreact/RAMBundle.h @@ -1,7 +1,6 @@ #pragma once #include "Bundle.h" -#include "JSBigString.h" namespace facebook { namespace react { diff --git a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp index 92573d010d38..f8fb896596f0 100644 --- a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp +++ b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp @@ -3,9 +3,8 @@ // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. -#include "jsireact/JSIExecutor.h" +#include "JSIExecutor.h" -#include #include #include #include From 293fa62eb09acdc3c91adcbed6c010862a32a5eb Mon Sep 17 00:00:00 2001 From: Dratwas Date: Thu, 20 Jun 2019 00:25:20 +0200 Subject: [PATCH 2/9] Still WIP --- React/Base/RCTBridge.h | 7 - React/Base/RCTBridge.m | 5 - React/Base/RCTBridgeDelegate.h | 8 +- React/Base/RCTBundleLoader.h | 15 ++ ...orkBundleLoader.h => RCTDevBundleLoader.h} | 14 +- React/Base/RCTDevBundleLoader.mm | 32 +++ React/Base/RCTDevBundlesDownloader.h | 82 ++++++ React/Base/RCTDevBundlesDownloader.m | 232 +++++++++++++++++ React/Base/RCTFileBundleLoader.h | 1 + React/Base/RCTFileBundleLoader.mm | 81 +++--- React/Base/RCTNetworkBundleLoader.mm | 120 --------- React/CxxBridge/RCTCxxBridge.mm | 236 +++++++++++------- React/DevSupport/RCTDevLoadingView.h | 4 +- React/DevSupport/RCTDevLoadingView.m | 3 +- React/React.xcodeproj/project.pbxproj | 38 ++- .../xcshareddata/xcschemes/React.xcscheme | 80 ++++++ .../jsiexecutor/jsireact/JSIExecutor.h | 3 +- 17 files changed, 659 insertions(+), 302 deletions(-) create mode 100644 React/Base/RCTBundleLoader.h rename React/Base/{RCTNetworkBundleLoader.h => RCTDevBundleLoader.h} (60%) create mode 100644 React/Base/RCTDevBundleLoader.mm create mode 100644 React/Base/RCTDevBundlesDownloader.h create mode 100644 React/Base/RCTDevBundlesDownloader.m delete mode 100644 React/Base/RCTNetworkBundleLoader.mm create mode 100644 React/React.xcodeproj/xcshareddata/xcschemes/React.xcscheme diff --git a/React/Base/RCTBridge.h b/React/Base/RCTBridge.h index a9150471d547..bc9f54110568 100644 --- a/React/Base/RCTBridge.h +++ b/React/Base/RCTBridge.h @@ -139,13 +139,6 @@ RCT_EXTERN void RCTEnableTurboModule(BOOL enabled); - (void)enqueueJSCall:(NSString *)moduleDotMethod args:(NSArray *)args; - (void)enqueueJSCall:(NSString *)module method:(NSString *)method args:(NSArray *)args completion:(dispatch_block_t)completion; -/** - * This method registers the file path of an additional JS segment by its ID. - * - * @experimental - */ -- (void)registerSegmentWithId:(NSUInteger)segmentId path:(NSString *)path; - /** * Retrieve a bridge module instance by name or class. Note that modules are * lazily instantiated, so calling these methods for the first time with a given diff --git a/React/Base/RCTBridge.m b/React/Base/RCTBridge.m index 0ff789cf44c8..115871745d9b 100644 --- a/React/Base/RCTBridge.m +++ b/React/Base/RCTBridge.m @@ -398,9 +398,4 @@ - (void)enqueueCallback:(NSNumber *)cbID args:(NSArray *)args [self.batchedBridge enqueueCallback:cbID args:args]; } -- (void)registerSegmentWithId:(NSUInteger)segmentId path:(NSString *)path -{ - [self.batchedBridge registerSegmentWithId:segmentId path:path]; -} - @end diff --git a/React/Base/RCTBridgeDelegate.h b/React/Base/RCTBridgeDelegate.h index 5133d6fb0600..b7b88927c620 100644 --- a/React/Base/RCTBridgeDelegate.h +++ b/React/Base/RCTBridgeDelegate.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import +#import @class RCTBridge; @protocol RCTBridgeModule; @@ -62,15 +62,15 @@ * to handle loading the JS yourself, you can do so by implementing this method. */ - (void)loadSourceForBridge:(RCTBridge *)bridge - onProgress:(RCTSourceLoadProgressBlock)onProgress - onComplete:(RCTSourceLoadBlock)loadCallback; + onProgress:(RCTDevBundlesProgressBlock)onProgress + onComplete:(RCTDevBundlesLoadBlock)loadCallback; /** * Similar to loadSourceForBridge:onProgress:onComplete: but without progress * reporting. */ - (void)loadSourceForBridge:(RCTBridge *)bridge - withBlock:(RCTSourceLoadBlock)loadCallback; + withBlock:(RCTDevBundlesLoadBlock)loadCallback; /** * Retrieve the list of lazy-native-modules names for the given bridge. diff --git a/React/Base/RCTBundleLoader.h b/React/Base/RCTBundleLoader.h new file mode 100644 index 000000000000..b2be1c86b431 --- /dev/null +++ b/React/Base/RCTBundleLoader.h @@ -0,0 +1,15 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + + +@protocol RCTInvalidating + +- (void)invalidate; + +@end diff --git a/React/Base/RCTNetworkBundleLoader.h b/React/Base/RCTDevBundleLoader.h similarity index 60% rename from React/Base/RCTNetworkBundleLoader.h rename to React/Base/RCTDevBundleLoader.h index 7e4876e5fdfa..5639d4f1a209 100644 --- a/React/Base/RCTNetworkBundleLoader.h +++ b/React/Base/RCTDevBundleLoader.h @@ -3,25 +3,25 @@ #import #import #import +#import "RCTDevBundlesDownloader.h" #import -NS_ENUM(NSInteger) { - RCTNetworkBundleLoaderErrorURLLoadFailed = 3, -}; - namespace facebook { namespace react { - class RCTNetworkBundleLoader : public BundleLoader { + class RCTDevBundleLoader : public BundleLoader { public: - RCTNetworkBundleLoader(//TODO //) {}; - ~RCTNetworkBundleLoader() {} + RCTDevBundleLoader(NSDictionary *bundles); + ~RCTDevBundleLoader() {} std::unique_ptr getBundle(std::string bundleURL) const override; std::string getBundleURLFromName(std::string bundleName) const override; + private: + NSDictionary *_bundles; + }; } // namespace react diff --git a/React/Base/RCTDevBundleLoader.mm b/React/Base/RCTDevBundleLoader.mm new file mode 100644 index 000000000000..86efc78a1824 --- /dev/null +++ b/React/Base/RCTDevBundleLoader.mm @@ -0,0 +1,32 @@ +#import "RCTDevBundleLoader.h" + +#import "RCTMultipartDataTask.h" +#import +#import "NSDataBigString.h" +#import "RCTUtils.h" + + +namespace facebook { + namespace react { + + RCTDevBundleLoader::RCTDevBundleLoader(NSDictionary *bundles) { + _bundles = bundles; + } + + std::unique_ptr RCTDevBundleLoader::getBundle(std::string bundleURL) const { + RCTDevBundleSource *bundleSource = [_bundles objectForKey:[NSString stringWithUTF8String:bundleURL.c_str()]]; + if(bundleSource) { + std::unique_ptr script = std::make_unique([bundleSource data]); + return std::make_unique(std::move(script), std::string([[[bundleSource url] absoluteString] UTF8String])); + } + return nil; + } + + std::string RCTDevBundleLoader::getBundleURLFromName(std::string bundleName) const { + //TODO + // return bundlesContainer_->getSourceURLByName(bundleName); + return "index"; + } + + } // namespace react +} // namespace facebook diff --git a/React/Base/RCTDevBundlesDownloader.h b/React/Base/RCTDevBundlesDownloader.h new file mode 100644 index 000000000000..cd4103e898c5 --- /dev/null +++ b/React/Base/RCTDevBundlesDownloader.h @@ -0,0 +1,82 @@ +/** + * Copyright (c) Facebook, Inc. and its 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 + +extern NSString *const RCTDevBundleDownloaderErrorDomain; + +NS_ENUM(NSInteger) { + RCTDevBundleDownloaderErrorNoScriptURL = 1, + RCTDevBundleDownloaderErrorURLLoadFailed = 3, +}; + +NS_ENUM(NSInteger) { + RCTDevSourceFilesChangedCountNotBuiltByBundler = -2, + RCTDevSourceFilesChangedCountRebuiltFromScratch = -1, +}; + +@interface RCTDevBundleLoadingProgress : NSObject + +@property (nonatomic, copy) NSString *status; +@property (strong, nonatomic) NSNumber *done; +@property (strong, nonatomic) NSNumber *total; + +@end + +@interface RCTDevBundleSource : NSObject + +/** + * Name of the bundle. + */ +@property (strong, nonatomic, readonly) NSString *bundleName; + +/** + * URL of the source object. + */ +@property (strong, nonatomic, readonly) NSURL *url; + +/** + * JS source (or simply the binary header in the case of a RAM bundle). + */ +@property (strong, nonatomic, readonly) NSData *data; + +/** + * Length of the entire JS bundle. Note that self.length != self.data.length in the case of certain bundle formats. For + * instance, when using RAM bundles: + * + * - self.data will point to the bundle header + * - self.data.length is the length of the bundle header, i.e. sizeof(facebook::react::BundleHeader) + * - self.length is the length of the entire bundle file (header + contents) + */ +@property (nonatomic, readonly) NSUInteger length; + +/** + * Returns number of files changed when building this bundle: + * + * - RCTSourceFilesChangedCountNotBuiltByBundler if the source wasn't built by the bundler (e.g. read from disk) + * - RCTSourceFilesChangedCountRebuiltFromScratch if the source was rebuilt from scratch by the bundler + * - Otherwise, the number of files changed when incrementally rebuilding the source + */ +@property (nonatomic, readonly) NSInteger filesChangedCount; + +@end + +typedef void (^RCTDevBundlesProgressBlock)(RCTDevBundleLoadingProgress *progressData); +typedef void (^RCTDevBundlesLoadBlock)(NSError *error, NSDictionary *bundles); + +typedef void (^RCTDevBundleLoadBlock)(NSError *error, RCTDevBundleSource *bundleSource, NSArray *additionalBundles); +typedef void (^RCTDevBundleProgressBlock)(RCTDevBundleLoadingProgress *progressData); + +@interface RCTDevBundlesDownloader : NSObject + +@property (nonatomic, readonly) NSMutableDictionary *bundlesContainer; + ++ (void)loadBundleAtURL:(NSURL *)scriptURL onProgress:(RCTDevBundlesProgressBlock)onProgress onComplete:(RCTDevBundlesLoadBlock)onComplete; + +@end diff --git a/React/Base/RCTDevBundlesDownloader.m b/React/Base/RCTDevBundlesDownloader.m new file mode 100644 index 000000000000..79627671b1ce --- /dev/null +++ b/React/Base/RCTDevBundlesDownloader.m @@ -0,0 +1,232 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "RCTDevBundlesDownloader.h" + +#import "RCTBridge.h" +#import "RCTConvert.h" +#import "RCTMultipartDataTask.h" +#import "RCTPerformanceLogger.h" +#import "RCTUtils.h" +#import "RCTBundleURLProvider.h" + +NSString *const RCTDevBundleDownloaderErrorDomain = @"RCTDevBundleDownloaderErrorDomain"; + + +@interface RCTDevBundleSource() +{ +@public + NSURL *_url; + NSData *_data; + NSUInteger _length; + NSInteger _filesChangedCount; +} + +@end + +@implementation RCTDevBundleSource + +static RCTDevBundleSource *RCTSourceCreate(NSURL *url, NSData *data, int64_t length, NSString *bundleName) NS_RETURNS_RETAINED +{ + RCTDevBundleSource *source = [RCTDevBundleSource new]; + source->_url = url; + source->_data = data; + source->_length = length; + source->_filesChangedCount = RCTDevSourceFilesChangedCountNotBuiltByBundler; + source->_bundleName = bundleName; + return source; +} + +@end + +@implementation RCTDevBundlesDownloader + +RCT_NOT_IMPLEMENTED(- (instancetype)init) ++ (void)loadBundleAtURL:(NSURL *)scriptURL onProgress:(RCTDevBundlesProgressBlock)onProgress onComplete:(RCTDevBundlesLoadBlock)onComplete +{ + // FETCH INITIAL BUNDLE + attemptAsynchronousLoadOfBundleAtURL(scriptURL, ^(RCTDevBundleLoadingProgress *progressData) { + // TODO i don't know what to do with progress. + // Since we do not know at this moment if we need to download additional bundles or not + }, ^(NSError *error, RCTDevBundleSource *initialBundle, NSArray *additionalBundles) { + if(error) { + onComplete(error, nil); + } else { + NSMutableDictionary *bundlesContainer = [[NSMutableDictionary alloc] init]; + [bundlesContainer setValue:initialBundle forKey:initialBundle.url.absoluteString]; + if(additionalBundles) { + downloadAdditionalBundles(additionalBundles, bundlesContainer, onComplete); + } else { + onComplete(error, bundlesContainer); + } + } + }); +} + +static void parseHeaders(NSDictionary *headers, RCTDevBundleSource *source) { + source->_filesChangedCount = [headers[@"X-Metro-Files-Changed-Count"] integerValue]; +} + +static void attemptAsynchronousLoadOfBundleAtURL(NSURL *scriptURL, RCTDevBundleProgressBlock onProgress, RCTDevBundleLoadBlock onComplete) +{ + scriptURL = sanitizeURL(scriptURL); + RCTMultipartDataTask *task = [[RCTMultipartDataTask alloc] initWithURL:scriptURL partHandler:^(NSInteger statusCode, NSDictionary *headers, NSData *data, NSError *error, BOOL done) { + if (!done) { + if (onProgress) { + // TODO + // onProgress(progressEventFromData(data)); + } + return; + } + + // Handle general request errors + if (error) { + if ([error.domain isEqualToString:NSURLErrorDomain]) { + error = [NSError errorWithDomain:RCTDevBundleDownloaderErrorDomain + code:RCTDevBundleDownloaderErrorURLLoadFailed + userInfo: + @{ + NSLocalizedDescriptionKey: + [@"Could not connect to development server.\n\n" + "Ensure the following:\n" + "- Node server is running and available on the same network - run 'npm start' from react-native root\n" + "- Node server URL is correctly set in AppDelegate\n" + "- WiFi is enabled and connected to the same network as the Node Server\n\n" + "URL: " stringByAppendingString:scriptURL.absoluteString], + NSLocalizedFailureReasonErrorKey: error.localizedDescription, + NSUnderlyingErrorKey: error, + }]; + } + onComplete(error, nil, nil); + return; + } + + // For multipart responses packager sets X-Http-Status header in case HTTP status code + // is different from 200 OK + NSString *statusCodeHeader = headers[@"X-Http-Status"]; + if (statusCodeHeader) { + statusCode = [statusCodeHeader integerValue]; + } + + if (statusCode != 200) { + error = [NSError errorWithDomain:@"JSServer" + code:statusCode + userInfo:userInfoForRawResponse([[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding])]; + onComplete(error, nil, nil); + return; + } + + // Validate that the packager actually returned javascript. + NSString *contentType = headers[@"Content-Type"]; + NSString *mimeType = [[contentType componentsSeparatedByString:@";"] firstObject]; + if (![mimeType isEqualToString:@"application/javascript"] && + ![mimeType isEqualToString:@"text/javascript"]) { + NSString *description = [NSString stringWithFormat:@"Expected MIME-Type to be 'application/javascript' or 'text/javascript', but got '%@'.", mimeType]; + error = [NSError errorWithDomain:@"JSServer" + code:NSURLErrorCannotParseResponse + userInfo:@{ + NSLocalizedDescriptionKey: description, + @"headers": headers, + @"data": data + }]; + onComplete(error, nil, nil); + return; + } + + //TODO Get name from sourceURL + RCTDevBundleSource *source = RCTSourceCreate(scriptURL, data, data.length, @"index"); + parseHeaders(headers, source); + + // Check if there are additional bundles to fetch + NSString *additionalBundlesHeader = headers[@"X-multi-bundle"]; + NSArray *additionalBundles; + if(additionalBundlesHeader) { + additionalBundles = [additionalBundlesHeader componentsSeparatedByString:@","]; + } + + onComplete(nil, source, additionalBundles); + } progressHandler:^(NSDictionary *headers, NSNumber *loaded, NSNumber *total) { + // Only care about download progress events for the javascript bundle part. + if ([headers[@"Content-Type"] isEqualToString:@"application/javascript"]) { + // TODO + // onProgress(progressEventFromDownloadProgress(loaded, total)); + } + }]; + + [task startTask]; +} + +static void downloadAdditionalBundles(NSArray *bundles, NSMutableDictionary *bundlesContainer, RCTDevBundlesLoadBlock onComplete) { + + //TODO +} + +static NSString *getBundleNameFromURL(NSString *sourceURL) { + // TODO + return @"index"; +} + +static NSURL *getBundleURLFromName(NSString *bundleName) { + return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:bundleName fallbackResource:nil]; +} + +static NSURL *sanitizeURL(NSURL *url) +{ + // Why we do this is lost to time. We probably shouldn't; passing a valid URL is the caller's responsibility not ours. + return [RCTConvert NSURL:url.absoluteString]; +} + + +//TODO PROGRESS + +//static RCTLoadingProgress *progressEventFromData(NSData *rawData) +//{ +// NSString *text = [[NSString alloc] initWithData:rawData encoding:NSUTF8StringEncoding]; +// id info = RCTJSONParse(text, nil); +// if (!info || ![info isKindOfClass:[NSDictionary class]]) { +// return nil; +// } +// +// RCTLoadingProgress *progress = [RCTLoadingProgress new]; +// progress.status = info[@"status"]; +// progress.done = info[@"done"]; +// progress.total = info[@"total"]; +// return progress; +//} +// +//static RCTLoadingProgress *progressEventFromDownloadProgress(NSNumber *total, NSNumber *done) +//{ +// RCTLoadingProgress *progress = [RCTLoadingProgress new]; +// progress.status = @"Downloading JavaScript bundle"; +// // Progress values are in bytes transform them to kilobytes for smaller numbers. +// progress.done = done != nil ? @([done integerValue] / 1024) : nil; +// progress.total = total != nil ? @([total integerValue] / 1024) : nil; +// return progress; +//} + +static NSDictionary *userInfoForRawResponse(NSString *rawText) +{ + NSDictionary *parsedResponse = RCTJSONParse(rawText, nil); + if (![parsedResponse isKindOfClass:[NSDictionary class]]) { + return @{NSLocalizedDescriptionKey: rawText}; + } + NSArray *errors = parsedResponse[@"errors"]; + if (![errors isKindOfClass:[NSArray class]]) { + return @{NSLocalizedDescriptionKey: rawText}; + } + NSMutableArray *fakeStack = [NSMutableArray new]; + for (NSDictionary *err in errors) { + [fakeStack addObject: @{ + @"methodName": err[@"description"] ?: @"", + @"file": err[@"filename"] ?: @"", + @"lineNumber": err[@"lineNumber"] ?: @0 + }]; + } + return @{NSLocalizedDescriptionKey: parsedResponse[@"message"] ?: @"No message provided", @"stack": [fakeStack copy]}; +} + +@end diff --git a/React/Base/RCTFileBundleLoader.h b/React/Base/RCTFileBundleLoader.h index fc875e508151..065c33d8b7fc 100644 --- a/React/Base/RCTFileBundleLoader.h +++ b/React/Base/RCTFileBundleLoader.h @@ -4,6 +4,7 @@ #import #import #import +#import NS_ENUM(NSInteger) { RCTFileBundleLoaderErrorNoScriptURL = 1, diff --git a/React/Base/RCTFileBundleLoader.mm b/React/Base/RCTFileBundleLoader.mm index 8d82eb452585..c243f1028c1a 100644 --- a/React/Base/RCTFileBundleLoader.mm +++ b/React/Base/RCTFileBundleLoader.mm @@ -5,12 +5,14 @@ #import #import #import "NSDataBigString.h" +#import "RCTPerformanceLogger.h" +#import "RCTUtils.h" NSString *const RCTFileBundleLoaderErrorDomain = @"RCTFileBundleLoaderErrorDomain"; static const int32_t JSNoBytecodeFileFormatVersion = -1; -//TODO FIGURE OUT ERRORS +//TODO FIGURE HOW TO THROW ERRORS HERE namespace facebook { namespace react { @@ -38,8 +40,8 @@ } return nil; } - facebook::react::BundleType tag = facebook::react::Bundle::parseTypeFromHeader(header); - switch (tag) { + + switch (facebook::react::Bundle::parseTypeFromHeader(header)) { case facebook::react::BundleType::IndexedRAMBundle: { struct stat statInfo; if (stat(bundleURL.c_str(), &statInfo) != 0) { @@ -60,57 +62,44 @@ // Not sure if delta or file RAM bundles are supported on iOS return nil; case facebook::react::BundleType::BasicBundle: { -#if RCT_ENABLE_INSPECTOR - NSData *source = [NSData dataWithContentsOfFile:bundleURL + NSData *source = [NSData dataWithContentsOfFile:[NSString stringWithUTF8String:bundleURL.c_str()] options:NSDataReadingMappedIfSafe - error:error]; - if (sourceLength && source != nil) { - *sourceLength = source.length; - } + error:&error]; std::unique_ptr script = std::make_unique(source); - std::unique_ptr = std::make_unique(std::move(script), bundleURL); - return ; -#else - if (error) { - error = [NSError errorWithDomain:RCTFileBundleLoaderErrorDomain - code:RCTFileBundleLoaderErrorCannotBeLoadedSynchronously - userInfo:@{NSLocalizedDescriptionKey: - @"Cannot load text/javascript files synchronously"}]; - } - return nil; -#endif + return std::make_unique(std::move(script), bundleURL); } - // WHAT IS IT FOR? - case facebook::react::BundleType::BCBundle:{ - if (runtimeBCVersion == JSNoBytecodeFileFormatVersion || runtimeBCVersion < 0) { - if (error) { - error = [NSError errorWithDomain:RCTFileBundleLoaderErrorDomain - code:RCTFileBundleLoaderErrorBCNotSupported - userInfo:@{NSLocalizedDescriptionKey: - @"Bytecode bundles are not supported by this runtime."}]; - } - return nil; - } - else if ((uint32_t)runtimeBCVersion != header.version) { - if (error) { - NSString *errDesc = - [NSString stringWithFormat:@"BC Version Mismatch. Expect: %d, Actual: %u", - runtimeBCVersion, header.version]; + // WHAT IS IT FOR? + case facebook::react::BundleType::BCBundle:{ + if (runtimeBCVersion == JSNoBytecodeFileFormatVersion || runtimeBCVersion < 0) { + if (error) { + error = [NSError errorWithDomain:RCTFileBundleLoaderErrorDomain + code:RCTFileBundleLoaderErrorBCNotSupported + userInfo:@{NSLocalizedDescriptionKey: + @"Bytecode bundles are not supported by this runtime."}]; + } + return nil; + } + else if ((uint32_t)runtimeBCVersion != header.version) { + if (error) { + NSString *errDesc = + [NSString stringWithFormat:@"BC Version Mismatch. Expect: %d, Actual: %u", + runtimeBCVersion, header.version]; - error = [NSError errorWithDomain:RCTFileBundleLoaderErrorDomain - code:RCTFileBundleLoaderErrorBCVersion - userInfo:@{NSLocalizedDescriptionKey: errDesc}]; - } - return nil; - } - break; - } + error = [NSError errorWithDomain:RCTFileBundleLoaderErrorDomain + code:RCTFileBundleLoaderErrorBCVersion + userInfo:@{NSLocalizedDescriptionKey: errDesc}]; + } + return nil; + } + break; + } } + return nil; } std::string RCTFileBundleLoader::getBundleURLFromName(std::string bundleName) const { - //TODO -// return bundlesContainer_->getSourceURLByName(bundleName); + //TODO + return "index"; } diff --git a/React/Base/RCTNetworkBundleLoader.mm b/React/Base/RCTNetworkBundleLoader.mm deleted file mode 100644 index 9b3918af5265..000000000000 --- a/React/Base/RCTNetworkBundleLoader.mm +++ /dev/null @@ -1,120 +0,0 @@ -#import "RCTNetworkBundleLoader.h" - -#import "RCTMultipartDataTask.h" -#import -#import -#import -#import "RCTUtils.h" - -NSString *const RCTNetworkBundleLoaderErrorDomain = @"RCTNetworkBundleLoaderErrorDomain"; - - -namespace facebook { - namespace react { - - static NSDictionary *userInfoForRawResponse(NSString *rawText) - { - NSDictionary *parsedResponse = RCTJSONParse(rawText, nil); - if (![parsedResponse isKindOfClass:[NSDictionary class]]) { - return @{NSLocalizedDescriptionKey: rawText}; - } - NSArray *errors = parsedResponse[@"errors"]; - if (![errors isKindOfClass:[NSArray class]]) { - return @{NSLocalizedDescriptionKey: rawText}; - } - NSMutableArray *fakeStack = [NSMutableArray new]; - for (NSDictionary *err in errors) { - [fakeStack addObject: @{ - @"methodName": err[@"description"] ?: @"", - @"file": err[@"filename"] ?: @"", - @"lineNumber": err[@"lineNumber"] ?: @0 - }]; - } - return @{NSLocalizedDescriptionKey: parsedResponse[@"message"] ?: @"No message provided", @"stack": [fakeStack copy]}; - } - - std::unique_ptr RCTNetworkBundleLoader::getBundle(std::string bundleURL) const { - NSURL *sourceURL = [[NSURL alloc] initWithString:[NSString stringWithUTF8String:bundleURL.c_str()]]; - RCTMultipartDataTask *task = [[RCTMultipartDataTask alloc] initWithURL:sourceURL partHandler:^(NSInteger statusCode, NSDictionary *headers, NSData *data, NSError *error, BOOL done) { - if (!done) { -// if (onProgress) { -// onProgress(progressEventFromData(data)); -// } - return; - } - - // Handle general request errors - if (error) { - if ([error.domain isEqualToString:NSURLErrorDomain]) { - error = [NSError errorWithDomain:RCTNetworkBundleLoaderErrorDomain - code:RCTNetworkBundleLoaderErrorURLLoadFailed - userInfo: - @{ - NSLocalizedDescriptionKey: - [@"Could not connect to development server.\n\n" - "Ensure the following:\n" - "- Node server is running and available on the same network - run 'npm start' from react-native root\n" - "- Node server URL is correctly set in AppDelegate\n" - "- WiFi is enabled and connected to the same network as the Node Server\n\n" - "URL: " stringByAppendingString:sourceURL.absoluteString], - NSLocalizedFailureReasonErrorKey: error.localizedDescription, - NSUnderlyingErrorKey: error, - }]; - } -// onComplete(error, nil); - return; - } - - // For multipart responses packager sets X-Http-Status header in case HTTP status code - // is different from 200 OK - NSString *statusCodeHeader = headers[@"X-Http-Status"]; - if (statusCodeHeader) { - statusCode = [statusCodeHeader integerValue]; - } - - if (statusCode != 200) { - error = [NSError errorWithDomain:@"JSServer" - code:statusCode - userInfo:userInfoForRawResponse([[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding])]; -// onComplete(error, nil); - return; - } - - // Validate that the packager actually returned javascript. - NSString *contentType = headers[@"Content-Type"]; - NSString *mimeType = [[contentType componentsSeparatedByString:@";"] firstObject]; - if (![mimeType isEqualToString:@"application/javascript"] && - ![mimeType isEqualToString:@"text/javascript"]) { - NSString *description = [NSString stringWithFormat:@"Expected MIME-Type to be 'application/javascript' or 'text/javascript', but got '%@'.", mimeType]; - error = [NSError errorWithDomain:@"JSServer" - code:NSURLErrorCannotParseResponse - userInfo:@{ - NSLocalizedDescriptionKey: description, - @"headers": headers, - @"data": data - }]; -// onComplete(error, nil); - return; - } - -// RCTSource *source = RCTSourceCreate(scriptURL, data, data.length); -// parseHeaders(headers, source); -// onComplete(nil, source); - } progressHandler:^(NSDictionary *headers, NSNumber *loaded, NSNumber *total) { - // Only care about download progress events for the javascript bundle part. - if ([headers[@"Content-Type"] isEqualToString:@"application/javascript"]) { -// onProgress(progressEventFromDownloadProgress(loaded, total)); - } - }]; - - [task startTask]; - } - - std::string RCTNetworkBundleLoader::getBundleURLFromName(std::string bundleName) const { - //TODO - // return bundlesContainer_->getSourceURLByName(bundleName); - return "index"; - } - - } // namespace react -} // namespace facebook diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index c8f3cbf2be10..60eeabf5d26a 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -27,6 +27,8 @@ #import #import #import +#import +#import #import #import #import @@ -343,35 +345,42 @@ - (void)start }]; // Load the source asynchronously, then store it for later execution. - dispatch_group_enter(prepareBridge); - __block NSData *sourceCode; - [self loadSource:^(NSError *error, RCTSource *source) { - if (error) { - [weakSelf handleError:error]; - } - - sourceCode = source.data; - dispatch_group_leave(prepareBridge); - } onProgress:^(RCTLoadingProgress *progressData) { -#if RCT_DEV && __has_include("RCTDevLoadingView.h") - // Note: RCTDevLoadingView should have been loaded at this point, so no need to allow lazy loading. - RCTDevLoadingView *loadingView = [weakSelf moduleForName:RCTBridgeModuleNameForClass([RCTDevLoadingView class]) - lazilyLoadIfNecessary:NO]; - [loadingView updateProgress:progressData]; -#endif - }]; - - // Wait for both the modules and source code to have finished loading - dispatch_group_notify(prepareBridge, dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{ - RCTCxxBridge *strongSelf = weakSelf; - if (sourceCode && strongSelf.loading) { - [strongSelf executeSourceCode:sourceCode sync:NO]; - } - }); + if(!self.bundleURL.fileURL) { + dispatch_group_enter(prepareBridge); + __block NSDictionary *bundlesContainer; + [self loadSource:^(NSError *error, NSDictionary *bundles) { + if (error) { + [weakSelf handleError:error]; + } + bundlesContainer = bundles; + dispatch_group_leave(prepareBridge); + } onProgress:^(RCTDevBundleLoadingProgress *progressData) { + #if RCT_DEV && __has_include("RCTDevLoadingView.h") + // Note: RCTDevLoadingView should have been loaded at this point, so no need to allow lazy loading. + RCTDevLoadingView *loadingView = [weakSelf moduleForName:RCTBridgeModuleNameForClass([RCTDevLoadingView class]) + lazilyLoadIfNecessary:NO]; + [loadingView updateProgress:progressData]; + #endif + }]; + // Wait for both the modules and source code to have finished loading + dispatch_group_notify(prepareBridge, dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{ + RCTCxxBridge *strongSelf = weakSelf; + if (bundlesContainer && strongSelf.loading) { + [strongSelf executeSourceCode:bundlesContainer sync:NO]; + } + }); + } else { + dispatch_group_notify(prepareBridge, dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{ + RCTCxxBridge *strongSelf = weakSelf; + if (strongSelf.loading) { + [strongSelf executeFileSourceCode:NO]; + } + }); + } RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); } -- (void)loadSource:(RCTSourceLoadBlock)_onSourceLoad onProgress:(RCTSourceLoadProgressBlock)onProgress +- (void)loadSource:(RCTDevBundlesLoadBlock)_onSourceLoad onProgress:(RCTDevBundlesProgressBlock)onProgress { NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; [center postNotificationName:RCTBridgeWillDownloadScriptNotification object:_parentBridge]; @@ -382,21 +391,26 @@ - (void)loadSource:(RCTSourceLoadBlock)_onSourceLoad onProgress:(RCTSourceLoadPr (void)cookie; RCTPerformanceLogger *performanceLogger = _performanceLogger; - RCTSourceLoadBlock onSourceLoad = ^(NSError *error, RCTSource *source) { + + RCTDevBundlesLoadBlock onSourceLoad = ^(NSError *error, NSDictionary *bundlesContainer) { RCTProfileEndAsyncEvent(0, @"native", cookie, @"JavaScript download", @"JS async"); [performanceLogger markStopForTag:RCTPLScriptDownload]; - [performanceLogger setValue:source.length forTag:RCTPLBundleSize]; + + // TODO fix performance logs + +// [performanceLogger setValue:source.length forTag:RCTPLBundleSize]; - NSDictionary *userInfo = @{ - RCTBridgeDidDownloadScriptNotificationSourceKey: source ?: [NSNull null], - RCTBridgeDidDownloadScriptNotificationBridgeDescriptionKey: self->_bridgeDescription ?: [NSNull null], - }; +// NSDictionary *userInfo = @{ +// RCTBridgeDidDownloadScriptNotificationSourceKey: source ?: [NSNull null], +// RCTBridgeDidDownloadScriptNotificationBridgeDescriptionKey: self->_bridgeDescription ?: [NSNull null], +// }; - [center postNotificationName:RCTBridgeDidDownloadScriptNotification object:self->_parentBridge userInfo:userInfo]; +// [center postNotificationName:RCTBridgeDidDownloadScriptNotification object:self->_parentBridge userInfo:userInfo]; - _onSourceLoad(error, source); + _onSourceLoad(error, bundlesContainer); }; + if ([self.delegate respondsToSelector:@selector(loadSourceForBridge:onProgress:onComplete:)]) { [self.delegate loadSourceForBridge:_parentBridge onProgress:onProgress onComplete:onSourceLoad]; } else if ([self.delegate respondsToSelector:@selector(loadSourceForBridge:withBlock:)]) { @@ -406,12 +420,12 @@ - (void)loadSource:(RCTSourceLoadBlock)_onSourceLoad onProgress:(RCTSourceLoadPr "server or have included a .jsbundle file in your application bundle."); onSourceLoad(error, nil); } else { - [RCTJavaScriptLoader loadBundleAtURL:self.bundleURL onProgress:onProgress onComplete:^(NSError *error, RCTSource *source) { + [RCTDevBundlesDownloader loadBundleAtURL:self.bundleURL onProgress:onProgress onComplete:^(NSError *error, NSDictionary *bundles) { if (error) { RCTLogError(@"Failed to load bundle(%@) with error:(%@ %@)", self.bundleURL, error.localizedDescription, error.localizedFailureReason); return; } - onSourceLoad(error, source); + onSourceLoad(error, bundles); }]; } } @@ -857,22 +871,56 @@ - (void)registerModuleForFrameUpdates:(id)module [_displayLink registerModuleForFrameUpdates:module withModuleData:moduleData]; } -- (void)executeSourceCode:(NSData *)sourceCode sync:(BOOL)sync +- (void)executeSourceCode:(NSDictionary *)bundles sync:(BOOL)sync +{ + dispatch_block_t completion = [self getCompletionHandler]; + + if (sync) { + [self executeApplicationScriptSync:bundles]; + completion(); + } else { + [self enqueueApplicationScript:bundles onComplete:completion]; + } +} + +- (void)executeFileSourceCode:(BOOL)sync { // This will get called from whatever thread was actually executing JS. - dispatch_block_t completion = ^{ + dispatch_block_t completion = [self getCompletionHandler]; + + if (sync) { + [self executeApplicationFileScriptSync:self.bundleURL]; + completion(); + } else { + [self enqueueApplicationFileScript:self.bundleURL onComplete:completion]; + } + +#if RCT_DEV + if (self.devSettings.isHotLoadingAvailable && self.devSettings.isHotLoadingEnabled) { + NSString *path = [self.bundleURL.path substringFromIndex:1]; // strip initial slash + NSString *host = self.bundleURL.host; + NSNumber *port = self.bundleURL.port; + [self enqueueJSCall:@"HMRClient" + method:@"enable" + args:@[@"ios", path, host, RCTNullIfNil(port)] + completion:NULL]; } +#endif +} + +- (dispatch_block_t)getCompletionHandler { + return ^{ // Log start up metrics early before processing any other js calls [self logStartupFinish]; // Flush pending calls immediately so we preserve ordering [self _flushPendingCalls]; - + // Perform the state update and notification on the main thread, so we can't run into // timing issues with RCTRootView dispatch_async(dispatch_get_main_queue(), ^{ [[NSNotificationCenter defaultCenter] postNotificationName:RCTJavaScriptDidLoadNotification object:self->_parentBridge userInfo:@{@"bridge": self}]; - + // Starting the display link is not critical to startup, so do it last [self ensureOnJavaScriptThread:^{ // Register the display link to start sending js calls after everything is setup @@ -880,24 +928,6 @@ - (void)executeSourceCode:(NSData *)sourceCode sync:(BOOL)sync }]; }); }; - - if (sync) { - [self executeApplicationScriptSync:sourceCode url:self.bundleURL]; - completion(); - } else { - [self enqueueApplicationScript:sourceCode url:self.bundleURL onComplete:completion]; - } - -#if RCT_DEV - if (self.devSettings.isHotLoadingAvailable && self.devSettings.isHotLoadingEnabled) { - NSString *path = [self.bundleURL.path substringFromIndex:1]; // strip initial slash - NSString *host = self.bundleURL.host; - NSNumber *port = self.bundleURL.port; - [self enqueueJSCall:@"HMRClient" - method:@"enable" - args:@[@"ios", path, host, RCTNullIfNil(port)] - completion:NULL]; } -#endif } - (void)handleError:(NSError *)error @@ -1252,13 +1282,12 @@ - (void)_immediatelyCallTimer:(NSNumber *)timer } } -- (void)enqueueApplicationScript:(NSData *)script - url:(NSURL *)url +- (void)enqueueApplicationScript:(NSDictionary *)bundles onComplete:(dispatch_block_t)onComplete { RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[RCTCxxBridge enqueueApplicationScript]", nil); - [self executeApplicationScript:script url:url async:YES]; + [self executeApplicationScript:bundles async:YES]; RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); @@ -1269,53 +1298,68 @@ - (void)enqueueApplicationScript:(NSData *)script } } -- (void)executeApplicationScriptSync:(NSData *)script url:(NSURL *)url +- (void)executeApplicationScriptSync:(NSDictionary *)bundles { - [self executeApplicationScript:script url:url async:NO]; + [self executeApplicationScript:bundles async:NO]; } -- (void)executeApplicationScript:(NSData *)script - url:(NSURL *)url +- (void)executeApplicationScript:(NSDictionary *)bundles async:(BOOL)async { [self _tryAndHandleError:^{ - NSString *sourceUrlStr = deriveSourceURL(url); + NSString *sourceUrlStr = deriveSourceURL(self.bundleURL); [[NSNotificationCenter defaultCenter] postNotificationName:RCTJavaScriptWillStartExecutingNotification object:self->_parentBridge userInfo:@{@"bridge": self}]; - if (url.isFileURL) { - std::unique_ptr loader = std::make_unique(); - } else { - - //TODO create bundle loader - } - if (IndexedRAMBundle::isIndexedRAMBundle(sourceUrlStr.UTF8String)) { - [self->_performanceLogger markStartForTag:RCTPLRAMBundleLoad]; - auto ramBundle = std::make_unique(sourceUrlStr.UTF8String, sourceUrlStr.UTF8String); - std::unique_ptr scriptStr = ramBundle->getStartupScript(); - [self->_performanceLogger markStopForTag:RCTPLRAMBundleLoad]; - [self->_performanceLogger setValue:scriptStr->size() forTag:RCTPLRAMStartupCodeSize]; - if (self->_reactInstance) { -// auto registry = RAMBundleRegistry::multipleBundlesRegistry(std::move(ramBundle), JSIndexedRAMBundle::buildFactory()); -// self->_reactInstance->loadRAMBundle(std::move(registry), std::move(scriptStr), -// sourceUrlStr.UTF8String, !async); - } - } else if (self->_reactInstance) { -// self->_reactInstance->loadScriptFromString(std::make_unique(script), -// sourceUrlStr.UTF8String, !async); - } else { - std::string methodName = async ? "loadApplicationScript" : "loadApplicationScriptSync"; - throw std::logic_error("Attempt to call " + methodName + ": on uninitialized bridge"); - } + + std::unique_ptr loader = std::make_unique(bundles); + self->_reactInstance->runApplication(std::string([sourceUrlStr UTF8String]), std::move(loader), !async); }]; } -//- (void)registerSegmentWithId:(NSUInteger)segmentId path:(NSString *)path -//{ -// if (_reactInstance) { -// _reactInstance->registerBundle(static_cast(segmentId), path.UTF8String); -// } -//} +- (void)enqueueApplicationFileScript:(NSURL *)url + onComplete:(dispatch_block_t)onComplete +{ + RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[RCTCxxBridge enqueueApplicationFileScript]", nil); + + [self executeApplicationFileScript:url async:YES]; + + RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); + + // Assumes that onComplete can be called when the next block on the JS thread is scheduled + if (onComplete) { + RCTAssert(_jsMessageThread != nullptr, @"Cannot invoke completion without jsMessageThread"); + _jsMessageThread->runOnQueue(onComplete); + } +} + + +- (void)executeApplicationFileScriptSync:(NSURL *)url +{ + [self executeApplicationFileScript:url async:NO]; +} + +- (void)executeApplicationFileScript:(NSURL *)url + async:(BOOL)async +{ + [self _tryAndHandleError:^{ + NSString *sourceUrlStr = deriveSourceURL(url); + [[NSNotificationCenter defaultCenter] + postNotificationName:RCTJavaScriptWillStartExecutingNotification + object:self->_parentBridge userInfo:@{@"bridge": self}]; + + std::unique_ptr loader = std::make_unique(); + self->_reactInstance->runApplication(std::string([sourceUrlStr UTF8String]), std::move(loader), !async); + //TODO figure out where and when call these permormance logs +// if (IndexedRAMBundle::isIndexedRAMBundle(sourceUrlStr.UTF8String)) { +// [self->_performanceLogger markStartForTag:RCTPLRAMBundleLoad]; +// auto ramBundle = std::make_unique(sourceUrlStr.UTF8String, sourceUrlStr.UTF8String); +// std::unique_ptr scriptStr = ramBundle->getStartupScript(); +// [self->_performanceLogger markStopForTag:RCTPLRAMBundleLoad]; +// [self->_performanceLogger setValue:scriptStr->size() forTag:RCTPLRAMStartupCodeSize]; +// } + }]; +} #pragma mark - Payload Processing diff --git a/React/DevSupport/RCTDevLoadingView.h b/React/DevSupport/RCTDevLoadingView.h index 2a4a7d4c5c51..769833bf8420 100644 --- a/React/DevSupport/RCTDevLoadingView.h +++ b/React/DevSupport/RCTDevLoadingView.h @@ -9,14 +9,14 @@ #import -@class RCTLoadingProgress; +@class RCTDevBundleLoadingProgress; @interface RCTDevLoadingView : NSObject + (void)setEnabled:(BOOL)enabled; - (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(UIColor *)backgroundColor; - (void)showWithURL:(NSURL *)URL; -- (void)updateProgress:(RCTLoadingProgress *)progress; +- (void)updateProgress:(RCTDevBundleLoadingProgress *)progress; - (void)hide; @end diff --git a/React/DevSupport/RCTDevLoadingView.m b/React/DevSupport/RCTDevLoadingView.m index 08ae65b0ccba..f38c8379a587 100644 --- a/React/DevSupport/RCTDevLoadingView.m +++ b/React/DevSupport/RCTDevLoadingView.m @@ -13,6 +13,7 @@ #import "RCTDefines.h" #import "RCTModalHostViewController.h" #import "RCTUtils.h" +#import #if RCT_DEV | RCT_ENABLE_LOADING_VIEW @@ -149,7 +150,7 @@ - (void)showWithURL:(NSURL *)URL backgroundColor:backgroundColor]; } -- (void)updateProgress:(RCTLoadingProgress *)progress +- (void)updateProgress:(RCTDevBundleLoadingProgress *)progress { if (!progress) { return; diff --git a/React/React.xcodeproj/project.pbxproj b/React/React.xcodeproj/project.pbxproj index ffb72f896f63..82a5c636b95c 100644 --- a/React/React.xcodeproj/project.pbxproj +++ b/React/React.xcodeproj/project.pbxproj @@ -990,10 +990,15 @@ 66CD94B71F1045E700CB3C7C /* RCTMaskedViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 66CD94B01F1045E700CB3C7C /* RCTMaskedViewManager.m */; }; 66CD94B81F1045E700CB3C7C /* RCTMaskedViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 66CD94B01F1045E700CB3C7C /* RCTMaskedViewManager.m */; }; 68EFE4EE1CF6EB3900A1DE13 /* RCTBundleURLProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 68EFE4ED1CF6EB3900A1DE13 /* RCTBundleURLProvider.m */; }; - 690D491922B79FFB0039D9D6 /* RCTNetworkBundleLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 690D491822B79FFB0039D9D6 /* RCTNetworkBundleLoader.h */; }; - 690D491A22B79FFB0039D9D6 /* RCTNetworkBundleLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 690D491822B79FFB0039D9D6 /* RCTNetworkBundleLoader.h */; }; - 690D491C22B7A0560039D9D6 /* RCTNetworkBundleLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 690D491B22B7A0560039D9D6 /* RCTNetworkBundleLoader.mm */; }; - 690D491D22B7A0560039D9D6 /* RCTNetworkBundleLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 690D491B22B7A0560039D9D6 /* RCTNetworkBundleLoader.mm */; }; + 690D491922B79FFB0039D9D6 /* RCTDevBundleLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 690D491822B79FFB0039D9D6 /* RCTDevBundleLoader.h */; }; + 690D491A22B79FFB0039D9D6 /* RCTDevBundleLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 690D491822B79FFB0039D9D6 /* RCTDevBundleLoader.h */; }; + 690D491C22B7A0560039D9D6 /* RCTDevBundleLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 690D491B22B7A0560039D9D6 /* RCTDevBundleLoader.mm */; }; + 690D491D22B7A0560039D9D6 /* RCTDevBundleLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 690D491B22B7A0560039D9D6 /* RCTDevBundleLoader.mm */; }; + 691083B622BA8DAA00CBA067 /* RCTDevBundlesDownloader.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 6917608922B8DE2B00B35BC7 /* RCTDevBundlesDownloader.h */; }; + 6917608A22B8DE2B00B35BC7 /* RCTDevBundlesDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 6917608922B8DE2B00B35BC7 /* RCTDevBundlesDownloader.h */; }; + 6917608B22B8DE2B00B35BC7 /* RCTDevBundlesDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 6917608922B8DE2B00B35BC7 /* RCTDevBundlesDownloader.h */; }; + 6917608D22B8EA5900B35BC7 /* RCTDevBundlesDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 6917608C22B8EA5900B35BC7 /* RCTDevBundlesDownloader.m */; }; + 6917608E22B8EA5900B35BC7 /* RCTDevBundlesDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 6917608C22B8EA5900B35BC7 /* RCTDevBundlesDownloader.m */; }; 697ACDB122B2B303003C13DF /* BasicBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697ACDA022B2A3D7003C13DF /* BasicBundle.cpp */; }; 697ACDB222B2B309003C13DF /* BasicBundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 697ACD9322B2A3D6003C13DF /* BasicBundle.h */; }; 697ACDB322B2B31C003C13DF /* Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697ACD9622B2A3D6003C13DF /* Bundle.cpp */; }; @@ -1566,6 +1571,7 @@ dstPath = include/React; dstSubfolderSpec = 16; files = ( + 691083B622BA8DAA00CBA067 /* RCTDevBundlesDownloader.h in Copy Headers */, 39C50FF92046EACF00CEE534 /* RCTVersion.h in Copy Headers */, 591F78DE202ADB8F004A668C /* RCTLayout.h in Copy Headers */, 59EDBCBD1FDF4E43003573DE /* RCTScrollableProtocol.h in Copy Headers */, @@ -2171,8 +2177,10 @@ 66CD94B01F1045E700CB3C7C /* RCTMaskedViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMaskedViewManager.m; sourceTree = ""; }; 68EFE4EC1CF6EB3000A1DE13 /* RCTBundleURLProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBundleURLProvider.h; sourceTree = ""; }; 68EFE4ED1CF6EB3900A1DE13 /* RCTBundleURLProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBundleURLProvider.m; sourceTree = ""; }; - 690D491822B79FFB0039D9D6 /* RCTNetworkBundleLoader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTNetworkBundleLoader.h; sourceTree = ""; }; - 690D491B22B7A0560039D9D6 /* RCTNetworkBundleLoader.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTNetworkBundleLoader.mm; sourceTree = ""; }; + 690D491822B79FFB0039D9D6 /* RCTDevBundleLoader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTDevBundleLoader.h; sourceTree = ""; }; + 690D491B22B7A0560039D9D6 /* RCTDevBundleLoader.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTDevBundleLoader.mm; sourceTree = ""; }; + 6917608922B8DE2B00B35BC7 /* RCTDevBundlesDownloader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTDevBundlesDownloader.h; sourceTree = ""; }; + 6917608C22B8EA5900B35BC7 /* RCTDevBundlesDownloader.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTDevBundlesDownloader.m; sourceTree = ""; }; 697ACD9122B2A3D6003C13DF /* BundleRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BundleRegistry.cpp; sourceTree = ""; }; 697ACD9222B2A3D6003C13DF /* DeltaBundleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeltaBundleClient.cpp; sourceTree = ""; }; 697ACD9322B2A3D6003C13DF /* BasicBundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BasicBundle.h; sourceTree = ""; }; @@ -2950,11 +2958,13 @@ 83CBBA4C1A601E3B00E9B192 /* RCTInvalidating.h */, 83CBBA631A601ECA00E9B192 /* RCTJavaScriptExecutor.h */, 14200DA81AC179B3008EE6BA /* RCTJavaScriptLoader.h */, + 6917608922B8DE2B00B35BC7 /* RCTDevBundlesDownloader.h */, + 6917608C22B8EA5900B35BC7 /* RCTDevBundlesDownloader.m */, AC70D2E81DE489E4002E6351 /* RCTJavaScriptLoader.mm */, 697ACDED22B395E9003C13DF /* RCTFileBundleLoader.h */, - 690D491822B79FFB0039D9D6 /* RCTNetworkBundleLoader.h */, + 690D491822B79FFB0039D9D6 /* RCTDevBundleLoader.h */, 69CF112122B53DCB000075E3 /* RCTFileBundleLoader.mm */, - 690D491B22B7A0560039D9D6 /* RCTNetworkBundleLoader.mm */, + 690D491B22B7A0560039D9D6 /* RCTDevBundleLoader.mm */, 008341F51D1DB34400876D9A /* RCTJSStackFrame.h */, 008341F41D1DB34400876D9A /* RCTJSStackFrame.m */, 13A1F71C1A75392D00D3D453 /* RCTKeyCommands.h */, @@ -3146,7 +3156,7 @@ 3D302F251DF828F800D6DDAE /* RCTImageStoreManager.h in Headers */, C60128AC1F3D1258009DF9FF /* RCTCxxConvert.h in Headers */, 3D302F261DF828F800D6DDAE /* RCTResizeMode.h in Headers */, - 690D491A22B79FFB0039D9D6 /* RCTNetworkBundleLoader.h in Headers */, + 690D491A22B79FFB0039D9D6 /* RCTDevBundleLoader.h in Headers */, 3D302F271DF828F800D6DDAE /* RCTLinkingManager.h in Headers */, 3D7BFD161EA8E351008DFB7A /* RCTPackagerClient.h in Headers */, 3D302F281DF828F800D6DDAE /* RCTNetworking.h in Headers */, @@ -3198,6 +3208,7 @@ 3D302F491DF828F800D6DDAE /* RCTRootViewDelegate.h in Headers */, 3D302F4A1DF828F800D6DDAE /* RCTRootViewInternal.h in Headers */, 3D302F4B1DF828F800D6DDAE /* RCTTouchEvent.h in Headers */, + 6917608B22B8DE2B00B35BC7 /* RCTDevBundlesDownloader.h in Headers */, 591F78DD202ADB22004A668C /* RCTLayout.h in Headers */, 59D031F21F8353D3008361F0 /* RCTSafeAreaView.h in Headers */, 3D302F4C1DF828F800D6DDAE /* RCTTouchHandler.h in Headers */, @@ -3447,7 +3458,7 @@ 3D80DA291DF820620028D040 /* RCTDisplayLink.h in Headers */, 597633381F4E021D005BE8A4 /* RCTShadowView+Internal.h in Headers */, 3D80DA2A1DF820620028D040 /* RCTErrorCustomizer.h in Headers */, - 690D491922B79FFB0039D9D6 /* RCTNetworkBundleLoader.h in Headers */, + 690D491922B79FFB0039D9D6 /* RCTDevBundleLoader.h in Headers */, 3D80DA2B1DF820620028D040 /* RCTErrorInfo.h in Headers */, 1384E2081E806D4E00545659 /* RCTNativeModule.h in Headers */, 50E98FED21460B0D00CD9289 /* RCTWKWebViewManager.h in Headers */, @@ -3467,6 +3478,7 @@ 3D80DA321DF820620028D040 /* RCTJSStackFrame.h in Headers */, 130443DC1E401AF400D93A67 /* RCTConvert+Transform.h in Headers */, 3D80DA331DF820620028D040 /* RCTKeyCommands.h in Headers */, + 6917608A22B8DE2B00B35BC7 /* RCTDevBundlesDownloader.h in Headers */, 3D80DA341DF820620028D040 /* RCTLog.h in Headers */, 3D80DA351DF820620028D040 /* RCTModuleData.h in Headers */, 3D80DA361DF820620028D040 /* RCTModuleMethod.h in Headers */, @@ -4240,7 +4252,7 @@ 2D3B5EAE1D9B08F800451313 /* RCTEventEmitter.m in Sources */, 2D3B5ECA1D9B095F00451313 /* RCTComponentData.m in Sources */, 2D3B5EA31D9B08BE00451313 /* RCTParserUtils.m in Sources */, - 690D491D22B7A0560039D9D6 /* RCTNetworkBundleLoader.mm in Sources */, + 690D491D22B7A0560039D9D6 /* RCTDevBundleLoader.mm in Sources */, 59500D461F71C63F00B122B7 /* RCTUIManagerUtils.m in Sources */, 599FAA4D1FB274980058CCF6 /* RCTSurfaceView.mm in Sources */, 59EDBCB41FDF4E0C003573DE /* (null) in Sources */, @@ -4327,6 +4339,7 @@ 59EDBCBC1FDF4E0C003573DE /* RCTScrollViewManager.m in Sources */, 59EDBCB01FDF4E0C003573DE /* RCTScrollContentView.m in Sources */, 2D3B5EF01D9B09E300451313 /* RCTWrapperViewController.m in Sources */, + 6917608E22B8EA5900B35BC7 /* RCTDevBundlesDownloader.m in Sources */, 2D3B5EB01D9B08FE00451313 /* RCTAlertManager.m in Sources */, 13134C9B1E296B2A00B9F3CB /* RCTCxxMethod.mm in Sources */, 2D3B5E9C1D9B08A300451313 /* RCTImageSource.m in Sources */, @@ -4575,6 +4588,7 @@ 3D7749441DC1065C007EC8D8 /* RCTPlatform.m in Sources */, 59EDBCAF1FDF4E0C003573DE /* RCTScrollContentView.m in Sources */, 13D9FEEE1CDCD93000158BD7 /* RCTKeyboardObserver.m in Sources */, + 6917608D22B8EA5900B35BC7 /* RCTDevBundlesDownloader.m in Sources */, B233E6EA1D2D845D00BC68BA /* RCTI18nManager.m in Sources */, 3D7BFD1F1EA8E351008DFB7A /* RCTPackagerConnection.mm in Sources */, 13456E931ADAD2DE009F94A7 /* RCTConvert+CoreLocation.m in Sources */, @@ -4600,7 +4614,7 @@ 657734911EE8354A00A0E9EA /* RCTInspectorPackagerConnection.m in Sources */, 68EFE4EE1CF6EB3900A1DE13 /* RCTBundleURLProvider.m in Sources */, B95154321D1B34B200FE7B80 /* RCTActivityIndicatorView.m in Sources */, - 690D491C22B7A0560039D9D6 /* RCTNetworkBundleLoader.mm in Sources */, + 690D491C22B7A0560039D9D6 /* RCTDevBundleLoader.mm in Sources */, 5960C1BB1F0804A00066FD5B /* RCTLayoutAnimationGroup.m in Sources */, 13F17A851B8493E5007D4C75 /* RCTRedBox.m in Sources */, 59D031F31F8353D3008361F0 /* RCTSafeAreaView.m in Sources */, diff --git a/React/React.xcodeproj/xcshareddata/xcschemes/React.xcscheme b/React/React.xcodeproj/xcshareddata/xcschemes/React.xcscheme new file mode 100644 index 000000000000..8180aa0335ea --- /dev/null +++ b/React/React.xcodeproj/xcshareddata/xcschemes/React.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h index b568e75ebda0..42d3efa2fe6c 100644 --- a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h +++ b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h @@ -6,8 +6,7 @@ #pragma once #include "JSINativeModules.h" - -#include +//#include #include #include #include From 378a1f75991a92ce5f605020bdd2cdd9dbdd87a3 Mon Sep 17 00:00:00 2001 From: Dratwas Date: Thu, 20 Jun 2019 01:10:20 +0200 Subject: [PATCH 3/9] add additional bundle loading --- React/Base/RCTDevBundlesDownloader.m | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/React/Base/RCTDevBundlesDownloader.m b/React/Base/RCTDevBundlesDownloader.m index 79627671b1ce..c13bf399856a 100644 --- a/React/Base/RCTDevBundlesDownloader.m +++ b/React/Base/RCTDevBundlesDownloader.m @@ -161,13 +161,25 @@ static void attemptAsynchronousLoadOfBundleAtURL(NSURL *scriptURL, RCTDevBundleP } static void downloadAdditionalBundles(NSArray *bundles, NSMutableDictionary *bundlesContainer, RCTDevBundlesLoadBlock onComplete) { + dispatch_group_t downloadAdditionalBundles = dispatch_group_create(); + __block NSError *err; + for(NSString * bundleName in bundles) { + dispatch_group_enter(downloadAdditionalBundles); + NSURL *bundleURL = getBundleURLFromName(bundleName); + attemptAsynchronousLoadOfBundleAtURL(bundleURL, ^(RCTDevBundleLoadingProgress *progressData) { + //TODO + }, ^(NSError *error, RCTDevBundleSource *bundleSource, NSArray *additionalBundles) { + if(error) { + err = error; + } + [bundlesContainer setValue:bundleSource forKey:bundleURL.absoluteString]; + dispatch_group_leave(downloadAdditionalBundles); + }); + } - //TODO -} - -static NSString *getBundleNameFromURL(NSString *sourceURL) { - // TODO - return @"index"; + dispatch_group_notify(downloadAdditionalBundles, dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{ + onComplete(err, bundlesContainer); + }); } static NSURL *getBundleURLFromName(NSString *bundleName) { From d3e949e22ba243e429c325520305915feada5db7 Mon Sep 17 00:00:00 2001 From: Dratwas Date: Thu, 20 Jun 2019 01:28:41 +0200 Subject: [PATCH 4/9] add get url from bundle name --- React/Base/RCTDevBundleLoader.mm | 5 ++--- React/Base/RCTFileBundleLoader.mm | 9 +++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/React/Base/RCTDevBundleLoader.mm b/React/Base/RCTDevBundleLoader.mm index 86efc78a1824..efdc11546e43 100644 --- a/React/Base/RCTDevBundleLoader.mm +++ b/React/Base/RCTDevBundleLoader.mm @@ -3,6 +3,7 @@ #import "RCTMultipartDataTask.h" #import #import "NSDataBigString.h" +#import "RCTBundleURLProvider.h" #import "RCTUtils.h" @@ -23,9 +24,7 @@ } std::string RCTDevBundleLoader::getBundleURLFromName(std::string bundleName) const { - //TODO - // return bundlesContainer_->getSourceURLByName(bundleName); - return "index"; + return std::string([[[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil].absoluteString UTF8String]); } } // namespace react diff --git a/React/Base/RCTFileBundleLoader.mm b/React/Base/RCTFileBundleLoader.mm index c243f1028c1a..2c8b6df00618 100644 --- a/React/Base/RCTFileBundleLoader.mm +++ b/React/Base/RCTFileBundleLoader.mm @@ -98,10 +98,11 @@ } std::string RCTFileBundleLoader::getBundleURLFromName(std::string bundleName) const { - //TODO - - return "index"; + return std::string([ + [[NSBundle mainBundle] + URLForResource: [NSString stringWithUTF8String:bundleName.c_str()] + withExtension:@"jsbundle"] + .path UTF8String]); } - } // namespace react } // namespace facebook From 4a9abf9c5de981fff2214ae1e122243fb34fa10c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Trys=C5=82a?= Date: Mon, 1 Jul 2019 16:37:02 +0200 Subject: [PATCH 5/9] refactor bundle progress tracking --- RNTester/RNTester/AppDelegate.m | 4 +- React/Base/RCTDevBundleLoader.mm | 4 +- React/Base/RCTDevBundlesDownloader.m | 82 ++-- React/Base/RCTJavaScriptLoader.h | 92 ----- React/Base/RCTJavaScriptLoader.mm | 368 ------------------ React/CxxBridge/RCTCxxBridge.mm | 1 - React/DevSupport/RCTDevLoadingView.m | 2 +- .../react/devsupport/BundleDownloader.java | 2 +- 8 files changed, 53 insertions(+), 502 deletions(-) delete mode 100755 React/Base/RCTJavaScriptLoader.h delete mode 100755 React/Base/RCTJavaScriptLoader.mm diff --git a/RNTester/RNTester/AppDelegate.m b/RNTester/RNTester/AppDelegate.m index ff34483af678..615cdb49e8d4 100644 --- a/RNTester/RNTester/AppDelegate.m +++ b/RNTester/RNTester/AppDelegate.m @@ -10,7 +10,7 @@ #import #import -#import +#import #import #import @@ -72,7 +72,7 @@ - (void)loadSourceForBridge:(RCTBridge *)bridge onProgress:(RCTSourceLoadProgressBlock)onProgress onComplete:(RCTSourceLoadBlock)loadCallback { - [RCTJavaScriptLoader loadBundleAtURL:[self sourceURLForBridge:bridge] + [RCTDevBundlesDownloader loadBundleAtURL:[self sourceURLForBridge:bridge] onProgress:onProgress onComplete:loadCallback]; } diff --git a/React/Base/RCTDevBundleLoader.mm b/React/Base/RCTDevBundleLoader.mm index efdc11546e43..7d7cf7bd447d 100644 --- a/React/Base/RCTDevBundleLoader.mm +++ b/React/Base/RCTDevBundleLoader.mm @@ -24,7 +24,9 @@ } std::string RCTDevBundleLoader::getBundleURLFromName(std::string bundleName) const { - return std::string([[[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil].absoluteString UTF8String]); + return std::string([[[RCTBundleURLProvider sharedSettings] + jsBundleURLForBundleRoot:[NSString stringWithUTF8String:bundleName.c_str()] + fallbackResource:nil].absoluteString UTF8String]); } } // namespace react diff --git a/React/Base/RCTDevBundlesDownloader.m b/React/Base/RCTDevBundlesDownloader.m index c13bf399856a..b58eeee2115f 100644 --- a/React/Base/RCTDevBundlesDownloader.m +++ b/React/Base/RCTDevBundlesDownloader.m @@ -43,6 +43,22 @@ @implementation RCTDevBundleSource @end +@implementation RCTDevBundleLoadingProgress + +- (NSString *)description +{ + NSMutableString *desc = [NSMutableString new]; + [desc appendString:_status ?: @"Loading"]; + + if ([_total integerValue] > 0) { + [desc appendFormat:@" %ld%% (%@/%@)", (long)(100 * [_done integerValue] / [_total integerValue]), _done, _total]; + } + [desc appendString:@"\u2026"]; + return desc; +} + +@end + @implementation RCTDevBundlesDownloader RCT_NOT_IMPLEMENTED(- (instancetype)init) @@ -50,8 +66,8 @@ + (void)loadBundleAtURL:(NSURL *)scriptURL onProgress:(RCTDevBundlesProgressBloc { // FETCH INITIAL BUNDLE attemptAsynchronousLoadOfBundleAtURL(scriptURL, ^(RCTDevBundleLoadingProgress *progressData) { - // TODO i don't know what to do with progress. - // Since we do not know at this moment if we need to download additional bundles or not + // Display progres from initial bundle only + onProgress(progressData); }, ^(NSError *error, RCTDevBundleSource *initialBundle, NSArray *additionalBundles) { if(error) { onComplete(error, nil); @@ -77,8 +93,7 @@ static void attemptAsynchronousLoadOfBundleAtURL(NSURL *scriptURL, RCTDevBundleP RCTMultipartDataTask *task = [[RCTMultipartDataTask alloc] initWithURL:scriptURL partHandler:^(NSInteger statusCode, NSDictionary *headers, NSData *data, NSError *error, BOOL done) { if (!done) { if (onProgress) { - // TODO - // onProgress(progressEventFromData(data)); + onProgress(progressEventFromData(data)); } return; } @@ -151,9 +166,8 @@ static void attemptAsynchronousLoadOfBundleAtURL(NSURL *scriptURL, RCTDevBundleP onComplete(nil, source, additionalBundles); } progressHandler:^(NSDictionary *headers, NSNumber *loaded, NSNumber *total) { // Only care about download progress events for the javascript bundle part. - if ([headers[@"Content-Type"] isEqualToString:@"application/javascript"]) { - // TODO - // onProgress(progressEventFromDownloadProgress(loaded, total)); + if (onProgress && [headers[@"Content-Type"] isEqualToString:@"application/javascript"]) { + onProgress(progressEventFromDownloadProgress(loaded, total)); } }]; @@ -166,9 +180,7 @@ static void downloadAdditionalBundles(NSArray *bundles, NSMutableDic for(NSString * bundleName in bundles) { dispatch_group_enter(downloadAdditionalBundles); NSURL *bundleURL = getBundleURLFromName(bundleName); - attemptAsynchronousLoadOfBundleAtURL(bundleURL, ^(RCTDevBundleLoadingProgress *progressData) { - //TODO - }, ^(NSError *error, RCTDevBundleSource *bundleSource, NSArray *additionalBundles) { + attemptAsynchronousLoadOfBundleAtURL(bundleURL, nil, ^(NSError *error, RCTDevBundleSource *bundleSource, NSArray *additionalBundles) { if(error) { err = error; } @@ -192,33 +204,31 @@ static void downloadAdditionalBundles(NSArray *bundles, NSMutableDic return [RCTConvert NSURL:url.absoluteString]; } +static RCTDevBundleLoadingProgress *progressEventFromData(NSData *rawData) +{ + NSString *text = [[NSString alloc] initWithData:rawData encoding:NSUTF8StringEncoding]; + id info = RCTJSONParse(text, nil); + if (!info || ![info isKindOfClass:[NSDictionary class]]) { + return nil; + } + + RCTDevBundleLoadingProgress *progress = [RCTDevBundleLoadingProgress new]; + progress.status = info[@"status"]; + progress.done = info[@"done"]; + progress.total = info[@"total"]; + return progress; +} -//TODO PROGRESS - -//static RCTLoadingProgress *progressEventFromData(NSData *rawData) -//{ -// NSString *text = [[NSString alloc] initWithData:rawData encoding:NSUTF8StringEncoding]; -// id info = RCTJSONParse(text, nil); -// if (!info || ![info isKindOfClass:[NSDictionary class]]) { -// return nil; -// } -// -// RCTLoadingProgress *progress = [RCTLoadingProgress new]; -// progress.status = info[@"status"]; -// progress.done = info[@"done"]; -// progress.total = info[@"total"]; -// return progress; -//} -// -//static RCTLoadingProgress *progressEventFromDownloadProgress(NSNumber *total, NSNumber *done) -//{ -// RCTLoadingProgress *progress = [RCTLoadingProgress new]; -// progress.status = @"Downloading JavaScript bundle"; -// // Progress values are in bytes transform them to kilobytes for smaller numbers. -// progress.done = done != nil ? @([done integerValue] / 1024) : nil; -// progress.total = total != nil ? @([total integerValue] / 1024) : nil; -// return progress; -//} + +static RCTDevBundleLoadingProgress *progressEventFromDownloadProgress(NSNumber *total, NSNumber *done) +{ + RCTDevBundleLoadingProgress *progress = [RCTDevBundleLoadingProgress new]; + progress.status = @"Downloading JavaScript bundle"; + // Progress values are in bytes transform them to kilobytes for smaller numbers. + progress.done = done != nil ? @([done integerValue] / 1024) : nil; + progress.total = total != nil ? @([total integerValue] / 1024) : nil; + return progress; +} static NSDictionary *userInfoForRawResponse(NSString *rawText) { diff --git a/React/Base/RCTJavaScriptLoader.h b/React/Base/RCTJavaScriptLoader.h deleted file mode 100755 index eee7de18ced0..000000000000 --- a/React/Base/RCTJavaScriptLoader.h +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its 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 - -extern NSString *const RCTJavaScriptLoaderErrorDomain; - -NS_ENUM(NSInteger) { - RCTJavaScriptLoaderErrorNoScriptURL = 1, - RCTJavaScriptLoaderErrorFailedOpeningFile = 2, - RCTJavaScriptLoaderErrorFailedReadingFile = 3, - RCTJavaScriptLoaderErrorFailedStatingFile = 3, - RCTJavaScriptLoaderErrorURLLoadFailed = 3, - RCTJavaScriptLoaderErrorBCVersion = 4, - RCTJavaScriptLoaderErrorBCNotSupported = 4, - - RCTJavaScriptLoaderErrorCannotBeLoadedSynchronously = 1000, -}; - -NS_ENUM(NSInteger) { - RCTSourceFilesChangedCountNotBuiltByBundler = -2, - RCTSourceFilesChangedCountRebuiltFromScratch = -1, -}; - -@interface RCTLoadingProgress : NSObject - -@property (nonatomic, copy) NSString *status; -@property (strong, nonatomic) NSNumber *done; -@property (strong, nonatomic) NSNumber *total; - -@end - -@interface RCTSource : NSObject - -/** - * URL of the source object. - */ -@property (strong, nonatomic, readonly) NSURL *url; - -/** - * JS source (or simply the binary header in the case of a RAM bundle). - */ -@property (strong, nonatomic, readonly) NSData *data; - -/** - * Length of the entire JS bundle. Note that self.length != self.data.length in the case of certain bundle formats. For - * instance, when using RAM bundles: - * - * - self.data will point to the bundle header - * - self.data.length is the length of the bundle header, i.e. sizeof(facebook::react::BundleHeader) - * - self.length is the length of the entire bundle file (header + contents) - */ -@property (nonatomic, readonly) NSUInteger length; - -/** - * Returns number of files changed when building this bundle: - * - * - RCTSourceFilesChangedCountNotBuiltByBundler if the source wasn't built by the bundler (e.g. read from disk) - * - RCTSourceFilesChangedCountRebuiltFromScratch if the source was rebuilt from scratch by the bundler - * - Otherwise, the number of files changed when incrementally rebuilding the source - */ -@property (nonatomic, readonly) NSInteger filesChangedCount; - -@end - -typedef void (^RCTSourceLoadProgressBlock)(RCTLoadingProgress *progressData); -typedef void (^RCTSourceLoadBlock)(NSError *error, RCTSource *source); - -@interface RCTJavaScriptLoader : NSObject - -+ (void)loadBundleAtURL:(NSURL *)scriptURL onProgress:(RCTSourceLoadProgressBlock)onProgress onComplete:(RCTSourceLoadBlock)onComplete; - -/** - * @experimental - * Attempts to synchronously load the script at the given URL. The following two conditions must be met: - * 1. It must be a file URL. - * 2. It must not point to a text/javascript file. - * If the URL does not meet those conditions, this method will return nil and supply an error with the domain - * RCTJavaScriptLoaderErrorDomain and the code RCTJavaScriptLoaderErrorCannotBeLoadedSynchronously. - */ -+ (NSData *)attemptSynchronousLoadOfBundleAtURL:(NSURL *)scriptURL - runtimeBCVersion:(int32_t)runtimeBCVersion - sourceLength:(int64_t *)sourceLength - error:(NSError **)error; - -@end diff --git a/React/Base/RCTJavaScriptLoader.mm b/React/Base/RCTJavaScriptLoader.mm deleted file mode 100755 index 2a7cf5c8594f..000000000000 --- a/React/Base/RCTJavaScriptLoader.mm +++ /dev/null @@ -1,368 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTJavaScriptLoader.h" - -#import - -#import - -#import "RCTBridge.h" -#import "RCTConvert.h" -#import "RCTMultipartDataTask.h" -#import "RCTPerformanceLogger.h" -#import "RCTUtils.h" - -NSString *const RCTJavaScriptLoaderErrorDomain = @"RCTJavaScriptLoaderErrorDomain"; - -static const int32_t JSNoBytecodeFileFormatVersion = -1; - -@interface RCTSource() -{ -@public - NSURL *_url; - NSData *_data; - NSUInteger _length; - NSInteger _filesChangedCount; -} - -@end - -@implementation RCTSource - -static RCTSource *RCTSourceCreate(NSURL *url, NSData *data, int64_t length) NS_RETURNS_RETAINED -{ - RCTSource *source = [RCTSource new]; - source->_url = url; - source->_data = data; - source->_length = length; - source->_filesChangedCount = RCTSourceFilesChangedCountNotBuiltByBundler; - return source; -} - -@end - -@implementation RCTLoadingProgress - -- (NSString *)description -{ - NSMutableString *desc = [NSMutableString new]; - [desc appendString:_status ?: @"Loading"]; - - if ([_total integerValue] > 0) { - [desc appendFormat:@" %ld%% (%@/%@)", (long)(100 * [_done integerValue] / [_total integerValue]), _done, _total]; - } - [desc appendString:@"\u2026"]; - return desc; -} - -@end - -@implementation RCTJavaScriptLoader - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -+ (void)loadBundleAtURL:(NSURL *)scriptURL onProgress:(RCTSourceLoadProgressBlock)onProgress onComplete:(RCTSourceLoadBlock)onComplete -{ - int64_t sourceLength; - NSError *error; - NSData *data = [self attemptSynchronousLoadOfBundleAtURL:scriptURL - runtimeBCVersion:JSNoBytecodeFileFormatVersion - sourceLength:&sourceLength - error:&error]; - if (data) { - onComplete(nil, RCTSourceCreate(scriptURL, data, sourceLength)); - return; - } - - const BOOL isCannotLoadSyncError = - [error.domain isEqualToString:RCTJavaScriptLoaderErrorDomain] - && error.code == RCTJavaScriptLoaderErrorCannotBeLoadedSynchronously; - - if (isCannotLoadSyncError) { - attemptAsynchronousLoadOfBundleAtURL(scriptURL, onProgress, onComplete); - } else { - onComplete(error, nil); - } -} - -+ (NSData *)attemptSynchronousLoadOfBundleAtURL:(NSURL *)scriptURL - runtimeBCVersion:(int32_t)runtimeBCVersion - sourceLength:(int64_t *)sourceLength - error:(NSError **)error -{ - NSString *unsanitizedScriptURLString = scriptURL.absoluteString; - // Sanitize the script URL - scriptURL = sanitizeURL(scriptURL); - - if (!scriptURL) { - if (error) { - *error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain - code:RCTJavaScriptLoaderErrorNoScriptURL - userInfo:@{NSLocalizedDescriptionKey: - [NSString stringWithFormat:@"No script URL provided. Make sure the packager is " - @"running or you have embedded a JS bundle in your application bundle.\n\n" - @"unsanitizedScriptURLString = %@", unsanitizedScriptURLString]}]; - } - return nil; - } - - // Load local script file - if (!scriptURL.fileURL) { - if (error) { - *error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain - code:RCTJavaScriptLoaderErrorCannotBeLoadedSynchronously - userInfo:@{NSLocalizedDescriptionKey: - [NSString stringWithFormat:@"Cannot load %@ URLs synchronously", - scriptURL.scheme]}]; - } - return nil; - } - - // Load the first 4 bytes to check if the bundle is regular or RAM ("Random Access Modules" bundle). - // The RAM bundle has a magic number in the 4 first bytes `(0xFB0BD1E5)`. - // The benefit of RAM bundle over a regular bundle is that we can lazily inject - // modules into JSC as they're required. - FILE *bundle = fopen(scriptURL.path.UTF8String, "r"); - if (!bundle) { - if (error) { - *error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain - code:RCTJavaScriptLoaderErrorFailedOpeningFile - userInfo:@{NSLocalizedDescriptionKey: - [NSString stringWithFormat:@"Error opening bundle %@", scriptURL.path]}]; - } - return nil; - } - - facebook::react::BundleHeader header; - size_t readResult = fread(&header, sizeof(header), 1, bundle); - fclose(bundle); - if (readResult != 1) { - if (error) { - *error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain - code:RCTJavaScriptLoaderErrorFailedReadingFile - userInfo:@{NSLocalizedDescriptionKey: - [NSString stringWithFormat:@"Error reading bundle %@", scriptURL.path]}]; - } - return nil; - } - - facebook::react::BundleType tag = facebook::react::Bundle::parseTypeFromHeader(header); - switch (tag) { - case facebook::react::BundleType::IndexedRAMBundle: - case facebook::react::BundleType::FileRAMBundle: - case facebook::react::BundleType::DeltaBundle: - break; - - case facebook::react::BundleType::BasicBundle: { -#if RCT_ENABLE_INSPECTOR - NSData *source = [NSData dataWithContentsOfFile:scriptURL.path - options:NSDataReadingMappedIfSafe - error:error]; - if (sourceLength && source != nil) { - *sourceLength = source.length; - } - return source; -#else - if (error) { - *error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain - code:RCTJavaScriptLoaderErrorCannotBeLoadedSynchronously - userInfo:@{NSLocalizedDescriptionKey: - @"Cannot load text/javascript files synchronously"}]; - } - return nil; -#endif - } - case facebook::react::BundleType::BCBundle: - if (runtimeBCVersion == JSNoBytecodeFileFormatVersion || runtimeBCVersion < 0) { - if (error) { - *error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain - code:RCTJavaScriptLoaderErrorBCNotSupported - userInfo:@{NSLocalizedDescriptionKey: - @"Bytecode bundles are not supported by this runtime."}]; - } - return nil; - } - else if ((uint32_t)runtimeBCVersion != header.version) { - if (error) { - NSString *errDesc = - [NSString stringWithFormat:@"BC Version Mismatch. Expect: %d, Actual: %u", - runtimeBCVersion, header.version]; - - *error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain - code:RCTJavaScriptLoaderErrorBCVersion - userInfo:@{NSLocalizedDescriptionKey: errDesc}]; - } - return nil; - } - break; - } - - struct stat statInfo; - if (stat(scriptURL.path.UTF8String, &statInfo) != 0) { - if (error) { - *error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain - code:RCTJavaScriptLoaderErrorFailedStatingFile - userInfo:@{NSLocalizedDescriptionKey: - [NSString stringWithFormat:@"Error stating bundle %@", scriptURL.path]}]; - } - return nil; - } - if (sourceLength) { - *sourceLength = statInfo.st_size; - } - return [NSData dataWithBytes:&header length:sizeof(header)]; -} - -static void parseHeaders(NSDictionary *headers, RCTSource *source) { - source->_filesChangedCount = [headers[@"X-Metro-Files-Changed-Count"] integerValue]; -} - -static void attemptAsynchronousLoadOfBundleAtURL(NSURL *scriptURL, RCTSourceLoadProgressBlock onProgress, RCTSourceLoadBlock onComplete) -{ - scriptURL = sanitizeURL(scriptURL); - - if (scriptURL.fileURL) { - // Reading in a large bundle can be slow. Dispatch to the background queue to do it. - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - NSError *error = nil; - NSData *source = [NSData dataWithContentsOfFile:scriptURL.path - options:NSDataReadingMappedIfSafe - error:&error]; - onComplete(error, RCTSourceCreate(scriptURL, source, source.length)); - }); - return; - } - - RCTMultipartDataTask *task = [[RCTMultipartDataTask alloc] initWithURL:scriptURL partHandler:^(NSInteger statusCode, NSDictionary *headers, NSData *data, NSError *error, BOOL done) { - if (!done) { - if (onProgress) { - onProgress(progressEventFromData(data)); - } - return; - } - - // Handle general request errors - if (error) { - if ([error.domain isEqualToString:NSURLErrorDomain]) { - error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain - code:RCTJavaScriptLoaderErrorURLLoadFailed - userInfo: - @{ - NSLocalizedDescriptionKey: - [@"Could not connect to development server.\n\n" - "Ensure the following:\n" - "- Node server is running and available on the same network - run 'npm start' from react-native root\n" - "- Node server URL is correctly set in AppDelegate\n" - "- WiFi is enabled and connected to the same network as the Node Server\n\n" - "URL: " stringByAppendingString:scriptURL.absoluteString], - NSLocalizedFailureReasonErrorKey: error.localizedDescription, - NSUnderlyingErrorKey: error, - }]; - } - onComplete(error, nil); - return; - } - - // For multipart responses packager sets X-Http-Status header in case HTTP status code - // is different from 200 OK - NSString *statusCodeHeader = headers[@"X-Http-Status"]; - if (statusCodeHeader) { - statusCode = [statusCodeHeader integerValue]; - } - - if (statusCode != 200) { - error = [NSError errorWithDomain:@"JSServer" - code:statusCode - userInfo:userInfoForRawResponse([[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding])]; - onComplete(error, nil); - return; - } - - // Validate that the packager actually returned javascript. - NSString *contentType = headers[@"Content-Type"]; - NSString *mimeType = [[contentType componentsSeparatedByString:@";"] firstObject]; - if (![mimeType isEqualToString:@"application/javascript"] && - ![mimeType isEqualToString:@"text/javascript"]) { - NSString *description = [NSString stringWithFormat:@"Expected MIME-Type to be 'application/javascript' or 'text/javascript', but got '%@'.", mimeType]; - error = [NSError errorWithDomain:@"JSServer" - code:NSURLErrorCannotParseResponse - userInfo:@{ - NSLocalizedDescriptionKey: description, - @"headers": headers, - @"data": data - }]; - onComplete(error, nil); - return; - } - - RCTSource *source = RCTSourceCreate(scriptURL, data, data.length); - parseHeaders(headers, source); - onComplete(nil, source); - } progressHandler:^(NSDictionary *headers, NSNumber *loaded, NSNumber *total) { - // Only care about download progress events for the javascript bundle part. - if ([headers[@"Content-Type"] isEqualToString:@"application/javascript"]) { - onProgress(progressEventFromDownloadProgress(loaded, total)); - } - }]; - - [task startTask]; -} - -static NSURL *sanitizeURL(NSURL *url) -{ - // Why we do this is lost to time. We probably shouldn't; passing a valid URL is the caller's responsibility not ours. - return [RCTConvert NSURL:url.absoluteString]; -} - -static RCTLoadingProgress *progressEventFromData(NSData *rawData) -{ - NSString *text = [[NSString alloc] initWithData:rawData encoding:NSUTF8StringEncoding]; - id info = RCTJSONParse(text, nil); - if (!info || ![info isKindOfClass:[NSDictionary class]]) { - return nil; - } - - RCTLoadingProgress *progress = [RCTLoadingProgress new]; - progress.status = info[@"status"]; - progress.done = info[@"done"]; - progress.total = info[@"total"]; - return progress; -} - -static RCTLoadingProgress *progressEventFromDownloadProgress(NSNumber *total, NSNumber *done) -{ - RCTLoadingProgress *progress = [RCTLoadingProgress new]; - progress.status = @"Downloading JavaScript bundle"; - // Progress values are in bytes transform them to kilobytes for smaller numbers. - progress.done = done != nil ? @([done integerValue] / 1024) : nil; - progress.total = total != nil ? @([total integerValue] / 1024) : nil; - return progress; -} - -static NSDictionary *userInfoForRawResponse(NSString *rawText) -{ - NSDictionary *parsedResponse = RCTJSONParse(rawText, nil); - if (![parsedResponse isKindOfClass:[NSDictionary class]]) { - return @{NSLocalizedDescriptionKey: rawText}; - } - NSArray *errors = parsedResponse[@"errors"]; - if (![errors isKindOfClass:[NSArray class]]) { - return @{NSLocalizedDescriptionKey: rawText}; - } - NSMutableArray *fakeStack = [NSMutableArray new]; - for (NSDictionary *err in errors) { - [fakeStack addObject: @{ - @"methodName": err[@"description"] ?: @"", - @"file": err[@"filename"] ?: @"", - @"lineNumber": err[@"lineNumber"] ?: @0 - }]; - } - return @{NSLocalizedDescriptionKey: parsedResponse[@"message"] ?: @"No message provided", @"stack": [fakeStack copy]}; -} - -@end diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index 60eeabf5d26a..2003347c51da 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -18,7 +18,6 @@ #import #import #import -#import #import #import #import diff --git a/React/DevSupport/RCTDevLoadingView.m b/React/DevSupport/RCTDevLoadingView.m index f38c8379a587..27190242db95 100644 --- a/React/DevSupport/RCTDevLoadingView.m +++ b/React/DevSupport/RCTDevLoadingView.m @@ -170,7 +170,7 @@ + (NSString *)moduleName { return nil; } + (void)setEnabled:(BOOL)enabled { } - (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(UIColor *)backgroundColor { } - (void)showWithURL:(NSURL *)URL { } -- (void)updateProgress:(RCTLoadingProgress *)progress { } +- (void)updateProgress:(RCTDevBundleLoadingProgress *)progress { } - (void)hide { } @end diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java index 53d4d472dc9a..353840445c3f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java @@ -39,7 +39,7 @@ public class BundleDownloader { private static final String TAG = "BundleDownloader"; - // Should be kept in sync with constants in RCTJavaScriptLoader.h + // Should be kept in sync with constants in RCTDevBundlesDownloader.h private static final int FILES_CHANGED_COUNT_NOT_BUILT_BY_BUNDLER = -2; private final OkHttpClient mClient; From b2d03406d988c9bee9bbf9234c7fae4fa8b255e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Trys=C5=82a?= Date: Mon, 1 Jul 2019 17:43:01 +0200 Subject: [PATCH 6/9] tweaks --- React/Base/RCTBridge.h | 6 ++++++ React/Base/RCTBridge.m | 1 + React/Base/RCTDevBundlesDownloader.m | 10 ++++++++-- React/CxxBridge/RCTCxxBridge.mm | 22 ++++++++++++++-------- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/React/Base/RCTBridge.h b/React/Base/RCTBridge.h index bc9f54110568..384c0219e50d 100644 --- a/React/Base/RCTBridge.h +++ b/React/Base/RCTBridge.h @@ -72,6 +72,12 @@ RCT_EXTERN NSString *const RCTBridgeDidDownloadScriptNotification; */ RCT_EXTERN NSString *const RCTBridgeDidDownloadScriptNotificationSourceKey; +/** +* Key for the bundles' RCTSource object in the RCTBridgeDidDownloadScriptNotification +* userInfo dictionary. +*/ +RCT_EXTERN NSString *const RCTBridgeDidDownloadScriptNotificationBundlesKey; + /** * Key for the bridge description (NSString_ in the * RCTBridgeDidDownloadScriptNotification userInfo dictionary. diff --git a/React/Base/RCTBridge.m b/React/Base/RCTBridge.m index 115871745d9b..ab1e78c5d282 100644 --- a/React/Base/RCTBridge.m +++ b/React/Base/RCTBridge.m @@ -31,6 +31,7 @@ NSString *const RCTBridgeWillDownloadScriptNotification = @"RCTBridgeWillDownloadScriptNotification"; NSString *const RCTBridgeDidDownloadScriptNotification = @"RCTBridgeDidDownloadScriptNotification"; NSString *const RCTBridgeDidDownloadScriptNotificationSourceKey = @"source"; +NSString *const RCTBridgeDidDownloadScriptNotificationBundlesKey = @"bundles"; NSString *const RCTBridgeDidDownloadScriptNotificationBridgeDescriptionKey = @"bridgeDescription"; static NSMutableArray *RCTModuleClasses; diff --git a/React/Base/RCTDevBundlesDownloader.m b/React/Base/RCTDevBundlesDownloader.m index b58eeee2115f..c39ec483c67f 100644 --- a/React/Base/RCTDevBundlesDownloader.m +++ b/React/Base/RCTDevBundlesDownloader.m @@ -152,8 +152,7 @@ static void attemptAsynchronousLoadOfBundleAtURL(NSURL *scriptURL, RCTDevBundleP return; } - //TODO Get name from sourceURL - RCTDevBundleSource *source = RCTSourceCreate(scriptURL, data, data.length, @"index"); + RCTDevBundleSource *source = RCTSourceCreate(scriptURL, data, data.length, getBundleNameFromURL(scriptURL)); parseHeaders(headers, source); // Check if there are additional bundles to fetch @@ -198,6 +197,13 @@ static void downloadAdditionalBundles(NSArray *bundles, NSMutableDic return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:bundleName fallbackResource:nil]; } +static NSString *getBundleNameFromURL(NSURL *url) { + NSString *bundleFilename = url.pathComponents[1]; + NSString *bundleName = [bundleFilename + substringToIndex:[bundleFilename rangeOfString:@"."].location]; + return bundleName; +} + static NSURL *sanitizeURL(NSURL *url) { // Why we do this is lost to time. We probably shouldn't; passing a valid URL is the caller's responsibility not ours. diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index 2003347c51da..1fbe3f96b9c5 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -395,16 +395,22 @@ - (void)loadSource:(RCTDevBundlesLoadBlock)_onSourceLoad onProgress:(RCTDevBundl RCTProfileEndAsyncEvent(0, @"native", cookie, @"JavaScript download", @"JS async"); [performanceLogger markStopForTag:RCTPLScriptDownload]; - // TODO fix performance logs + __block NSUInteger bundleSize = 0; + [bundlesContainer enumerateKeysAndObjectsUsingBlock:^(id key, RCTDevBundleSource *value, BOOL* stop) { + bundleSize += value.length; + }]; + [performanceLogger setValue:bundleSize forTag:RCTPLBundleSize]; -// [performanceLogger setValue:source.length forTag:RCTPLBundleSize]; - -// NSDictionary *userInfo = @{ -// RCTBridgeDidDownloadScriptNotificationSourceKey: source ?: [NSNull null], -// RCTBridgeDidDownloadScriptNotificationBridgeDescriptionKey: self->_bridgeDescription ?: [NSNull null], -// }; + NSDictionary *userInfo = @{ + // Pass bundle source only if single bundle is preset. + RCTBridgeDidDownloadScriptNotificationSourceKey: [bundlesContainer count] == 1 + ? [bundlesContainer allValues][0] + : [NSNull null], + RCTBridgeDidDownloadScriptNotificationBundlesKey: bundlesContainer ?: [NSNull null], + RCTBridgeDidDownloadScriptNotificationBridgeDescriptionKey: self->_bridgeDescription ?: [NSNull null], + }; -// [center postNotificationName:RCTBridgeDidDownloadScriptNotification object:self->_parentBridge userInfo:userInfo]; + [center postNotificationName:RCTBridgeDidDownloadScriptNotification object:self->_parentBridge userInfo:userInfo]; _onSourceLoad(error, bundlesContainer); }; From 258211b268d10119ab3eee5938ddde27c807c6a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Trys=C5=82a?= Date: Mon, 1 Jul 2019 17:44:15 +0200 Subject: [PATCH 7/9] remove comment --- ReactCommon/jsiexecutor/jsireact/JSIExecutor.h | 1 - 1 file changed, 1 deletion(-) diff --git a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h index 42d3efa2fe6c..d6a4b3d0d32b 100644 --- a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h +++ b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h @@ -6,7 +6,6 @@ #pragma once #include "JSINativeModules.h" -//#include #include #include #include From 99bbd8790e631aa954a0b939afaa06388f18059f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Trys=C5=82a?= Date: Wed, 3 Jul 2019 15:04:43 +0200 Subject: [PATCH 8/9] add missing performance logging back --- React/Base/RCTFileBundleLoader.h | 5 ++++- React/Base/RCTFileBundleLoader.mm | 11 ++++++++++- React/CxxBridge/RCTCxxBridge.mm | 11 ++--------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/React/Base/RCTFileBundleLoader.h b/React/Base/RCTFileBundleLoader.h index 065c33d8b7fc..23339d1a2d48 100644 --- a/React/Base/RCTFileBundleLoader.h +++ b/React/Base/RCTFileBundleLoader.h @@ -5,6 +5,7 @@ #import #import #import +#import NS_ENUM(NSInteger) { RCTFileBundleLoaderErrorNoScriptURL = 1, @@ -22,12 +23,14 @@ namespace facebook { class RCTFileBundleLoader : public BundleLoader { public: - RCTFileBundleLoader() {}; + RCTFileBundleLoader(RCTPerformanceLogger* performanceLogger); ~RCTFileBundleLoader() {} std::unique_ptr getBundle(std::string bundleURL) const override; std::string getBundleURLFromName(std::string bundleName) const override; + private: + RCTPerformanceLogger* _performanceLogger; }; } // namespace react diff --git a/React/Base/RCTFileBundleLoader.mm b/React/Base/RCTFileBundleLoader.mm index 2c8b6df00618..593ca4042ae1 100644 --- a/React/Base/RCTFileBundleLoader.mm +++ b/React/Base/RCTFileBundleLoader.mm @@ -15,6 +15,10 @@ //TODO FIGURE HOW TO THROW ERRORS HERE namespace facebook { namespace react { + + RCTFileBundleLoader::RCTFileBundleLoader(RCTPerformanceLogger* performanceLogger) { + _performanceLogger = performanceLogger; + } std::unique_ptr RCTFileBundleLoader::getBundle(std::string bundleURL) const { const uint32_t runtimeBCVersion = JSNoBytecodeFileFormatVersion; @@ -54,7 +58,12 @@ return nil; } - return std::make_unique(bundleURL.c_str(), bundleURL.c_str()); + [_performanceLogger markStartForTag:RCTPLRAMBundleLoad]; + auto ramBundle = std::make_unique(bundleURL.c_str(), bundleURL.c_str()); + std::unique_ptr startupScript = ramBundle->getStartupScript(); + [_performanceLogger markStopForTag:RCTPLRAMBundleLoad]; + [_performanceLogger setValue:startupScript->size() forTag:RCTPLRAMStartupCodeSize]; + return ramBundle; } break; case facebook::react::BundleType::DeltaBundle: diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index 1fbe3f96b9c5..0c684f25789d 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -1353,16 +1353,9 @@ - (void)executeApplicationFileScript:(NSURL *)url postNotificationName:RCTJavaScriptWillStartExecutingNotification object:self->_parentBridge userInfo:@{@"bridge": self}]; - std::unique_ptr loader = std::make_unique(); + std::unique_ptr loader + = std::make_unique(self->_performanceLogger); self->_reactInstance->runApplication(std::string([sourceUrlStr UTF8String]), std::move(loader), !async); - //TODO figure out where and when call these permormance logs -// if (IndexedRAMBundle::isIndexedRAMBundle(sourceUrlStr.UTF8String)) { -// [self->_performanceLogger markStartForTag:RCTPLRAMBundleLoad]; -// auto ramBundle = std::make_unique(sourceUrlStr.UTF8String, sourceUrlStr.UTF8String); -// std::unique_ptr scriptStr = ramBundle->getStartupScript(); -// [self->_performanceLogger markStopForTag:RCTPLRAMBundleLoad]; -// [self->_performanceLogger setValue:scriptStr->size() forTag:RCTPLRAMStartupCodeSize]; -// } }]; } From cd76ee24b9334d98f2ba6455ca1d9452ecc97e1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Trys=C5=82a?= Date: Wed, 3 Jul 2019 15:13:02 +0200 Subject: [PATCH 9/9] Delete React.xcscheme --- .../xcshareddata/xcschemes/React.xcscheme | 80 ------------------- 1 file changed, 80 deletions(-) delete mode 100644 React/React.xcodeproj/xcshareddata/xcschemes/React.xcscheme diff --git a/React/React.xcodeproj/xcshareddata/xcschemes/React.xcscheme b/React/React.xcodeproj/xcshareddata/xcschemes/React.xcscheme deleted file mode 100644 index 8180aa0335ea..000000000000 --- a/React/React.xcodeproj/xcshareddata/xcschemes/React.xcscheme +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -