import { PathInterface, GlobMatch, GlobPattern, GlobPatternWithRoot } from './GlobMatcherTypes'; declare type Optional = { [P in keyof T]?: T[P] | undefined; }; export declare type GlobMatchOptions = Optional; export declare type MatcherMode = 'exclude' | 'include'; interface NormalizedGlobMatchOptions { /** * The matcher has two modes (`include` or `exclude`) that impact how globs behave. * * `include` - designed for searching for file. By default it matches a sub-set of file. * In include mode, the globs need to be more explicit to match. * - `dot` is by default false. * - `nested` is by default false. * * `exclude` - designed to emulate `.gitignore`. By default it matches a larger range of files. * - `dot` is by default true. * - `nested` is by default true. * * @default: 'exclude' */ mode: MatcherMode; /** * The default directory from which a glob is relative. * Any globs that are not relative to the root will ignored. * @default: process.cwd() */ root: string; /** * The directory to use as the current working directory. * @default: process.cwd(); */ cwd: string; /** * Allows matching against directories with a leading `.`. * * @default: mode == 'exclude' */ dot: boolean; /** * Allows matching against nested directories or files without needing to add `**` * * @default: mode == 'exclude' */ nested: boolean; /** * Mostly used for testing purposes. It allows explicitly specifying `path.win32` or `path.posix`. * * @default: require('path') */ nodePath: PathInterface; /** * Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. * * @default false */ nobrace?: boolean | undefined; } export declare class GlobMatcher { /** * @param filename full path of file to match against. * @returns a GlobMatch - information about the match. */ readonly matchEx: (filename: string) => GlobMatch; readonly path: PathInterface; readonly patterns: GlobPatternWithRoot[]; readonly patternsNormalizedToRoot: GlobPatternWithRoot[]; readonly root: string; readonly dot: boolean; readonly options: NormalizedGlobMatchOptions; /** * Construct a `.gitignore` emulator * @param patterns - the contents of a `.gitignore` style file or an array of individual glob rules. * @param root - the working directory */ constructor(patterns: GlobPattern | GlobPattern[], root?: string, nodePath?: PathInterface); /** * Construct a `.gitignore` emulator * @param patterns - the contents of a `.gitignore` style file or an array of individual glob rules. * @param options - to set the root and other options */ constructor(patterns: GlobPattern | GlobPattern[], options?: GlobMatchOptions); constructor(patterns: GlobPattern | GlobPattern[], rootOrOptions?: string | GlobMatchOptions); /** * Check to see if a filename matches any of the globs. * If filename is relative, it is considered relative to the root. * If filename is absolute and contained within the root, it will be made relative before being tested for a glob match. * If filename is absolute and not contained within the root, it will be tested as is. * @param filename full path of the file to check. */ match(filename: string): boolean; } export {}; //# sourceMappingURL=GlobMatcher.d.ts.map