| 1 | import { AST } from './ast.js';
|
|---|
| 2 | export type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd';
|
|---|
| 3 | export interface MinimatchOptions {
|
|---|
| 4 | /** do not expand `{x,y}` style braces */
|
|---|
| 5 | nobrace?: boolean;
|
|---|
| 6 | /** do not treat patterns starting with `#` as a comment */
|
|---|
| 7 | nocomment?: boolean;
|
|---|
| 8 | /** do not treat patterns starting with `!` as a negation */
|
|---|
| 9 | nonegate?: boolean;
|
|---|
| 10 | /** print LOTS of debugging output */
|
|---|
| 11 | debug?: boolean;
|
|---|
| 12 | /** treat `**` the same as `*` */
|
|---|
| 13 | noglobstar?: boolean;
|
|---|
| 14 | /** do not expand extglobs like `+(a|b)` */
|
|---|
| 15 | noext?: boolean;
|
|---|
| 16 | /** return the pattern if nothing matches */
|
|---|
| 17 | nonull?: boolean;
|
|---|
| 18 | /** treat `\\` as a path separator, not an escape character */
|
|---|
| 19 | windowsPathsNoEscape?: boolean;
|
|---|
| 20 | /**
|
|---|
| 21 | * inverse of {@link MinimatchOptions.windowsPathsNoEscape}
|
|---|
| 22 | * @deprecated
|
|---|
| 23 | */
|
|---|
| 24 | allowWindowsEscape?: boolean;
|
|---|
| 25 | /**
|
|---|
| 26 | * Compare a partial path to a pattern. As long as the parts
|
|---|
| 27 | * of the path that are present are not contradicted by the
|
|---|
| 28 | * pattern, it will be treated as a match. This is useful in
|
|---|
| 29 | * applications where you're walking through a folder structure,
|
|---|
| 30 | * and don't yet have the full path, but want to ensure that you
|
|---|
| 31 | * do not walk down paths that can never be a match.
|
|---|
| 32 | */
|
|---|
| 33 | partial?: boolean;
|
|---|
| 34 | /** allow matches that start with `.` even if the pattern does not */
|
|---|
| 35 | dot?: boolean;
|
|---|
| 36 | /** ignore case */
|
|---|
| 37 | nocase?: boolean;
|
|---|
| 38 | /** ignore case only in wildcard patterns */
|
|---|
| 39 | nocaseMagicOnly?: boolean;
|
|---|
| 40 | /** consider braces to be "magic" for the purpose of `hasMagic` */
|
|---|
| 41 | magicalBraces?: boolean;
|
|---|
| 42 | /**
|
|---|
| 43 | * If set, then patterns without slashes will be matched
|
|---|
| 44 | * against the basename of the path if it contains slashes.
|
|---|
| 45 | * For example, `a?b` would match the path `/xyz/123/acb`, but
|
|---|
| 46 | * not `/xyz/acb/123`.
|
|---|
| 47 | */
|
|---|
| 48 | matchBase?: boolean;
|
|---|
| 49 | /** invert the results of negated matches */
|
|---|
| 50 | flipNegate?: boolean;
|
|---|
| 51 | /** do not collapse multiple `/` into a single `/` */
|
|---|
| 52 | preserveMultipleSlashes?: boolean;
|
|---|
| 53 | /**
|
|---|
| 54 | * A number indicating the level of optimization that should be done
|
|---|
| 55 | * to the pattern prior to parsing and using it for matches.
|
|---|
| 56 | */
|
|---|
| 57 | optimizationLevel?: number;
|
|---|
| 58 | /** operating system platform */
|
|---|
| 59 | platform?: Platform;
|
|---|
| 60 | /**
|
|---|
| 61 | * When a pattern starts with a UNC path or drive letter, and in
|
|---|
| 62 | * `nocase:true` mode, do not convert the root portions of the
|
|---|
| 63 | * pattern into a case-insensitive regular expression, and instead
|
|---|
| 64 | * leave them as strings.
|
|---|
| 65 | *
|
|---|
| 66 | * This is the default when the platform is `win32` and
|
|---|
| 67 | * `nocase:true` is set.
|
|---|
| 68 | */
|
|---|
| 69 | windowsNoMagicRoot?: boolean;
|
|---|
| 70 | /**
|
|---|
| 71 | * max number of `{...}` patterns to expand. Default 100_000.
|
|---|
| 72 | */
|
|---|
| 73 | braceExpandMax?: number;
|
|---|
| 74 | }
|
|---|
| 75 | export declare const minimatch: {
|
|---|
| 76 | (p: string, pattern: string, options?: MinimatchOptions): boolean;
|
|---|
| 77 | sep: Sep;
|
|---|
| 78 | GLOBSTAR: typeof GLOBSTAR;
|
|---|
| 79 | filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean;
|
|---|
| 80 | defaults: (def: MinimatchOptions) => typeof minimatch;
|
|---|
| 81 | braceExpand: (pattern: string, options?: MinimatchOptions) => string[];
|
|---|
| 82 | makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp;
|
|---|
| 83 | match: (list: string[], pattern: string, options?: MinimatchOptions) => string[];
|
|---|
| 84 | AST: typeof AST;
|
|---|
| 85 | Minimatch: typeof Minimatch;
|
|---|
| 86 | escape: (s: string, { windowsPathsNoEscape, magicalBraces, }?: Pick<MinimatchOptions, "windowsPathsNoEscape" | "magicalBraces">) => string;
|
|---|
| 87 | unescape: (s: string, { windowsPathsNoEscape, magicalBraces, }?: Pick<MinimatchOptions, "windowsPathsNoEscape" | "magicalBraces">) => string;
|
|---|
| 88 | };
|
|---|
| 89 | export type Sep = '\\' | '/';
|
|---|
| 90 | export declare const sep: Sep;
|
|---|
| 91 | export declare const GLOBSTAR: unique symbol;
|
|---|
| 92 | export declare const filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean;
|
|---|
| 93 | export declare const defaults: (def: MinimatchOptions) => typeof minimatch;
|
|---|
| 94 | export declare const braceExpand: (pattern: string, options?: MinimatchOptions) => string[];
|
|---|
| 95 | export declare const makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp;
|
|---|
| 96 | export declare const match: (list: string[], pattern: string, options?: MinimatchOptions) => string[];
|
|---|
| 97 | export type MMRegExp = RegExp & {
|
|---|
| 98 | _src?: string;
|
|---|
| 99 | _glob?: string;
|
|---|
| 100 | };
|
|---|
| 101 | export type ParseReturnFiltered = string | MMRegExp | typeof GLOBSTAR;
|
|---|
| 102 | export type ParseReturn = ParseReturnFiltered | false;
|
|---|
| 103 | export declare class Minimatch {
|
|---|
| 104 | options: MinimatchOptions;
|
|---|
| 105 | set: ParseReturnFiltered[][];
|
|---|
| 106 | pattern: string;
|
|---|
| 107 | windowsPathsNoEscape: boolean;
|
|---|
| 108 | nonegate: boolean;
|
|---|
| 109 | negate: boolean;
|
|---|
| 110 | comment: boolean;
|
|---|
| 111 | empty: boolean;
|
|---|
| 112 | preserveMultipleSlashes: boolean;
|
|---|
| 113 | partial: boolean;
|
|---|
| 114 | globSet: string[];
|
|---|
| 115 | globParts: string[][];
|
|---|
| 116 | nocase: boolean;
|
|---|
| 117 | isWindows: boolean;
|
|---|
| 118 | platform: Platform;
|
|---|
| 119 | windowsNoMagicRoot: boolean;
|
|---|
| 120 | regexp: false | null | MMRegExp;
|
|---|
| 121 | constructor(pattern: string, options?: MinimatchOptions);
|
|---|
| 122 | hasMagic(): boolean;
|
|---|
| 123 | debug(..._: any[]): void;
|
|---|
| 124 | make(): void;
|
|---|
| 125 | preprocess(globParts: string[][]): string[][];
|
|---|
| 126 | adjascentGlobstarOptimize(globParts: string[][]): string[][];
|
|---|
| 127 | levelOneOptimize(globParts: string[][]): string[][];
|
|---|
| 128 | levelTwoFileOptimize(parts: string | string[]): string[];
|
|---|
| 129 | firstPhasePreProcess(globParts: string[][]): string[][];
|
|---|
| 130 | secondPhasePreProcess(globParts: string[][]): string[][];
|
|---|
| 131 | partsMatch(a: string[], b: string[], emptyGSMatch?: boolean): false | string[];
|
|---|
| 132 | parseNegate(): void;
|
|---|
| 133 | matchOne(file: string[], pattern: ParseReturn[], partial?: boolean): boolean;
|
|---|
| 134 | braceExpand(): string[];
|
|---|
| 135 | parse(pattern: string): ParseReturn;
|
|---|
| 136 | makeRe(): false | MMRegExp;
|
|---|
| 137 | slashSplit(p: string): string[];
|
|---|
| 138 | match(f: string, partial?: boolean): boolean;
|
|---|
| 139 | static defaults(def: MinimatchOptions): typeof Minimatch;
|
|---|
| 140 | }
|
|---|
| 141 | export { AST } from './ast.js';
|
|---|
| 142 | export { escape } from './escape.js';
|
|---|
| 143 | export { unescape } from './unescape.js';
|
|---|
| 144 | //# sourceMappingURL=index.d.ts.map |
|---|