first commit
This commit is contained in:
75
app_vue/node_modules/dir-glob/index.js
generated
vendored
Normal file
75
app_vue/node_modules/dir-glob/index.js
generated
vendored
Normal 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
app_vue/node_modules/dir-glob/license
generated
vendored
Normal file
9
app_vue/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.
|
38
app_vue/node_modules/dir-glob/package.json
generated
vendored
Normal file
38
app_vue/node_modules/dir-glob/package.json
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "dir-glob",
|
||||
"version": "3.0.1",
|
||||
"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": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"convert",
|
||||
"directory",
|
||||
"extensions",
|
||||
"files",
|
||||
"glob"
|
||||
],
|
||||
"dependencies": {
|
||||
"path-type": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.1.0",
|
||||
"del": "^4.1.1",
|
||||
"make-dir": "^3.0.0",
|
||||
"rimraf": "^2.5.0",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
76
app_vue/node_modules/dir-glob/readme.md
generated
vendored
Normal file
76
app_vue/node_modules/dir-glob/readme.md
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
# dir-glob [](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.
|
Reference in New Issue
Block a user