pattern.d.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import { GLOBSTAR } from 'minimatch';
  2. export type MMPattern = string | RegExp | typeof GLOBSTAR;
  3. export type PatternList = [p: MMPattern, ...rest: MMPattern[]];
  4. export type UNCPatternList = [
  5. p0: '',
  6. p1: '',
  7. p2: string,
  8. p3: string,
  9. ...rest: MMPattern[]
  10. ];
  11. export type DrivePatternList = [p0: string, ...rest: MMPattern[]];
  12. export type AbsolutePatternList = [p0: '', ...rest: MMPattern[]];
  13. export type GlobList = [p: string, ...rest: string[]];
  14. /**
  15. * An immutable-ish view on an array of glob parts and their parsed
  16. * results
  17. */
  18. export declare class Pattern {
  19. #private;
  20. readonly length: number;
  21. constructor(patternList: MMPattern[], globList: string[], index: number, platform: NodeJS.Platform);
  22. /**
  23. * The first entry in the parsed list of patterns
  24. */
  25. pattern(): MMPattern;
  26. /**
  27. * true of if pattern() returns a string
  28. */
  29. isString(): boolean;
  30. /**
  31. * true of if pattern() returns GLOBSTAR
  32. */
  33. isGlobstar(): boolean;
  34. /**
  35. * true if pattern() returns a regexp
  36. */
  37. isRegExp(): boolean;
  38. /**
  39. * The /-joined set of glob parts that make up this pattern
  40. */
  41. globString(): string;
  42. /**
  43. * true if there are more pattern parts after this one
  44. */
  45. hasMore(): boolean;
  46. /**
  47. * The rest of the pattern after this part, or null if this is the end
  48. */
  49. rest(): Pattern | null;
  50. /**
  51. * true if the pattern represents a //unc/path/ on windows
  52. */
  53. isUNC(): boolean;
  54. /**
  55. * True if the pattern starts with a drive letter on Windows
  56. */
  57. isDrive(): boolean;
  58. /**
  59. * True if the pattern is rooted on an absolute path
  60. */
  61. isAbsolute(): boolean;
  62. /**
  63. * consume the root of the pattern, and return it
  64. */
  65. root(): string;
  66. /**
  67. * Check to see if the current globstar pattern is allowed to follow
  68. * a symbolic link.
  69. */
  70. checkFollowGlobstar(): boolean;
  71. /**
  72. * Mark that the current globstar pattern is following a symbolic link
  73. */
  74. markFollowGlobstar(): boolean;
  75. }
  76. //# sourceMappingURL=pattern.d.ts.map