summaryrefslogtreecommitdiffstats
path: root/node_modules/dir-glob
diff options
context:
space:
mode:
authorGravatar Piotr Russ <mail@pruss.it> 2020-11-16 00:10:28 +0100
committerGravatar Piotr Russ <mail@pruss.it> 2020-11-16 00:10:28 +0100
commite06ec920f7a5d784e674c4c4b4e6d1da3dc7391d (patch)
tree55713f725f77b44ebfec86e4eec3ce33e71458ca /node_modules/dir-glob
downloadwebsite_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.gz
website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.bz2
website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.zip
api, login, auth
Diffstat (limited to 'node_modules/dir-glob')
-rw-r--r--node_modules/dir-glob/index.js75
-rw-r--r--node_modules/dir-glob/license9
-rw-r--r--node_modules/dir-glob/node_modules/path-type/index.d.ts51
-rw-r--r--node_modules/dir-glob/node_modules/path-type/index.js43
-rw-r--r--node_modules/dir-glob/node_modules/path-type/license9
-rw-r--r--node_modules/dir-glob/node_modules/path-type/package.json77
-rw-r--r--node_modules/dir-glob/node_modules/path-type/readme.md72
-rw-r--r--node_modules/dir-glob/package.json70
-rw-r--r--node_modules/dir-glob/readme.md76
9 files changed, 482 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..c21cdf3
--- /dev/null
+++ b/node_modules/dir-glob/index.js
@@ -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
+};
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/node_modules/path-type/index.d.ts b/node_modules/dir-glob/node_modules/path-type/index.d.ts
new file mode 100644
index 0000000..910a50a
--- /dev/null
+++ b/node_modules/dir-glob/node_modules/path-type/index.d.ts
@@ -0,0 +1,51 @@
+export type PathTypeFunction = (path: string) => Promise<boolean>;
+
+/**
+ * Check whether the passed `path` is a file.
+ *
+ * @param path - The path to check.
+ * @returns Whether the `path` is a file.
+ */
+export const isFile: PathTypeFunction;
+
+/**
+ * Check whether the passed `path` is a directory.
+ *
+ * @param path - The path to check.
+ * @returns Whether the `path` is a directory.
+ */
+export const isDirectory: PathTypeFunction;
+
+/**
+ * Check whether the passed `path` is a symlink.
+ *
+ * @param path - The path to check.
+ * @returns Whether the `path` is a symlink.
+ */
+export const isSymlink: PathTypeFunction;
+
+export type PathTypeSyncFunction = (path: string) => boolean;
+
+/**
+ * Synchronously check whether the passed `path` is a file.
+ *
+ * @param path - The path to check.
+ * @returns Whether the `path` is a file.
+ */
+export const isFileSync: PathTypeSyncFunction;
+
+/**
+ * Synchronously check whether the passed `path` is a directory.
+ *
+ * @param path - The path to check.
+ * @returns Whether the `path` is a directory.
+ */
+export const isDirectorySync: PathTypeSyncFunction;
+
+/**
+ * Synchronously check whether the passed `path` is a symlink.
+ *
+ * @param path - The path to check.
+ * @returns Whether the `path` is a directory.
+ */
+export const isSymlinkSync: PathTypeSyncFunction;
diff --git a/node_modules/dir-glob/node_modules/path-type/index.js b/node_modules/dir-glob/node_modules/path-type/index.js
new file mode 100644
index 0000000..b8f34b2
--- /dev/null
+++ b/node_modules/dir-glob/node_modules/path-type/index.js
@@ -0,0 +1,43 @@
+'use strict';
+const {promisify} = require('util');
+const fs = require('fs');
+
+async function isType(fsStatType, statsMethodName, filePath) {
+ if (typeof filePath !== 'string') {
+ throw new TypeError(`Expected a string, got ${typeof filePath}`);
+ }
+
+ try {
+ const stats = await promisify(fs[fsStatType])(filePath);
+ return stats[statsMethodName]();
+ } catch (error) {
+ if (error.code === 'ENOENT') {
+ return false;
+ }
+
+ throw error;
+ }
+}
+
+function isTypeSync(fsStatType, statsMethodName, filePath) {
+ if (typeof filePath !== 'string') {
+ throw new TypeError(`Expected a string, got ${typeof filePath}`);
+ }
+
+ try {
+ return fs[fsStatType](filePath)[statsMethodName]();
+ } catch (error) {
+ if (error.code === 'ENOENT') {
+ return false;
+ }
+
+ throw error;
+ }
+}
+
+exports.isFile = isType.bind(null, 'stat', 'isFile');
+exports.isDirectory = isType.bind(null, 'stat', 'isDirectory');
+exports.isSymlink = isType.bind(null, 'lstat', 'isSymbolicLink');
+exports.isFileSync = isTypeSync.bind(null, 'statSync', 'isFile');
+exports.isDirectorySync = isTypeSync.bind(null, 'statSync', 'isDirectory');
+exports.isSymlinkSync = isTypeSync.bind(null, 'lstatSync', 'isSymbolicLink');
diff --git a/node_modules/dir-glob/node_modules/path-type/license b/node_modules/dir-glob/node_modules/path-type/license
new file mode 100644
index 0000000..e7af2f7
--- /dev/null
+++ b/node_modules/dir-glob/node_modules/path-type/license
@@ -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.
diff --git a/node_modules/dir-glob/node_modules/path-type/package.json b/node_modules/dir-glob/node_modules/path-type/package.json
new file mode 100644
index 0000000..b309977
--- /dev/null
+++ b/node_modules/dir-glob/node_modules/path-type/package.json
@@ -0,0 +1,77 @@
+{
+ "_from": "path-type@^4.0.0",
+ "_id": "path-type@4.0.0",
+ "_inBundle": false,
+ "_integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
+ "_location": "/dir-glob/path-type",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "path-type@^4.0.0",
+ "name": "path-type",
+ "escapedName": "path-type",
+ "rawSpec": "^4.0.0",
+ "saveSpec": null,
+ "fetchSpec": "^4.0.0"
+ },
+ "_requiredBy": [
+ "/dir-glob"
+ ],
+ "_resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
+ "_shasum": "84ed01c0a7ba380afe09d90a8c180dcd9d03043b",
+ "_spec": "path-type@^4.0.0",
+ "_where": "/home/pruss/Dev/3-minute-website/node_modules/dir-glob",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "bugs": {
+ "url": "https://github.com/sindresorhus/path-type/issues"
+ },
+ "bundleDependencies": false,
+ "deprecated": false,
+ "description": "Check if a path is a file, directory, or symlink",
+ "devDependencies": {
+ "ava": "^1.3.1",
+ "nyc": "^13.3.0",
+ "tsd-check": "^0.3.0",
+ "xo": "^0.24.0"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "homepage": "https://github.com/sindresorhus/path-type#readme",
+ "keywords": [
+ "path",
+ "fs",
+ "type",
+ "is",
+ "check",
+ "directory",
+ "dir",
+ "file",
+ "filepath",
+ "symlink",
+ "symbolic",
+ "link",
+ "stat",
+ "stats",
+ "filesystem"
+ ],
+ "license": "MIT",
+ "name": "path-type",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/sindresorhus/path-type.git"
+ },
+ "scripts": {
+ "test": "xo && nyc ava && tsd-check"
+ },
+ "version": "4.0.0"
+}
diff --git a/node_modules/dir-glob/node_modules/path-type/readme.md b/node_modules/dir-glob/node_modules/path-type/readme.md
new file mode 100644
index 0000000..4c972fa
--- /dev/null
+++ b/node_modules/dir-glob/node_modules/path-type/readme.md
@@ -0,0 +1,72 @@
+# path-type [![Build Status](https://travis-ci.org/sindresorhus/path-type.svg?branch=master)](https://travis-ci.org/sindresorhus/path-type)
+
+> Check if a path is a file, directory, or symlink
+
+
+## Install
+
+```
+$ npm install path-type
+```
+
+
+## Usage
+
+```js
+const {isFile} = require('path-type');
+
+(async () => {
+ console.log(await isFile('package.json'));
+ //=> true
+})();
+```
+
+
+## API
+
+### isFile(path)
+
+Check whether the passed `path` is a file.
+
+Returns a `Promise<boolean>`.
+
+#### path
+
+Type: `string`
+
+The path to check.
+
+### isDirectory(path)
+
+Check whether the passed `path` is a directory.
+
+Returns a `Promise<boolean>`.
+
+### isSymlink(path)
+
+Check whether the passed `path` is a symlink.
+
+Returns a `Promise<boolean>`.
+
+### isFileSync(path)
+
+Synchronously check whether the passed `path` is a file.
+
+Returns a `boolean`.
+
+### isDirectorySync(path)
+
+Synchronously check whether the passed `path` is a directory.
+
+Returns a `boolean`.
+
+### isSymlinkSync(path)
+
+Synchronously check whether the passed `path` is a symlink.
+
+Returns a `boolean`.
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/node_modules/dir-glob/package.json b/node_modules/dir-glob/package.json
new file mode 100644
index 0000000..cd4ff58
--- /dev/null
+++ b/node_modules/dir-glob/package.json
@@ -0,0 +1,70 @@
+{
+ "_from": "dir-glob@^3.0.1",
+ "_id": "dir-glob@3.0.1",
+ "_inBundle": false,
+ "_integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==",
+ "_location": "/dir-glob",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "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",
+ "_shasum": "56dbf73d992a4a93ba1584f4534063fd2e41717f",
+ "_spec": "dir-glob@^3.0.1",
+ "_where": "/home/pruss/Dev/3-minute-website/node_modules/globby",
+ "author": {
+ "name": "Kevin Mårtensson",
+ "email": "kevinmartensson@gmail.com",
+ "url": "github.com/kevva"
+ },
+ "bugs": {
+ "url": "https://github.com/kevva/dir-glob/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "path-type": "^4.0.0"
+ },
+ "deprecated": false,
+ "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"
+}
diff --git a/node_modules/dir-glob/readme.md b/node_modules/dir-glob/readme.md
new file mode 100644
index 0000000..cb7313f
--- /dev/null
+++ b/node_modules/dir-glob/readme.md
@@ -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.