import IndexedDBAsync from 'indexed-db-async'; import RemoteModule from './module'; import { RemoteOptions, EntriesInfo, RemoteModuleWebpack, RemoteModuleRuntime } from './types'; type FetchMethod = 'GET'|'POST'|'HEAD'|'OPTIONS'; interface FetchOptions { timeout?: number, sync?: boolean, cacheDB?: boolean, nocache?: boolean, method?: FetchMethod, headers?: Record, require?: (moduleId: string) => any, cached?: Record, } declare function fetch(url: string, options?: FetchOptions): Promise; declare function requireJs(url: string, options?: FetchOptions): Promise; declare function resolveModuleUrl(host: string, moduleName?: string): string; interface RemoteModuleOptions extends RemoteOptions { resolveModuleUrl?: ( this: RemoteModule, host: string, moduleName: string, originResolveModuleUrl?: typeof resolveModuleUrl, sync?: boolean ) => string|Promise; } declare class AsyncRemoteModule { public libraryUrl: string; public host: string; public options: RemoteModuleOptions; constructor(libraryUrl: string|RemoteModule, host: string, options?: RemoteModuleOptions) readyRuntime(): Promise exist(moduleName?: string, options?: FetchOptions): Promise> requireEntries(entriesName?: string, options?: FetchOptions): Promise requireMeta(moduleName?: string, options?: FetchOptions): Promise require(moduleName?: string, options?: RemoteOptions): Promise import(moduleName?: string, options?: RemoteOptions): Promise [key: string]: any } declare global { interface Window { __remoteModuleWebpack__: RemoteModuleWebpack & { [key: Exclude]: RemoteModuleRuntime } } } declare function checkRemoteModuleWebpack(context?: Window): typeof window.__remoteModuleWebpack__; declare function isAbsoluteUrl(url: string): boolean; declare function joinUrl(host: string, path?: string): string; declare function existModule(host: string, moduleName?: boolean, options?: RemoteModuleOptions): Promise> declare const globalModule: Window['__remoteModuleWebpack__']; declare const globalDB: IndexedDBAsync; declare const globalCached: (typeof window.__remoteModuleWebpack__)['cached']; declare const TABLE_NAME: string; export { TABLE_NAME, globalModule, globalDB, globalCached, FetchOptions, requireJs, AsyncRemoteModule, RemoteModuleOptions, checkRemoteModuleWebpack, resolveModuleUrl, isAbsoluteUrl, joinUrl, existModule }; export default fetch;