///
export interface LocalBundle {
dev: boolean;
platform: Platform;
sourceMapPath: string;
bundlePath: string;
assets: ReactNativeAsset[];
}
export interface LiveBundleConfig {
bundler: Record;
server: Record;
storage: Record;
generators: Record;
notifiers: Record;
}
export interface Uploader {
upload({ bundles }: {
bundles: LocalBundle[];
}): Promise;
}
export declare type Platform = "android" | "ios";
export interface Bundle {
id: string;
dev: boolean;
platform: Platform;
sourceMap: string;
}
export interface Package {
id: string;
bundles: Bundle[];
timestamp: number;
}
export declare enum LiveBundleContentType {
PACKAGE = 0,
SESSION = 1
}
export interface LiveBundle {
upload(config: LiveBundleConfig): Promise;
live(config: LiveBundleConfig, opts?: ServerOpts): Promise;
}
export interface ReactNativeAsset {
files: string[];
hash: string;
}
export interface PluginLoader {
loadBundlerPlugin(name: string, config: Record): Promise;
loadServerPlugin(name: string, config: Record): Promise;
loadGeneratorPlugin(name: string, config: Record, storage: StoragePlugin): Promise;
loadNotifierPlugin(name: string, config: Record): Promise;
loadStoragePlugin(name: string, config: Record): Promise;
loadAllPlugins(config: LiveBundleConfig): Promise<{
bundler: NamedBundlerPlugin;
server: NamedServerPlugin;
storage: NamedStoragePlugin;
generators: NamedGeneratorPlugin[];
notifiers: NamedNotifierPlugin[];
uploader: Uploader;
}>;
}
export interface Named {
name: string;
}
export interface PluginClass {
create: (config: Record, storage?: StoragePlugin) => T;
readonly envVarToConfigKey: Record;
readonly schema: Record;
readonly defaultConfig: Record;
}
export interface BundlerPlugin {
bundle(): Promise;
}
export interface ServerPlugin {
launchServer(opts?: ServerOpts): Promise;
}
export interface ServerOpts {
host?: string;
port?: number;
rest?: string[];
}
export interface GeneratorPlugin {
generate({ id, type, }: {
id: string;
type: LiveBundleContentType;
}): Promise>;
}
export interface StoragePlugin {
store(content: string, contentLength: number, targetPath: string): Promise;
storeFile(filePath: string, targetPath: string, options?: {
contentType?: string;
}): Promise;
hasFile(filePath: string): Promise;
downloadFile(filePath: string): Promise;
readonly baseUrl: string;
}
export interface NotifierPlugin {
notify({ generators, pkg, type, }: {
generators: Record>;
pkg?: Package;
type: LiveBundleContentType;
}): Promise;
}
export declare type NamedBundlerPlugin = BundlerPlugin & Named;
export declare type NamedStoragePlugin = StoragePlugin & Named;
export declare type NamedGeneratorPlugin = GeneratorPlugin & Named;
export declare type NamedNotifierPlugin = NotifierPlugin & Named;
export declare type NamedServerPlugin = ServerPlugin & Named;