UNPKG

egg-ts-helper

Version:
41 lines (40 loc) 1.09 kB
import chokidar from 'chokidar'; import { EventEmitter } from 'node:events'; import { TsGenerator, TsHelperConfig, default as TsHelper } from './core'; export interface BaseWatchItem { ref?: string; directory: string; generator?: string; enabled?: boolean; ignore?: string | string[]; trigger?: Array<'add' | 'unlink' | 'change'>; pattern?: string | string[]; watch?: boolean; execAtInit?: boolean; } export interface WatchItem extends PlainObject, BaseWatchItem { } interface WatcherOptions extends WatchItem { name: string; } export default class Watcher extends EventEmitter { ref: string; name: string; dir: string; options: WatcherOptions; pattern: string[]; dtsDir: string; config: TsHelperConfig; generator: TsGenerator; fsWatcher?: chokidar.FSWatcher; throttleTick: any; throttleStack: string[]; helper: TsHelper; constructor(helper: TsHelper); init(options: WatcherOptions): void; destroy(): void; watch(): void; execute(file?: string): any; private onChange; } export {};