nope-js-browser
Version:
NoPE Runtime for the Browser. For nodejs please use nope-js-node
34 lines (33 loc) • 1.19 kB
TypeScript
/// <reference types="node" />
export type Plugin = ExtendFunction & {
install: (lib: string | NodeModule) => Set<string>;
base: string[];
pluginName: string;
};
/**
* Helper to test if the plugin in is type plugin.
* @param plug the Plugin to test.
* @returns {boolean} the test if it is a plugin.
*/
export declare function isPlugin(plug: Plugin): plug is Plugin;
/**
* Function to define an extension
*/
export type ExtendFunction = (...args: any[]) => Array<{
path: string;
name: string;
adapted: any;
}>;
export declare function plugin(base: string | string[], extend: ExtendFunction, name?: string): Plugin;
/**
* Helper function to install Plugins.
* @param lib The Library to modify.
* @param plugins The Plugins install. This can be the registered names, pathes in the library or the plugin itself.
* @param log Flag to control the log information.
*/
export declare function installPlugins(lib: string | NodeModule, plugins: string | Plugin | Array<Plugin | string>, log?: boolean): void;
/**
* Helper to list all Plugins
* @returns List of recognized Plugins
*/
export declare function allPlugins(): string[];