Initial pass

This commit is contained in:
Danny McCormick
2019-06-26 21:12:00 -04:00
commit 39c08a0eaa
7242 changed files with 1886006 additions and 0 deletions

26
node_modules/read-pkg-up/index.js generated vendored Normal file
View File

@ -0,0 +1,26 @@
'use strict';
const findUp = require('find-up');
const readPkg = require('read-pkg');
module.exports = options => {
return findUp('package.json', options).then(fp => {
if (!fp) {
return {};
}
return readPkg(fp, options).then(pkg => ({pkg, path: fp}));
});
};
module.exports.sync = options => {
const fp = findUp.sync('package.json', options);
if (!fp) {
return {};
}
return {
pkg: readPkg.sync(fp, options),
path: fp
};
};

9
node_modules/read-pkg-up/license generated vendored Normal file
View 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/read-pkg-up/node_modules/find-up/index.js generated vendored Normal file
View 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);
}
};

View 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.

View File

@ -0,0 +1,86 @@
{
"_args": [
[
"find-up@3.0.0",
"C:\\Users\\Administrator\\Documents\\setup-python"
]
],
"_development": true,
"_from": "find-up@3.0.0",
"_id": "find-up@3.0.0",
"_inBundle": false,
"_integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
"_location": "/read-pkg-up/find-up",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "find-up@3.0.0",
"name": "find-up",
"escapedName": "find-up",
"rawSpec": "3.0.0",
"saveSpec": null,
"fetchSpec": "3.0.0"
},
"_requiredBy": [
"/read-pkg-up"
],
"_resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
"_spec": "3.0.0",
"_where": "C:\\Users\\Administrator\\Documents\\setup-python",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/find-up/issues"
},
"dependencies": {
"locate-path": "^3.0.0"
},
"description": "Find a file or directory by walking up parent directories",
"devDependencies": {
"ava": "*",
"tempy": "^0.2.1",
"xo": "*"
},
"engines": {
"node": ">=6"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/find-up#readme",
"keywords": [
"find",
"up",
"find-up",
"findup",
"look-up",
"look",
"file",
"search",
"match",
"package",
"resolve",
"parent",
"parents",
"folder",
"directory",
"dir",
"walk",
"walking",
"path"
],
"license": "MIT",
"name": "find-up",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/find-up.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "3.0.0"
}

View File

@ -0,0 +1,87 @@
# find-up [![Build Status: Linux and macOS](https://travis-ci.org/sindresorhus/find-up.svg?branch=master)](https://travis-ci.org/sindresorhus/find-up) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/l0cyjmvh5lq72vq2/branch/master?svg=true)](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)

View 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;
}
}
};

View 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.

View File

@ -0,0 +1,80 @@
{
"_args": [
[
"locate-path@3.0.0",
"C:\\Users\\Administrator\\Documents\\setup-python"
]
],
"_development": true,
"_from": "locate-path@3.0.0",
"_id": "locate-path@3.0.0",
"_inBundle": false,
"_integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
"_location": "/read-pkg-up/locate-path",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "locate-path@3.0.0",
"name": "locate-path",
"escapedName": "locate-path",
"rawSpec": "3.0.0",
"saveSpec": null,
"fetchSpec": "3.0.0"
},
"_requiredBy": [
"/read-pkg-up/find-up"
],
"_resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
"_spec": "3.0.0",
"_where": "C:\\Users\\Administrator\\Documents\\setup-python",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/locate-path/issues"
},
"dependencies": {
"p-locate": "^3.0.0",
"path-exists": "^3.0.0"
},
"description": "Get the first path that exists on disk of multiple paths",
"devDependencies": {
"ava": "*",
"xo": "*"
},
"engines": {
"node": ">=6"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/locate-path#readme",
"keywords": [
"locate",
"path",
"paths",
"file",
"files",
"exists",
"find",
"finder",
"search",
"searcher",
"array",
"iterable",
"iterator"
],
"license": "MIT",
"name": "locate-path",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/locate-path.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "3.0.0"
}

View File

@ -0,0 +1,99 @@
# locate-path [![Build Status](https://travis-ci.org/sindresorhus/locate-path.svg?branch=master)](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)

View 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));
};

View 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.

View File

@ -0,0 +1,87 @@
{
"_args": [
[
"p-locate@3.0.0",
"C:\\Users\\Administrator\\Documents\\setup-python"
]
],
"_development": true,
"_from": "p-locate@3.0.0",
"_id": "p-locate@3.0.0",
"_inBundle": false,
"_integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
"_location": "/read-pkg-up/p-locate",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "p-locate@3.0.0",
"name": "p-locate",
"escapedName": "p-locate",
"rawSpec": "3.0.0",
"saveSpec": null,
"fetchSpec": "3.0.0"
},
"_requiredBy": [
"/read-pkg-up/locate-path"
],
"_resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
"_spec": "3.0.0",
"_where": "C:\\Users\\Administrator\\Documents\\setup-python",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/p-locate/issues"
},
"dependencies": {
"p-limit": "^2.0.0"
},
"description": "Get the first fulfilled promise that satisfies the provided testing function",
"devDependencies": {
"ava": "*",
"delay": "^3.0.0",
"in-range": "^1.0.0",
"time-span": "^2.0.0",
"xo": "*"
},
"engines": {
"node": ">=6"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/p-locate#readme",
"keywords": [
"promise",
"locate",
"find",
"finder",
"search",
"searcher",
"test",
"array",
"collection",
"iterable",
"iterator",
"race",
"fulfilled",
"fastest",
"async",
"await",
"promises",
"bluebird"
],
"license": "MIT",
"name": "p-locate",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/p-locate.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "3.0.0"
}

View File

@ -0,0 +1,88 @@
# p-locate [![Build Status](https://travis-ci.org/sindresorhus/p-locate.svg?branch=master)](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)

View 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;
}
};

View 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.

View File

@ -0,0 +1,76 @@
{
"_args": [
[
"path-exists@3.0.0",
"C:\\Users\\Administrator\\Documents\\setup-python"
]
],
"_development": true,
"_from": "path-exists@3.0.0",
"_id": "path-exists@3.0.0",
"_inBundle": false,
"_integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
"_location": "/read-pkg-up/path-exists",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "path-exists@3.0.0",
"name": "path-exists",
"escapedName": "path-exists",
"rawSpec": "3.0.0",
"saveSpec": null,
"fetchSpec": "3.0.0"
},
"_requiredBy": [
"/read-pkg-up/locate-path"
],
"_resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
"_spec": "3.0.0",
"_where": "C:\\Users\\Administrator\\Documents\\setup-python",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/path-exists/issues"
},
"description": "Check if a path exists",
"devDependencies": {
"ava": "*",
"xo": "*"
},
"engines": {
"node": ">=4"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/path-exists#readme",
"keywords": [
"path",
"exists",
"exist",
"file",
"filepath",
"fs",
"filesystem",
"file-system",
"access",
"stat"
],
"license": "MIT",
"name": "path-exists",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/path-exists.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "3.0.0",
"xo": {
"esnext": true
}
}

View File

@ -0,0 +1,50 @@
# path-exists [![Build Status](https://travis-ci.org/sindresorhus/path-exists.svg?branch=master)](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)

View File

@ -0,0 +1,47 @@
'use strict';
const path = require('path');
const loadJsonFile = require('load-json-file');
const pathType = require('path-type');
module.exports = (fp, opts) => {
if (typeof fp !== 'string') {
opts = fp;
fp = '.';
}
opts = opts || {};
return pathType.dir(fp)
.then(isDir => {
if (isDir) {
fp = path.join(fp, 'package.json');
}
return loadJsonFile(fp);
})
.then(x => {
if (opts.normalize !== false) {
require('normalize-package-data')(x);
}
return x;
});
};
module.exports.sync = (fp, opts) => {
if (typeof fp !== 'string') {
opts = fp;
fp = '.';
}
opts = opts || {};
fp = pathType.dirSync(fp) ? path.join(fp, 'package.json') : fp;
const x = loadJsonFile.sync(fp);
if (opts.normalize !== false) {
require('normalize-package-data')(x);
}
return x;
};

View 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.

View File

@ -0,0 +1,78 @@
{
"_args": [
[
"read-pkg@3.0.0",
"C:\\Users\\Administrator\\Documents\\setup-python"
]
],
"_development": true,
"_from": "read-pkg@3.0.0",
"_id": "read-pkg@3.0.0",
"_inBundle": false,
"_integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=",
"_location": "/read-pkg-up/read-pkg",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "read-pkg@3.0.0",
"name": "read-pkg",
"escapedName": "read-pkg",
"rawSpec": "3.0.0",
"saveSpec": null,
"fetchSpec": "3.0.0"
},
"_requiredBy": [
"/read-pkg-up"
],
"_resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz",
"_spec": "3.0.0",
"_where": "C:\\Users\\Administrator\\Documents\\setup-python",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/read-pkg/issues"
},
"dependencies": {
"load-json-file": "^4.0.0",
"normalize-package-data": "^2.3.2",
"path-type": "^3.0.0"
},
"description": "Read a package.json file",
"devDependencies": {
"ava": "*",
"xo": "*"
},
"engines": {
"node": ">=4"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/read-pkg#readme",
"keywords": [
"json",
"read",
"parse",
"file",
"fs",
"graceful",
"load",
"pkg",
"package",
"normalize"
],
"license": "MIT",
"name": "read-pkg",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/read-pkg.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "3.0.0"
}

View File

@ -0,0 +1,79 @@
# read-pkg [![Build Status](https://travis-ci.org/sindresorhus/read-pkg.svg?branch=master)](https://travis-ci.org/sindresorhus/read-pkg)
> Read a package.json file
## Why
- [Gracefully handles filesystem issues](https://github.com/isaacs/node-graceful-fs)
- [Strips UTF-8 BOM](https://github.com/sindresorhus/strip-bom)
- [Throws more helpful JSON errors](https://github.com/sindresorhus/parse-json)
- [Normalizes the data](https://github.com/npm/normalize-package-data#what-normalization-currently-entails)
## Install
```
$ npm install read-pkg
```
## Usage
```js
const readPkg = require('read-pkg');
readPkg().then(pkg => {
console.log(pkg);
//=> {name: 'read-pkg', ...}
});
readPkg(__dirname).then(pkg => {
console.log(pkg);
//=> {name: 'read-pkg', ...}
});
readPkg(path.join('unicorn', 'package.json')).then(pkg => {
console.log(pkg);
//=> {name: 'read-pkg', ...}
});
```
## API
### readPkg([path], [options])
Returns a `Promise` for the parsed JSON.
### readPkg.sync([path], [options])
Returns the parsed JSON.
#### path
Type: `string`<br>
Default: `process.cwd()`
Path to a `package.json` file or its directory.
#### options
##### normalize
Type: `boolean`<br>
Default: `true`
[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.
## Related
- [read-pkg-up](https://github.com/sindresorhus/read-pkg-up) - Read the closest package.json file
- [write-pkg](https://github.com/sindresorhus/write-pkg) - Write a `package.json` file
- [load-json-file](https://github.com/sindresorhus/load-json-file) - Read and parse a JSON file
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

98
node_modules/read-pkg-up/package.json generated vendored Normal file
View File

@ -0,0 +1,98 @@
{
"_args": [
[
"read-pkg-up@4.0.0",
"C:\\Users\\Administrator\\Documents\\setup-python"
]
],
"_development": true,
"_from": "read-pkg-up@4.0.0",
"_id": "read-pkg-up@4.0.0",
"_inBundle": false,
"_integrity": "sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA==",
"_location": "/read-pkg-up",
"_phantomChildren": {
"load-json-file": "4.0.0",
"normalize-package-data": "2.5.0",
"p-limit": "2.2.0",
"path-type": "3.0.0"
},
"_requested": {
"type": "version",
"registry": true,
"raw": "read-pkg-up@4.0.0",
"name": "read-pkg-up",
"escapedName": "read-pkg-up",
"rawSpec": "4.0.0",
"saveSpec": null,
"fetchSpec": "4.0.0"
},
"_requiredBy": [
"/test-exclude"
],
"_resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-4.0.0.tgz",
"_spec": "4.0.0",
"_where": "C:\\Users\\Administrator\\Documents\\setup-python",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/read-pkg-up/issues"
},
"dependencies": {
"find-up": "^3.0.0",
"read-pkg": "^3.0.0"
},
"description": "Read the closest package.json file",
"devDependencies": {
"ava": "*",
"xo": "*"
},
"engines": {
"node": ">=6"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/read-pkg-up#readme",
"keywords": [
"json",
"read",
"parse",
"file",
"fs",
"graceful",
"load",
"pkg",
"package",
"find",
"up",
"find-up",
"findup",
"look-up",
"look",
"search",
"match",
"resolve",
"parent",
"parents",
"folder",
"directory",
"dir",
"walk",
"walking",
"path"
],
"license": "MIT",
"name": "read-pkg-up",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/read-pkg-up.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "4.0.0"
}

82
node_modules/read-pkg-up/readme.md generated vendored Normal file
View File

@ -0,0 +1,82 @@
# read-pkg-up [![Build Status](https://travis-ci.org/sindresorhus/read-pkg-up.svg?branch=master)](https://travis-ci.org/sindresorhus/read-pkg-up)
> Read the closest package.json file
## Why
- [Finds the closest package.json](https://github.com/sindresorhus/find-up)
- [Gracefully handles filesystem issues](https://github.com/isaacs/node-graceful-fs)
- [Strips UTF-8 BOM](https://github.com/sindresorhus/strip-bom)
- [Throws more helpful JSON errors](https://github.com/sindresorhus/parse-json)
- [Normalizes the data](https://github.com/npm/normalize-package-data#what-normalization-currently-entails)
## Install
```
$ npm install read-pkg-up
```
## Usage
```js
const readPkgUp = require('read-pkg-up');
(async () => {
console.log(await readPkgUp());
/*
{
pkg: {
name: 'awesome-package',
version: '1.0.0',
},
path: '/Users/sindresorhus/dev/awesome-package/package.json'
}
*/
})();
```
## API
### readPkgUp([options])
Returns a `Promise` for the result object.
### readPkgUp.sync([options])
Returns the result object.
#### options
Type: `Object`
##### cwd
Type: `string`<br>
Default: `process.cwd()`
Directory to start looking for a package.json file.
##### normalize
Type: `boolean`<br>
Default: `true`
[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.
## Related
- [read-pkg](https://github.com/sindresorhus/read-pkg) - Read a package.json file
- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file
- [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories
- [pkg-conf](https://github.com/sindresorhus/pkg-conf) - Get namespaced config from the closest package.json
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)