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.

164 lines
4.2 KiB

2 years ago
  1. import { FileSystemAdapter, Pattern } from './types';
  2. export declare const DEFAULT_FILE_SYSTEM_ADAPTER: FileSystemAdapter;
  3. export declare type Options = {
  4. /**
  5. * Return the absolute path for entries.
  6. *
  7. * @default false
  8. */
  9. absolute?: boolean;
  10. /**
  11. * If set to `true`, then patterns without slashes will be matched against
  12. * the basename of the path if it contains slashes.
  13. *
  14. * @default false
  15. */
  16. baseNameMatch?: boolean;
  17. /**
  18. * Enables Bash-like brace expansion.
  19. *
  20. * @default true
  21. */
  22. braceExpansion?: boolean;
  23. /**
  24. * Enables a case-sensitive mode for matching files.
  25. *
  26. * @default true
  27. */
  28. caseSensitiveMatch?: boolean;
  29. /**
  30. * Specifies the maximum number of concurrent requests from a reader to read
  31. * directories.
  32. *
  33. * @default os.cpus().length
  34. */
  35. concurrency?: number;
  36. /**
  37. * The current working directory in which to search.
  38. *
  39. * @default process.cwd()
  40. */
  41. cwd?: string;
  42. /**
  43. * Specifies the maximum depth of a read directory relative to the start
  44. * directory.
  45. *
  46. * @default Infinity
  47. */
  48. deep?: number;
  49. /**
  50. * Allow patterns to match entries that begin with a period (`.`).
  51. *
  52. * @default false
  53. */
  54. dot?: boolean;
  55. /**
  56. * Enables Bash-like `extglob` functionality.
  57. *
  58. * @default true
  59. */
  60. extglob?: boolean;
  61. /**
  62. * Indicates whether to traverse descendants of symbolic link directories.
  63. *
  64. * @default true
  65. */
  66. followSymbolicLinks?: boolean;
  67. /**
  68. * Custom implementation of methods for working with the file system.
  69. *
  70. * @default fs.*
  71. */
  72. fs?: Partial<FileSystemAdapter>;
  73. /**
  74. * Enables recursively repeats a pattern containing `**`.
  75. * If `false`, `**` behaves exactly like `*`.
  76. *
  77. * @default true
  78. */
  79. globstar?: boolean;
  80. /**
  81. * An array of glob patterns to exclude matches.
  82. * This is an alternative way to use negative patterns.
  83. *
  84. * @default []
  85. */
  86. ignore?: Pattern[];
  87. /**
  88. * Mark the directory path with the final slash.
  89. *
  90. * @default false
  91. */
  92. markDirectories?: boolean;
  93. /**
  94. * Returns objects (instead of strings) describing entries.
  95. *
  96. * @default false
  97. */
  98. objectMode?: boolean;
  99. /**
  100. * Return only directories.
  101. *
  102. * @default false
  103. */
  104. onlyDirectories?: boolean;
  105. /**
  106. * Return only files.
  107. *
  108. * @default true
  109. */
  110. onlyFiles?: boolean;
  111. /**
  112. * Enables an object mode (`objectMode`) with an additional `stats` field.
  113. *
  114. * @default false
  115. */
  116. stats?: boolean;
  117. /**
  118. * By default this package suppress only `ENOENT` errors.
  119. * Set to `true` to suppress any error.
  120. *
  121. * @default false
  122. */
  123. suppressErrors?: boolean;
  124. /**
  125. * Throw an error when symbolic link is broken if `true` or safely
  126. * return `lstat` call if `false`.
  127. *
  128. * @default false
  129. */
  130. throwErrorOnBrokenSymbolicLink?: boolean;
  131. /**
  132. * Ensures that the returned entries are unique.
  133. *
  134. * @default true
  135. */
  136. unique?: boolean;
  137. };
  138. export default class Settings {
  139. private readonly _options;
  140. readonly absolute: boolean;
  141. readonly baseNameMatch: boolean;
  142. readonly braceExpansion: boolean;
  143. readonly caseSensitiveMatch: boolean;
  144. readonly concurrency: number;
  145. readonly cwd: string;
  146. readonly deep: number;
  147. readonly dot: boolean;
  148. readonly extglob: boolean;
  149. readonly followSymbolicLinks: boolean;
  150. readonly fs: FileSystemAdapter;
  151. readonly globstar: boolean;
  152. readonly ignore: Pattern[];
  153. readonly markDirectories: boolean;
  154. readonly objectMode: boolean;
  155. readonly onlyDirectories: boolean;
  156. readonly onlyFiles: boolean;
  157. readonly stats: boolean;
  158. readonly suppressErrors: boolean;
  159. readonly throwErrorOnBrokenSymbolicLink: boolean;
  160. readonly unique: boolean;
  161. constructor(_options?: Options);
  162. private _getValue;
  163. private _getFileSystemMethods;
  164. }