Move ScriptTag and RCTJSModulesUnbundle to cxxreact

Reviewed By: javache

Differential Revision: D4213662

fbshipit-source-id: fc2ec9717c24fe77bb022a48777049f88173ebeb
This commit is contained in:
David Aurelio
2016-11-23 06:31:43 -08:00
committed by Facebook Github Bot
parent f9d80a451a
commit 5db7484e8d
10 changed files with 396 additions and 100 deletions

View File

@@ -11,55 +11,6 @@
#import "RCTDefines.h"
/**
* RCTScriptTag
*
* Scripts given to the JS Executors to run could be in any of the following
* formats. They are tagged so the executor knows how to run them.
*/
typedef NS_ENUM(NSInteger) {
RCTScriptString = 0,
RCTScriptRAMBundle,
RCTScriptBCBundle,
} RCTScriptTag;
/**
* RCTBundleHeader
*
* RAM bundles and BC bundles begin with headers. For RAM bundles this is
* 4 bytes, for BC bundles this is 12 bytes. This structure holds the first 12
* bytes from a bundle in a way that gives access to that information.
*/
typedef union {
// `allBytes` is the first field so that zero-initializing the union fills
// it completely with zeroes. Without it, only the first field of the union
// gets zero-initialized.
uint32_t allBytes[3];
uint32_t RAMMagic;
struct {
uint64_t BCMagic;
uint32_t BCVersion;
};
} RCTBundleHeader;
/**
* RCTParseTypeFromHeader
*
* Takes the first 8 bytes of a bundle, and returns a tag describing the
* bundle's format.
*/
RCT_EXTERN RCTScriptTag RCTParseTypeFromHeader(RCTBundleHeader header);
/**
* RCTStringForScriptTag
*
* Convert an `RCTScriptTag` enum into a string, useful for emitting in errors
* and diagnostic messages.
*/
RCT_EXTERN NSString *RCTStringForScriptTag(RCTScriptTag tag);
extern NSString *const RCTJavaScriptLoaderErrorDomain;
NS_ENUM(NSInteger) {