Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 1548e33

Browse files
authored
expost supported file exts (#22)
1 parent f3bffa0 commit 1548e33

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/index.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,20 +297,28 @@ export class DependencyTree {
297297
}
298298

299299
/**
300-
* Globs all supported files from the {rootDirs}
301-
*
302-
* @returns {string[]} An array of found files (absolute paths)
300+
* @returns {string[]} An array of supported file extensions
303301
*/
304-
getFiles(): readonly Path[] {
302+
getSupportedFileTypes(): string[] {
305303
const supportedFileTypes = new Set(
306304
this.fileProcessors.reduce(
307305
(acc, processor) => [...acc, ...processor.supportedFileTypes()],
308306
[],
309307
),
310308
);
309+
return Array.from(supportedFileTypes);
310+
}
311+
312+
/**
313+
* Globs all supported files from the {rootDirs}
314+
*
315+
* @returns {string[]} An array of found files (absolute paths)
316+
*/
317+
getFiles(): readonly Path[] {
318+
const supportedFileTypes = this.getSupportedFileTypes();
311319
return this.rootDirs.reduce<Path[]>((acc: string[], rootDir) => {
312320
return acc.concat(
313-
fg.sync(`**/*.{${Array.from(supportedFileTypes).join(',')}}`, {
321+
fg.sync(`**/*.{${supportedFileTypes.join(',')}}`, {
314322
cwd: rootDir,
315323
ignore: this.ignoreGlobs,
316324
absolute: true,

0 commit comments

Comments
 (0)