@types/minimatch
Advanced tools
Comparing version 3.0.5 to 5.1.0
@@ -1,5 +0,6 @@ | ||
// Type definitions for Minimatch 3.0 | ||
// Type definitions for minimatch 5.1 | ||
// Project: https://github.com/isaacs/minimatch | ||
// Definitions by: vvakame <https://github.com/vvakame> | ||
// Shant Marouti <https://github.com/shantmarouti> | ||
// BendingBender <https://github.com/BendingBender> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -9,6 +10,11 @@ | ||
* Tests a path against the pattern using the options. | ||
* | ||
* @example | ||
* import minimatch = require("minimatch"); | ||
* | ||
* const isJS = minimatch(file, "*.js", { matchBase: true }); | ||
*/ | ||
declare function M(target: string, pattern: string, options?: M.IOptions): boolean; | ||
declare function minimatch(target: string, pattern: string, options?: minimatch.IOptions): boolean; | ||
declare namespace M { | ||
declare namespace minimatch { | ||
/** | ||
@@ -18,9 +24,22 @@ * Match against the list of files, in the style of fnmatch or glob. | ||
* then return a list containing the pattern itself. | ||
* | ||
* @example | ||
* import minimatch = require("minimatch"); | ||
* | ||
* const javascripts = minimatch.match(fileList, "*.js", {matchBase: true}); | ||
*/ | ||
function match(list: ReadonlyArray<string>, pattern: string, options?: IOptions): string[]; | ||
function match(list: readonly string[], pattern: string, options?: IOptions): string[]; | ||
/** | ||
* Returns a function that tests its supplied argument, suitable for use with Array.filter | ||
* @return A function that tests its supplied argument, suitable for use with `Array.filter`. | ||
* | ||
* @example | ||
* import minimatch = require("minimatch"); | ||
* | ||
* const javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})); | ||
*/ | ||
function filter(pattern: string, options?: IOptions): (element: string, indexed: number, array: ReadonlyArray<string>) => boolean; | ||
function filter( | ||
pattern: string, | ||
options?: IOptions, | ||
): (element: string, indexed: number, array: readonly string[]) => boolean; | ||
@@ -30,6 +49,11 @@ /** | ||
*/ | ||
function makeRe(pattern: string, options?: IOptions): RegExp; | ||
function makeRe(pattern: string, options?: IOptions): RegExp | false; | ||
let Minimatch: IMinimatchStatic; | ||
function defaults(defaultOptions: IOptions): typeof minimatch; | ||
function braceExpand(pattern: string, options?: IOptions): string[]; | ||
const sep: string; | ||
const GLOBSTAR: unique symbol; | ||
interface IOptions { | ||
@@ -44,3 +68,3 @@ /** | ||
/** | ||
* Do not expand {a,b} and {1..3} brace sets. | ||
* Do not expand `{a,b}` and `{1..3}` brace sets. | ||
* | ||
@@ -52,3 +76,3 @@ * @default false | ||
/** | ||
* Disable ** matching against multiple folder names. | ||
* Disable `**` matching against multiple folder names. | ||
* | ||
@@ -63,2 +87,4 @@ * @default false | ||
* | ||
* Note that by default, `'a/**' + '/b'` will **not** match `a/.d/b`, unless `dot` is set. | ||
* | ||
* @default false | ||
@@ -69,3 +95,3 @@ */ | ||
/** | ||
* Disable "extglob" style patterns like +(a|b). | ||
* Disable "extglob" style patterns like `+(a|b)`. | ||
* | ||
@@ -84,3 +110,3 @@ * @default false | ||
/** | ||
* When a match is not found by minimatch.match, | ||
* When a match is not found by `minimatch.match`, | ||
* return a list containing the pattern itself if this option is set. | ||
@@ -94,4 +120,5 @@ * Otherwise, an empty list is returned if there are no matches. | ||
/** | ||
* If set, then patterns without slashes will be matched against | ||
* the basename of the path if it contains slashes. | ||
* If set, then patterns without slashes will be matched | ||
* against the basename of the path if it contains slashes. For example, | ||
* `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. | ||
* | ||
@@ -103,4 +130,3 @@ * @default false | ||
/** | ||
* Suppress the behavior of treating # | ||
* at the start of a pattern as a comment. | ||
* Suppress the behavior of treating `#` at the start of a pattern as a comment. | ||
* | ||
@@ -112,3 +138,3 @@ * @default false | ||
/** | ||
* Suppress the behavior of treating a leading ! character as negation. | ||
* Suppress the behavior of treating a leading `!` character as negation. | ||
* | ||
@@ -126,10 +152,61 @@ * @default false | ||
flipNegate?: boolean | undefined; | ||
} | ||
interface IMinimatchStatic { | ||
new(pattern: string, options?: IOptions): IMinimatch; | ||
prototype: IMinimatch; | ||
/** | ||
* Compare a partial path to a pattern. As long as the parts of the path that | ||
* are present are not contradicted by the pattern, it will be treated as a | ||
* match. This is useful in applications where you're walking through a | ||
* folder structure, and don't yet have the full path, but want to ensure that | ||
* you do not walk down paths that can never be a match. | ||
* | ||
* @default false | ||
* | ||
* @example | ||
* import minimatch = require("minimatch"); | ||
* | ||
* minimatch('/a/b', '/a/*' + '/c/d', { partial: true }) // true, might be /a/b/c/d | ||
* minimatch('/a/b', '/**' + '/d', { partial: true }) // true, might be /a/b/.../d | ||
* minimatch('/x/y/z', '/a/**' + '/z', { partial: true }) // false, because x !== a | ||
*/ | ||
partial?: boolean; | ||
/** | ||
* Use `\\` as a path separator _only_, and _never_ as an escape | ||
* character. If set, all `\\` characters are replaced with `/` in | ||
* the pattern. Note that this makes it **impossible** to match | ||
* against paths containing literal glob pattern characters, but | ||
* allows matching with patterns constructed using `path.join()` and | ||
* `path.resolve()` on Windows platforms, mimicking the (buggy!) | ||
* behavior of earlier versions on Windows. Please use with | ||
* caution, and be mindful of the caveat about Windows paths | ||
* | ||
* For legacy reasons, this is also set if | ||
* `options.allowWindowsEscape` is set to the exact value `false`. | ||
* | ||
* @default false | ||
*/ | ||
windowsPathsNoEscape?: boolean; | ||
} | ||
interface IMinimatch { | ||
/** | ||
* @deprecated Keep legacy interface to prevent unnecessary breakage. | ||
*/ | ||
type IMinimatchStatic = typeof Minimatch; | ||
/** | ||
* @deprecated Keep legacy interface to prevent unnecessary breakage. | ||
*/ | ||
type IMinimatch = Minimatch; | ||
/** | ||
* Create a minimatch object by instantiating the `minimatch.Minimatch` class. | ||
* | ||
* @example | ||
* import { Minimatch } from "minimatch"; | ||
* | ||
* const mm = new Minimatch(pattern, options); | ||
*/ | ||
class Minimatch { | ||
constructor(pattern: string, options?: IOptions); | ||
static defaults(defaultOptions: IOptions): typeof Minimatch; | ||
/** | ||
@@ -146,11 +223,21 @@ * The original pattern the minimatch object represents. | ||
/** | ||
* A 2-dimensional array of regexp or string expressions. | ||
* A 2-dimensional array of regexp or string expressions. Each row in the array corresponds | ||
* to a brace-expanded pattern. Each item in the row corresponds to a single path-part. For | ||
* example, the pattern `{a,b/c}/d` would expand to a set of patterns like: | ||
* | ||
* ``` | ||
* [ [ a, d ] | ||
* , [ b, c, d ] ] | ||
* ``` | ||
* | ||
* If a portion of the pattern doesn't have any "magic" in it (that is, it's something like `"foo"`` | ||
* rather than `fo*o?`), then it will be left as a string rather than converted to a regular expression. | ||
*/ | ||
set: any[][]; // (RegExp | string)[][] | ||
set: Array<Array<RegExp | string>>; | ||
/** | ||
* A single regular expression expressing the entire pattern. | ||
* Created by the makeRe method. | ||
* Created by the `makeRe` method. A single regular expression expressing the entire pattern. This is | ||
* useful in cases where you wish to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. | ||
*/ | ||
regexp: RegExp; | ||
regexp: RegExp | false | null; | ||
@@ -168,3 +255,3 @@ /** | ||
/** | ||
* True if the pattern is "" | ||
* True if the pattern is `""`. | ||
*/ | ||
@@ -174,18 +261,27 @@ empty: boolean; | ||
/** | ||
* Generate the regexp member if necessary, and return it. | ||
* Will return false if the pattern is invalid. | ||
* True if windows path delimiters shouldn't be interpreted as escape characters. | ||
*/ | ||
makeRe(): RegExp; // regexp or boolean | ||
windowsPathsNoEscape: boolean; | ||
/** | ||
* Return true if the filename matches the pattern, or false otherwise. | ||
* True if partial paths should be compared to a pattern. | ||
*/ | ||
match(fname: string): boolean; | ||
partial: boolean; | ||
/** | ||
* Take a /-split filename, and match it against a single row in the regExpSet. | ||
* Generate the `regexp` member if necessary, and return it. Will return `false` if the pattern is invalid. | ||
*/ | ||
makeRe(): RegExp | false; | ||
/** | ||
* @return `true` if the filename matches the pattern, or `false` otherwise. | ||
*/ | ||
match(fname: string, partial?: boolean): boolean; | ||
/** | ||
* Take a `/`-split filename, and match it against a single row in the `regExpSet`. | ||
* This method is mainly for internal use, but is exposed so that it can be used | ||
* by a glob-walker that needs to avoid excessive filesystem calls. | ||
*/ | ||
matchOne(files: string[], pattern: string[], partial: boolean): boolean; | ||
matchOne(file: string, pattern: readonly string[], partial: boolean): boolean; | ||
@@ -210,3 +306,3 @@ /** | ||
*/ | ||
braceExpand(pattern: string, options: IOptions): void; | ||
braceExpand(): string[]; | ||
@@ -216,6 +312,6 @@ /** | ||
*/ | ||
parse(pattern: string, isSub?: boolean): void; | ||
parse(pattern: string, isSub?: boolean): string | false | [string, boolean] | RegExp | typeof GLOBSTAR; | ||
} | ||
} | ||
export = M; | ||
export = minimatch; |
{ | ||
"name": "@types/minimatch", | ||
"version": "3.0.5", | ||
"description": "TypeScript definitions for Minimatch", | ||
"version": "5.1.0", | ||
"description": "TypeScript definitions for minimatch", | ||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/minimatch", | ||
@@ -17,2 +17,7 @@ "license": "MIT", | ||
"githubUsername": "shantmarouti" | ||
}, | ||
{ | ||
"name": "BendingBender", | ||
"url": "https://github.com/BendingBender", | ||
"githubUsername": "BendingBender" | ||
} | ||
@@ -29,4 +34,4 @@ ], | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "ce8670ab7ddb0b32136aa0f819c3e7d791e75f04ff991f2f1baa3a9967dd61c0", | ||
"typeScriptVersion": "3.6" | ||
"typesPublisherContentHash": "393ad7dd03ff638ad34b79d6f5bffdff845be56b6982b86f0152a6e201ef0839", | ||
"typeScriptVersion": "4.0" | ||
} |
@@ -5,3 +5,3 @@ # Installation | ||
# Summary | ||
This package contains type definitions for Minimatch (https://github.com/isaacs/minimatch). | ||
This package contains type definitions for minimatch (https://github.com/isaacs/minimatch). | ||
@@ -12,3 +12,3 @@ # Details | ||
### Additional Details | ||
* Last updated: Wed, 07 Jul 2021 00:01:40 GMT | ||
* Last updated: Wed, 24 Aug 2022 08:32:18 GMT | ||
* Dependencies: none | ||
@@ -18,2 +18,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by [vvakame](https://github.com/vvakame), and [Shant Marouti](https://github.com/shantmarouti). | ||
These definitions were written by [vvakame](https://github.com/vvakame), [Shant Marouti](https://github.com/shantmarouti), and [BendingBender](https://github.com/BendingBender). |
12498
259