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.

74 lines
2.7 KiB

4 years ago
  1. import micromatch = require('micromatch');
  2. import { Pattern, PatternRe } from '../types/patterns';
  3. /**
  4. * Return true for static pattern.
  5. */
  6. export declare function isStaticPattern(pattern: Pattern): boolean;
  7. /**
  8. * Return true for pattern that looks like glob.
  9. */
  10. export declare function isDynamicPattern(pattern: Pattern): boolean;
  11. /**
  12. * Convert a windows «path» to a unix-style «path».
  13. */
  14. export declare function unixifyPattern(pattern: Pattern): Pattern;
  15. /**
  16. * Returns negative pattern as positive pattern.
  17. */
  18. export declare function convertToPositivePattern(pattern: Pattern): Pattern;
  19. /**
  20. * Returns positive pattern as negative pattern.
  21. */
  22. export declare function convertToNegativePattern(pattern: Pattern): Pattern;
  23. /**
  24. * Return true if provided pattern is negative pattern.
  25. */
  26. export declare function isNegativePattern(pattern: Pattern): boolean;
  27. /**
  28. * Return true if provided pattern is positive pattern.
  29. */
  30. export declare function isPositivePattern(pattern: Pattern): boolean;
  31. /**
  32. * Extracts negative patterns from array of patterns.
  33. */
  34. export declare function getNegativePatterns(patterns: Pattern[]): Pattern[];
  35. /**
  36. * Extracts positive patterns from array of patterns.
  37. */
  38. export declare function getPositivePatterns(patterns: Pattern[]): Pattern[];
  39. /**
  40. * Extract base directory from provided pattern.
  41. */
  42. export declare function getBaseDirectory(pattern: Pattern): string;
  43. /**
  44. * Return true if provided pattern has globstar.
  45. */
  46. export declare function hasGlobStar(pattern: Pattern): boolean;
  47. /**
  48. * Return true if provided pattern ends with slash and globstar.
  49. */
  50. export declare function endsWithSlashGlobStar(pattern: Pattern): boolean;
  51. /**
  52. * Returns «true» when pattern ends with a slash and globstar or the last partial of the pattern is static pattern.
  53. */
  54. export declare function isAffectDepthOfReadingPattern(pattern: Pattern): boolean;
  55. /**
  56. * Return naive depth of provided pattern without depth of the base directory.
  57. */
  58. export declare function getNaiveDepth(pattern: Pattern): number;
  59. /**
  60. * Return max naive depth of provided patterns without depth of the base directory.
  61. */
  62. export declare function getMaxNaivePatternsDepth(patterns: Pattern[]): number;
  63. /**
  64. * Make RegExp for provided pattern.
  65. */
  66. export declare function makeRe(pattern: Pattern, options: micromatch.Options): PatternRe;
  67. /**
  68. * Convert patterns to regexps.
  69. */
  70. export declare function convertPatternsToRe(patterns: Pattern[], options: micromatch.Options): PatternRe[];
  71. /**
  72. * Returns true if the entry match any of the given RegExp's.
  73. */
  74. export declare function matchAny(entry: string, patternsRe: PatternRe[]): boolean;