index.d.ts 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import { AST } from './ast.js';
  2. type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd';
  3. export interface MinimatchOptions {
  4. nobrace?: boolean;
  5. nocomment?: boolean;
  6. nonegate?: boolean;
  7. debug?: boolean;
  8. noglobstar?: boolean;
  9. noext?: boolean;
  10. nonull?: boolean;
  11. windowsPathsNoEscape?: boolean;
  12. allowWindowsEscape?: boolean;
  13. partial?: boolean;
  14. dot?: boolean;
  15. nocase?: boolean;
  16. nocaseMagicOnly?: boolean;
  17. magicalBraces?: boolean;
  18. matchBase?: boolean;
  19. flipNegate?: boolean;
  20. preserveMultipleSlashes?: boolean;
  21. optimizationLevel?: number;
  22. platform?: Platform;
  23. windowsNoMagicRoot?: boolean;
  24. }
  25. export declare const minimatch: {
  26. (p: string, pattern: string, options?: MinimatchOptions): boolean;
  27. sep: Sep;
  28. GLOBSTAR: typeof GLOBSTAR;
  29. filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean;
  30. defaults: (def: MinimatchOptions) => typeof minimatch;
  31. braceExpand: (pattern: string, options?: MinimatchOptions) => string[];
  32. makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp;
  33. match: (list: string[], pattern: string, options?: MinimatchOptions) => string[];
  34. AST: typeof AST;
  35. Minimatch: typeof Minimatch;
  36. escape: (s: string, { windowsPathsNoEscape, }?: Pick<MinimatchOptions, "windowsPathsNoEscape">) => string;
  37. unescape: (s: string, { windowsPathsNoEscape, }?: Pick<MinimatchOptions, "windowsPathsNoEscape">) => string;
  38. };
  39. type Sep = '\\' | '/';
  40. export declare const sep: Sep;
  41. export declare const GLOBSTAR: unique symbol;
  42. export declare const filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean;
  43. export declare const defaults: (def: MinimatchOptions) => typeof minimatch;
  44. export declare const braceExpand: (pattern: string, options?: MinimatchOptions) => string[];
  45. export declare const makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp;
  46. export declare const match: (list: string[], pattern: string, options?: MinimatchOptions) => string[];
  47. export type MMRegExp = RegExp & {
  48. _src?: string;
  49. _glob?: string;
  50. };
  51. export type ParseReturnFiltered = string | MMRegExp | typeof GLOBSTAR;
  52. export type ParseReturn = ParseReturnFiltered | false;
  53. export declare class Minimatch {
  54. options: MinimatchOptions;
  55. set: ParseReturnFiltered[][];
  56. pattern: string;
  57. windowsPathsNoEscape: boolean;
  58. nonegate: boolean;
  59. negate: boolean;
  60. comment: boolean;
  61. empty: boolean;
  62. preserveMultipleSlashes: boolean;
  63. partial: boolean;
  64. globSet: string[];
  65. globParts: string[][];
  66. nocase: boolean;
  67. isWindows: boolean;
  68. platform: Platform;
  69. windowsNoMagicRoot: boolean;
  70. regexp: false | null | MMRegExp;
  71. constructor(pattern: string, options?: MinimatchOptions);
  72. hasMagic(): boolean;
  73. debug(..._: any[]): void;
  74. make(): void;
  75. preprocess(globParts: string[][]): string[][];
  76. adjascentGlobstarOptimize(globParts: string[][]): string[][];
  77. levelOneOptimize(globParts: string[][]): string[][];
  78. levelTwoFileOptimize(parts: string | string[]): string[];
  79. firstPhasePreProcess(globParts: string[][]): string[][];
  80. secondPhasePreProcess(globParts: string[][]): string[][];
  81. partsMatch(a: string[], b: string[], emptyGSMatch?: boolean): false | string[];
  82. parseNegate(): void;
  83. matchOne(file: string[], pattern: ParseReturn[], partial?: boolean): boolean;
  84. braceExpand(): string[];
  85. parse(pattern: string): ParseReturn;
  86. makeRe(): false | MMRegExp;
  87. slashSplit(p: string): string[];
  88. match(f: string, partial?: boolean): boolean;
  89. static defaults(def: MinimatchOptions): typeof Minimatch;
  90. }
  91. export { AST } from './ast.js';
  92. export { escape } from './escape.js';
  93. export { unescape } from './unescape.js';
  94. //# sourceMappingURL=index.d.ts.map