export type LogFormatterProp = { level: "info" | "warn" | "error"; caller: NodeJS.CallSite | null; args: any[]; }; export type LogFormatter = (props: LogFormatterProp) => any[]; export type WatchConfig = { /** * 是否启用polyfill */ polyfill?: { /** * 是否启用console polyfill */ console?: { /** * 是否启用 */ enable?: boolean; /** * 是否打印调用堆栈信息 */ trace?: boolean; /** * 格式化函数 */ formatter: LogFormatter; }; }; /** * 生命周期钩子 */ lifecycle?: { /** * 初始化时调用 * @returns void */ onInit?: () => void; /** * 服务启动时调用 * @returns void */ onServerStart?: () => void; /** * 编译前调用 * @returns void */ onBeforeCompile?: () => void; /** * 编译后调用 * @returns void */ onAfterCompile?: () => void; /** * 服务关闭时调用 * @returns void */ onServerShutdown?: () => void; /** * 销毁监视器时调用 * @returns void */ onDispose?: () => void; }; }; type DeepRequiredIfPresent = { [P in keyof T]-?: NonNullable extends (...args: any) => any ? T[P] : NonNullable extends (infer U)[] ? DeepRequiredIfPresent[] : NonNullable extends object ? DeepRequiredIfPresent> : T[P] extends undefined | null ? T[P] : NonNullable; }; export type RealWatchConfig = DeepRequiredIfPresent; export declare const watch: (projectPath: string, config?: WatchConfig) => Promise<() => Promise>; export {};