index.d.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { Output, OnlyCountsOutput, GroupOutput, PathsOutput, Options, FilterPredicate, ExcludePredicate, GlobParams } from "../types";
  2. import { APIBuilder } from "./api-builder";
  3. import type picomatch from "picomatch";
  4. export declare class Builder<TReturnType extends Output = PathsOutput, TGlobFunction = typeof picomatch> {
  5. private readonly globCache;
  6. private options;
  7. private globFunction?;
  8. constructor(options?: Partial<Options<TGlobFunction>>);
  9. group(): Builder<GroupOutput, TGlobFunction>;
  10. withPathSeparator(separator: "/" | "\\"): this;
  11. withBasePath(): this;
  12. withRelativePaths(): this;
  13. withDirs(): this;
  14. withMaxDepth(depth: number): this;
  15. withMaxFiles(limit: number): this;
  16. withFullPaths(): this;
  17. withErrors(): this;
  18. withSymlinks({ resolvePaths }?: {
  19. resolvePaths?: boolean | undefined;
  20. }): this;
  21. withAbortSignal(signal: AbortSignal): this;
  22. normalize(): this;
  23. filter(predicate: FilterPredicate): this;
  24. onlyDirs(): this;
  25. exclude(predicate: ExcludePredicate): this;
  26. onlyCounts(): Builder<OnlyCountsOutput, TGlobFunction>;
  27. crawl(root?: string): APIBuilder<TReturnType>;
  28. withGlobFunction<TFunc>(fn: TFunc): Builder<TReturnType, TFunc>;
  29. /**
  30. * @deprecated Pass options using the constructor instead:
  31. * ```ts
  32. * new fdir(options).crawl("/path/to/root");
  33. * ```
  34. * This method will be removed in v7.0
  35. */
  36. crawlWithOptions(root: string, options: Partial<Options<TGlobFunction>>): APIBuilder<TReturnType>;
  37. glob(...patterns: string[]): Builder<TReturnType, TGlobFunction>;
  38. globWithOptions(patterns: string[]): Builder<TReturnType, TGlobFunction>;
  39. globWithOptions(patterns: string[], ...options: GlobParams<TGlobFunction>): Builder<TReturnType, TGlobFunction>;
  40. }