watcher.d.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /// <reference types="node" />
  2. import chokidar from 'chokidar';
  3. import { EventEmitter } from 'events';
  4. import { TsGenerator, TsHelperConfig, default as TsHelper } from './core';
  5. export interface BaseWatchItem {
  6. ref?: string;
  7. directory: string;
  8. generator?: string;
  9. enabled?: boolean;
  10. ignore?: string | string[];
  11. trigger?: Array<'add' | 'unlink' | 'change'>;
  12. pattern?: string | string[];
  13. watch?: boolean;
  14. execAtInit?: boolean;
  15. }
  16. export interface WatchItem extends PlainObject, BaseWatchItem {
  17. }
  18. interface WatcherOptions extends WatchItem {
  19. name: string;
  20. }
  21. export default class Watcher extends EventEmitter {
  22. helper: TsHelper;
  23. ref: string;
  24. name: string;
  25. dir: string;
  26. options: WatcherOptions;
  27. pattern: string[];
  28. dtsDir: string;
  29. config: TsHelperConfig;
  30. generator: TsGenerator;
  31. fsWatcher?: chokidar.FSWatcher;
  32. throttleTick: any;
  33. throttleStack: string[];
  34. constructor(helper: TsHelper);
  35. init(options: WatcherOptions): void;
  36. destroy(): void;
  37. watch(): void;
  38. execute(file?: string): any;
  39. private onChange;
  40. }
  41. export {};
  42. //# sourceMappingURL=watcher.d.ts.map