piral-base
Version:
The base library for creating a Piral instance.
39 lines (38 loc) • 1.63 kB
TypeScript
/**
* Imports a pilet via SystemJS.
* @param link The link to the pilet's root module.
* @returns The evaluated pilet or an empty pilet in case of an error.
*/
export declare function loadSystemPilet(link: string): Promise<import("../types").SinglePiletApp | System.Module>;
export interface ModuleResolver {
(): any;
}
/**
* Registers all static global dependencies in the system.
* @param modules The modules to register as dependencies.
* @returns A promise when SystemJS included all dependencies.
*/
export declare function registerDependencies(modules: Record<string, any>): Promise<System.Module[]>;
/**
* Registers a plain module in SystemJS.
* @param name The name of the module
* @param resolve The resolver for the module's content.
*/
export declare function registerModule(name: string, resolve: ModuleResolver): void;
/**
* Registers the given dependency URLs in SystemJS.
* @param dependencies The dependencies to resolve later.
*/
export declare function registerDependencyUrls(dependencies: Record<string, string>): void;
/**
* Unregisters all modules coming from the given base URL.
* @param baseUrl The base URL used to identify the modules to delete to.
* @param dependencies The shared dependencies from the pilet. These will be left alive.
*/
export declare function unregisterModules(baseUrl: string, dependencies: Array<string>): void;
/**
* Requires a module from SystemJS
* @param name The name of the module to obtain
* @returns The module's content, if any, otherwise throws an error.
*/
export declare function requireModule(name: string, parent: string): System.Module;