|
| 1 | +/** |
| 2 | + * TODO(erikian): remove this file once we upgrade to the latest `glob` version. |
| 3 | + * https://github.com/electron/asar/pull/332#issuecomment-2435407933 |
| 4 | + */ |
| 5 | + |
| 6 | +declare module 'glob' { |
| 7 | + export function glob( |
| 8 | + pattern: string, |
| 9 | + options: IGlobOptions, |
| 10 | + cb: (err: Error | null, matches: string[]) => void, |
| 11 | + ): unknown; |
| 12 | +} |
| 13 | + |
| 14 | +interface IMinimatchOptions { |
| 15 | + /** |
| 16 | + * Dump a ton of stuff to stderr. |
| 17 | + * |
| 18 | + * @default false |
| 19 | + */ |
| 20 | + debug?: boolean | undefined; |
| 21 | + |
| 22 | + /** |
| 23 | + * Do not expand `{a,b}` and `{1..3}` brace sets. |
| 24 | + * |
| 25 | + * @default false |
| 26 | + */ |
| 27 | + nobrace?: boolean | undefined; |
| 28 | + |
| 29 | + /** |
| 30 | + * Disable `**` matching against multiple folder names. |
| 31 | + * |
| 32 | + * @default false |
| 33 | + */ |
| 34 | + noglobstar?: boolean | undefined; |
| 35 | + |
| 36 | + /** |
| 37 | + * Allow patterns to match filenames starting with a period, |
| 38 | + * even if the pattern does not explicitly have a period in that spot. |
| 39 | + * |
| 40 | + * Note that by default, `'a/**' + '/b'` will **not** match `a/.d/b`, unless `dot` is set. |
| 41 | + * |
| 42 | + * @default false |
| 43 | + */ |
| 44 | + dot?: boolean | undefined; |
| 45 | + |
| 46 | + /** |
| 47 | + * Disable "extglob" style patterns like `+(a|b)`. |
| 48 | + * |
| 49 | + * @default false |
| 50 | + */ |
| 51 | + noext?: boolean | undefined; |
| 52 | + |
| 53 | + /** |
| 54 | + * Perform a case-insensitive match. |
| 55 | + * |
| 56 | + * @default false |
| 57 | + */ |
| 58 | + nocase?: boolean | undefined; |
| 59 | + |
| 60 | + /** |
| 61 | + * When a match is not found by `minimatch.match`, |
| 62 | + * return a list containing the pattern itself if this option is set. |
| 63 | + * Otherwise, an empty list is returned if there are no matches. |
| 64 | + * |
| 65 | + * @default false |
| 66 | + */ |
| 67 | + nonull?: boolean | undefined; |
| 68 | + |
| 69 | + /** |
| 70 | + * If set, then patterns without slashes will be matched |
| 71 | + * against the basename of the path if it contains slashes. For example, |
| 72 | + * `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. |
| 73 | + * |
| 74 | + * @default false |
| 75 | + */ |
| 76 | + matchBase?: boolean | undefined; |
| 77 | + |
| 78 | + /** |
| 79 | + * Suppress the behavior of treating `#` at the start of a pattern as a comment. |
| 80 | + * |
| 81 | + * @default false |
| 82 | + */ |
| 83 | + nocomment?: boolean | undefined; |
| 84 | + |
| 85 | + /** |
| 86 | + * Suppress the behavior of treating a leading `!` character as negation. |
| 87 | + * |
| 88 | + * @default false |
| 89 | + */ |
| 90 | + nonegate?: boolean | undefined; |
| 91 | + |
| 92 | + /** |
| 93 | + * Returns from negate expressions the same as if they were not negated. |
| 94 | + * (Ie, true on a hit, false on a miss.) |
| 95 | + * |
| 96 | + * @default false |
| 97 | + */ |
| 98 | + flipNegate?: boolean | undefined; |
| 99 | + |
| 100 | + /** |
| 101 | + * Compare a partial path to a pattern. As long as the parts of the path that |
| 102 | + * are present are not contradicted by the pattern, it will be treated as a |
| 103 | + * match. This is useful in applications where you're walking through a |
| 104 | + * folder structure, and don't yet have the full path, but want to ensure that |
| 105 | + * you do not walk down paths that can never be a match. |
| 106 | + * |
| 107 | + * @default false |
| 108 | + * |
| 109 | + * @example |
| 110 | + * import minimatch = require("minimatch"); |
| 111 | + * |
| 112 | + * minimatch('/a/b', '/a/*' + '/c/d', { partial: true }) // true, might be /a/b/c/d |
| 113 | + * minimatch('/a/b', '/**' + '/d', { partial: true }) // true, might be /a/b/.../d |
| 114 | + * minimatch('/x/y/z', '/a/**' + '/z', { partial: true }) // false, because x !== a |
| 115 | + */ |
| 116 | + partial?: boolean; |
| 117 | + |
| 118 | + /** |
| 119 | + * Use `\\` as a path separator _only_, and _never_ as an escape |
| 120 | + * character. If set, all `\\` characters are replaced with `/` in |
| 121 | + * the pattern. Note that this makes it **impossible** to match |
| 122 | + * against paths containing literal glob pattern characters, but |
| 123 | + * allows matching with patterns constructed using `path.join()` and |
| 124 | + * `path.resolve()` on Windows platforms, mimicking the (buggy!) |
| 125 | + * behavior of earlier versions on Windows. Please use with |
| 126 | + * caution, and be mindful of the caveat about Windows paths |
| 127 | + * |
| 128 | + * For legacy reasons, this is also set if |
| 129 | + * `options.allowWindowsEscape` is set to the exact value `false`. |
| 130 | + * |
| 131 | + * @default false |
| 132 | + */ |
| 133 | + windowsPathsNoEscape?: boolean; |
| 134 | +} |
| 135 | + |
| 136 | +export interface IGlobOptions extends IMinimatchOptions { |
| 137 | + cwd?: string | undefined; |
| 138 | + root?: string | undefined; |
| 139 | + dot?: boolean | undefined; |
| 140 | + nomount?: boolean | undefined; |
| 141 | + mark?: boolean | undefined; |
| 142 | + nosort?: boolean | undefined; |
| 143 | + stat?: boolean | undefined; |
| 144 | + silent?: boolean | undefined; |
| 145 | + strict?: boolean | undefined; |
| 146 | + cache?: { [path: string]: boolean | 'DIR' | 'FILE' | ReadonlyArray<string> } | undefined; |
| 147 | + statCache?: { [path: string]: false | { isDirectory(): boolean } | undefined } | undefined; |
| 148 | + symlinks?: { [path: string]: boolean | undefined } | undefined; |
| 149 | + realpathCache?: { [path: string]: string } | undefined; |
| 150 | + sync?: boolean | undefined; |
| 151 | + nounique?: boolean | undefined; |
| 152 | + nonull?: boolean | undefined; |
| 153 | + debug?: boolean | undefined; |
| 154 | + nobrace?: boolean | undefined; |
| 155 | + noglobstar?: boolean | undefined; |
| 156 | + noext?: boolean | undefined; |
| 157 | + nocase?: boolean | undefined; |
| 158 | + matchBase?: any; |
| 159 | + nodir?: boolean | undefined; |
| 160 | + ignore?: string | ReadonlyArray<string> | undefined; |
| 161 | + follow?: boolean | undefined; |
| 162 | + realpath?: boolean | undefined; |
| 163 | + nonegate?: boolean | undefined; |
| 164 | + nocomment?: boolean | undefined; |
| 165 | + absolute?: boolean | undefined; |
| 166 | + allowWindowsEscape?: boolean | undefined; |
| 167 | + fs?: typeof import('fs'); |
| 168 | +} |
0 commit comments