diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-10-10 03:43:44 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-10-10 03:43:44 +0200 |
commit | abd94a7f5a50f43c797a11b53549ae48fff667c3 (patch) | |
tree | ab8ed457f65cdd72e13e0571d2975729428f1551 /node_modules/micromatch | |
parent | a0247c6a3fd6a09a41a7e35a3441324c4dcb58be (diff) |
add node_modules to address #4364
Diffstat (limited to 'node_modules/micromatch')
-rwxr-xr-x | node_modules/micromatch/LICENSE | 21 | ||||
-rw-r--r-- | node_modules/micromatch/README.md | 689 | ||||
-rwxr-xr-x | node_modules/micromatch/index.js | 431 | ||||
-rw-r--r-- | node_modules/micromatch/lib/chars.js | 67 | ||||
-rw-r--r-- | node_modules/micromatch/lib/expand.js | 304 | ||||
-rw-r--r-- | node_modules/micromatch/lib/glob.js | 193 | ||||
-rw-r--r-- | node_modules/micromatch/lib/utils.js | 149 | ||||
-rw-r--r-- | node_modules/micromatch/package.json | 189 |
8 files changed, 2043 insertions, 0 deletions
diff --git a/node_modules/micromatch/LICENSE b/node_modules/micromatch/LICENSE new file mode 100755 index 000000000..fa30c4cb3 --- /dev/null +++ b/node_modules/micromatch/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2015, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/micromatch/README.md b/node_modules/micromatch/README.md new file mode 100644 index 000000000..8fb391910 --- /dev/null +++ b/node_modules/micromatch/README.md @@ -0,0 +1,689 @@ +# micromatch [![NPM version](https://img.shields.io/npm/v/micromatch.svg?style=flat)](https://www.npmjs.com/package/micromatch) [![NPM downloads](https://img.shields.io/npm/dm/micromatch.svg?style=flat)](https://npmjs.org/package/micromatch) [![Build Status](https://img.shields.io/travis/jonschlinkert/micromatch.svg?style=flat)](https://travis-ci.org/jonschlinkert/micromatch) + +> Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. + +Micromatch supports all of the same matching features as [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch). + +* [mm()](#usage) is the same as [multimatch()](https://github.com/sindresorhus/multimatch) +* [mm.match()](#match) is the same as [minimatch.match()](https://github.com/isaacs/minimatch) +* use [mm.isMatch()](#ismatch) instead of [minimatch()](https://github.com/isaacs/minimatch) + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save micromatch +``` + +## Start matching! + +```js +var mm = require('micromatch'); +console.log(mm([''])) +``` + +*** + +### Features + +* [Drop-in replacement](#switch-from-minimatch) for [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch) +* Built-in support for multiple glob patterns, like `['foo/*.js', '!bar.js']` +* [Brace Expansion](https://github.com/jonschlinkert/braces) (`foo/bar-{1..5}.md`, `one/{two,three}/four.md`) +* Typical glob patterns, like `**/*`, `a/b/*.js`, or `['foo/*.js', '!bar.js']` +* Methods like `.isMatch()`, `.contains()` and `.any()` + +**Extended globbing features:** + +* Logical `OR` (`foo/bar/(abc|xyz).js`) +* Regex character classes (`foo/bar/baz-[1-5].js`) +* POSIX [bracket expressions](https://github.com/jonschlinkert/expand-brackets) (`**/[[:alpha:][:digit:]]/`) +* [extglobs](https://github.com/jonschlinkert/extglob) (`**/+(x|y)`, `!(a|b)`, etc). + +You can combine these to create whatever matching patterns you need. + +**Example** + +```js +// double-negation! +mm(['fa', 'fb', 'f', 'fo'], '!(f!(o))'); +//=> ['fo'] +``` + +## Why switch to micromatch? + +* Native support for multiple glob patterns, no need for wrappers like [multimatch](https://github.com/sindresorhus/multimatch) +* [10-55x faster](#benchmarks) and more performant than [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch). This is achieved through a combination of caching and regex optimization strategies, a fundamentally different approach than minimatch. +* More extensive support for the Bash 4.3 specification +* More complete extglob support +* Extensive [unit tests](./test) (approx. 1,300 tests). Minimatch fails many of the tests. + +### Switch from minimatch + +Use `mm.isMatch()` instead of `minimatch()`: + +```js +mm.isMatch('foo', 'b*'); +//=> false +``` + +Use `mm.match()` instead of `minimatch.match()`: + +```js +mm.match(['foo', 'bar'], 'b*'); +//=> 'bar' +``` + +### Switch from multimatch + +Same signature: + +```js +mm(['foo', 'bar', 'baz'], ['f*', '*z']); +//=> ['foo', 'baz'] +``` + +*** + +## Usage + +Add micromatch to your node.js project: + +```js +var mm = require('micromatch'); +``` + +**Signature** + +```js +mm(array_of_strings, glob_patterns[, options]); +``` + +**Example** + +```js +mm(['foo', 'bar', 'baz'], 'b*'); +//=> ['bar', 'baz'] +``` + +### Usage examples + +**Brace expansion** + +Match files with `.js` or `.txt` extensions. + +```js +mm(['a.js', 'b.md', 'c.txt'], '*.{js,txt}'); +//=> ['a.js', 'c.txt'] +``` + +**Extglobs** + +Match anything except for files with the `.md` extension. + +```js +mm(files, '**/*.!(md)'); + +//=> ['a.js', 'c.txt'] +``` + +**Multiple patterns** + +Match using an array of patterns. + +```js +mm(['a.md', 'b.js', 'c.txt', 'd.json'], ['*.md', '*.txt']); +//=> ['a.md', 'c.txt'] +``` + +**Negation patterns:** + +Behavior is designed to be what users would expect, based on conventions that are already well-established. + +* [minimatch](https://github.com/isaacs/minimatch) behavior is used when the pattern is a string, so patterns are **inclusive by default**. +* [multimatch](https://github.com/sindresorhus/multimatch) behavior is used when an array of patterns is passed, so patterns are **exclusive by default**. + +```js +mm(['a.js', 'b.md', 'c.txt'], '!*.{js,txt}'); +//=> ['b.md'] + +mm(['a.md', 'b.js', 'c.txt', 'd.json'], ['*.*', '!*.{js,txt}']); +//=> ['a.md', 'd.json'] +``` + +*** + +## API methods + +```js +var mm = require('micromatch'); +``` + +### .match + +```js +mm.match(array, globString); +``` + +Return an array of files that match the given glob pattern. Useful if you only need to use a single glob pattern. + +**Example** + +```js +mm.match(['ab', 'a/b', 'bb', 'b/c'], '?b'); +//=> ['ab', 'bb'] + +mm.match(['ab', 'a/b', 'bb', 'b/c'], '*/b'); +//=> ['a/b'] +``` + +### .isMatch + +```js +mm.isMatch(filepath, globString); +``` + +Returns true if a file path matches the given glob pattern. + +**Example** + +```js +mm.isMatch('.verb.md', '*.md'); +//=> false + +mm.isMatch('.verb.md', '*.md', {dot: true}); +//=> true +``` + +### .contains + +Returns true if any part of a file path matches the given glob pattern. Think of this is "has path" versus "is path". + +**Example** + +`.isMatch()` would return false for both of the following: + +```js +mm.contains('a/b/c', 'a/b'); +//=> true + +mm.contains('a/b/c', 'a/*'); +//=> true +``` + +### .matcher + +Returns a function for matching using the supplied pattern. e.g. create your own "matcher". The advantage of this method is that the pattern can be compiled outside of a loop. + +**Pattern** + +Can be any of the following: + +* `glob/string` +* `regex` +* `function` + +**Example** + +```js +var isMatch = mm.matcher('*.md'); +var files = []; + +['a.md', 'b.txt', 'c.md'].forEach(function(fp) { + if (isMatch(fp)) { + files.push(fp); + } +}); +``` + +### .filter + +Returns a function that can be passed to `Array#filter()`. + +**Params** + +* `patterns` **{String|Array}**: + +**Examples** + +Single glob: + +```js +var fn = mm.filter('*.md'); +['a.js', 'b.txt', 'c.md'].filter(fn); +//=> ['c.md'] + +var fn = mm.filter('[a-c]'); +['a', 'b', 'c', 'd', 'e'].filter(fn); +//=> ['a', 'b', 'c'] +``` + +Array of glob patterns: + +```js +var arr = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]; + +var fn = mm.filter(['{1..10}', '![7-9]', '!{3..4}']); +arr.filter(fn); +//=> [1, 2, 5, 6, 10] +``` + +_(Internally this function generates the matching function by using the [matcher](#matcher) method. You can use the [matcher](#matcher) method directly to create your own filter function)_ + +### .any + +Returns true if a file path matches any of the given patterns. + +```js +mm.any(filepath, patterns, options); +``` + +**Params** + +* filepath `{String}`: The file path to test. +* patterns `{String|Array}`: One or more glob patterns +* options: `{Object}`: options to pass to the `.matcher()` method. + +**Example** + +```js +mm.any('abc', ['!*z']); +//=> true +mm.any('abc', ['a*', 'z*']); +//=> true +mm.any('abc', 'a*'); +//=> true +mm.any('abc', ['z*']); +//=> false +``` + +### .expand + +Returns an object with a regex-compatible string and tokens. + +```js +mm.expand('*.js'); + +// when `track` is enabled (for debugging), the `history` array is used +// to record each mutation to the glob pattern as it's converted to regex +{ options: { track: false, dot: undefined, makeRe: true, negated: false }, + pattern: '(.*\\/|^)bar\\/(?:(?!(?:^|\\/)\\.).)*?', + history: [], + tokens: + { path: + { whole: '**/bar/**', + dirname: '**/bar/', + filename: '**', + basename: '**', + extname: '', + ext: '' }, + is: + { glob: true, + negated: false, + globstar: true, + dotfile: false, + dotdir: false }, + match: {}, + original: '**/bar/**', + pattern: '**/bar/**', + base: '' } } +``` + +### .makeRe + +Create a regular expression for matching file paths based on the given pattern: + +```js +mm.makeRe('*.js'); +//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ +``` + +## Options + +### options.unixify + +Normalize slashes in file paths and glob patterns to forward slashes. + +Type: `{Boolean}` + +Default: `undefined` on non-windows, `true` on windows. + +### options.dot + +Match dotfiles. Same behavior as [minimatch](https://github.com/isaacs/minimatch). + +Type: `{Boolean}` + +Default: `false` + +### options.unescape + +Unescape slashes in glob patterns. Use cautiously, especially on windows. + +Type: `{Boolean}` + +Default: `undefined` + +**Example** + +```js +mm.isMatch('abc', '\\a\\b\\c', {unescape: true}); +//=> true +``` + +### options.nodupes + +Remove duplicate elements from the result array. + +Type: `{Boolean}` + +Default: `undefined` + +**Example** + +Example of using the `unescape` and `nodupes` options together: + +```js +mm.match(['abc', '\\a\\b\\c'], '\\a\\b\\c', {unescape: true}); +//=> ['abc', 'abc'] + +mm.match(['abc', '\\a\\b\\c'], '\\a\\b\\c', {unescape: true, nodupes: true}); +//=> ['abc'] +``` + +### options.matchBase + +Allow glob patterns without slashes to match a file path based on its basename. . Same behavior as [minimatch](https://github.com/isaacs/minimatch). + +Type: `{Boolean}` + +Default: `false` + +**Example** + +```js +mm(['a/b.js', 'a/c.md'], '*.js'); +//=> [] + +mm(['a/b.js', 'a/c.md'], '*.js', {matchBase: true}); +//=> ['a/b.js'] +``` + +### options.nobraces + +Don't expand braces in glob patterns. Same behavior as [minimatch](https://github.com/isaacs/minimatch) `nobrace`. + +Type: `{Boolean}` + +Default: `undefined` + +See [braces](https://github.com/jonschlinkert/braces) for more information about extended brace expansion. + +### options.nobrackets + +Don't expand POSIX bracket expressions. + +Type: `{Boolean}` + +Default: `undefined` + +See [expand-brackets](https://github.com/jonschlinkert/expand-brackets) for more information about extended bracket expressions. + +### options.noextglob + +Don't expand extended globs. + +Type: `{Boolean}` + +Default: `undefined` + +See [extglob](https://github.com/jonschlinkert/extglob) for more information about extended globs. + +### options.nocase + +Use a case-insensitive regex for matching files. Same behavior as [minimatch](https://github.com/isaacs/minimatch). + +Type: `{Boolean}` + +Default: `false` + +### options.nonegate + +Disallow negation (`!`) patterns. + +Type: `{Boolean}` + +Default: `false` + +### options.nonull + +If `true`, when no matches are found the actual (array-ified) glob pattern is returned instead of an empty array. Same behavior as [minimatch](https://github.com/isaacs/minimatch). + +Type: `{Boolean}` + +Default: `false` + +### options.cache + +Cache the platform (e.g. `win32`) to prevent this from being looked up for every filepath. + +Type: `{Boolean}` + +Default: `true` + +*** + +## Other features + +Micromatch also supports the following. + +### Extended globbing + +#### extglobs + +Extended globbing, as described by the bash man page: + +| **pattern** | **regex equivalent** | **description** | +| --- | --- | --- | +| `?(pattern-list)` | `(... | ...)?` | Matches zero or one occurrence of the given patterns | +| `*(pattern-list)` | `(... | ...)*` | Matches zero or more occurrences of the given patterns | +| `+(pattern-list)` | `(... | ...)+` | Matches one or more occurrences of the given patterns | +| `@(pattern-list)` | `(... | ...)` <sup>*</sup> | Matches one of the given patterns | +| `!(pattern-list)` | N/A | Matches anything except one of the given patterns | + +<sup><strong>*</strong></sup> `@` isn't a RegEx character. + +Powered by [extglob](https://github.com/jonschlinkert/extglob). Visit that library for the full range of options or to report extglob related issues. + +See [extglob](https://github.com/jonschlinkert/extglob) for more information about extended globs. + +#### brace expansion + +In simple cases, brace expansion appears to work the same way as the logical `OR` operator. For example, `(a|b)` will achieve the same result as `{a,b}`. + +Here are some powerful features unique to brace expansion (versus character classes): + +* range expansion: `a{1..3}b/*.js` expands to: `['a1b/*.js', 'a2b/*.js', 'a3b/*.js']` +* nesting: `a{c,{d,e}}b/*.js` expands to: `['acb/*.js', 'adb/*.js', 'aeb/*.js']` + +Visit [braces](https://github.com/jonschlinkert/braces) to ask questions and create an issue related to brace-expansion, or to see the full range of features and options related to brace expansion. + +#### regex character classes + +With the exception of brace expansion (`{a,b}`, `{1..5}`, etc), most of the special characters convert directly to regex, so you can expect them to follow the same rules and produce the same results as regex. + +For example, given the list: `['a.js', 'b.js', 'c.js', 'd.js', 'E.js']`: + +* `[ac].js`: matches both `a` and `c`, returning `['a.js', 'c.js']` +* `[b-d].js`: matches from `b` to `d`, returning `['b.js', 'c.js', 'd.js']` +* `[b-d].js`: matches from `b` to `d`, returning `['b.js', 'c.js', 'd.js']` +* `a/[A-Z].js`: matches and uppercase letter, returning `['a/E.md']` + +Learn about [regex character classes](http://www.regular-expressions.info/charclass.html). + +#### regex groups + +Given `['a.js', 'b.js', 'c.js', 'd.js', 'E.js']`: + +* `(a|c).js`: would match either `a` or `c`, returning `['a.js', 'c.js']` +* `(b|d).js`: would match either `b` or `d`, returning `['b.js', 'd.js']` +* `(b|[A-Z]).js`: would match either `b` or an uppercase letter, returning `['b.js', 'E.js']` + +As with regex, parenthese can be nested, so patterns like `((a|b)|c)/b` will work. But it might be easier to achieve your goal using brace expansion. + +#### POSIX bracket expressions + +**Example** + +```js +mm.isMatch('a1', '[[:alpha:][:digit:]]'); +//=> true +``` + +See [expand-brackets](https://github.com/jonschlinkert/expand-brackets) for more information about extended bracket expressions. + +*** + +## Notes + +Whenever possible parsing behavior for patterns is based on globbing specifications in Bash 4.3. Patterns that aren't described by Bash follow wildmatch spec (used by git). + +## Benchmarks + +Run the [benchmarks](./benchmark): + +```bash +node benchmark +``` + +As of July 15, 2016: + +```bash +#1: basename-braces + micromatch x 26,420 ops/sec ±0.89% (91 runs sampled) + minimatch x 3,507 ops/sec ±0.64% (97 runs sampled) + +#2: basename + micromatch x 25,315 ops/sec ±0.82% (93 runs sampled) + minimatch x 4,398 ops/sec ±0.86% (94 runs sampled) + +#3: braces-no-glob + micromatch x 341,254 ops/sec ±0.78% (93 runs sampled) + minimatch x 30,197 ops/sec ±1.12% (91 runs sampled) + +#4: braces + micromatch x 54,649 ops/sec ±0.74% (94 runs sampled) + minimatch x 3,095 ops/sec ±0.82% (95 runs sampled) + +#5: immediate + micromatch x 16,719 ops/sec ±0.79% (95 runs sampled) + minimatch x 4,348 ops/sec ±0.86% (96 runs sampled) + +#6: large + micromatch x 721 ops/sec ±0.77% (94 runs sampled) + minimatch x 17.73 ops/sec ±1.08% (50 runs sampled) + +#7: long + micromatch x 5,051 ops/sec ±0.87% (97 runs sampled) + minimatch x 628 ops/sec ±0.83% (94 runs sampled) + +#8: mid + micromatch x 51,280 ops/sec ±0.80% (95 runs sampled) + minimatch x 1,923 ops/sec ±0.84% (95 runs sampled) + +#9: multi-patterns + micromatch x 22,440 ops/sec ±0.97% (94 runs sampled) + minimatch x 2,481 ops/sec ±1.10% (94 runs sampled) + +#10: no-glob + micromatch x 722,823 ops/sec ±1.30% (87 runs sampled) + minimatch x 52,967 ops/sec ±1.09% (94 runs sampled) + +#11: range + micromatch x 243,471 ops/sec ±0.79% (94 runs sampled) + minimatch x 11,736 ops/sec ±0.82% (96 runs sampled) + +#12: shallow + micromatch x 190,874 ops/sec ±0.98% (95 runs sampled) + minimatch x 21,699 ops/sec ±0.81% (97 runs sampled) + +#13: short + micromatch x 496,393 ops/sec ±3.86% (90 runs sampled) + minimatch x 53,765 ops/sec ±0.75% (95 runs sampled) +``` + +## Tests + +### Running tests + +Install dev dependencies: + +```sh +$ npm install -d && npm test +``` + +### Coverage + +As of July 15, 2016: + +```sh +Statements : 100% (441/441) +Branches : 100% (270/270) +Functions : 100% (54/54) +Lines : 100% (429/429) +``` + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +Please be sure to run the benchmarks before/after any code changes to judge the impact before you do a PR. thanks! + +## Related + +* [braces](https://www.npmjs.com/package/braces): Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces… [more](https://github.com/jonschlinkert/braces) | [homepage](https://github.com/jonschlinkert/braces "Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces specification.") +* [expand-brackets](https://www.npmjs.com/package/expand-brackets): Expand POSIX bracket expressions (character classes) in glob patterns. | [homepage](https://github.com/jonschlinkert/expand-brackets "Expand POSIX bracket expressions (character classes) in glob patterns.") +* [expand-range](https://www.npmjs.com/package/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. See… [more](https://github.com/jonschlinkert/expand-range) | [homepage](https://github.com/jonschlinkert/expand-range "Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. See the benchmarks. Used by micromatch.") +* [extglob](https://www.npmjs.com/package/extglob): Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to… [more](https://github.com/jonschlinkert/extglob) | [homepage](https://github.com/jonschlinkert/extglob "Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to glob patterns.") +* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or multiplier to… [more](https://github.com/jonschlinkert/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range "Fill in a range of numbers or letters, optionally passing an increment or multiplier to use.") +* [gulp-micromatch](https://www.npmjs.com/package/gulp-micromatch): Filter vinyl files with glob patterns, string, regexp, array, object or matcher function. micromatch stream. | [homepage](https://github.com/tunnckocore/gulp-micromatch#readme "Filter vinyl files with glob patterns, string, regexp, array, object or matcher function. micromatch stream.") +* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") +* [parse-glob](https://www.npmjs.com/package/parse-glob): Parse a glob pattern into an object of tokens. | [homepage](https://github.com/jonschlinkert/parse-glob "Parse a glob pattern into an object of tokens.") + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +## Building docs + +_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_ + +To generate the readme and API documentation with [verb](https://github.com/verbose/verb): + +```sh +$ npm install -g verb verb-generate-readme && verb +``` + +## Running tests + +Install dev dependencies: + +```sh +$ npm install -d && npm test +``` + +## Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT license](https://github.com/jonschlinkert/micromatch/blob/master/LICENSE). + +*** + +_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on July 15, 2016._
\ No newline at end of file diff --git a/node_modules/micromatch/index.js b/node_modules/micromatch/index.js new file mode 100755 index 000000000..f898ec176 --- /dev/null +++ b/node_modules/micromatch/index.js @@ -0,0 +1,431 @@ +/*! + * micromatch <https://github.com/jonschlinkert/micromatch> + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var expand = require('./lib/expand'); +var utils = require('./lib/utils'); + +/** + * The main function. Pass an array of filepaths, + * and a string or array of glob patterns + * + * @param {Array|String} `files` + * @param {Array|String} `patterns` + * @param {Object} `opts` + * @return {Array} Array of matches + */ + +function micromatch(files, patterns, opts) { + if (!files || !patterns) return []; + opts = opts || {}; + + if (typeof opts.cache === 'undefined') { + opts.cache = true; + } + + if (!Array.isArray(patterns)) { + return match(files, patterns, opts); + } + + var len = patterns.length, i = 0; + var omit = [], keep = []; + + while (len--) { + var glob = patterns[i++]; + if (typeof glob === 'string' && glob.charCodeAt(0) === 33 /* ! */) { + omit.push.apply(omit, match(files, glob.slice(1), opts)); + } else { + keep.push.apply(keep, match(files, glob, opts)); + } + } + return utils.diff(keep, omit); +} + +/** + * Return an array of files that match the given glob pattern. + * + * This function is called by the main `micromatch` function If you only + * need to pass a single pattern you might get very minor speed improvements + * using this function. + * + * @param {Array} `files` + * @param {String} `pattern` + * @param {Object} `options` + * @return {Array} + */ + +function match(files, pattern, opts) { + if (utils.typeOf(files) !== 'string' && !Array.isArray(files)) { + throw new Error(msg('match', 'files', 'a string or array')); + } + + files = utils.arrayify(files); + opts = opts || {}; + + var negate = opts.negate || false; + var orig = pattern; + + if (typeof pattern === 'string') { + negate = pattern.charAt(0) === '!'; + if (negate) { + pattern = pattern.slice(1); + } + + // we need to remove the character regardless, + // so the above logic is still needed + if (opts.nonegate === true) { + negate = false; + } + } + + var _isMatch = matcher(pattern, opts); + var len = files.length, i = 0; + var res = []; + + while (i < len) { + var file = files[i++]; + var fp = utils.unixify(file, opts); + + if (!_isMatch(fp)) { continue; } + res.push(fp); + } + + if (res.length === 0) { + if (opts.failglob === true) { + throw new Error('micromatch.match() found no matches for: "' + orig + '".'); + } + + if (opts.nonull || opts.nullglob) { + res.push(utils.unescapeGlob(orig)); + } + } + + // if `negate` was defined, diff negated files + if (negate) { res = utils.diff(files, res); } + + // if `ignore` was defined, diff ignored filed + if (opts.ignore && opts.ignore.length) { + pattern = opts.ignore; + opts = utils.omit(opts, ['ignore']); + res = utils.diff(res, micromatch(res, pattern, opts)); + } + + if (opts.nodupes) { + return utils.unique(res); + } + return res; +} + +/** + * Returns a function that takes a glob pattern or array of glob patterns + * to be used with `Array#filter()`. (Internally this function generates + * the matching function using the [matcher] method). + * + * ```js + * var fn = mm.filter('[a-c]'); + * ['a', 'b', 'c', 'd', 'e'].filter(fn); + * //=> ['a', 'b', 'c'] + * ``` + * @param {String|Array} `patterns` Can be a glob or array of globs. + * @param {Options} `opts` Options to pass to the [matcher] method. + * @return {Function} Filter function to be passed to `Array#filter()`. + */ + +function filter(patterns, opts) { + if (!Array.isArray(patterns) && typeof patterns !== 'string') { + throw new TypeError(msg('filter', 'patterns', 'a string or array')); + } + + patterns = utils.arrayify(patterns); + var len = patterns.length, i = 0; + var patternMatchers = Array(len); + while (i < len) { + patternMatchers[i] = matcher(patterns[i++], opts); + } + + return function(fp) { + if (fp == null) return []; + var len = patternMatchers.length, i = 0; + var res = true; + + fp = utils.unixify(fp, opts); + while (i < len) { + var fn = patternMatchers[i++]; + if (!fn(fp)) { + res = false; + break; + } + } + return res; + }; +} + +/** + * Returns true if the filepath contains the given + * pattern. Can also return a function for matching. + * + * ```js + * isMatch('foo.md', '*.md', {}); + * //=> true + * + * isMatch('*.md', {})('foo.md') + * //=> true + * ``` + * @param {String} `fp` + * @param {String} `pattern` + * @param {Object} `opts` + * @return {Boolean} + */ + +function isMatch(fp, pattern, opts) { + if (typeof fp !== 'string') { + throw new TypeError(msg('isMatch', 'filepath', 'a string')); + } + + fp = utils.unixify(fp, opts); + if (utils.typeOf(pattern) === 'object') { + return matcher(fp, pattern); + } + return matcher(pattern, opts)(fp); +} + +/** + * Returns true if the filepath matches the + * given pattern. + */ + +function contains(fp, pattern, opts) { + if (typeof fp !== 'string') { + throw new TypeError(msg('contains', 'pattern', 'a string')); + } + + opts = opts || {}; + opts.contains = (pattern !== ''); + fp = utils.unixify(fp, opts); + + if (opts.contains && !utils.isGlob(pattern)) { + return fp.indexOf(pattern) !== -1; + } + return matcher(pattern, opts)(fp); +} + +/** + * Returns true if a file path matches any of the + * given patterns. + * + * @param {String} `fp` The filepath to test. + * @param {String|Array} `patterns` Glob patterns to use. + * @param {Object} `opts` Options to pass to the `matcher()` function. + * @return {String} + */ + +function any(fp, patterns, opts) { + if (!Array.isArray(patterns) && typeof patterns !== 'string') { + throw new TypeError(msg('any', 'patterns', 'a string or array')); + } + + patterns = utils.arrayify(patterns); + var len = patterns.length; + + fp = utils.unixify(fp, opts); + while (len--) { + var isMatch = matcher(patterns[len], opts); + if (isMatch(fp)) { + return true; + } + } + return false; +} + +/** + * Filter the keys of an object with the given `glob` pattern + * and `options` + * + * @param {Object} `object` + * @param {Pattern} `object` + * @return {Array} + */ + +function matchKeys(obj, glob, options) { + if (utils.typeOf(obj) !== 'object') { + throw new TypeError(msg('matchKeys', 'first argument', 'an object')); + } + + var fn = matcher(glob, options); + var res = {}; + + for (var key in obj) { + if (obj.hasOwnProperty(key) && fn(key)) { + res[key] = obj[key]; + } + } + return res; +} + +/** + * Return a function for matching based on the + * given `pattern` and `options`. + * + * @param {String} `pattern` + * @param {Object} `options` + * @return {Function} + */ + +function matcher(pattern, opts) { + // pattern is a function + if (typeof pattern === 'function') { + return pattern; + } + // pattern is a regex + if (pattern instanceof RegExp) { + return function(fp) { + return pattern.test(fp); + }; + } + + if (typeof pattern !== 'string') { + throw new TypeError(msg('matcher', 'pattern', 'a string, regex, or function')); + } + + // strings, all the way down... + pattern = utils.unixify(pattern, opts); + + // pattern is a non-glob string + if (!utils.isGlob(pattern)) { + return utils.matchPath(pattern, opts); + } + // pattern is a glob string + var re = makeRe(pattern, opts); + + // `matchBase` is defined + if (opts && opts.matchBase) { + return utils.hasFilename(re, opts); + } + // `matchBase` is not defined + return function(fp) { + fp = utils.unixify(fp, opts); + return re.test(fp); + }; +} + +/** + * Create and cache a regular expression for matching + * file paths. + * + * If the leading character in the `glob` is `!`, a negation + * regex is returned. + * + * @param {String} `glob` + * @param {Object} `options` + * @return {RegExp} + */ + +function toRegex(glob, options) { + // clone options to prevent mutating the original object + var opts = Object.create(options || {}); + var flags = opts.flags || ''; + if (opts.nocase && flags.indexOf('i') === -1) { + flags += 'i'; + } + + var parsed = expand(glob, opts); + + // pass in tokens to avoid parsing more than once + opts.negated = opts.negated || parsed.negated; + opts.negate = opts.negated; + glob = wrapGlob(parsed.pattern, opts); + var re; + + try { + re = new RegExp(glob, flags); + return re; + } catch (err) { + err.reason = 'micromatch invalid regex: (' + re + ')'; + if (opts.strict) throw new SyntaxError(err); + } + + // we're only here if a bad pattern was used and the user + // passed `options.silent`, so match nothing + return /$^/; +} + +/** + * Create the regex to do the matching. If the leading + * character in the `glob` is `!` a negation regex is returned. + * + * @param {String} `glob` + * @param {Boolean} `negate` + */ + +function wrapGlob(glob, opts) { + var prefix = (opts && !opts.contains) ? '^' : ''; + var after = (opts && !opts.contains) ? '$' : ''; + glob = ('(?:' + glob + ')' + after); + if (opts && opts.negate) { + return prefix + ('(?!^' + glob + ').*$'); + } + return prefix + glob; +} + +/** + * Create and cache a regular expression for matching file paths. + * If the leading character in the `glob` is `!`, a negation + * regex is returned. + * + * @param {String} `glob` + * @param {Object} `options` + * @return {RegExp} + */ + +function makeRe(glob, opts) { + if (utils.typeOf(glob) !== 'string') { + throw new Error(msg('makeRe', 'glob', 'a string')); + } + return utils.cache(toRegex, glob, opts); +} + +/** + * Make error messages consistent. Follows this format: + * + * ```js + * msg(methodName, argNumber, nativeType); + * // example: + * msg('matchKeys', 'first', 'an object'); + * ``` + * + * @param {String} `method` + * @param {String} `num` + * @param {String} `type` + * @return {String} + */ + +function msg(method, what, type) { + return 'micromatch.' + method + '(): ' + what + ' should be ' + type + '.'; +} + +/** + * Public methods + */ + +/* eslint no-multi-spaces: 0 */ +micromatch.any = any; +micromatch.braces = micromatch.braceExpand = utils.braces; +micromatch.contains = contains; +micromatch.expand = expand; +micromatch.filter = filter; +micromatch.isMatch = isMatch; +micromatch.makeRe = makeRe; +micromatch.match = match; +micromatch.matcher = matcher; +micromatch.matchKeys = matchKeys; + +/** + * Expose `micromatch` + */ + +module.exports = micromatch; diff --git a/node_modules/micromatch/lib/chars.js b/node_modules/micromatch/lib/chars.js new file mode 100644 index 000000000..a1ffe3714 --- /dev/null +++ b/node_modules/micromatch/lib/chars.js @@ -0,0 +1,67 @@ +'use strict'; + +var chars = {}, unesc, temp; + +function reverse(object, prepender) { + return Object.keys(object).reduce(function(reversed, key) { + var newKey = prepender ? prepender + key : key; // Optionally prepend a string to key. + reversed[object[key]] = newKey; // Swap key and value. + return reversed; // Return the result. + }, {}); +} + +/** + * Regex for common characters + */ + +chars.escapeRegex = { + '?': /\?/g, + '@': /\@/g, + '!': /\!/g, + '+': /\+/g, + '*': /\*/g, + '(': /\(/g, + ')': /\)/g, + '[': /\[/g, + ']': /\]/g +}; + +/** + * Escape characters + */ + +chars.ESC = { + '?': '__UNESC_QMRK__', + '@': '__UNESC_AMPE__', + '!': '__UNESC_EXCL__', + '+': '__UNESC_PLUS__', + '*': '__UNESC_STAR__', + ',': '__UNESC_COMMA__', + '(': '__UNESC_LTPAREN__', + ')': '__UNESC_RTPAREN__', + '[': '__UNESC_LTBRACK__', + ']': '__UNESC_RTBRACK__' +}; + +/** + * Unescape characters + */ + +chars.UNESC = unesc || (unesc = reverse(chars.ESC, '\\')); + +chars.ESC_TEMP = { + '?': '__TEMP_QMRK__', + '@': '__TEMP_AMPE__', + '!': '__TEMP_EXCL__', + '*': '__TEMP_STAR__', + '+': '__TEMP_PLUS__', + ',': '__TEMP_COMMA__', + '(': '__TEMP_LTPAREN__', + ')': '__TEMP_RTPAREN__', + '[': '__TEMP_LTBRACK__', + ']': '__TEMP_RTBRACK__' +}; + +chars.TEMP = temp || (temp = reverse(chars.ESC_TEMP)); + +module.exports = chars; diff --git a/node_modules/micromatch/lib/expand.js b/node_modules/micromatch/lib/expand.js new file mode 100644 index 000000000..e99b081eb --- /dev/null +++ b/node_modules/micromatch/lib/expand.js @@ -0,0 +1,304 @@ +/*! + * micromatch <https://github.com/jonschlinkert/micromatch> + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var utils = require('./utils'); +var Glob = require('./glob'); + +/** + * Expose `expand` + */ + +module.exports = expand; + +/** + * Expand a glob pattern to resolve braces and + * similar patterns before converting to regex. + * + * @param {String|Array} `pattern` + * @param {Array} `files` + * @param {Options} `opts` + * @return {Array} + */ + +function expand(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('micromatch.expand(): argument should be a string.'); + } + + var glob = new Glob(pattern, options || {}); + var opts = glob.options; + + if (!utils.isGlob(pattern)) { + glob.pattern = glob.pattern.replace(/([\/.])/g, '\\$1'); + return glob; + } + + glob.pattern = glob.pattern.replace(/(\+)(?!\()/g, '\\$1'); + glob.pattern = glob.pattern.split('$').join('\\$'); + + if (typeof opts.braces !== 'boolean' && typeof opts.nobraces !== 'boolean') { + opts.braces = true; + } + + if (glob.pattern === '.*') { + return { + pattern: '\\.' + star, + tokens: tok, + options: opts + }; + } + + if (glob.pattern === '*') { + return { + pattern: oneStar(opts.dot), + tokens: tok, + options: opts + }; + } + + // parse the glob pattern into tokens + glob.parse(); + var tok = glob.tokens; + tok.is.negated = opts.negated; + + // dotfile handling + if ((opts.dotfiles === true || tok.is.dotfile) && opts.dot !== false) { + opts.dotfiles = true; + opts.dot = true; + } + + if ((opts.dotdirs === true || tok.is.dotdir) && opts.dot !== false) { + opts.dotdirs = true; + opts.dot = true; + } + + // check for braces with a dotfile pattern + if (/[{,]\./.test(glob.pattern)) { + opts.makeRe = false; + opts.dot = true; + } + + if (opts.nonegate !== true) { + opts.negated = glob.negated; + } + + // if the leading character is a dot or a slash, escape it + if (glob.pattern.charAt(0) === '.' && glob.pattern.charAt(1) !== '/') { + glob.pattern = '\\' + glob.pattern; + } + + /** + * Extended globs + */ + + // expand braces, e.g `{1..5}` + glob.track('before braces'); + if (tok.is.braces) { + glob.braces(); + } + glob.track('after braces'); + + // expand extglobs, e.g `foo/!(a|b)` + glob.track('before extglob'); + if (tok.is.extglob) { + glob.extglob(); + } + glob.track('after extglob'); + + // expand brackets, e.g `[[:alpha:]]` + glob.track('before brackets'); + if (tok.is.brackets) { + glob.brackets(); + } + glob.track('after brackets'); + + // special patterns + glob._replace('[!', '[^'); + glob._replace('(?', '(%~'); + glob._replace(/\[\]/, '\\[\\]'); + glob._replace('/[', '/' + (opts.dot ? dotfiles : nodot) + '[', true); + glob._replace('/?', '/' + (opts.dot ? dotfiles : nodot) + '[^/]', true); + glob._replace('/.', '/(?=.)\\.', true); + + // windows drives + glob._replace(/^(\w):([\\\/]+?)/gi, '(?=.)$1:$2', true); + + // negate slashes in exclusion ranges + if (glob.pattern.indexOf('[^') !== -1) { + glob.pattern = negateSlash(glob.pattern); + } + + if (opts.globstar !== false && glob.pattern === '**') { + glob.pattern = globstar(opts.dot); + + } else { + glob.pattern = balance(glob.pattern, '[', ']'); + glob.escape(glob.pattern); + + // if the pattern has `**` + if (tok.is.globstar) { + glob.pattern = collapse(glob.pattern, '/**'); + glob.pattern = collapse(glob.pattern, '**/'); + glob._replace('/**/', '(?:/' + globstar(opts.dot) + '/|/)', true); + glob._replace(/\*{2,}/g, '**'); + + // 'foo/*' + glob._replace(/(\w+)\*(?!\/)/g, '$1[^/]*?', true); + glob._replace(/\*\*\/\*(\w)/g, globstar(opts.dot) + '\\/' + (opts.dot ? dotfiles : nodot) + '[^/]*?$1', true); + + if (opts.dot !== true) { + glob._replace(/\*\*\/(.)/g, '(?:**\\/|)$1'); + } + + // 'foo/**' or '{**,*}', but not 'foo**' + if (tok.path.dirname !== '' || /,\*\*|\*\*,/.test(glob.orig)) { + glob._replace('**', globstar(opts.dot), true); + } + } + + // ends with /* + glob._replace(/\/\*$/, '\\/' + oneStar(opts.dot), true); + // ends with *, no slashes + glob._replace(/(?!\/)\*$/, star, true); + // has 'n*.' (partial wildcard w/ file extension) + glob._replace(/([^\/]+)\*/, '$1' + oneStar(true), true); + // has '*' + glob._replace('*', oneStar(opts.dot), true); + glob._replace('?.', '?\\.', true); + glob._replace('?:', '?:', true); + + glob._replace(/\?+/g, function(match) { + var len = match.length; + if (len === 1) { + return qmark; + } + return qmark + '{' + len + '}'; + }); + + // escape '.abc' => '\\.abc' + glob._replace(/\.([*\w]+)/g, '\\.$1'); + // fix '[^\\\\/]' + glob._replace(/\[\^[\\\/]+\]/g, qmark); + // '///' => '\/' + glob._replace(/\/+/g, '\\/'); + // '\\\\\\' => '\\' + glob._replace(/\\{2,}/g, '\\'); + } + + // unescape previously escaped patterns + glob.unescape(glob.pattern); + glob._replace('__UNESC_STAR__', '*'); + + // escape dots that follow qmarks + glob._replace('?.', '?\\.'); + + // remove unnecessary slashes in character classes + glob._replace('[^\\/]', qmark); + + if (glob.pattern.length > 1) { + if (/^[\[?*]/.test(glob.pattern)) { + // only prepend the string if we don't want to match dotfiles + glob.pattern = (opts.dot ? dotfiles : nodot) + glob.pattern; + } + } + + return glob; +} + +/** + * Collapse repeated character sequences. + * + * ```js + * collapse('a/../../../b', '../'); + * //=> 'a/../b' + * ``` + * + * @param {String} `str` + * @param {String} `ch` Character sequence to collapse + * @return {String} + */ + +function collapse(str, ch) { + var res = str.split(ch); + var isFirst = res[0] === ''; + var isLast = res[res.length - 1] === ''; + res = res.filter(Boolean); + if (isFirst) res.unshift(''); + if (isLast) res.push(''); + return res.join(ch); +} + +/** + * Negate slashes in exclusion ranges, per glob spec: + * + * ```js + * negateSlash('[^foo]'); + * //=> '[^\\/foo]' + * ``` + * + * @param {String} `str` glob pattern + * @return {String} + */ + +function negateSlash(str) { + return str.replace(/\[\^([^\]]*?)\]/g, function(match, inner) { + if (inner.indexOf('/') === -1) { + inner = '\\/' + inner; + } + return '[^' + inner + ']'; + }); +} + +/** + * Escape imbalanced braces/bracket. This is a very + * basic, naive implementation that only does enough + * to serve the purpose. + */ + +function balance(str, a, b) { + var aarr = str.split(a); + var alen = aarr.join('').length; + var blen = str.split(b).join('').length; + + if (alen !== blen) { + str = aarr.join('\\' + a); + return str.split(b).join('\\' + b); + } + return str; +} + +/** + * Special patterns to be converted to regex. + * Heuristics are used to simplify patterns + * and speed up processing. + */ + +/* eslint no-multi-spaces: 0 */ +var qmark = '[^/]'; +var star = qmark + '*?'; +var nodot = '(?!\\.)(?=.)'; +var dotfileGlob = '(?:\\/|^)\\.{1,2}($|\\/)'; +var dotfiles = '(?!' + dotfileGlob + ')(?=.)'; +var twoStarDot = '(?:(?!' + dotfileGlob + ').)*?'; + +/** + * Create a regex for `*`. + * + * If `dot` is true, or the pattern does not begin with + * a leading star, then return the simpler regex. + */ + +function oneStar(dotfile) { + return dotfile ? '(?!' + dotfileGlob + ')(?=.)' + star : (nodot + star); +} + +function globstar(dotfile) { + if (dotfile) { return twoStarDot; } + return '(?:(?!(?:\\/|^)\\.).)*?'; +} diff --git a/node_modules/micromatch/lib/glob.js b/node_modules/micromatch/lib/glob.js new file mode 100644 index 000000000..c61332673 --- /dev/null +++ b/node_modules/micromatch/lib/glob.js @@ -0,0 +1,193 @@ +'use strict'; + +var chars = require('./chars'); +var utils = require('./utils'); + +/** + * Expose `Glob` + */ + +var Glob = module.exports = function Glob(pattern, options) { + if (!(this instanceof Glob)) { + return new Glob(pattern, options); + } + this.options = options || {}; + this.pattern = pattern; + this.history = []; + this.tokens = {}; + this.init(pattern); +}; + +/** + * Initialize defaults + */ + +Glob.prototype.init = function(pattern) { + this.orig = pattern; + this.negated = this.isNegated(); + this.options.track = this.options.track || false; + this.options.makeRe = true; +}; + +/** + * Push a change into `glob.history`. Useful + * for debugging. + */ + +Glob.prototype.track = function(msg) { + if (this.options.track) { + this.history.push({msg: msg, pattern: this.pattern}); + } +}; + +/** + * Return true if `glob.pattern` was negated + * with `!`, also remove the `!` from the pattern. + * + * @return {Boolean} + */ + +Glob.prototype.isNegated = function() { + if (this.pattern.charCodeAt(0) === 33 /* '!' */) { + this.pattern = this.pattern.slice(1); + return true; + } + return false; +}; + +/** + * Expand braces in the given glob pattern. + * + * We only need to use the [braces] lib when + * patterns are nested. + */ + +Glob.prototype.braces = function() { + if (this.options.nobraces !== true && this.options.nobrace !== true) { + // naive/fast check for imbalanced characters + var a = this.pattern.match(/[\{\(\[]/g); + var b = this.pattern.match(/[\}\)\]]/g); + + // if imbalanced, don't optimize the pattern + if (a && b && (a.length !== b.length)) { + this.options.makeRe = false; + } + + // expand brace patterns and join the resulting array + var expanded = utils.braces(this.pattern, this.options); + this.pattern = expanded.join('|'); + } +}; + +/** + * Expand bracket expressions in `glob.pattern` + */ + +Glob.prototype.brackets = function() { + if (this.options.nobrackets !== true) { + this.pattern = utils.brackets(this.pattern); + } +}; + +/** + * Expand bracket expressions in `glob.pattern` + */ + +Glob.prototype.extglob = function() { + if (this.options.noextglob === true) return; + + if (utils.isExtglob(this.pattern)) { + this.pattern = utils.extglob(this.pattern, {escape: true}); + } +}; + +/** + * Parse the given pattern + */ + +Glob.prototype.parse = function(pattern) { + this.tokens = utils.parseGlob(pattern || this.pattern, true); + return this.tokens; +}; + +/** + * Replace `a` with `b`. Also tracks the change before and + * after each replacement. This is disabled by default, but + * can be enabled by setting `options.track` to true. + * + * Also, when the pattern is a string, `.split()` is used, + * because it's much faster than replace. + * + * @param {RegExp|String} `a` + * @param {String} `b` + * @param {Boolean} `escape` When `true`, escapes `*` and `?` in the replacement. + * @return {String} + */ + +Glob.prototype._replace = function(a, b, escape) { + this.track('before (find): "' + a + '" (replace with): "' + b + '"'); + if (escape) b = esc(b); + if (a && b && typeof a === 'string') { + this.pattern = this.pattern.split(a).join(b); + } else { + this.pattern = this.pattern.replace(a, b); + } + this.track('after'); +}; + +/** + * Escape special characters in the given string. + * + * @param {String} `str` Glob pattern + * @return {String} + */ + +Glob.prototype.escape = function(str) { + this.track('before escape: '); + var re = /["\\](['"]?[^"'\\]['"]?)/g; + + this.pattern = str.replace(re, function($0, $1) { + var o = chars.ESC; + var ch = o && o[$1]; + if (ch) { + return ch; + } + if (/[a-z]/i.test($0)) { + return $0.split('\\').join(''); + } + return $0; + }); + + this.track('after escape: '); +}; + +/** + * Unescape special characters in the given string. + * + * @param {String} `str` + * @return {String} + */ + +Glob.prototype.unescape = function(str) { + var re = /__([A-Z]+)_([A-Z]+)__/g; + this.pattern = str.replace(re, function($0, $1) { + return chars[$1][$0]; + }); + this.pattern = unesc(this.pattern); +}; + +/** + * Escape/unescape utils + */ + +function esc(str) { + str = str.split('?').join('%~'); + str = str.split('*').join('%%'); + return str; +} + +function unesc(str) { + str = str.split('%~').join('?'); + str = str.split('%%').join('*'); + return str; +} diff --git a/node_modules/micromatch/lib/utils.js b/node_modules/micromatch/lib/utils.js new file mode 100644 index 000000000..7c24a5106 --- /dev/null +++ b/node_modules/micromatch/lib/utils.js @@ -0,0 +1,149 @@ +'use strict'; + +var win32 = process && process.platform === 'win32'; +var path = require('path'); +var fileRe = require('filename-regex'); +var utils = module.exports; + +/** + * Module dependencies + */ + +utils.diff = require('arr-diff'); +utils.unique = require('array-unique'); +utils.braces = require('braces'); +utils.brackets = require('expand-brackets'); +utils.extglob = require('extglob'); +utils.isExtglob = require('is-extglob'); +utils.isGlob = require('is-glob'); +utils.typeOf = require('kind-of'); +utils.normalize = require('normalize-path'); +utils.omit = require('object.omit'); +utils.parseGlob = require('parse-glob'); +utils.cache = require('regex-cache'); + +/** + * Get the filename of a filepath + * + * @param {String} `string` + * @return {String} + */ + +utils.filename = function filename(fp) { + var seg = fp.match(fileRe()); + return seg && seg[0]; +}; + +/** + * Returns a function that returns true if the given + * pattern is the same as a given `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.isPath = function isPath(pattern, opts) { + opts = opts || {}; + return function(fp) { + var unixified = utils.unixify(fp, opts); + if(opts.nocase){ + return pattern.toLowerCase() === unixified.toLowerCase(); + } + return pattern === unixified; + }; +}; + +/** + * Returns a function that returns true if the given + * pattern contains a `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.hasPath = function hasPath(pattern, opts) { + return function(fp) { + return utils.unixify(pattern, opts).indexOf(fp) !== -1; + }; +}; + +/** + * Returns a function that returns true if the given + * pattern matches or contains a `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.matchPath = function matchPath(pattern, opts) { + var fn = (opts && opts.contains) + ? utils.hasPath(pattern, opts) + : utils.isPath(pattern, opts); + return fn; +}; + +/** + * Returns a function that returns true if the given + * regex matches the `filename` of a file path. + * + * @param {RegExp} `re` + * @return {Boolean} + */ + +utils.hasFilename = function hasFilename(re) { + return function(fp) { + var name = utils.filename(fp); + return name && re.test(name); + }; +}; + +/** + * Coerce `val` to an array + * + * @param {*} val + * @return {Array} + */ + +utils.arrayify = function arrayify(val) { + return !Array.isArray(val) + ? [val] + : val; +}; + +/** + * Normalize all slashes in a file path or glob pattern to + * forward slashes. + */ + +utils.unixify = function unixify(fp, opts) { + if (opts && opts.unixify === false) return fp; + if (opts && opts.unixify === true || win32 || path.sep === '\\') { + return utils.normalize(fp, false); + } + if (opts && opts.unescape === true) { + return fp ? fp.toString().replace(/\\(\w)/g, '$1') : ''; + } + return fp; +}; + +/** + * Escape/unescape utils + */ + +utils.escapePath = function escapePath(fp) { + return fp.replace(/[\\.]/g, '\\$&'); +}; + +utils.unescapeGlob = function unescapeGlob(fp) { + return fp.replace(/[\\"']/g, ''); +}; + +utils.escapeRe = function escapeRe(str) { + return str.replace(/[-[\\$*+?.#^\s{}(|)\]]/g, '\\$&'); +}; + +/** + * Expose `utils` + */ + +module.exports = utils; diff --git a/node_modules/micromatch/package.json b/node_modules/micromatch/package.json new file mode 100644 index 000000000..679ad735d --- /dev/null +++ b/node_modules/micromatch/package.json @@ -0,0 +1,189 @@ +{ + "_args": [ + [ + { + "raw": "micromatch@^2.3.7", + "scope": null, + "escapedName": "micromatch", + "name": "micromatch", + "rawSpec": "^2.3.7", + "spec": ">=2.3.7 <3.0.0", + "type": "range" + }, + "/home/dold/repos/taler/wallet-webex/node_modules/findup-sync" + ] + ], + "_from": "micromatch@>=2.3.7 <3.0.0", + "_id": "micromatch@2.3.11", + "_inCache": true, + "_location": "/micromatch", + "_nodeVersion": "6.3.0", + "_npmOperationalInternal": { + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/micromatch-2.3.11.tgz_1468602931475_0.3629888044670224" + }, + "_npmUser": { + "name": "jonschlinkert", + "email": "github@sellside.com" + }, + "_npmVersion": "3.10.3", + "_phantomChildren": {}, + "_requested": { + "raw": "micromatch@^2.3.7", + "scope": null, + "escapedName": "micromatch", + "name": "micromatch", + "rawSpec": "^2.3.7", + "spec": ">=2.3.7 <3.0.0", + "type": "range" + }, + "_requiredBy": [ + "/findup-sync", + "/vinyl-fs/glob-stream" + ], + "_resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "_shasum": "86677c97d1720b363431d04d0d15293bd38c1565", + "_shrinkwrap": null, + "_spec": "micromatch@^2.3.7", + "_where": "/home/dold/repos/taler/wallet-webex/node_modules/findup-sync", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/micromatch/issues" + }, + "dependencies": { + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" + }, + "description": "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.", + "devDependencies": { + "benchmarked": "^0.1.4", + "chalk": "^1.1.1", + "gulp": "^3.9.0", + "gulp-eslint": "^1.1.1", + "gulp-format-md": "^0.1.8", + "gulp-istanbul": "^0.10.1", + "gulp-mocha": "^2.1.3", + "minimatch": "^3.0.0", + "minimist": "^1.2.0", + "mocha": "^2", + "multimatch": "^2.0.0", + "should": "^8", + "write": "^0.2.1" + }, + "directories": {}, + "dist": { + "shasum": "86677c97d1720b363431d04d0d15293bd38c1565", + "tarball": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js", + "lib" + ], + "gitHead": "f194c187d04677b03047bb7d8d25643725f7a577", + "homepage": "https://github.com/jonschlinkert/micromatch", + "keywords": [ + "bash", + "expand", + "expansion", + "expression", + "file", + "files", + "filter", + "find", + "glob", + "globbing", + "globs", + "globstar", + "match", + "matcher", + "matches", + "matching", + "minimatch", + "multimatch", + "path", + "pattern", + "patterns", + "regex", + "regexp", + "regular", + "shell", + "wildcard" + ], + "license": "MIT", + "main": "index.js", + "maintainers": [ + { + "name": "jonschlinkert", + "email": "github@sellside.com" + }, + { + "name": "doowb", + "email": "brian.woodward@gmail.com" + }, + { + "name": "es128", + "email": "elan.shanker+npm@gmail.com" + } + ], + "name": "micromatch", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/micromatch.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "braces", + "expand-brackets", + "expand-range", + "extglob", + "fill-range", + "gulp-micromatch", + "is-glob", + "parse-glob" + ] + }, + "reflinks": [ + "braces", + "expand-brackets", + "extglob", + "minimatch", + "multimatch", + "verb" + ], + "toc": false, + "layout": false, + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + }, + "version": "2.3.11" +} |