2025-11-18 14:46:51 +08:00
|
|
|
export interface CompileResult {
|
|
|
|
|
success: boolean;
|
|
|
|
|
message: string;
|
|
|
|
|
outputFiles?: string[];
|
|
|
|
|
errors?: string[];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
import type { IFileSystem } from './IFileSystem';
|
|
|
|
|
import type { IDialog } from './IDialog';
|
2025-12-08 21:23:37 +08:00
|
|
|
import type { IService, ServiceType } from '@esengine/esengine';
|
2025-11-18 14:46:51 +08:00
|
|
|
|
|
|
|
|
export interface CompilerModuleContext {
|
|
|
|
|
fileSystem: IFileSystem;
|
|
|
|
|
dialog: IDialog;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface CompilerContext {
|
|
|
|
|
projectPath: string | null;
|
|
|
|
|
moduleContext: CompilerModuleContext;
|
|
|
|
|
getService<T extends IService>(serviceClass: ServiceType<T>): T | undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ICompiler<TOptions = unknown> {
|
|
|
|
|
readonly id: string;
|
|
|
|
|
readonly name: string;
|
|
|
|
|
readonly description: string;
|
|
|
|
|
|
|
|
|
|
compile(options: TOptions, context: CompilerContext): Promise<CompileResult>;
|
|
|
|
|
|
|
|
|
|
createConfigUI?(onOptionsChange: (options: TOptions) => void, context: CompilerContext): React.ReactElement;
|
|
|
|
|
|
|
|
|
|
validateOptions?(options: TOptions): string | null;
|
|
|
|
|
}
|