glob-extra
Advanced tools
Comparing version 3.0.0 to 4.0.0
'use strict'; | ||
const _ = require('lodash'); | ||
module.exports = (options) => { | ||
return _.defaults(options || {}, { | ||
const defaultOpts = { | ||
expandOpts: { | ||
root: null, | ||
formats: [] | ||
}); | ||
}, | ||
globOpts: { | ||
onlyFiles: false | ||
} | ||
}; | ||
module.exports = (name, options = {}) => _.defaults(options, defaultOpts[name]); |
'use strict'; | ||
const path = require('path'); | ||
const Promise = require('bluebird'); | ||
const _ = require('lodash'); | ||
const glob = Promise.promisify(require('glob')); | ||
const fg = require('fast-glob'); | ||
const {Minimatch} = require('minimatch'); | ||
const defaults = require('./defaults'); | ||
const utils = require('./utils'); | ||
const path = require('path'); | ||
const isMask = (pattern) => glob.hasMagic(pattern); | ||
const getFilesByMask = (pattern, options) => fg(pattern, options); | ||
const getFilesByMask = (pattern, options) => glob(pattern, options); | ||
const expandPath = (basePath, options) => { | ||
@@ -29,3 +28,4 @@ basePath = options.root ? path.resolve(options.root, basePath) : basePath; | ||
exports.expandPaths = (paths, expandOpts, globOpts) => { | ||
expandOpts = defaults(expandOpts); | ||
expandOpts = defaults('expandOpts', expandOpts); | ||
globOpts = _(defaults('globOpts', globOpts)).omitBy(_.isUndefined).value(); | ||
@@ -38,2 +38,14 @@ paths = [].concat(paths); | ||
exports.isMask = isMask; | ||
exports.isMask = (pattern) => { | ||
if (!pattern) { | ||
return false; | ||
} | ||
const {set} = new Minimatch(pattern); | ||
if (set.length > 1) { | ||
return true; | ||
} | ||
return set[0].some((v) => typeof v !== 'string'); | ||
}; |
{ | ||
"name": "glob-extra", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "Utility which provides expanding of masks, dirs and files to absolute file paths.", | ||
@@ -28,5 +28,7 @@ "bugs": "https://github.com/gemini-testing/glob-extra/issues", | ||
"dependencies": { | ||
"bluebird": "^3.5.1", | ||
"fast-glob": "^2.2.3", | ||
"glob": "^7.0.5", | ||
"lodash": "^4.15.0", | ||
"bluebird": "^3.5.1" | ||
"minimatch": "^3.0.4" | ||
}, | ||
@@ -33,0 +35,0 @@ "devDependencies": { |
# glob-extra | ||
Wrapper for utility [glob](https://github.com/isaacs/node-glob) with promises support which provides expanding of masks, dirs and files to absolute file paths. | ||
Wrapper for utility [fast-glob](https://github.com/mrmlnc/fast-glob) with promises support which provides expanding of masks, dirs and files to absolute file paths. | ||
@@ -5,0 +5,0 @@ [![NPM version](https://img.shields.io/npm/v/glob-extra.svg?style=flat)](https://www.npmjs.org/package/glob-extra) |
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
8083
72
5
+ Addedfast-glob@^2.2.3
+ Addedminimatch@^3.0.4
+ Added@mrmlnc/readdir-enhanced@2.2.1(transitive)
+ Added@nodelib/fs.stat@1.1.3(transitive)
+ Addedarr-diff@4.0.0(transitive)
+ Addedarr-flatten@1.1.0(transitive)
+ Addedarr-union@3.1.0(transitive)
+ Addedarray-unique@0.3.2(transitive)
+ Addedassign-symbols@1.0.0(transitive)
+ Addedatob@2.1.2(transitive)
+ Addedbase@0.11.2(transitive)
+ Addedbraces@2.3.2(transitive)
+ Addedcache-base@1.0.1(transitive)
+ Addedcall-me-maybe@1.0.2(transitive)
+ Addedclass-utils@0.3.6(transitive)
+ Addedcollection-visit@1.0.0(transitive)
+ Addedcomponent-emitter@1.3.1(transitive)
+ Addedcopy-descriptor@0.1.1(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddecode-uri-component@0.2.2(transitive)
+ Addeddefine-property@0.2.51.0.02.0.2(transitive)
+ Addedexpand-brackets@2.1.4(transitive)
+ Addedextend-shallow@2.0.13.0.2(transitive)
+ Addedextglob@2.0.4(transitive)
+ Addedfast-glob@2.2.7(transitive)
+ Addedfill-range@4.0.0(transitive)
+ Addedfor-in@1.0.2(transitive)
+ Addedfragment-cache@0.2.1(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-value@2.0.6(transitive)
+ Addedglob-parent@3.1.0(transitive)
+ Addedglob-to-regexp@0.3.0(transitive)
+ Addedhas-value@0.3.11.0.0(transitive)
+ Addedhas-values@0.1.41.0.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedis-accessor-descriptor@1.0.1(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedis-data-descriptor@1.0.1(transitive)
+ Addedis-descriptor@0.1.71.0.3(transitive)
+ Addedis-extendable@0.1.11.0.1(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@3.1.04.0.3(transitive)
+ Addedis-number@3.0.0(transitive)
+ Addedis-plain-object@2.0.4(transitive)
+ Addedis-windows@1.0.2(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedisobject@2.1.03.0.1(transitive)
+ Addedkind-of@3.2.24.0.06.0.3(transitive)
+ Addedmap-cache@0.2.2(transitive)
+ Addedmap-visit@1.0.0(transitive)
+ Addedmerge2@1.4.1(transitive)
+ Addedmicromatch@3.1.10(transitive)
+ Addedmixin-deep@1.3.2(transitive)
+ Addedms@2.0.0(transitive)
+ Addednanomatch@1.2.13(transitive)
+ Addedobject-copy@0.1.0(transitive)
+ Addedobject-visit@1.0.1(transitive)
+ Addedobject.pick@1.3.0(transitive)
+ Addedpascalcase@0.1.1(transitive)
+ Addedpath-dirname@1.0.2(transitive)
+ Addedposix-character-classes@0.1.1(transitive)
+ Addedregex-not@1.0.2(transitive)
+ Addedrepeat-element@1.1.4(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedresolve-url@0.2.1(transitive)
+ Addedret@0.1.15(transitive)
+ Addedsafe-regex@1.1.0(transitive)
+ Addedset-value@2.0.1(transitive)
+ Addedsnapdragon@0.8.2(transitive)
+ Addedsnapdragon-node@2.1.1(transitive)
+ Addedsnapdragon-util@3.0.1(transitive)
+ Addedsource-map@0.5.7(transitive)
+ Addedsource-map-resolve@0.5.3(transitive)
+ Addedsource-map-url@0.4.1(transitive)
+ Addedsplit-string@3.1.0(transitive)
+ Addedstatic-extend@0.1.2(transitive)
+ Addedto-object-path@0.3.0(transitive)
+ Addedto-regex@3.0.2(transitive)
+ Addedto-regex-range@2.1.1(transitive)
+ Addedunion-value@1.0.1(transitive)
+ Addedunset-value@1.0.0(transitive)
+ Addedurix@0.1.0(transitive)
+ Addeduse@3.1.1(transitive)