import { Service } from './ir'; import { BasketryError, EngineEvents, EngineInput, File, FileStatus, LegacyInput, LocalConfig, Overrides, Violation } from './types'; import { FileSystem } from './file-system'; export type EngineLoadInput = { configPath?: string | undefined; } & Overrides & EngineEvents; export interface Engine { /** Gets the list of any plugins that were loaded by the deprecated process of falling back to Node modules. */ get legacyModules(): string[]; /** Gets the list of files generated by the engine when `runGenerators` is called. */ get files(): File[]; /** Gets the list of all file changes detected by the engine when `compareFiles` is called. */ get changes(): Record; /** Gets the list of all errors encountered by the engine. */ get errors(): BasketryError[]; /** Gets the list of all violations encountered by the engine when `runParser` and `runRules` are called. */ get violations(): Violation[]; /** Gets the service definition produced by the engine when `runParser` is called. */ get service(): Service | undefined; /** Gets the absolute path to the source file. */ get sourcePath(): string; /** Gets the absolute path to a file relative to the project config. */ resolve(relativePath: string): string; runParser(): Promise; runRules(): Promise; runGenerators(): Promise; compareFiles(): Promise; commitFiles(): Promise; } export declare class RpcEngine implements Engine { private readonly config; private readonly fs; private readonly events?; static load({ configPath, onError, onViolation, }: { configPath: string; } & EngineEvents): Promise<{ engines: Engine[]; errors: BasketryError[]; }>; constructor(config: LocalConfig, absoluteConfigPath: string, fs: FileSystem, events?: { onError?: ((error: BasketryError) => void) | undefined; onViolation?: ((violation: Violation, line: string) => void) | undefined; } | undefined); private _legacyModules; get legacyModules(): string[]; private _nextRequestId; private get requestId(); private readonly basketryContext; private readonly _filesByFilepath; private _files; get files(): File[]; private readonly _changes; get changes(): Record; private readonly _errors; get errors(): BasketryError[]; private pushErrors; private readonly _violationsByRange; private readonly _violations; get violations(): Violation[]; private pushViolations; private readonly _contentBySource; private getLine; private __service; get service(): Service | undefined; private set service(value); get sourcePath(): string; resolve(relativePath: string): string; private hasParserRun; runParser(): Promise; /** @deprecated */ private legacyRunParserAsNodeModule; private hasRunRules; runRules(): Promise; private runRule; /** @deprecated */ private legacyRunRuleAsNodeModule; private hasRunGenerators; runGenerators(): Promise; runGenerator(generatorCommand: string, options: any): Promise; /** @deprecated */ private legacyRunGeneratorAsNodeModule; compareFiles(): Promise; private compare; commitFiles(): Promise; } /** * @deprecated Use RpcEngine instead. */ export declare class NodeEngine implements Engine { private readonly input; private readonly fs; private readonly events?; constructor(input: EngineInput, fs: FileSystem, events?: { onError?: ((error: BasketryError) => void) | undefined; onViolation?: ((violation: Violation, line: string) => void) | undefined; } | undefined); static load({ configPath, onError, onViolation, ...overrides }: EngineLoadInput): Promise<{ engines: Engine[]; errors: BasketryError[]; }>; readonly legacyModules: string[]; private readonly _projectDirectory; private readonly _outputPath; private readonly _files; private readonly _changes; private readonly _errors; private readonly _violations; private readonly _filesByFilepath; private readonly _violationsByRange; /** Gets the absolute path to the source file. */ get sourcePath(): string; /** Gets the absolute path to a file relative to the project config. */ resolve(relativePath: string): string; get files(): File[]; get changes(): Record; get errors(): BasketryError[]; get violations(): Violation[]; get service(): Service | undefined; private _service; private hasParserRun; private rulesRun; private hasGeneratorsRun; runParser(): Promise; runRules(): Promise; runGenerators(): Promise; compareFiles(): Promise; private compare; commitFiles(): Promise; private pushErrors; private pushViolations; private readonly _contentBySource; private getLine; private absolute; } export declare function getInput(configPath: string | undefined, fs: FileSystem, overrides?: Overrides): Promise<{ values: LegacyInput[]; errors: BasketryError[]; }>;