mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Remove SourceCode.getScriptText
Summary: After cleaning up JS SourceMap code, these native methods are not needed anymore. On iOS it saves another 30+ Mb during development. Reviewed By: javache, astreet Differential Revision: D3348975 fbshipit-source-id: a68ae9b00b4dbaa374b421029ae676fc69ae5a75
This commit is contained in:
committed by
Facebook Github Bot 2
parent
a7404713a4
commit
f3fab5184e
@@ -455,7 +455,6 @@ RCT_EXTERN NSArray<Class> *RCTGetModuleClasses(void);
|
||||
|
||||
RCTSourceCode *sourceCodeModule = [self moduleForClass:[RCTSourceCode class]];
|
||||
sourceCodeModule.scriptURL = self.bundleURL;
|
||||
sourceCodeModule.scriptData = sourceCode;
|
||||
|
||||
[self enqueueApplicationScript:sourceCode url:self.bundleURL onComplete:^(NSError *loadError) {
|
||||
if (!_valid) {
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
@interface RCTSourceCode : NSObject <RCTBridgeModule>
|
||||
|
||||
@property (nonatomic, copy) NSData *scriptData;
|
||||
@property (nonatomic, copy) NSURL *scriptURL;
|
||||
|
||||
@end
|
||||
|
||||
@@ -20,23 +20,6 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
@synthesize bridge = _bridge;
|
||||
|
||||
#if !RCT_DEV
|
||||
- (void)setScriptText:(NSString *)scriptText {}
|
||||
#endif
|
||||
|
||||
NSString *const RCTErrorUnavailable = @"E_SOURCE_CODE_UNAVAILABLE";
|
||||
|
||||
RCT_EXPORT_METHOD(getScriptText:(RCTPromiseResolveBlock)resolve
|
||||
reject:(RCTPromiseRejectBlock)reject)
|
||||
{
|
||||
if (RCT_DEV && self.scriptData && self.scriptURL) {
|
||||
NSString *scriptText = [[NSString alloc] initWithData:self.scriptData encoding:NSUTF8StringEncoding];
|
||||
resolve(@{@"text": RCTNullIfNil(scriptText), @"url": self.scriptURL.absoluteString});
|
||||
} else {
|
||||
reject(RCTErrorUnavailable, nil, RCTErrorWithMessage(@"Source code is not available"));
|
||||
}
|
||||
}
|
||||
|
||||
- (NSDictionary<NSString *, id> *)constantsToExport
|
||||
{
|
||||
NSString *URL = self.bridge.bundleURL.absoluteString ?: @"";
|
||||
|
||||
Reference in New Issue
Block a user