UNPKG

bit-bin

Version:

<a href="https://opensource.org/licenses/Apache-2.0"><img alt="apache" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a> <a href="https://github.com/teambit/bit/blob/master/CONTRIBUTING.md"><img alt="prs" src="https://img.shields.io/b

86 lines (85 loc) 3.23 kB
import { EnvExtensionOptions } from './env-extension-types'; import { ExtensionOptions } from './extension'; import { PathOsBased } from '../utils/path'; export declare type BaseExtensionOptions = { file?: string | null | undefined; }; declare type BaseArgs = { name: string; rawConfig: Record<string, any>; options: ExtensionOptions | EnvExtensionOptions; }; export declare type BaseLoadArgsProps = BaseArgs & { consumerPath?: PathOsBased | null | undefined; scopePath?: PathOsBased | null | undefined; context?: Record<string, any> | null | undefined; throws?: boolean; }; declare type BaseLoadFromFileArgsProps = BaseArgs & { filePath: string; rootDir?: string; throws?: boolean; }; declare type StaticProps = BaseArgs & { dynamicConfig: Record<string, any>; filePath: string; rootDir?: string | null | undefined; schema?: Record<string, any> | null | undefined; script?: Function; disabled: boolean; loaded: boolean; context?: Record<string, any> | null | undefined; }; declare type InstanceSpecificProps = { api: Record<string, any>; }; export declare type BaseExtensionProps = InstanceSpecificProps & StaticProps; export declare type BaseExtensionModel = { name: string; config: Record<string, any>; }; export declare type InitOptions = { writeConfigFilesOnAction: boolean | null | undefined; }; export default class BaseExtension { name: string; loaded: boolean; initialized: boolean; disabled: boolean; filePath: string; rootDir: string; rawConfig: Record<string, any>; schema: Record<string, any> | null | undefined; options: Record<string, any>; dynamicConfig: Record<string, any>; context: Record<string, any> | null | undefined; script: Function | null | undefined; _initOptions: InitOptions | null | undefined; api: any; constructor(extensionProps: BaseExtensionProps); get writeConfigFilesOnAction(): any; get initOptions(): Record<string, any> | null | undefined; set initOptions(opts: Record<string, any> | null | undefined); init(throws?: boolean): Promise<boolean>; extendAPI(baseApi: Record<string, any>, api: Record<string, any>): void; toString(): string; toBitJsonObject(): { [x: string]: { rawConfig: Record<string, any>; options: Record<string, any>; }; }; toModelObject(): { name: string; config: Record<string, any>; }; toObject(): Record<string, any>; reload(scopePath: string, { throws }: Record<string, any>): Promise<void>; setExtensionPathInScope(scopePath: string): void; static transformStringToModelObject(name: string): BaseExtensionModel; static load({ name, rawConfig, options, consumerPath, scopePath, throws, context }: BaseLoadArgsProps): Promise<BaseExtensionProps | BaseExtension>; static loadFromModelObjectBase(modelObject: string | BaseExtensionModel): BaseExtensionProps; static loadFromFile({ name, filePath, rootDir, rawConfig, options, throws }: BaseLoadFromFileArgsProps): Promise<StaticProps>; static loadDynamicConfig(extensionProps: StaticProps): Record<string, any> | null | undefined; } export {};