Initial commit
This commit is contained in:
48
node_modules/dir-glob/index.js
generated
vendored
Normal file
48
node_modules/dir-glob/index.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const arrify = require('arrify');
|
||||
const pathType = require('path-type');
|
||||
|
||||
const getExtensions = extensions => extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0];
|
||||
const getPath = filepath => filepath[0] === '!' ? filepath.slice(1) : filepath;
|
||||
|
||||
const addExtensions = (file, extensions) => {
|
||||
if (path.extname(file)) {
|
||||
return `**/${file}`;
|
||||
}
|
||||
|
||||
return `**/${file}.${getExtensions(extensions)}`;
|
||||
};
|
||||
|
||||
const getGlob = (dir, opts) => {
|
||||
opts = Object.assign({}, opts);
|
||||
|
||||
if (opts.files && !Array.isArray(opts.files)) {
|
||||
throw new TypeError(`\`options.files\` must be an \`Array\`, not \`${typeof opts.files}\``);
|
||||
}
|
||||
|
||||
if (opts.extensions && !Array.isArray(opts.extensions)) {
|
||||
throw new TypeError(`\`options.extensions\` must be an \`Array\`, not \`${typeof opts.extensions}\``);
|
||||
}
|
||||
|
||||
if (opts.files && opts.extensions) {
|
||||
return opts.files.map(x => path.join(dir, addExtensions(x, opts.extensions)));
|
||||
} else if (opts.files) {
|
||||
return opts.files.map(x => path.join(dir, `**/${x}`));
|
||||
} else if (opts.extensions) {
|
||||
return [path.join(dir, `**/*.${getExtensions(opts.extensions)}`)];
|
||||
}
|
||||
|
||||
return [path.join(dir, '**')];
|
||||
};
|
||||
|
||||
module.exports = (input, opts) => {
|
||||
return Promise.all(arrify(input).map(x => pathType.dir(getPath(x))
|
||||
.then(isDir => isDir ? getGlob(x, opts) : x)))
|
||||
.then(globs => [].concat.apply([], globs));
|
||||
};
|
||||
|
||||
module.exports.sync = (input, opts) => {
|
||||
const globs = arrify(input).map(x => pathType.dirSync(getPath(x)) ? getGlob(x, opts) : x);
|
||||
return [].concat.apply([], globs);
|
||||
};
|
||||
9
node_modules/dir-glob/license
generated
vendored
Normal file
9
node_modules/dir-glob/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Kevin Mårtensson <kevinmartensson@gmail.com> (github.com/kevva)
|
||||
|
||||
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.
|
||||
42
node_modules/dir-glob/node_modules/path-type/index.js
generated
vendored
Normal file
42
node_modules/dir-glob/node_modules/path-type/index.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const pify = require('pify');
|
||||
|
||||
function type(fn, fn2, fp) {
|
||||
if (typeof fp !== 'string') {
|
||||
return Promise.reject(new TypeError(`Expected a string, got ${typeof fp}`));
|
||||
}
|
||||
|
||||
return pify(fs[fn])(fp)
|
||||
.then(stats => stats[fn2]())
|
||||
.catch(err => {
|
||||
if (err.code === 'ENOENT') {
|
||||
return false;
|
||||
}
|
||||
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
|
||||
function typeSync(fn, fn2, fp) {
|
||||
if (typeof fp !== 'string') {
|
||||
throw new TypeError(`Expected a string, got ${typeof fp}`);
|
||||
}
|
||||
|
||||
try {
|
||||
return fs[fn](fp)[fn2]();
|
||||
} catch (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
return false;
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
exports.file = type.bind(null, 'stat', 'isFile');
|
||||
exports.dir = type.bind(null, 'stat', 'isDirectory');
|
||||
exports.symlink = type.bind(null, 'lstat', 'isSymbolicLink');
|
||||
exports.fileSync = typeSync.bind(null, 'statSync', 'isFile');
|
||||
exports.dirSync = typeSync.bind(null, 'statSync', 'isDirectory');
|
||||
exports.symlinkSync = typeSync.bind(null, 'lstatSync', 'isSymbolicLink');
|
||||
9
node_modules/dir-glob/node_modules/path-type/license
generated
vendored
Normal file
9
node_modules/dir-glob/node_modules/path-type/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
25
node_modules/dir-glob/node_modules/path-type/package.json
generated
vendored
Normal file
25
node_modules/dir-glob/node_modules/path-type/package.json
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "path-type",
|
||||
"version": "3.0.0",
|
||||
"description": "Check if a path is a file, directory, or symlink",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/path-type",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"pify": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
29
node_modules/dir-glob/package.json
generated
vendored
Normal file
29
node_modules/dir-glob/package.json
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "dir-glob",
|
||||
"version": "2.0.0",
|
||||
"description": "Convert directories to glob compatible strings",
|
||||
"license": "MIT",
|
||||
"repository": "kevva/dir-glob",
|
||||
"author": {
|
||||
"name": "Kevin Mårtensson",
|
||||
"email": "kevinmartensson@gmail.com",
|
||||
"url": "github.com/kevva"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"arrify": "^1.0.1",
|
||||
"path-type": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"del": "^3.0.0",
|
||||
"make-dir": "^1.0.0",
|
||||
"rimraf": "^2.5.0",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user