You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.7 KiB

4 years ago
  1. import { EntryItem } from '../types/entries';
  2. import { Pattern } from '../types/patterns';
  3. export declare type TransformFunction<T> = (entry: EntryItem) => T;
  4. export interface IOptions<T = EntryItem> {
  5. /**
  6. * The current working directory in which to search.
  7. */
  8. cwd: string;
  9. /**
  10. * The deep option can be set to true to traverse the entire directory structure,
  11. * or it can be set to a number to only traverse that many levels deep.
  12. */
  13. deep: number | boolean;
  14. /**
  15. * Add an array of glob patterns to exclude matches.
  16. */
  17. ignore: Pattern[];
  18. /**
  19. * Allow patterns to match filenames starting with a period (files & directories),
  20. * even if the pattern does not explicitly have a period in that spot.
  21. */
  22. dot: boolean;
  23. /**
  24. * Return `fs.Stats` with `path` property instead of file path.
  25. */
  26. stats: boolean;
  27. /**
  28. * Return only files.
  29. */
  30. onlyFiles: boolean;
  31. /**
  32. * Return only directories.
  33. */
  34. onlyDirectories: boolean;
  35. /**
  36. * Follow symlinked directories when expanding `**` patterns.
  37. */
  38. followSymlinkedDirectories: boolean;
  39. /**
  40. * Prevent duplicate results.
  41. */
  42. unique: boolean;
  43. /**
  44. * Add a `/` character to directory entries.
  45. */
  46. markDirectories: boolean;
  47. /**
  48. * Return absolute paths for matched entries.
  49. */
  50. absolute: boolean;
  51. /**
  52. * Disable expansion of brace patterns.
  53. */
  54. nobrace: boolean;
  55. /**
  56. * Enable expansion of brace patterns.
  57. */
  58. brace: boolean;
  59. /**
  60. * Disable matching with globstars (`**`).
  61. */
  62. noglobstar: boolean;
  63. /**
  64. * Enable matching with globstars (`**`).
  65. */
  66. globstar: boolean;
  67. /**
  68. * Disable extglob support, so that extglobs are regarded as literal characters.
  69. */
  70. noext: boolean;
  71. /**
  72. * Enable extglob support, so that extglobs are regarded as literal characters.
  73. */
  74. extension: boolean;
  75. /**
  76. * Disable a case-insensitive regex for matching files.
  77. */
  78. nocase: boolean;
  79. /**
  80. * Enable a case-insensitive regex for matching files.
  81. */
  82. case: boolean;
  83. /**
  84. * Allow glob patterns without slashes to match a file path based on its basename.
  85. * For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.
  86. */
  87. matchBase: boolean;
  88. /**
  89. * Allows you to transform a path or `fs.Stats` object before sending to the array.
  90. */
  91. transform: TransformFunction<T> | null;
  92. }
  93. export declare type IPartialOptions<T = EntryItem> = Partial<IOptions<T>>;
  94. export declare function prepare(options?: IPartialOptions): IOptions;