@@ -11,97 +11,143 @@ export const DEFAULT_FILE_SYSTEM_ADAPTER: FileSystemAdapter = {
1111 readdirSync : fs . readdirSync
1212} ;
1313
14+ // tslint:disable no-redundant-jsdoc
1415export interface Options {
1516 /**
16- * The maximum number of concurrent calls to `fs.readdir`.
17+ * Return the absolute path for entries.
18+ *
19+ * @default false
1720 */
18- concurrency ?: number ;
21+ absolute ?: boolean ;
1922 /**
20- * The current working directory in which to search.
23+ * If set to `true`, then patterns without slashes will be matched against
24+ * the basename of the path if it contains slashes.
25+ *
26+ * @default false
2127 */
22- cwd ?: string ;
28+ baseNameMatch ?: boolean ;
2329 /**
24- * The deep option can be set to true to traverse the entire directory structure,
25- * or it can be set to a number to only traverse that many levels deep.
30+ * Enables Bash-like brace expansion.
31+ *
32+ * @default true
2633 */
27- deep ?: number ;
34+ braceExpansion ?: boolean ;
2835 /**
29- * Add an array of glob patterns to exclude matches.
36+ * Enables a case-sensitive mode for matching files.
37+ *
38+ * @default true
3039 */
31- ignore ?: Pattern [ ] ;
40+ caseSensitiveMatch ?: boolean ;
3241 /**
33- * Allow patterns to match filenames starting with a period (files & directories),
34- * even if the pattern does not explicitly have a period in that spot.
42+ * Specifies the maximum number of concurrent requests from a reader to read
43+ * directories.
44+ *
45+ * @default Infinity
3546 */
36- dot ?: boolean ;
47+ concurrency ?: number ;
3748 /**
38- * Return `Entry` object instead of filepath.
49+ * The current working directory in which to search.
50+ *
51+ * @default process.cwd()
3952 */
40- objectMode ?: boolean ;
53+ cwd ?: string ;
4154 /**
42- * Return `fs.Stats` with `path` property instead of file path.
55+ * Specifies the maximum depth of a read directory relative to the start
56+ * directory.
57+ *
58+ * @default Infinity
4359 */
44- stats ?: boolean ;
60+ deep ?: number ;
4561 /**
46- * Return only files.
62+ * Allow patterns to match entries that begin with a period (`.`).
63+ *
64+ * @default false
4765 */
48- onlyFiles ?: boolean ;
66+ dot ?: boolean ;
4967 /**
50- * Return only directories.
68+ * Enables Bash-like `extglob` functionality.
69+ *
70+ * @default true
5171 */
52- onlyDirectories ?: boolean ;
72+ extglob ?: boolean ;
5373 /**
5474 * Indicates whether to traverse descendants of symbolic link directories.
55- * Also, if the `stats` option is specified, it tries to get `fs.Stats` for symbolic link file.
75+ *
76+ * @default true
5677 */
5778 followSymbolicLinks ?: boolean ;
5879 /**
59- * Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`.
80+ * Custom implementation of methods for working with the file system.
81+ *
82+ * @default fs.*
6083 */
61- throwErrorOnBrokenSymbolicLink ?: boolean ;
84+ fs ?: Partial < FileSystemAdapter > ;
6285 /**
63- * Prevent duplicate results.
86+ * Enables recursively repeats a pattern containing `**`.
87+ * If `false`, `**` behaves exactly like `*`.
88+ *
89+ * @default true
6490 */
65- unique ?: boolean ;
91+ globstar ?: boolean ;
6692 /**
67- * Add a `/` character to directory entries.
93+ * An array of glob patterns to exclude matches.
94+ * This is an alternative way to use negative patterns.
95+ *
96+ * @default []
6897 */
69- markDirectories ?: boolean ;
98+ ignore ?: Pattern [ ] ;
7099 /**
71- * Return absolute paths for matched entries.
100+ * Mark the directory path with the final slash.
101+ *
102+ * @default false
72103 */
73- absolute ?: boolean ;
104+ markDirectories ?: boolean ;
74105 /**
75- * Enable expansion of brace patterns.
106+ * Returns objects (instead of strings) describing entries.
107+ *
108+ * @default false
76109 */
77- braceExpansion ?: boolean ;
110+ objectMode ?: boolean ;
78111 /**
79- * Enable matching with globstars (`**`).
112+ * Return only directories.
113+ *
114+ * @default false
80115 */
81- globstar ?: boolean ;
116+ onlyDirectories ?: boolean ;
82117 /**
83- * Enable extglob support, so that extglobs are regarded as literal characters.
118+ * Return only files.
119+ *
120+ * @default true
84121 */
85- extglob ?: boolean ;
122+ onlyFiles ?: boolean ;
86123 /**
87- * Enable a case-sensitive regex for matching files.
124+ * Enables an object mode (`objectMode`) with an additional `stats` field.
125+ *
126+ * @default false
88127 */
89- caseSensitiveMatch ?: boolean ;
128+ stats ?: boolean ;
90129 /**
91- * Allow glob patterns without slashes to match a file path based on its basename.
92- * For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.
130+ * By default this package suppress only `ENOENT` errors.
131+ * Set to `true` to suppress any error.
132+ *
133+ * @default false
93134 */
94- baseNameMatch ?: boolean ;
135+ suppressErrors ?: boolean ;
95136 /**
96- * Suppress any errors from reader.
97- * Can be useful when the directory has entries with a special level of access.
137+ * Throw an error when symbolic link is broken if `true` or safely
138+ * return `lstat` call if `false`.
139+ *
140+ * @default false
98141 */
99- suppressErrors ?: boolean ;
142+ throwErrorOnBrokenSymbolicLink ?: boolean ;
100143 /**
101- * Custom implementation of methods for working with the file system.
144+ * Ensures that the returned entries are unique.
145+ *
146+ * @default true
102147 */
103- fs ?: Partial < FileSystemAdapter > ;
148+ unique ?: boolean ;
104149}
150+ // tslint:enable no-redundant-jsdoc
105151
106152export default class Settings {
107153 public readonly absolute : boolean = this . _getValue ( this . _options . absolute , false ) ;
0 commit comments