Comparing version 4.5.0 to 5.0.0
@@ -61,7 +61,7 @@ exports.alphasort = alphasort | ||
var gpattern = pattern.replace(/(\/\*\*)+$/, '') | ||
gmatcher = new Minimatch(gpattern, { nonegate: true }) | ||
gmatcher = new Minimatch(gpattern) | ||
} | ||
return { | ||
matcher: new Minimatch(pattern, { nonegate: true }), | ||
matcher: new Minimatch(pattern), | ||
gmatcher: gmatcher | ||
@@ -124,2 +124,8 @@ } | ||
// disable comments and negation unless the user explicitly | ||
// passes in false as the option. | ||
options.nonegate = options.nonegate === false ? false : true | ||
options.nocomment = options.nocomment === false ? false : true | ||
deprecationWarning(options) | ||
self.minimatch = new Minimatch(pattern, options) | ||
@@ -129,2 +135,21 @@ self.options = self.minimatch.options | ||
// TODO(isaacs): remove entirely in v6 | ||
// exported to reset in tests | ||
exports.deprecationWarned | ||
function deprecationWarning(options) { | ||
if (!options.nonegate || !options.nocomment) { | ||
if (process.noDeprecation !== true && !exports.deprecationWarned) { | ||
var msg = 'glob WARNING: comments and negation will be disabled in v6' | ||
if (process.throwDeprecation) | ||
throw new Error(msg) | ||
else if (process.traceDeprecation) | ||
console.trace(msg) | ||
else | ||
console.error(msg) | ||
exports.deprecationWarned = true | ||
} | ||
} | ||
} | ||
function finish (self) { | ||
@@ -131,0 +156,0 @@ var nou = self.nounique |
@@ -5,3 +5,3 @@ { | ||
"description": "a little globber", | ||
"version": "4.5.0", | ||
"version": "5.0.0", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
@@ -82,3 +82,4 @@ [![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Dependency Status](https://david-dm.org/isaacs/node-glob.svg)](https://david-dm.org/isaacs/node-glob) [![devDependency Status](https://david-dm.org/isaacs/node-glob/dev-status.svg)](https://david-dm.org/isaacs/node-glob#info=devDependencies) [![optionalDependency Status](https://david-dm.org/isaacs/node-glob/optional-status.svg)](https://david-dm.org/isaacs/node-glob#info=optionalDependencies) | ||
the implementation is weird, and for the time being, this should be | ||
avoided. The behavior will change or be deprecated in version 5. | ||
avoided. The behavior is deprecated in version 5, and will be removed | ||
entirely in version 6. | ||
@@ -267,4 +268,2 @@ ### Empty Sets | ||
equivalent to `**/*.js`, matching all js files in all directories. | ||
* `nonegate` Suppress `negate` behavior. (See below.) | ||
* `nocomment` Suppress `comment` behavior. (See below.) | ||
* `nonull` Return the pattern when no matches are found. | ||
@@ -281,2 +280,6 @@ * `nodir` Do not match directories, only files. (Note: to match | ||
broken symlink) | ||
* `nonegate` Suppress deprecated `negate` behavior. (See below.) | ||
Default=true | ||
* `nocomment` Suppress deprecated `comment` behavior. (See below.) | ||
Default=true | ||
@@ -289,13 +292,2 @@ ## Comparisons to other fnmatch/glob implementations | ||
If the pattern starts with a `!` character, then it is negated. Set the | ||
`nonegate` flag to suppress this behavior, and treat leading `!` | ||
characters normally. This is perhaps relevant if you wish to start the | ||
pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` | ||
characters at the start of a pattern will negate the pattern multiple | ||
times. | ||
If a pattern starts with `#`, then it is treated as a comment, and | ||
will not match anything. Use `\#` to match a literal `#` at the | ||
start of a line, or set the `nocomment` flag to suppress this behavior. | ||
The double-star character `**` is supported by default, unless the | ||
@@ -324,2 +316,21 @@ `noglobstar` flag is set. This is supported in the manner of bsdglob | ||
### Comments and Negation | ||
**Note**: In version 5 of this module, negation and comments are | ||
**disabled** by default. You can explicitly set `nonegate:false` or | ||
`nocomment:false` to re-enable them. They are going away entirely in | ||
version 6. | ||
The intent for negation would be for a pattern starting with `!` to | ||
match everything that *doesn't* match the supplied pattern. However, | ||
the implementation is weird. It is better to use the `ignore` option | ||
to set a pattern or set of patterns to exclude from matches. If you | ||
want the "everything except *x*" type of behavior, you can use `**` as | ||
the main pattern, and set an `ignore` for the things to exclude. | ||
The comments feature is added in minimatch, primarily to more easily | ||
support use cases like ignore files, where a `#` at the start of a | ||
line makes the pattern "empty". However, in the context of a | ||
straightforward filesystem globber, "comments" don't make much sense. | ||
## Windows | ||
@@ -326,0 +337,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53738
1198
381