index.d.ts 1.8 KB

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