UNPKG

2.9 kBTypeScriptView Raw
1import minimatch = require("minimatch");
2import glob = require("glob");
3
4interface FindOptions extends glob.IOptions {
5 src?: string | undefined;
6 filter?: string | ((filepath?: string, options?: any) => boolean) | undefined;
7 nonull?: boolean | undefined;
8 matchBase?: boolean | undefined;
9 srcBase?: string | undefined;
10 prefixBase?: boolean | undefined;
11}
12
13interface MappingOptions extends FindOptions {
14 srcBase?: string | undefined;
15 destBase?: string | undefined;
16 ext?: string | undefined;
17 extDot?: "first" | "last" | undefined;
18 flatten?: boolean | undefined;
19 rename?(p: string): string;
20}
21
22interface OneMapping {
23 src: string[];
24 dest: string;
25}
26
27interface GlobuleStatic {
28 /**
29 * Match one or more globbing patterns against one or more file paths.
30 * Returns a uniqued array of all file paths that match any of the specified globbing patterns.
31 */
32 match(patterns: string | string[], filepaths: string | string[], options?: minimatch.IOptions): string[];
33
34 /**
35 * Tests pattern(s) against against one or more file paths and returns true if any files were matched, otherwise false.
36 */
37 isMatch(patterns: string | string[], filepaths: string | string[], options?: minimatch.IOptions): boolean;
38
39 /**
40 * Returns a unique array of all file or directory paths that match the given globbing pattern(s)
41 */
42 find(pattern: string | string[], options?: FindOptions): string[];
43
44 /**
45 * Returns a unique array of all file or directory paths that match the given globbing pattern(s)
46 */
47 find(options: FindOptions): string[];
48
49 /**
50 * Returns a unique array of all file or directory paths that match the given globbing pattern(s)
51 */
52 find(pattern: string | string[], pattern2: string | string[], options?: FindOptions): string[];
53
54 /**
55 * Returns a unique array of all file or directory paths that match the given globbing pattern(s)
56 */
57 find(pattern: string, pattern2: string, pattern3: string | string[], options?: FindOptions): string[];
58
59 /**
60 * Given a set of source file paths, returns an array of src-dest file mapping objects
61 */
62 mapping(filepaths: string[], options?: MappingOptions): OneMapping[];
63
64 /**
65 * Given a set of source file paths, returns an array of src-dest file mapping objects
66 */
67 mapping(options: MappingOptions): OneMapping[];
68
69 /**
70 * Given a set of source file paths, returns an array of src-dest file mapping objects
71 */
72 mapping(filepaths: string[], filepaths2: string[], options?: MappingOptions): OneMapping[];
73
74 /**
75 * Given a set of source file paths, returns an array of src-dest file mapping objects
76 */
77 mapping(filepaths: string[], filepaths2: string[], filepaths3: string[], options?: MappingOptions): OneMapping[];
78}
79
80declare var globule: GlobuleStatic;
81export = globule;
82
\No newline at end of file