pattern.d.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { MicromatchOptions, Pattern, PatternRe } from '../types';
  2. declare type PatternTypeOptions = {
  3. braceExpansion?: boolean;
  4. caseSensitiveMatch?: boolean;
  5. extglob?: boolean;
  6. };
  7. export declare function isStaticPattern(pattern: Pattern, options?: PatternTypeOptions): boolean;
  8. export declare function isDynamicPattern(pattern: Pattern, options?: PatternTypeOptions): boolean;
  9. export declare function convertToPositivePattern(pattern: Pattern): Pattern;
  10. export declare function convertToNegativePattern(pattern: Pattern): Pattern;
  11. export declare function isNegativePattern(pattern: Pattern): boolean;
  12. export declare function isPositivePattern(pattern: Pattern): boolean;
  13. export declare function getNegativePatterns(patterns: Pattern[]): Pattern[];
  14. export declare function getPositivePatterns(patterns: Pattern[]): Pattern[];
  15. /**
  16. * Returns patterns that can be applied inside the current directory.
  17. *
  18. * @example
  19. * // ['./*', '*', 'a/*']
  20. * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
  21. */
  22. export declare function getPatternsInsideCurrentDirectory(patterns: Pattern[]): Pattern[];
  23. /**
  24. * Returns patterns to be expanded relative to (outside) the current directory.
  25. *
  26. * @example
  27. * // ['../*', './../*']
  28. * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
  29. */
  30. export declare function getPatternsOutsideCurrentDirectory(patterns: Pattern[]): Pattern[];
  31. export declare function isPatternRelatedToParentDirectory(pattern: Pattern): boolean;
  32. export declare function getBaseDirectory(pattern: Pattern): string;
  33. export declare function hasGlobStar(pattern: Pattern): boolean;
  34. export declare function endsWithSlashGlobStar(pattern: Pattern): boolean;
  35. export declare function isAffectDepthOfReadingPattern(pattern: Pattern): boolean;
  36. export declare function expandPatternsWithBraceExpansion(patterns: Pattern[]): Pattern[];
  37. export declare function expandBraceExpansion(pattern: Pattern): Pattern[];
  38. export declare function getPatternParts(pattern: Pattern, options: MicromatchOptions): Pattern[];
  39. export declare function makeRe(pattern: Pattern, options: MicromatchOptions): PatternRe;
  40. export declare function convertPatternsToRe(patterns: Pattern[], options: MicromatchOptions): PatternRe[];
  41. export declare function matchAny(entry: string, patternsRe: PatternRe[]): boolean;
  42. export {};