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:
Alex Kotliarskyi 2016-06-07 11:07:53 -07:00 коммит произвёл Facebook Github Bot 2
Родитель a7404713a4
Коммит f3fab5184e
5 изменённых файлов: 2 добавлений и 32 удалений

Просмотреть файл

@ -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 ?: @"";

Просмотреть файл

@ -81,9 +81,7 @@ import com.facebook.systrace.Systrace;
new DeviceEventManagerModule(catalystApplicationContext, mHardwareBackBtnHandler),
new ExceptionsManagerModule(mReactInstanceManager.getDevSupportManager()),
new Timing(catalystApplicationContext),
new SourceCodeModule(
mReactInstanceManager.getSourceUrl(),
mReactInstanceManager.getDevSupportManager().getSourceMapUrl()),
new SourceCodeModule(mReactInstanceManager.getSourceUrl()),
uiManagerModule,
new JSCHeapCapture(catalystApplicationContext),
new DebugComponentOwnershipModule(catalystApplicationContext));

Просмотреть файл

@ -25,11 +25,9 @@ import com.facebook.react.bridge.WritableNativeMap;
*/
public class SourceCodeModule extends BaseJavaModule {
private final String mSourceMapUrl;
private final String mSourceUrl;
public SourceCodeModule(String sourceUrl, String sourceMapUrl) {
mSourceMapUrl = sourceMapUrl;
public SourceCodeModule(String sourceUrl) {
mSourceUrl = sourceUrl;
}
@ -38,13 +36,6 @@ public class SourceCodeModule extends BaseJavaModule {
return "RCTSourceCode";
}
@ReactMethod
public void getScriptText(final Promise promise) {
WritableMap map = new WritableNativeMap();
map.putString("fullSourceMappingURL", mSourceMapUrl);
promise.resolve(map);
}
@Override
public @Nullable Map<String, Object> getConstants() {
HashMap<String, Object> constants = new HashMap<String, Object>();