aboutsummaryrefslogtreecommitdiff
path: root/node_modules/dir-glob
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2019-10-06 21:37:45 +0200
committerDimitri Staessens <dimitri@ouroboros.rocks>2019-10-06 21:37:45 +0200
commit3c51c3be85bb0d1bdb87ea0d6632f1c256912f27 (patch)
treec7ccc8279b12c4f7bdbbb4270d617e48f51722e4 /node_modules/dir-glob
parent412c104bebc507bea9c94fd53b5bdc4b64cbfe31 (diff)
downloadwebsite-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.tar.gz
website-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.zip
build: Add some required modules for node
Diffstat (limited to 'node_modules/dir-glob')
-rw-r--r--node_modules/dir-glob/index.js48
-rw-r--r--node_modules/dir-glob/license9
-rw-r--r--node_modules/dir-glob/package.json75
-rw-r--r--node_modules/dir-glob/readme.md74
4 files changed, 206 insertions, 0 deletions
diff --git a/node_modules/dir-glob/index.js b/node_modules/dir-glob/index.js
new file mode 100644
index 0000000..e353b30
--- /dev/null
+++ b/node_modules/dir-glob/index.js
@@ -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);
+};
diff --git a/node_modules/dir-glob/license b/node_modules/dir-glob/license
new file mode 100644
index 0000000..db6bc32
--- /dev/null
+++ b/node_modules/dir-glob/license
@@ -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.
diff --git a/node_modules/dir-glob/package.json b/node_modules/dir-glob/package.json
new file mode 100644
index 0000000..830947c
--- /dev/null
+++ b/node_modules/dir-glob/package.json
@@ -0,0 +1,75 @@
+{
+ "_args": [
+ [
+ "dir-glob@2.0.0",
+ "/home/dstaesse/git/website"
+ ]
+ ],
+ "_development": true,
+ "_from": "dir-glob@2.0.0",
+ "_id": "dir-glob@2.0.0",
+ "_inBundle": false,
+ "_integrity": "sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag==",
+ "_location": "/dir-glob",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "version",
+ "registry": true,
+ "raw": "dir-glob@2.0.0",
+ "name": "dir-glob",
+ "escapedName": "dir-glob",
+ "rawSpec": "2.0.0",
+ "saveSpec": null,
+ "fetchSpec": "2.0.0"
+ },
+ "_requiredBy": [
+ "/globby"
+ ],
+ "_resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.0.0.tgz",
+ "_spec": "2.0.0",
+ "_where": "/home/dstaesse/git/website",
+ "author": {
+ "name": "Kevin Mårtensson",
+ "email": "kevinmartensson@gmail.com",
+ "url": "github.com/kevva"
+ },
+ "bugs": {
+ "url": "https://github.com/kevva/dir-glob/issues"
+ },
+ "dependencies": {
+ "arrify": "^1.0.1",
+ "path-type": "^3.0.0"
+ },
+ "description": "Convert directories to glob compatible strings",
+ "devDependencies": {
+ "ava": "*",
+ "del": "^3.0.0",
+ "make-dir": "^1.0.0",
+ "rimraf": "^2.5.0",
+ "xo": "*"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "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": "2.0.0"
+}
diff --git a/node_modules/dir-glob/readme.md b/node_modules/dir-glob/readme.md
new file mode 100644
index 0000000..614ca37
--- /dev/null
+++ b/node_modules/dir-glob/readme.md
@@ -0,0 +1,74 @@
+# 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');
+
+dirGlob(['index.js', 'test.js', 'fixtures']).then(files => {
+ console.log(files);
+ //=> ['index.js', 'test.js', 'fixtures/**']
+});
+
+dirGlob(['lib/**', 'fixtures'], {
+ files: ['test', 'unicorn']
+ extensions: ['js']
+}).then(files => {
+ console.log(files);
+ //=> ['lib/**', 'fixtures/**/test.js', 'fixtures/**/unicorn.js']
+});
+
+dirGlob(['lib/**', 'fixtures'], {
+ files: ['test', 'unicorn', '*.jsx'],
+ extensions: ['js', 'png']
+}).then(files => {
+ console.log(files);
+ //=> ['lib/**', 'fixtures/**/test.{js,png}', 'fixtures/**/unicorn.{js,png}', 'fixtures/**/*.jsx']
+});
+```
+
+
+## API
+
+### dirGlob(input, [options])
+
+Returns a `Promise` for an array of glob strings.
+
+### dirGlob.sync(input, [options])
+
+Returns an array of glob strings.
+
+#### input
+
+Type: `Array` `string`
+
+A `string` or an `Array` of paths.
+
+#### options
+
+##### extensions
+
+Type: `Array`
+
+Append extensions to the end of your globs.
+
+##### files
+
+Type: `Array`
+
+Only glob for certain files.
+
+
+## License
+
+MIT © [Kevin Mårtensson](https://github.com/kevva)