1 import micromatch = require('micromatch');
\r
2 import { IOptions } from '../../managers/options';
\r
3 import { FilterFunction } from '@mrmlnc/readdir-enhanced';
\r
4 import { Pattern } from '../../types/patterns';
\r
5 export default class EntryFilter {
\r
6 private readonly options;
\r
7 private readonly micromatchOptions;
\r
8 readonly index: Map<string, undefined>;
\r
9 constructor(options: IOptions, micromatchOptions: micromatch.Options);
\r
11 * Returns filter for directories.
\r
13 getFilter(positive: Pattern[], negative: Pattern[]): FilterFunction;
\r
15 * Returns true if entry must be added to result.
\r
19 * Return true if the entry already has in the cross reader index.
\r
21 private isDuplicateEntry;
\r
23 * Create record in the cross reader index.
\r
25 private createIndexRecord;
\r
27 * Returns true for non-files if the «onlyFiles» option is enabled.
\r
29 private onlyFileFilter;
\r
31 * Returns true for non-directories if the «onlyDirectories» option is enabled.
\r
33 private onlyDirectoryFilter;
\r
35 * Return true when `absolute` option is enabled and matched to the negative patterns.
\r
37 private isSkippedByAbsoluteNegativePatterns;
\r
39 * Return true when entry match to provided patterns.
\r
41 * First, just trying to apply patterns to the path.
\r
42 * Second, trying to apply patterns to the path with final slash (need to micromatch to support «directory/**» patterns).
\r
44 private isMatchToPatterns;
\r