export interface IDoraDep { name: string; /** * hook precompile lifecycle */ hooks?: Partial; } export interface IHookContext { source: string; targetDir: string; taskName: string; pkg: IPkg; options: IDoraEsmToCjsOptions; } export interface IPkg { path: string; content: Record; } export interface ITaskrTaskParams { task: any; opts: any; } export interface IHookNccOptions { packageName: string; externals: Record; [key: string]: any; } export interface IHookAddTaskBefore extends IHookContext { } export interface IHookRunTaskBefore extends IHookContext { externals: Record; taskr: ITaskrTaskParams; nccOptions: IHookNccOptions; } export type IDoraHookReturn = void | Promise; export interface IDoraDepHooks { onAddTaskBefore(opts: IHookAddTaskBefore): IDoraHookReturn; onRunTaskBefore(opts: IHookRunTaskBefore): void; } export interface IDoraTaskrHookContext { tasks: string[]; es: Record; packages: string[]; options: IDoraCreateTaskfileOptions; } export interface IDoraTaskrHooks { onTasksAddBefore(opts: IDoraTaskrHookContext): IDoraHookReturn; } export interface IDoraConfig { /** * from esm to cjs deps */ deps?: Array; declaration?: { /** * generate package name prefixes for dep declaration */ prefix?: string; }; taskr?: { /** * taskr hooks */ hooks?: Partial; }; externals?: { /** * extra externals */ extra?: string[]; }; } export interface IOptions extends IArgv { cwd: string; } export interface IArgv { dep?: string; [key: string]: any; } export interface IPrecompileOptions extends IOptions { } export interface IDoraEsmToCjsOptions { packageName: string; basedir: string; es: Record; externals?: string[]; overrideSource?: string; hooks?: IDoraDep['hooks']; } export interface IDoraCreateTaskfileOptions { cwd: string; config: IDoraConfig; argv: IArgv; }