replace jest with ava
This commit is contained in:
parent
27cc8b23fe
commit
0347b72305
11775 changed files with 84546 additions and 1440575 deletions
92
node_modules/pkg-conf/index.d.ts
generated
vendored
Normal file
92
node_modules/pkg-conf/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
declare namespace pkgConf {
|
||||
type Config = {[key: string]: unknown};
|
||||
|
||||
interface Options<ConfigType extends Config> {
|
||||
/**
|
||||
Directory to start looking up for a `package.json` file.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
cwd?: string;
|
||||
|
||||
/**
|
||||
Default config.
|
||||
|
||||
@default {}
|
||||
*/
|
||||
defaults?: ConfigType;
|
||||
|
||||
/**
|
||||
Skip `package.json` files that have the namespaced config explicitly set to `false`.
|
||||
|
||||
Continues searching upwards until the next `package.json` file is reached. This can be useful when you need to support the ability for users to have nested `package.json` files, but only read from the root one, like in the case of [`electron-builder`](https://github.com/electron-userland/electron-builder/wiki/Options#AppMetadata) where you have one `package.json` file for the app and one top-level for development.
|
||||
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
{
|
||||
"name": "some-package",
|
||||
"version": "1.0.0",
|
||||
"unicorn": false
|
||||
}
|
||||
```
|
||||
*/
|
||||
skipOnFalse?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare const pkgConf: {
|
||||
/**
|
||||
It [walks up](https://github.com/sindresorhus/find-up) parent directories until a `package.json` can be found, reads it, and returns the user specified namespace or an empty object if not found.
|
||||
|
||||
@param namespace - The `package.json` namespace you want.
|
||||
@returns A `Promise` for the config.
|
||||
|
||||
@example
|
||||
```
|
||||
// {
|
||||
// "name": "some-package",
|
||||
// "version": "1.0.0",
|
||||
// "unicorn": {
|
||||
// "rainbow": true
|
||||
// }
|
||||
// }
|
||||
|
||||
import pkgConf = require('pkg-conf');
|
||||
|
||||
(async () => {
|
||||
const config = await pkgConf('unicorn');
|
||||
|
||||
console.log(config.rainbow);
|
||||
//=> true
|
||||
})();
|
||||
```
|
||||
*/
|
||||
<ConfigType extends pkgConf.Config = pkgConf.Config>(
|
||||
namespace: string,
|
||||
options?: pkgConf.Options<ConfigType>
|
||||
): Promise<ConfigType & pkgConf.Config>;
|
||||
|
||||
/**
|
||||
Same as `pkgConf()`, but runs synchronously.
|
||||
|
||||
@param namespace - The `package.json` namespace you want.
|
||||
@returns Returns the config.
|
||||
*/
|
||||
sync<ConfigType extends pkgConf.Config = pkgConf.Config>(
|
||||
namespace: string,
|
||||
options?: pkgConf.Options<ConfigType>
|
||||
): ConfigType & pkgConf.Config;
|
||||
|
||||
/**
|
||||
@param config - The `config` returned from any of the above methods.
|
||||
@returns The filepath to the `package.json` file or `null` when not found.
|
||||
*/
|
||||
filepath(config: pkgConf.Config): string | null;
|
||||
|
||||
// TODO: Remove this for the next major release
|
||||
default: typeof pkgConf;
|
||||
};
|
||||
|
||||
export = pkgConf;
|
||||
62
node_modules/pkg-conf/index.js
generated
vendored
Normal file
62
node_modules/pkg-conf/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
'use strict';
|
||||
const path = require('path');
|
||||
const findUp = require('find-up');
|
||||
const loadJsonFile = require('load-json-file');
|
||||
|
||||
const filepaths = new WeakMap();
|
||||
const filepath = conf => filepaths.get(conf);
|
||||
const findNextCwd = pkgPath => path.resolve(path.dirname(pkgPath), '..');
|
||||
|
||||
const addFilePath = (object, filePath) => {
|
||||
filepaths.set(object, filePath);
|
||||
return object;
|
||||
};
|
||||
|
||||
const pkgConf = (namespace, options = {}) => {
|
||||
if (!namespace) {
|
||||
return Promise.reject(new TypeError('Expected a namespace'));
|
||||
}
|
||||
|
||||
return findUp('package.json', options.cwd ? {cwd: options.cwd} : {})
|
||||
.then(filePath => {
|
||||
if (!filePath) {
|
||||
return addFilePath(Object.assign({}, options.defaults), filePath);
|
||||
}
|
||||
|
||||
return loadJsonFile(filePath).then(package_ => {
|
||||
if (options.skipOnFalse && package_[namespace] === false) {
|
||||
const newOptions = Object.assign({}, options, {cwd: findNextCwd(filePath)});
|
||||
return pkgConf(namespace, newOptions);
|
||||
}
|
||||
|
||||
return addFilePath(Object.assign({}, options.defaults, package_[namespace]), filePath);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const sync = (namespace, options = {}) => {
|
||||
if (!namespace) {
|
||||
throw new TypeError('Expected a namespace');
|
||||
}
|
||||
|
||||
const filePath = findUp.sync('package.json', options.cwd ? {cwd: options.cwd} : {});
|
||||
|
||||
if (!filePath) {
|
||||
return addFilePath(Object.assign({}, options.defaults), filePath);
|
||||
}
|
||||
|
||||
const package_ = loadJsonFile.sync(filePath);
|
||||
|
||||
if (options.skipOnFalse && package_[namespace] === false) {
|
||||
const newOptions = Object.assign({}, options, {cwd: findNextCwd(filePath)});
|
||||
return sync(namespace, newOptions);
|
||||
}
|
||||
|
||||
return addFilePath(Object.assign({}, options.defaults, package_[namespace]), filePath);
|
||||
};
|
||||
|
||||
module.exports = pkgConf;
|
||||
// TODO: Remove this for the next major release
|
||||
module.exports.default = pkgConf;
|
||||
module.exports.filepath = filepath;
|
||||
module.exports.sync = sync;
|
||||
9
node_modules/pkg-conf/license
generated
vendored
Normal file
9
node_modules/pkg-conf/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.
|
||||
46
node_modules/pkg-conf/node_modules/find-up/index.js
generated
vendored
Normal file
46
node_modules/pkg-conf/node_modules/find-up/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
'use strict';
|
||||
const path = require('path');
|
||||
const locatePath = require('locate-path');
|
||||
|
||||
module.exports = (filename, opts = {}) => {
|
||||
const startDir = path.resolve(opts.cwd || '');
|
||||
const {root} = path.parse(startDir);
|
||||
|
||||
const filenames = [].concat(filename);
|
||||
|
||||
return new Promise(resolve => {
|
||||
(function find(dir) {
|
||||
locatePath(filenames, {cwd: dir}).then(file => {
|
||||
if (file) {
|
||||
resolve(path.join(dir, file));
|
||||
} else if (dir === root) {
|
||||
resolve(null);
|
||||
} else {
|
||||
find(path.dirname(dir));
|
||||
}
|
||||
});
|
||||
})(startDir);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.sync = (filename, opts = {}) => {
|
||||
let dir = path.resolve(opts.cwd || '');
|
||||
const {root} = path.parse(dir);
|
||||
|
||||
const filenames = [].concat(filename);
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
const file = locatePath.sync(filenames, {cwd: dir});
|
||||
|
||||
if (file) {
|
||||
return path.join(dir, file);
|
||||
}
|
||||
|
||||
if (dir === root) {
|
||||
return null;
|
||||
}
|
||||
|
||||
dir = path.dirname(dir);
|
||||
}
|
||||
};
|
||||
9
node_modules/pkg-conf/node_modules/find-up/license
generated
vendored
Normal file
9
node_modules/pkg-conf/node_modules/find-up/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.
|
||||
50
node_modules/pkg-conf/node_modules/find-up/package.json
generated
vendored
Normal file
50
node_modules/pkg-conf/node_modules/find-up/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
"name": "find-up",
|
||||
"version": "3.0.0",
|
||||
"description": "Find a file or directory by walking up parent directories",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/find-up",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"find",
|
||||
"up",
|
||||
"find-up",
|
||||
"findup",
|
||||
"look-up",
|
||||
"look",
|
||||
"file",
|
||||
"search",
|
||||
"match",
|
||||
"package",
|
||||
"resolve",
|
||||
"parent",
|
||||
"parents",
|
||||
"folder",
|
||||
"directory",
|
||||
"dir",
|
||||
"walk",
|
||||
"walking",
|
||||
"path"
|
||||
],
|
||||
"dependencies": {
|
||||
"locate-path": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"tempy": "^0.2.1",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
87
node_modules/pkg-conf/node_modules/find-up/readme.md
generated
vendored
Normal file
87
node_modules/pkg-conf/node_modules/find-up/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
# find-up [](https://travis-ci.org/sindresorhus/find-up) [](https://ci.appveyor.com/project/sindresorhus/find-up/branch/master)
|
||||
|
||||
> Find a file or directory by walking up parent directories
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install find-up
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
/
|
||||
└── Users
|
||||
└── sindresorhus
|
||||
├── unicorn.png
|
||||
└── foo
|
||||
└── bar
|
||||
├── baz
|
||||
└── example.js
|
||||
```
|
||||
|
||||
`example.js`
|
||||
|
||||
```js
|
||||
const findUp = require('find-up');
|
||||
|
||||
(async () => {
|
||||
console.log(await findUp('unicorn.png'));
|
||||
//=> '/Users/sindresorhus/unicorn.png'
|
||||
|
||||
console.log(await findUp(['rainbow.png', 'unicorn.png']));
|
||||
//=> '/Users/sindresorhus/unicorn.png'
|
||||
})();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### findUp(filename, [options])
|
||||
|
||||
Returns a `Promise` for either the filepath or `null` if it couldn't be found.
|
||||
|
||||
### findUp([filenameA, filenameB], [options])
|
||||
|
||||
Returns a `Promise` for either the first filepath found (by respecting the order) or `null` if none could be found.
|
||||
|
||||
### findUp.sync(filename, [options])
|
||||
|
||||
Returns a filepath or `null`.
|
||||
|
||||
### findUp.sync([filenameA, filenameB], [options])
|
||||
|
||||
Returns the first filepath found (by respecting the order) or `null`.
|
||||
|
||||
#### filename
|
||||
|
||||
Type: `string`
|
||||
|
||||
Filename of the file to find.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Directory to start from.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module
|
||||
- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file
|
||||
- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package
|
||||
- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module like `require.resolve()` but from a given path
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
24
node_modules/pkg-conf/node_modules/locate-path/index.js
generated
vendored
Normal file
24
node_modules/pkg-conf/node_modules/locate-path/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
'use strict';
|
||||
const path = require('path');
|
||||
const pathExists = require('path-exists');
|
||||
const pLocate = require('p-locate');
|
||||
|
||||
module.exports = (iterable, options) => {
|
||||
options = Object.assign({
|
||||
cwd: process.cwd()
|
||||
}, options);
|
||||
|
||||
return pLocate(iterable, el => pathExists(path.resolve(options.cwd, el)), options);
|
||||
};
|
||||
|
||||
module.exports.sync = (iterable, options) => {
|
||||
options = Object.assign({
|
||||
cwd: process.cwd()
|
||||
}, options);
|
||||
|
||||
for (const el of iterable) {
|
||||
if (pathExists.sync(path.resolve(options.cwd, el))) {
|
||||
return el;
|
||||
}
|
||||
}
|
||||
};
|
||||
9
node_modules/pkg-conf/node_modules/locate-path/license
generated
vendored
Normal file
9
node_modules/pkg-conf/node_modules/locate-path/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.
|
||||
44
node_modules/pkg-conf/node_modules/locate-path/package.json
generated
vendored
Normal file
44
node_modules/pkg-conf/node_modules/locate-path/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"name": "locate-path",
|
||||
"version": "3.0.0",
|
||||
"description": "Get the first path that exists on disk of multiple paths",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/locate-path",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"locate",
|
||||
"path",
|
||||
"paths",
|
||||
"file",
|
||||
"files",
|
||||
"exists",
|
||||
"find",
|
||||
"finder",
|
||||
"search",
|
||||
"searcher",
|
||||
"array",
|
||||
"iterable",
|
||||
"iterator"
|
||||
],
|
||||
"dependencies": {
|
||||
"p-locate": "^3.0.0",
|
||||
"path-exists": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
99
node_modules/pkg-conf/node_modules/locate-path/readme.md
generated
vendored
Normal file
99
node_modules/pkg-conf/node_modules/locate-path/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
# locate-path [](https://travis-ci.org/sindresorhus/locate-path)
|
||||
|
||||
> Get the first path that exists on disk of multiple paths
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install locate-path
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Here we find the first file that exists on disk, in array order.
|
||||
|
||||
```js
|
||||
const locatePath = require('locate-path');
|
||||
|
||||
const files = [
|
||||
'unicorn.png',
|
||||
'rainbow.png', // Only this one actually exists on disk
|
||||
'pony.png'
|
||||
];
|
||||
|
||||
(async () => {
|
||||
console(await locatePath(files));
|
||||
//=> 'rainbow'
|
||||
})();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### locatePath(input, [options])
|
||||
|
||||
Returns a `Promise` for the first path that exists or `undefined` if none exists.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `Iterable<string>`
|
||||
|
||||
Paths to check.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### concurrency
|
||||
|
||||
Type: `number`<br>
|
||||
Default: `Infinity`<br>
|
||||
Minimum: `1`
|
||||
|
||||
Number of concurrently pending promises.
|
||||
|
||||
##### preserveOrder
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Preserve `input` order when searching.
|
||||
|
||||
Disable this to improve performance if you don't care about the order.
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Current working directory.
|
||||
|
||||
### locatePath.sync(input, [options])
|
||||
|
||||
Returns the first path that exists or `undefined` if none exists.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `Iterable<string>`
|
||||
|
||||
Paths to check.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Same as above.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [path-exists](https://github.com/sindresorhus/path-exists) - Check if a path exists
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
34
node_modules/pkg-conf/node_modules/p-locate/index.js
generated
vendored
Normal file
34
node_modules/pkg-conf/node_modules/p-locate/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
'use strict';
|
||||
const pLimit = require('p-limit');
|
||||
|
||||
class EndError extends Error {
|
||||
constructor(value) {
|
||||
super();
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
// The input can also be a promise, so we `Promise.resolve()` it
|
||||
const testElement = (el, tester) => Promise.resolve(el).then(tester);
|
||||
|
||||
// The input can also be a promise, so we `Promise.all()` them both
|
||||
const finder = el => Promise.all(el).then(val => val[1] === true && Promise.reject(new EndError(val[0])));
|
||||
|
||||
module.exports = (iterable, tester, opts) => {
|
||||
opts = Object.assign({
|
||||
concurrency: Infinity,
|
||||
preserveOrder: true
|
||||
}, opts);
|
||||
|
||||
const limit = pLimit(opts.concurrency);
|
||||
|
||||
// Start all the promises concurrently with optional limit
|
||||
const items = [...iterable].map(el => [el, limit(testElement, el, tester)]);
|
||||
|
||||
// Check the promises either serially or concurrently
|
||||
const checkLimit = pLimit(opts.preserveOrder ? 1 : Infinity);
|
||||
|
||||
return Promise.all(items.map(el => checkLimit(finder, el)))
|
||||
.then(() => {})
|
||||
.catch(err => err instanceof EndError ? err.value : Promise.reject(err));
|
||||
};
|
||||
9
node_modules/pkg-conf/node_modules/p-locate/license
generated
vendored
Normal file
9
node_modules/pkg-conf/node_modules/p-locate/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.
|
||||
51
node_modules/pkg-conf/node_modules/p-locate/package.json
generated
vendored
Normal file
51
node_modules/pkg-conf/node_modules/p-locate/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"name": "p-locate",
|
||||
"version": "3.0.0",
|
||||
"description": "Get the first fulfilled promise that satisfies the provided testing function",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/p-locate",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"locate",
|
||||
"find",
|
||||
"finder",
|
||||
"search",
|
||||
"searcher",
|
||||
"test",
|
||||
"array",
|
||||
"collection",
|
||||
"iterable",
|
||||
"iterator",
|
||||
"race",
|
||||
"fulfilled",
|
||||
"fastest",
|
||||
"async",
|
||||
"await",
|
||||
"promises",
|
||||
"bluebird"
|
||||
],
|
||||
"dependencies": {
|
||||
"p-limit": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"delay": "^3.0.0",
|
||||
"in-range": "^1.0.0",
|
||||
"time-span": "^2.0.0",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
88
node_modules/pkg-conf/node_modules/p-locate/readme.md
generated
vendored
Normal file
88
node_modules/pkg-conf/node_modules/p-locate/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
# p-locate [](https://travis-ci.org/sindresorhus/p-locate)
|
||||
|
||||
> Get the first fulfilled promise that satisfies the provided testing function
|
||||
|
||||
Think of it like an async version of [`Array#find`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install p-locate
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Here we find the first file that exists on disk, in array order.
|
||||
|
||||
```js
|
||||
const pathExists = require('path-exists');
|
||||
const pLocate = require('p-locate');
|
||||
|
||||
const files = [
|
||||
'unicorn.png',
|
||||
'rainbow.png', // Only this one actually exists on disk
|
||||
'pony.png'
|
||||
];
|
||||
|
||||
(async () => {
|
||||
const foundPath = await pLocate(files, file => pathExists(file));
|
||||
|
||||
console.log(foundPath);
|
||||
//=> 'rainbow'
|
||||
})();
|
||||
```
|
||||
|
||||
*The above is just an example. Use [`locate-path`](https://github.com/sindresorhus/locate-path) if you need this.*
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### pLocate(input, tester, [options])
|
||||
|
||||
Returns a `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `Iterable<Promise|any>`
|
||||
|
||||
#### tester(element)
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Expected to return a `Promise<boolean>` or boolean.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### concurrency
|
||||
|
||||
Type: `number`<br>
|
||||
Default: `Infinity`<br>
|
||||
Minimum: `1`
|
||||
|
||||
Number of concurrently pending promises returned by `tester`.
|
||||
|
||||
##### preserveOrder
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Preserve `input` order when searching.
|
||||
|
||||
Disable this to improve performance if you don't care about the order.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently
|
||||
- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently
|
||||
- [p-any](https://github.com/sindresorhus/p-any) - Wait for any promise to be fulfilled
|
||||
- [More…](https://github.com/sindresorhus/promise-fun)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
17
node_modules/pkg-conf/node_modules/path-exists/index.js
generated
vendored
Normal file
17
node_modules/pkg-conf/node_modules/path-exists/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
'use strict';
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = fp => new Promise(resolve => {
|
||||
fs.access(fp, err => {
|
||||
resolve(!err);
|
||||
});
|
||||
});
|
||||
|
||||
module.exports.sync = fp => {
|
||||
try {
|
||||
fs.accessSync(fp);
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
21
node_modules/pkg-conf/node_modules/path-exists/license
generated
vendored
Normal file
21
node_modules/pkg-conf/node_modules/path-exists/license
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
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.
|
||||
40
node_modules/pkg-conf/node_modules/path-exists/package.json
generated
vendored
Normal file
40
node_modules/pkg-conf/node_modules/path-exists/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"name": "path-exists",
|
||||
"version": "3.0.0",
|
||||
"description": "Check if a path exists",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/path-exists",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"path",
|
||||
"exists",
|
||||
"exist",
|
||||
"file",
|
||||
"filepath",
|
||||
"fs",
|
||||
"filesystem",
|
||||
"file-system",
|
||||
"access",
|
||||
"stat"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
||||
50
node_modules/pkg-conf/node_modules/path-exists/readme.md
generated
vendored
Normal file
50
node_modules/pkg-conf/node_modules/path-exists/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# path-exists [](https://travis-ci.org/sindresorhus/path-exists)
|
||||
|
||||
> Check if a path exists
|
||||
|
||||
Because [`fs.exists()`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback) is being [deprecated](https://github.com/iojs/io.js/issues/103), but there's still a genuine use-case of being able to check if a path exists for other purposes than doing IO with it.
|
||||
|
||||
Never use this before handling a file though:
|
||||
|
||||
> In particular, checking if a file exists before opening it is an anti-pattern that leaves you vulnerable to race conditions: another process may remove the file between the calls to `fs.exists()` and `fs.open()`. Just open the file and handle the error when it's not there.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save path-exists
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// foo.js
|
||||
const pathExists = require('path-exists');
|
||||
|
||||
pathExists('foo.js').then(exists => {
|
||||
console.log(exists);
|
||||
//=> true
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### pathExists(path)
|
||||
|
||||
Returns a promise for a boolean of whether the path exists.
|
||||
|
||||
### pathExists.sync(path)
|
||||
|
||||
Returns a boolean of whether the path exists.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [path-exists-cli](https://github.com/sindresorhus/path-exists-cli) - CLI for this module
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
51
node_modules/pkg-conf/package.json
generated
vendored
Normal file
51
node_modules/pkg-conf/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"name": "pkg-conf",
|
||||
"version": "3.1.0",
|
||||
"description": "Get namespaced config from the closest package.json",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/pkg-conf",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"json",
|
||||
"read",
|
||||
"parse",
|
||||
"file",
|
||||
"fs",
|
||||
"graceful",
|
||||
"load",
|
||||
"pkg",
|
||||
"package",
|
||||
"config",
|
||||
"conf",
|
||||
"configuration",
|
||||
"object",
|
||||
"namespace",
|
||||
"namespaced"
|
||||
],
|
||||
"dependencies": {
|
||||
"find-up": "^3.0.0",
|
||||
"load-json-file": "^5.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"fixture": {
|
||||
"foo": true
|
||||
}
|
||||
}
|
||||
109
node_modules/pkg-conf/readme.md
generated
vendored
Normal file
109
node_modules/pkg-conf/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
# pkg-conf [](https://travis-ci.org/sindresorhus/pkg-conf)
|
||||
|
||||
> Get namespaced config from the closest package.json
|
||||
|
||||
Having tool specific config in package.json reduces the amount of metafiles in your repo (there are usually a lot!) and makes the config obvious compared to hidden dotfiles like `.eslintrc`, which can end up causing confusion. [XO](https://github.com/xojs/xo), for example, uses the `xo` namespace in package.json, and [ESLint](http://eslint.org) uses `eslintConfig`. Many more tools supports this, like [AVA](https://ava.li), [Babel](https://babeljs.io), [nyc](https://github.com/istanbuljs/nyc), etc.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install pkg-conf
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "some-package",
|
||||
"version": "1.0.0",
|
||||
"unicorn": {
|
||||
"rainbow": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
const pkgConf = require('pkg-conf');
|
||||
|
||||
(async () => {
|
||||
const config = await pkgConf('unicorn');
|
||||
|
||||
console.log(config.rainbow);
|
||||
//=> true
|
||||
})();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
It [walks up](https://github.com/sindresorhus/find-up) parent directories until a `package.json` can be found, reads it, and returns the user specified namespace or an empty object if not found.
|
||||
|
||||
### pkgConf(namespace, [options])
|
||||
|
||||
Returns a `Promise` for the config.
|
||||
|
||||
### pkgConf.sync(namespace, [options])
|
||||
|
||||
Returns the config.
|
||||
|
||||
#### namespace
|
||||
|
||||
Type: `string`
|
||||
|
||||
The package.json namespace you want.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Directory to start looking up for a package.json file.
|
||||
|
||||
##### defaults
|
||||
|
||||
Type: `Object`<br>
|
||||
|
||||
Default config.
|
||||
|
||||
##### skipOnFalse
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
Skip `package.json` files that have the namespaced config explicitly set to `false`.
|
||||
|
||||
Continues searching upwards until the next `package.json` file is reached. This can be useful when you need to support the ability for users to have nested `package.json` files, but only read from the root one, like in the case of [`electron-builder`](https://github.com/electron-userland/electron-builder/wiki/Options#AppMetadata) where you have one `package.json` file for the app and one top-level for development.
|
||||
|
||||
Example usage for the user:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "some-package",
|
||||
"version": "1.0.0",
|
||||
"unicorn": false
|
||||
}
|
||||
```
|
||||
|
||||
### pkgConf.filepath(config)
|
||||
|
||||
Pass in the `config` returned from any of the above methods.
|
||||
|
||||
Returns the filepath to the package.json file or `null` when not found.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [read-pkg-up](https://github.com/sindresorhus/read-pkg-up) - Read the closest package.json file
|
||||
- [read-pkg](https://github.com/sindresorhus/read-pkg) - Read a package.json file
|
||||
- [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
Loading…
Add table
Add a link
Reference in a new issue