minimatch 3.1.2 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +34 -5
- package/lib/path.js +4 -0
- package/minimatch.js +738 -779
- package/package.json +7 -8
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The ISC License
|
|
2
2
|
|
|
3
|
-
Copyright (c) Isaac Z. Schlueter and Contributors
|
|
3
|
+
Copyright (c) 2011-2022 Isaac Z. Schlueter and Contributors
|
|
4
4
|
|
|
5
5
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
6
|
purpose with or without fee is hereby granted, provided that the above
|
package/README.md
CHANGED
|
@@ -35,6 +35,20 @@ See:
|
|
|
35
35
|
* `man 3 fnmatch`
|
|
36
36
|
* `man 5 gitignore`
|
|
37
37
|
|
|
38
|
+
## Windows
|
|
39
|
+
|
|
40
|
+
**Please only use forward-slashes in glob expressions.**
|
|
41
|
+
|
|
42
|
+
Though windows uses either `/` or `\` as its path separator, only `/`
|
|
43
|
+
characters are used by this glob implementation. You must use
|
|
44
|
+
forward-slashes **only** in glob expressions. Back-slashes in patterns
|
|
45
|
+
will always be interpreted as escape characters, not path separators.
|
|
46
|
+
|
|
47
|
+
Note that `\` or `/` _will_ be interpreted as path separators in paths on
|
|
48
|
+
Windows, and will match against `/` in glob expressions.
|
|
49
|
+
|
|
50
|
+
So just always use `/` in patterns.
|
|
51
|
+
|
|
38
52
|
## Minimatch Class
|
|
39
53
|
|
|
40
54
|
Create a minimatch object by instantiating the `minimatch.Minimatch` class.
|
|
@@ -106,7 +120,7 @@ files, in the style of fnmatch or glob. If nothing is matched, and
|
|
|
106
120
|
options.nonull is set, then return a list containing the pattern itself.
|
|
107
121
|
|
|
108
122
|
```javascript
|
|
109
|
-
var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})
|
|
123
|
+
var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})
|
|
110
124
|
```
|
|
111
125
|
|
|
112
126
|
### minimatch.makeRe(pattern, options)
|
|
@@ -187,11 +201,20 @@ minimatch('/a/b', '/**/d', { partial: true }) // true, might be /a/b/.../d
|
|
|
187
201
|
minimatch('/x/y/z', '/a/**/z', { partial: true }) // false, because x !== a
|
|
188
202
|
```
|
|
189
203
|
|
|
190
|
-
###
|
|
204
|
+
### windowsPathsNoEscape
|
|
205
|
+
|
|
206
|
+
Use `\\` as a path separator _only_, and _never_ as an escape
|
|
207
|
+
character. If set, all `\\` characters are replaced with `/` in
|
|
208
|
+
the pattern. Note that this makes it **impossible** to match
|
|
209
|
+
against paths containing literal glob pattern characters, but
|
|
210
|
+
allows matching with patterns constructed using `path.join()` and
|
|
211
|
+
`path.resolve()` on Windows platforms, mimicking the (buggy!)
|
|
212
|
+
behavior of earlier versions on Windows. Please use with
|
|
213
|
+
caution, and be mindful of [the caveat about Windows
|
|
214
|
+
paths](#windows).
|
|
191
215
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
behavior and allows using the escape character.
|
|
216
|
+
For legacy reasons, this is also set if
|
|
217
|
+
`options.allowWindowsEscape` is set to the exact value `false`.
|
|
195
218
|
|
|
196
219
|
## Comparisons to other fnmatch/glob implementations
|
|
197
220
|
|
|
@@ -228,3 +251,9 @@ other interpretation of the glob pattern. Thus, a pattern like
|
|
|
228
251
|
`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
|
|
229
252
|
**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
|
|
230
253
|
checked for validity. Since those two are valid, matching proceeds.
|
|
254
|
+
|
|
255
|
+
Note that `fnmatch(3)` in libc is an extremely naive string comparison
|
|
256
|
+
matcher, which does not do anything special for slashes. This library is
|
|
257
|
+
designed to be used in glob searching and file walkers, and so it does do
|
|
258
|
+
special things with `/`. Thus, `foo*` will not match `foo/bar` in this
|
|
259
|
+
library, even though it would in `fnmatch(3)`.
|
package/lib/path.js
ADDED