Files
flipper/desktop/types/live-plugin-manager.d.ts
Anton Nikolaev ecfdeb2276 Make external typings re-usable across all the workspaces
Summary: Our external typings were only effective for the main "app" package. In this diff I've made them effective for all other workspaces too, and also cleaned up typescript configs.

Reviewed By: passy

Differential Revision: D21927361

fbshipit-source-id: ceb8009255583d969d79cc11b20dfe8b686f2fb3
2020-06-08 08:57:06 -07:00

83 lines
1.9 KiB
TypeScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
export declare class PluginManager {
constructor(options?: Partial<LivePluginManager.PluginManagerOptions>);
install(
name: string,
version?: string,
): Promise<LivePluginManager.IPluginInfo>;
installFromPath(
location: string,
options?: {
force: boolean;
},
): Promise<LivePluginManager.IPluginInfo>;
readonly options: LivePluginManager.PluginManagerOptions;
}
declare namespace LivePluginManager {
interface IPluginInfo {
readonly mainFile: string;
readonly location: string;
readonly name: string;
readonly version: string;
readonly dependencies: {[name: string]: string};
}
interface PluginSandbox {
env?: NodeJS.ProcessEnv;
global?: NodeJS.Global;
}
export interface NpmRegistryAuthToken {
token: string;
}
export interface NpmRegistryAuthBasic {
username: string;
password: string;
}
interface NpmRegistryConfig {
auth?: NpmRegistryAuthToken | NpmRegistryAuthBasic;
userAgent?: string;
}
export interface GithubAuthUserToken {
type: 'token';
token: string;
}
export interface GithubAuthBasic {
type: 'basic';
username: string;
password: string;
}
export type GithubAuth = GithubAuthUserToken | GithubAuthBasic;
interface PluginManagerOptions {
cwd: string;
pluginsPath: string;
sandbox: PluginSandbox;
npmRegistryUrl: string;
npmRegistryConfig: NpmRegistryConfig;
npmInstallMode: 'useCache' | 'noCache';
requireCoreModules: boolean;
hostRequire?: NodeRequire;
ignoredDependencies: Array<string | RegExp>;
staticDependencies: {[key: string]: any};
githubAuthentication?: GithubAuth;
lockWait: number;
lockStale: number;
}
}