This commit is contained in:
Aevann1 2021-12-13 22:28:32 +00:00
parent 628618df89
commit e031240dff
3749 changed files with 1120848 additions and 1 deletions

75
node_modules/dir-glob/index.js generated vendored Normal file
View file

@ -0,0 +1,75 @@
'use strict';
const path = require('path');
const pathType = require('path-type');
const getExtensions = extensions => extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0];
const getPath = (filepath, cwd) => {
const pth = filepath[0] === '!' ? filepath.slice(1) : filepath;
return path.isAbsolute(pth) ? pth : path.join(cwd, pth);
};
const addExtensions = (file, extensions) => {
if (path.extname(file)) {
return `**/${file}`;
}
return `**/${file}.${getExtensions(extensions)}`;
};
const getGlob = (directory, options) => {
if (options.files && !Array.isArray(options.files)) {
throw new TypeError(`Expected \`files\` to be of type \`Array\` but received type \`${typeof options.files}\``);
}
if (options.extensions && !Array.isArray(options.extensions)) {
throw new TypeError(`Expected \`extensions\` to be of type \`Array\` but received type \`${typeof options.extensions}\``);
}
if (options.files && options.extensions) {
return options.files.map(x => path.posix.join(directory, addExtensions(x, options.extensions)));
}
if (options.files) {
return options.files.map(x => path.posix.join(directory, `**/${x}`));
}
if (options.extensions) {
return [path.posix.join(directory, `**/*.${getExtensions(options.extensions)}`)];
}
return [path.posix.join(directory, '**')];
};
module.exports = async (input, options) => {
options = {
cwd: process.cwd(),
...options
};
if (typeof options.cwd !== 'string') {
throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof options.cwd}\``);
}
const globs = await Promise.all([].concat(input).map(async x => {
const isDirectory = await pathType.isDirectory(getPath(x, options.cwd));
return isDirectory ? getGlob(x, options) : x;
}));
return [].concat.apply([], globs); // eslint-disable-line prefer-spread
};
module.exports.sync = (input, options) => {
options = {
cwd: process.cwd(),
...options
};
if (typeof options.cwd !== 'string') {
throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof options.cwd}\``);
}
const globs = [].concat(input).map(x => pathType.isDirectorySync(getPath(x, options.cwd)) ? getGlob(x, options) : x);
return [].concat.apply([], globs); // eslint-disable-line prefer-spread
};

9
node_modules/dir-glob/license generated vendored Normal file
View 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.

73
node_modules/dir-glob/package.json generated vendored Normal file
View file

@ -0,0 +1,73 @@
{
"_args": [
[
"dir-glob@3.0.1",
"/d"
]
],
"_from": "dir-glob@3.0.1",
"_id": "dir-glob@3.0.1",
"_inBundle": false,
"_integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==",
"_location": "/dir-glob",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "dir-glob@3.0.1",
"name": "dir-glob",
"escapedName": "dir-glob",
"rawSpec": "3.0.1",
"saveSpec": null,
"fetchSpec": "3.0.1"
},
"_requiredBy": [
"/globby"
],
"_resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
"_spec": "3.0.1",
"_where": "/d",
"author": {
"name": "Kevin Mårtensson",
"email": "kevinmartensson@gmail.com",
"url": "github.com/kevva"
},
"bugs": {
"url": "https://github.com/kevva/dir-glob/issues"
},
"dependencies": {
"path-type": "^4.0.0"
},
"description": "Convert directories to glob compatible strings",
"devDependencies": {
"ava": "^2.1.0",
"del": "^4.1.1",
"make-dir": "^3.0.0",
"rimraf": "^2.5.0",
"xo": "^0.24.0"
},
"engines": {
"node": ">=8"
},
"files": [
"index.js"
],
"homepage": "https://github.com/kevva/dir-glob#readme",
"keywords": [
"convert",
"directory",
"extensions",
"files",
"glob"
],
"license": "MIT",
"name": "dir-glob",
"repository": {
"type": "git",
"url": "git+https://github.com/kevva/dir-glob.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "3.0.1"
}

76
node_modules/dir-glob/readme.md generated vendored Normal file
View file

@ -0,0 +1,76 @@
# dir-glob [![Build Status](https://travis-ci.org/kevva/dir-glob.svg?branch=master)](https://travis-ci.org/kevva/dir-glob)
> Convert directories to glob compatible strings
## Install
```
$ npm install dir-glob
```
## Usage
```js
const dirGlob = require('dir-glob');
(async () => {
console.log(await dirGlob(['index.js', 'test.js', 'fixtures']));
//=> ['index.js', 'test.js', 'fixtures/**']
console.log(await dirGlob(['index.js', 'inner_folder'], {cwd: 'fixtures'}));
//=> ['index.js', 'inner_folder/**']
console.log(await dirGlob(['lib/**', 'fixtures'], {
files: ['test', 'unicorn']
extensions: ['js']
}));
//=> ['lib/**', 'fixtures/**/test.js', 'fixtures/**/unicorn.js']
console.log(await dirGlob(['lib/**', 'fixtures'], {
files: ['test', 'unicorn', '*.jsx'],
extensions: ['js', 'png']
}));
//=> ['lib/**', 'fixtures/**/test.{js,png}', 'fixtures/**/unicorn.{js,png}', 'fixtures/**/*.jsx']
})();
```
## API
### dirGlob(input, options?)
Returns a `Promise<string[]>` with globs.
### dirGlob.sync(input, options?)
Returns a `string[]` with globs.
#### input
Type: `string | string[]`
Paths.
#### options
Type: `object`
##### extensions
Type: `string[]`
Append extensions to the end of your globs.
##### files
Type: `string[]`
Only glob for certain files.
##### cwd
Type: `string[]`
Test in specific directory.