UNPKG

@kubb/core

Version:

Core functionality for Kubb's plugin-based code generation system, providing the foundation for transforming OpenAPI specifications.

64 lines (60 loc) 1.92 kB
import { colors } from 'consola/utils'; import { LogLevel, ConsolaInstance } from 'consola'; declare class EventEmitter<TEvents extends Record<string, any>> { #private; constructor(); emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void; on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void; off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void; removeAll(): void; } type DebugEvent = { date: Date; logs: string[]; fileName?: string; }; type Events = { start: [message: string]; success: [message: string]; error: [message: string, cause: Error]; warning: [message: string]; debug: [DebugEvent]; info: [message: string]; progress_start: [{ id: string; size: number; message?: string; }]; progressed: [{ id: string; message?: string; }]; progress_stop: [{ id: string; }]; }; declare const LogMapper: { readonly silent: number; readonly info: 3; readonly debug: 4; }; type Logger = { /** * Optional config name to show in CLI output */ name?: string; logLevel: LogLevel; consola?: ConsolaInstance; on: EventEmitter<Events>['on']; emit: EventEmitter<Events>['emit']; writeLogs: () => Promise<string[]>; }; type Props = { name?: string; logLevel?: LogLevel; consola?: ConsolaInstance; }; declare function createLogger({ logLevel, name, consola: _consola }?: Props): Logger; declare function randomColour(text?: string): keyof typeof colors; declare function randomCliColour(text?: string): string; export { EventEmitter as E, type Logger as L, LogMapper as a, randomCliColour as b, createLogger as c, randomColour as r };