index.d.ts 1.6 KB

123456789101112131415161718192021222324252627
  1. /// <reference types="node" />
  2. import * as taskManager from './managers/tasks';
  3. import { Options as OptionsInternal } from './settings';
  4. import { Entry as EntryInternal, FileSystemAdapter as FileSystemAdapterInternal, Pattern as PatternInternal } from './types';
  5. declare type EntryObjectModePredicate = {
  6. [TKey in keyof Pick<OptionsInternal, 'objectMode'>]-?: true;
  7. };
  8. declare type EntryStatsPredicate = {
  9. [TKey in keyof Pick<OptionsInternal, 'stats'>]-?: true;
  10. };
  11. declare type EntryObjectPredicate = EntryObjectModePredicate | EntryStatsPredicate;
  12. declare function FastGlob(source: PatternInternal | PatternInternal[], options: OptionsInternal & EntryObjectPredicate): Promise<EntryInternal[]>;
  13. declare function FastGlob(source: PatternInternal | PatternInternal[], options?: OptionsInternal): Promise<string[]>;
  14. declare namespace FastGlob {
  15. type Options = OptionsInternal;
  16. type Entry = EntryInternal;
  17. type Task = taskManager.Task;
  18. type Pattern = PatternInternal;
  19. type FileSystemAdapter = FileSystemAdapterInternal;
  20. function sync(source: PatternInternal | PatternInternal[], options: OptionsInternal & EntryObjectPredicate): EntryInternal[];
  21. function sync(source: PatternInternal | PatternInternal[], options?: OptionsInternal): string[];
  22. function stream(source: PatternInternal | PatternInternal[], options?: OptionsInternal): NodeJS.ReadableStream;
  23. function generateTasks(source: PatternInternal | PatternInternal[], options?: OptionsInternal): Task[];
  24. function isDynamicPattern(source: PatternInternal, options?: OptionsInternal): boolean;
  25. function escapePath(source: PatternInternal): PatternInternal;
  26. }
  27. export = FastGlob;