diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:01:11 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:02:09 +0200 |
commit | 363723fc84f7b8477592e0105aeb331ec9a017af (patch) | |
tree | 29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/find-cache-dir | |
parent | 5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff) |
node_modules
Diffstat (limited to 'node_modules/find-cache-dir')
8 files changed, 349 insertions, 0 deletions
diff --git a/node_modules/find-cache-dir/node_modules/find-up/index.js b/node_modules/find-cache-dir/node_modules/find-up/index.js new file mode 100644 index 000000000..7ff0e2b78 --- /dev/null +++ b/node_modules/find-cache-dir/node_modules/find-up/index.js @@ -0,0 +1,53 @@ +'use strict'; +var path = require('path'); +var pathExists = require('path-exists'); +var Promise = require('pinkie-promise'); + +function splitPath(x) { + return path.resolve(x || '').split(path.sep); +} + +function join(parts, filename) { + return path.resolve(parts.join(path.sep) + path.sep, filename); +} + +module.exports = function (filename, opts) { + opts = opts || {}; + + var parts = splitPath(opts.cwd); + + return new Promise(function (resolve) { + (function find() { + var fp = join(parts, filename); + + pathExists(fp).then(function (exists) { + if (exists) { + resolve(fp); + } else if (parts.pop()) { + find(); + } else { + resolve(null); + } + }); + })(); + }); +}; + +module.exports.sync = function (filename, opts) { + opts = opts || {}; + + var parts = splitPath(opts.cwd); + var len = parts.length; + + while (len--) { + var fp = join(parts, filename); + + if (pathExists.sync(fp)) { + return fp; + } + + parts.pop(); + } + + return null; +}; diff --git a/node_modules/find-cache-dir/node_modules/find-up/license b/node_modules/find-cache-dir/node_modules/find-up/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/find-cache-dir/node_modules/find-up/license @@ -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. diff --git a/node_modules/find-cache-dir/node_modules/find-up/package.json b/node_modules/find-cache-dir/node_modules/find-up/package.json new file mode 100644 index 000000000..478866c49 --- /dev/null +++ b/node_modules/find-cache-dir/node_modules/find-up/package.json @@ -0,0 +1,51 @@ +{ + "name": "find-up", + "version": "1.1.2", + "description": "Find a file by walking up parent directories", + "license": "MIT", + "repository": "sindresorhus/find-up", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "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": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "devDependencies": { + "ava": "*", + "tempfile": "^1.1.1", + "xo": "*" + } +} diff --git a/node_modules/find-cache-dir/node_modules/find-up/readme.md b/node_modules/find-cache-dir/node_modules/find-up/readme.md new file mode 100644 index 000000000..9ea0611c3 --- /dev/null +++ b/node_modules/find-cache-dir/node_modules/find-up/readme.md @@ -0,0 +1,72 @@ +# find-up [![Build Status](https://travis-ci.org/sindresorhus/find-up.svg?branch=master)](https://travis-ci.org/sindresorhus/find-up) + +> Find a file by walking up parent directories + + +## Install + +``` +$ npm install --save find-up +``` + + +## Usage + +``` +/ +└── Users + └── sindresorhus + ├── unicorn.png + └── foo + └── bar + ├── baz + └── example.js +``` + +```js +// example.js +const findUp = require('find-up'); + +findUp('unicorn.png').then(filepath => { + console.log(filepath); + //=> '/Users/sindresorhus/unicorn.png' +}); +``` + + +## API + +### findUp(filename, [options]) + +Returns a promise for the filepath or `null`. + +### findUp.sync(filename, [options]) + +Returns a filepath or `null`. + +#### filename + +Type: `string` + +Filename of the file to find. + +#### options + +##### cwd + +Type: `string` +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 + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/find-cache-dir/node_modules/pkg-dir/index.js b/node_modules/find-cache-dir/node_modules/pkg-dir/index.js new file mode 100644 index 000000000..ab09a3f12 --- /dev/null +++ b/node_modules/find-cache-dir/node_modules/pkg-dir/index.js @@ -0,0 +1,14 @@ +'use strict'; +var path = require('path'); +var findUp = require('find-up'); + +module.exports = function (cwd) { + return findUp('package.json', {cwd: cwd}).then(function (fp) { + return fp ? path.dirname(fp) : null; + }); +}; + +module.exports.sync = function (cwd) { + var fp = findUp.sync('package.json', {cwd: cwd}); + return fp ? path.dirname(fp) : null; +}; diff --git a/node_modules/find-cache-dir/node_modules/pkg-dir/license b/node_modules/find-cache-dir/node_modules/pkg-dir/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/find-cache-dir/node_modules/pkg-dir/license @@ -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. diff --git a/node_modules/find-cache-dir/node_modules/pkg-dir/package.json b/node_modules/find-cache-dir/node_modules/pkg-dir/package.json new file mode 100644 index 000000000..81f38d5cd --- /dev/null +++ b/node_modules/find-cache-dir/node_modules/pkg-dir/package.json @@ -0,0 +1,54 @@ +{ + "name": "pkg-dir", + "version": "1.0.0", + "description": "Find the root directory of a npm package", + "license": "MIT", + "repository": "sindresorhus/pkg-dir", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "package", + "json", + "root", + "npm", + "entry", + "find", + "up", + "find-up", + "findup", + "look-up", + "look", + "file", + "search", + "match", + "package", + "resolve", + "parent", + "parents", + "folder", + "directory", + "dir", + "walk", + "walking", + "path" + ], + "dependencies": { + "find-up": "^1.0.0" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/find-cache-dir/node_modules/pkg-dir/readme.md b/node_modules/find-cache-dir/node_modules/pkg-dir/readme.md new file mode 100644 index 000000000..82bb83517 --- /dev/null +++ b/node_modules/find-cache-dir/node_modules/pkg-dir/readme.md @@ -0,0 +1,63 @@ +# pkg-dir [![Build Status](https://travis-ci.org/sindresorhus/pkg-dir.svg?branch=master)](https://travis-ci.org/sindresorhus/pkg-dir) + +> Find the root directory of a npm package + + +## Install + +``` +$ npm install --save pkg-dir +``` + + +## Usage + +``` +/ +└── Users + └── sindresorhus + └── foo + ├── package.json + └── bar + ├── baz + └── example.js +``` + +```js +// example.js +var pkgDir = require('pkg-dir'); + +pkgDir(__dirname).then(function (rootPath) { + console.log(rootPath); + //=> '/Users/sindresorhus/foo' +}); +``` + + +## API + +### pkgDir([cwd]) + +Returns a promise that resolves to the package root path or `null`. + +### pkgDir.sync([cwd]) + +Returns the package root path or `null`. + +#### cwd + +Type: `string` +Default: `process.cwd()` + +Directory to start from. + + +## Related + +- [pkg-dir-cli](https://github.com/sindresorhus/pkg-dir-cli) - CLI for this module +- [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) |