UNPKG

@wuapi/generator

Version:
70 lines (69 loc) 2.12 kB
import { $Commentable, $Project } from "@wuapi/essential"; export type PluginArgument = { tag: string; withValue: boolean; description: string; }; export type PluginDescription = { name: string; version: string; abbreviation: string; description: string; arguments: PluginArgument[]; }; /** * This is the abstract parent class of all Plug-ins. */ export declare abstract class BasePlugin { /** * Convenient function to get plugin name. * @returns plugin name */ getName(): string; /** * Returns the description of this plugin. */ abstract getDescription(): PluginDescription; /** * Start process the project, and generate code. * @param project The project to process. * @param outputDir The output dir, NOTE! this is the root to all plugins, each plugin will create it's * @param args The arguments from command line. */ abstract process(project: $Project, outputDir: string, args: { [key: string]: string; }): void; /** * Rewrite a file with texts replaced. * @param src The source file path. * @param dst The destination file path. * @param map The map of texts to replace. */ rewriteFile(src: string, dst: string, map: { [key: string]: string; }): void; } /** * This is the abstract parent class for project processors. */ export declare abstract class ProjectProcessor { plugin: BasePlugin; project: $Project; readonly rootDir: string; readonly config: { [key: string]: string; }; /** * * @param plugin The parent plugin. * @param project The project * @param outputDir The output dir, for All plugins. * @param config The configuration of this plugin. */ constructor(plugin: BasePlugin, project: $Project, outputDir: string, config: { [key: string]: string; }); abstract process(): void; } export declare function toBlockComment(element: $Commentable | null | undefined): string; export declare function toLineComment(element: $Commentable | null | undefined): string;