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.
36 lines
1.4 KiB
36 lines
1.4 KiB
import * as path from 'path'; |
|
export declare type PathInterface = typeof path.posix; |
|
export declare type GlobMatch = GlobMatchRule | GlobMatchNoRule; |
|
export interface GlobMatchRule { |
|
matched: boolean; |
|
glob: string; |
|
index: number; |
|
isNeg: boolean; |
|
} |
|
export interface GlobMatchNoRule { |
|
matched: false; |
|
} |
|
export declare class GlobMatcher { |
|
readonly patterns: string | string[]; |
|
readonly root?: string | undefined; |
|
/** |
|
* @param filename full path of file to match against. |
|
* @returns a GlobMatch - information about the match. |
|
*/ |
|
readonly matchEx: (filename: string) => GlobMatch; |
|
readonly path: PathInterface; |
|
/** |
|
* 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: string | string[], root?: string | undefined, nodePath?: PathInterface); |
|
/** |
|
* 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; |
|
}
|
|
|