diff options
Diffstat (limited to 'node_modules/globby')
-rw-r--r-- | node_modules/globby/index.js | 29 | ||||
-rw-r--r-- | node_modules/globby/package.json | 9 | ||||
-rw-r--r-- | node_modules/globby/readme.md | 10 |
3 files changed, 38 insertions, 10 deletions
diff --git a/node_modules/globby/index.js b/node_modules/globby/index.js index 39da9f64d..587a0fdd1 100644 --- a/node_modules/globby/index.js +++ b/node_modules/globby/index.js @@ -3,7 +3,6 @@ var Promise = require('pinkie-promise'); var arrayUnion = require('array-union'); var objectAssign = require('object-assign'); var glob = require('glob'); -var arrify = require('arrify'); var pify = require('pify'); var globP = pify(glob, Promise).bind(glob); @@ -12,10 +11,22 @@ function isNegative(pattern) { return pattern[0] === '!'; } +function isString(value) { + return typeof value === 'string'; +} + +function assertPatternsInput(patterns) { + if (!patterns.every(isString)) { + throw new TypeError('patterns must be a string or an array of strings'); + } +} + function generateGlobTasks(patterns, opts) { + patterns = [].concat(patterns); + assertPatternsInput(patterns); + var globTasks = []; - patterns = arrify(patterns); opts = objectAssign({ cache: Object.create(null), statCache: Object.create(null), @@ -45,7 +56,13 @@ function generateGlobTasks(patterns, opts) { } module.exports = function (patterns, opts) { - var globTasks = generateGlobTasks(patterns, opts); + var globTasks; + + try { + globTasks = generateGlobTasks(patterns, opts); + } catch (err) { + return Promise.reject(err); + } return Promise.all(globTasks.map(function (task) { return globP(task.pattern, task.opts); @@ -63,3 +80,9 @@ module.exports.sync = function (patterns, opts) { }; module.exports.generateGlobTasks = generateGlobTasks; + +module.exports.hasMagic = function (patterns, opts) { + return [].concat(patterns).some(function (pattern) { + return glob.hasMagic(pattern, opts); + }); +}; diff --git a/node_modules/globby/package.json b/node_modules/globby/package.json index 9a0f580bf..925148862 100644 --- a/node_modules/globby/package.json +++ b/node_modules/globby/package.json @@ -1,6 +1,6 @@ { "name": "globby", - "version": "5.0.0", + "version": "6.1.0", "description": "Extends `glob` with support for multiple patterns and exposes a Promise API", "license": "MIT", "repository": "sindresorhus/globby", @@ -13,7 +13,7 @@ "node": ">=0.10.0" }, "scripts": { - "bench": "npm update globby glob-stream && matcha bench.js", + "bench": "npm update glob-stream && matcha bench.js", "test": "xo && ava" }, "files": [ @@ -53,7 +53,6 @@ ], "dependencies": { "array-union": "^1.0.1", - "arrify": "^1.0.0", "glob": "^7.0.3", "object-assign": "^4.0.1", "pify": "^2.0.0", @@ -61,10 +60,10 @@ }, "devDependencies": { "ava": "*", - "glob-stream": "wearefractal/glob-stream#master", + "glob-stream": "gulpjs/glob-stream#master", "globby": "sindresorhus/globby#master", "matcha": "^0.7.0", "rimraf": "^2.2.8", - "xo": "*" + "xo": "^0.16.0" } } diff --git a/node_modules/globby/readme.md b/node_modules/globby/readme.md index aad991d02..e10a48868 100644 --- a/node_modules/globby/readme.md +++ b/node_modules/globby/readme.md @@ -42,11 +42,17 @@ Returns an array of matching paths. Returns an array of objects in the format `{ pattern: string, opts: Object }`, which can be passed as arguments to [`node-glob`](https://github.com/isaacs/node-glob). This is useful for other globbing-related packages. -Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, create a new tasks list to ensure that file system changes are taken in consideration. +Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration. + +### globby.hasMagic(patterns, [options]) + +Returns a `boolean` of whether there are any special glob characters in the `patterns`. + +Note that the options affect the results. If `noext: true` is set, then `+(a|b)` will not be considered a magic pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}`, then that is considered magical, unless `nobrace: true` is set. #### patterns -Type: `string`, `Array` +Type: `string` `Array` See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage). |