Updated the files.
This commit is contained in:
parent
1553e6b971
commit
753967d4f5
23418 changed files with 3784666 additions and 0 deletions
58
my-app/node_modules/pkg-dir/index.d.ts
generated
vendored
Executable file
58
my-app/node_modules/pkg-dir/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,58 @@
|
|||
export interface Options {
|
||||
/**
|
||||
The directory to start searching from.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
Find the root directory of a Node.js project or npm package.
|
||||
|
||||
@returns The project root path or `undefined` if it could not be found.
|
||||
|
||||
@example
|
||||
```
|
||||
// /
|
||||
// └── Users
|
||||
// └── sindresorhus
|
||||
// └── foo
|
||||
// ├── package.json
|
||||
// └── bar
|
||||
// ├── baz
|
||||
// └── example.js
|
||||
|
||||
// example.js
|
||||
import {packageDirectory} from 'pkg-dir';
|
||||
|
||||
console.log(await packageDirectory());
|
||||
//=> '/Users/sindresorhus/foo'
|
||||
```
|
||||
*/
|
||||
export function packageDirectory(options?: Options): Promise<string | undefined>;
|
||||
|
||||
/**
|
||||
Synchronously find the root directory of a Node.js project or npm package.
|
||||
|
||||
@returns The project root path or `undefined` if it could not be found.
|
||||
|
||||
@example
|
||||
```
|
||||
// /
|
||||
// └── Users
|
||||
// └── sindresorhus
|
||||
// └── foo
|
||||
// ├── package.json
|
||||
// └── bar
|
||||
// ├── baz
|
||||
// └── example.js
|
||||
|
||||
// example.js
|
||||
import {packageDirectorySync} from 'pkg-dir';
|
||||
|
||||
console.log(packageDirectorySync());
|
||||
//=> '/Users/sindresorhus/foo'
|
||||
```
|
||||
*/
|
||||
export function packageDirectorySync(options?: Options): string | undefined;
|
12
my-app/node_modules/pkg-dir/index.js
generated
vendored
Executable file
12
my-app/node_modules/pkg-dir/index.js
generated
vendored
Executable file
|
@ -0,0 +1,12 @@
|
|||
import path from 'node:path';
|
||||
import {findUp, findUpSync} from 'find-up';
|
||||
|
||||
export async function packageDirectory({cwd} = {}) {
|
||||
const filePath = await findUp('package.json', {cwd});
|
||||
return filePath && path.dirname(filePath);
|
||||
}
|
||||
|
||||
export function packageDirectorySync({cwd} = {}) {
|
||||
const filePath = findUpSync('package.json', {cwd});
|
||||
return filePath && path.dirname(filePath);
|
||||
}
|
9
my-app/node_modules/pkg-dir/license
generated
vendored
Executable file
9
my-app/node_modules/pkg-dir/license
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://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.
|
248
my-app/node_modules/pkg-dir/node_modules/find-up/index.d.ts
generated
vendored
Executable file
248
my-app/node_modules/pkg-dir/node_modules/find-up/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,248 @@
|
|||
/* eslint-disable @typescript-eslint/unified-signatures */
|
||||
import {Options as LocatePathOptions} from 'locate-path';
|
||||
|
||||
/**
|
||||
Return this in a `matcher` function to stop the search and force `findUp` to immediately return `undefined`.
|
||||
*/
|
||||
export const findUpStop: unique symbol;
|
||||
|
||||
export type Match = string | typeof findUpStop | undefined;
|
||||
|
||||
export interface Options extends LocatePathOptions {
|
||||
/**
|
||||
The path to the directory to stop the search before reaching root if there were no matches before the `stopAt` directory.
|
||||
|
||||
@default path.parse(cwd).root
|
||||
*/
|
||||
readonly stopAt?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
Find a file or directory by walking up parent directories.
|
||||
|
||||
@param name - The name of the file or directory to find. Can be multiple.
|
||||
@returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found.
|
||||
|
||||
@example
|
||||
```
|
||||
// /
|
||||
// └── Users
|
||||
// └── sindresorhus
|
||||
// ├── unicorn.png
|
||||
// └── foo
|
||||
// └── bar
|
||||
// ├── baz
|
||||
// └── example.js
|
||||
|
||||
// example.js
|
||||
import {findUp} from 'find-up';
|
||||
|
||||
console.log(await findUp('unicorn.png'));
|
||||
//=> '/Users/sindresorhus/unicorn.png'
|
||||
|
||||
console.log(await findUp(['rainbow.png', 'unicorn.png']));
|
||||
//=> '/Users/sindresorhus/unicorn.png'
|
||||
```
|
||||
*/
|
||||
export function findUp(name: string | readonly string[], options?: Options): Promise<string | undefined>;
|
||||
|
||||
/**
|
||||
Find a file or directory by walking up parent directories.
|
||||
|
||||
@param matcher - Called for each directory in the search. Return a path or `findUpStop` to stop the search.
|
||||
@returns The first path found or `undefined` if none could be found.
|
||||
|
||||
@example
|
||||
```
|
||||
import path from 'node:path';
|
||||
import {findUp, pathExists} from 'find-up';
|
||||
|
||||
console.log(await findUp(async directory => {
|
||||
const hasUnicorns = await pathExists(path.join(directory, 'unicorn.png'));
|
||||
return hasUnicorns && directory;
|
||||
}, {type: 'directory'}));
|
||||
//=> '/Users/sindresorhus'
|
||||
```
|
||||
*/
|
||||
export function findUp(matcher: (directory: string) => (Match | Promise<Match>), options?: Options): Promise<string | undefined>;
|
||||
|
||||
/**
|
||||
Synchronously find a file or directory by walking up parent directories.
|
||||
|
||||
@param name - The name of the file or directory to find. Can be multiple.
|
||||
@returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found.
|
||||
|
||||
@example
|
||||
```
|
||||
// /
|
||||
// └── Users
|
||||
// └── sindresorhus
|
||||
// ├── unicorn.png
|
||||
// └── foo
|
||||
// └── bar
|
||||
// ├── baz
|
||||
// └── example.js
|
||||
|
||||
// example.js
|
||||
import {findUpSync} from 'find-up';
|
||||
|
||||
console.log(findUpSync('unicorn.png'));
|
||||
//=> '/Users/sindresorhus/unicorn.png'
|
||||
|
||||
console.log(findUpSync(['rainbow.png', 'unicorn.png']));
|
||||
//=> '/Users/sindresorhus/unicorn.png'
|
||||
```
|
||||
*/
|
||||
export function findUpSync(name: string | readonly string[], options?: Options): string | undefined;
|
||||
|
||||
/**
|
||||
Synchronously find a file or directory by walking up parent directories.
|
||||
|
||||
@param matcher - Called for each directory in the search. Return a path or `findUpStop` to stop the search.
|
||||
@returns The first path found or `undefined` if none could be found.
|
||||
|
||||
@example
|
||||
```
|
||||
import path from 'node:path';
|
||||
import {findUpSync, pathExistsSync} from 'find-up';
|
||||
|
||||
console.log(findUpSync(directory => {
|
||||
const hasUnicorns = pathExistsSync(path.join(directory, 'unicorn.png'));
|
||||
return hasUnicorns && directory;
|
||||
}, {type: 'directory'}));
|
||||
//=> '/Users/sindresorhus'
|
||||
```
|
||||
*/
|
||||
export function findUpSync(matcher: (directory: string) => Match, options?: Options): string | undefined;
|
||||
|
||||
/**
|
||||
Find files or directories by walking up parent directories.
|
||||
|
||||
@param name - The name of the file or directory to find. Can be multiple.
|
||||
@returns All paths found (by respecting the order of `name`s) or an empty array if none could be found.
|
||||
|
||||
@example
|
||||
```
|
||||
// /
|
||||
// └── Users
|
||||
// └── sindresorhus
|
||||
// ├── unicorn.png
|
||||
// └── foo
|
||||
// ├── unicorn.png
|
||||
// └── bar
|
||||
// ├── baz
|
||||
// └── example.js
|
||||
|
||||
// example.js
|
||||
import {findUpMultiple} from 'find-up';
|
||||
|
||||
console.log(await findUpMultiple('unicorn.png'));
|
||||
//=> ['/Users/sindresorhus/foo/unicorn.png', '/Users/sindresorhus/unicorn.png']
|
||||
|
||||
console.log(await findUpMultiple(['rainbow.png', 'unicorn.png']));
|
||||
//=> ['/Users/sindresorhus/foo/unicorn.png', '/Users/sindresorhus/unicorn.png']
|
||||
```
|
||||
*/
|
||||
export function findUpMultiple(name: string | readonly string[], options?: Options): Promise<string[]>;
|
||||
|
||||
/**
|
||||
Find files or directories by walking up parent directories.
|
||||
|
||||
@param matcher - Called for each directory in the search. Return a path or `findUpStop` to stop the search.
|
||||
@returns All paths found or an empty array if none could be found.
|
||||
|
||||
@example
|
||||
```
|
||||
import path from 'node:path';
|
||||
import {findUpMultiple, pathExists} from 'find-up';
|
||||
|
||||
console.log(await findUpMultiple(async directory => {
|
||||
const hasUnicorns = await pathExists(path.join(directory, 'unicorn.png'));
|
||||
return hasUnicorns && directory;
|
||||
}, {type: 'directory'}));
|
||||
//=> ['/Users/sindresorhus/foo', '/Users/sindresorhus']
|
||||
```
|
||||
*/
|
||||
export function findUpMultiple(matcher: (directory: string) => (Match | Promise<Match>), options?: Options): Promise<string[]>;
|
||||
|
||||
/**
|
||||
Synchronously find files or directories by walking up parent directories.
|
||||
|
||||
@param name - The name of the file or directory to find. Can be multiple.
|
||||
@returns All paths found (by respecting the order of `name`s) or an empty array if none could be found.
|
||||
|
||||
@example
|
||||
```
|
||||
// /
|
||||
// └── Users
|
||||
// └── sindresorhus
|
||||
// ├── unicorn.png
|
||||
// └── foo
|
||||
// ├── unicorn.png
|
||||
// └── bar
|
||||
// ├── baz
|
||||
// └── example.js
|
||||
|
||||
// example.js
|
||||
import {findUpMultipleSync} from 'find-up';
|
||||
|
||||
console.log(findUpMultipleSync('unicorn.png'));
|
||||
//=> ['/Users/sindresorhus/foo/unicorn.png', '/Users/sindresorhus/unicorn.png']
|
||||
|
||||
console.log(findUpMultipleSync(['rainbow.png', 'unicorn.png']));
|
||||
//=> ['/Users/sindresorhus/foo/unicorn.png', '/Users/sindresorhus/unicorn.png']
|
||||
```
|
||||
*/
|
||||
export function findUpMultipleSync(name: string | readonly string[], options?: Options): string[];
|
||||
|
||||
/**
|
||||
Synchronously find files or directories by walking up parent directories.
|
||||
|
||||
@param matcher - Called for each directory in the search. Return a path or `findUpStop` to stop the search.
|
||||
@returns All paths found or an empty array if none could be found.
|
||||
|
||||
@example
|
||||
```
|
||||
import path from 'node:path';
|
||||
import {findUpMultipleSync, pathExistsSync} from 'find-up';
|
||||
|
||||
console.log(findUpMultipleSync(directory => {
|
||||
const hasUnicorns = pathExistsSync(path.join(directory, 'unicorn.png'));
|
||||
return hasUnicorns && directory;
|
||||
}, {type: 'directory'}));
|
||||
//=> ['/Users/sindresorhus/foo', '/Users/sindresorhus']
|
||||
```
|
||||
*/
|
||||
export function findUpMultipleSync(matcher: (directory: string) => Match, options?: Options): string[];
|
||||
|
||||
/**
|
||||
Check if a path exists.
|
||||
|
||||
@param path - The path to a file or directory.
|
||||
@returns Whether the path exists.
|
||||
|
||||
@example
|
||||
```
|
||||
import {pathExists} from 'find-up';
|
||||
|
||||
console.log(await pathExists('/Users/sindresorhus/unicorn.png'));
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
export function pathExists(path: string): Promise<boolean>;
|
||||
|
||||
/**
|
||||
Synchronously check if a path exists.
|
||||
|
||||
@param path - Path to the file or directory.
|
||||
@returns Whether the path exists.
|
||||
|
||||
@example
|
||||
```
|
||||
import {pathExistsSync} from 'find-up';
|
||||
|
||||
console.log(pathExistsSync('/Users/sindresorhus/unicorn.png'));
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
export function pathExistsSync(path: string): boolean;
|
109
my-app/node_modules/pkg-dir/node_modules/find-up/index.js
generated
vendored
Executable file
109
my-app/node_modules/pkg-dir/node_modules/find-up/index.js
generated
vendored
Executable file
|
@ -0,0 +1,109 @@
|
|||
import path from 'node:path';
|
||||
import {fileURLToPath} from 'node:url';
|
||||
import {locatePath, locatePathSync} from 'locate-path';
|
||||
|
||||
const toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
||||
|
||||
export const findUpStop = Symbol('findUpStop');
|
||||
|
||||
export async function findUpMultiple(name, options = {}) {
|
||||
let directory = path.resolve(toPath(options.cwd) || '');
|
||||
const {root} = path.parse(directory);
|
||||
const stopAt = path.resolve(directory, options.stopAt || root);
|
||||
const limit = options.limit || Number.POSITIVE_INFINITY;
|
||||
const paths = [name].flat();
|
||||
|
||||
const runMatcher = async locateOptions => {
|
||||
if (typeof name !== 'function') {
|
||||
return locatePath(paths, locateOptions);
|
||||
}
|
||||
|
||||
const foundPath = await name(locateOptions.cwd);
|
||||
if (typeof foundPath === 'string') {
|
||||
return locatePath([foundPath], locateOptions);
|
||||
}
|
||||
|
||||
return foundPath;
|
||||
};
|
||||
|
||||
const matches = [];
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const foundPath = await runMatcher({...options, cwd: directory});
|
||||
|
||||
if (foundPath === findUpStop) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (foundPath) {
|
||||
matches.push(path.resolve(directory, foundPath));
|
||||
}
|
||||
|
||||
if (directory === stopAt || matches.length >= limit) {
|
||||
break;
|
||||
}
|
||||
|
||||
directory = path.dirname(directory);
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
||||
export function findUpMultipleSync(name, options = {}) {
|
||||
let directory = path.resolve(toPath(options.cwd) || '');
|
||||
const {root} = path.parse(directory);
|
||||
const stopAt = options.stopAt || root;
|
||||
const limit = options.limit || Number.POSITIVE_INFINITY;
|
||||
const paths = [name].flat();
|
||||
|
||||
const runMatcher = locateOptions => {
|
||||
if (typeof name !== 'function') {
|
||||
return locatePathSync(paths, locateOptions);
|
||||
}
|
||||
|
||||
const foundPath = name(locateOptions.cwd);
|
||||
if (typeof foundPath === 'string') {
|
||||
return locatePathSync([foundPath], locateOptions);
|
||||
}
|
||||
|
||||
return foundPath;
|
||||
};
|
||||
|
||||
const matches = [];
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
const foundPath = runMatcher({...options, cwd: directory});
|
||||
|
||||
if (foundPath === findUpStop) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (foundPath) {
|
||||
matches.push(path.resolve(directory, foundPath));
|
||||
}
|
||||
|
||||
if (directory === stopAt || matches.length >= limit) {
|
||||
break;
|
||||
}
|
||||
|
||||
directory = path.dirname(directory);
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
||||
export async function findUp(name, options = {}) {
|
||||
const matches = await findUpMultiple(name, {...options, limit: 1});
|
||||
return matches[0];
|
||||
}
|
||||
|
||||
export function findUpSync(name, options = {}) {
|
||||
const matches = findUpMultipleSync(name, {...options, limit: 1});
|
||||
return matches[0];
|
||||
}
|
||||
|
||||
export {
|
||||
pathExists,
|
||||
pathExistsSync,
|
||||
} from 'path-exists';
|
9
my-app/node_modules/pkg-dir/node_modules/find-up/license
generated
vendored
Executable file
9
my-app/node_modules/pkg-dir/node_modules/find-up/license
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://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.
|
56
my-app/node_modules/pkg-dir/node_modules/find-up/package.json
generated
vendored
Executable file
56
my-app/node_modules/pkg-dir/node_modules/find-up/package.json
generated
vendored
Executable file
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"name": "find-up",
|
||||
"version": "6.3.0",
|
||||
"description": "Find a file or directory by walking up parent directories",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/find-up",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"find",
|
||||
"up",
|
||||
"find-up",
|
||||
"findup",
|
||||
"look-up",
|
||||
"look",
|
||||
"file",
|
||||
"search",
|
||||
"match",
|
||||
"package",
|
||||
"resolve",
|
||||
"parent",
|
||||
"parents",
|
||||
"folder",
|
||||
"directory",
|
||||
"walk",
|
||||
"walking",
|
||||
"path"
|
||||
],
|
||||
"dependencies": {
|
||||
"locate-path": "^7.1.0",
|
||||
"path-exists": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^3.15.0",
|
||||
"is-path-inside": "^4.0.0",
|
||||
"tempy": "^2.0.0",
|
||||
"tsd": "^0.17.0",
|
||||
"xo": "^0.44.0"
|
||||
}
|
||||
}
|
172
my-app/node_modules/pkg-dir/node_modules/find-up/readme.md
generated
vendored
Executable file
172
my-app/node_modules/pkg-dir/node_modules/find-up/readme.md
generated
vendored
Executable file
|
@ -0,0 +1,172 @@
|
|||
# find-up
|
||||
|
||||
> 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
|
||||
import path from 'node:path';
|
||||
import {findUp, pathExists} from 'find-up';
|
||||
|
||||
console.log(await findUp('unicorn.png'));
|
||||
//=> '/Users/sindresorhus/unicorn.png'
|
||||
|
||||
console.log(await findUp(['rainbow.png', 'unicorn.png']));
|
||||
//=> '/Users/sindresorhus/unicorn.png'
|
||||
|
||||
console.log(await findUp(async directory => {
|
||||
const hasUnicorns = await pathExists(path.join(directory, 'unicorn.png'));
|
||||
return hasUnicorns && directory;
|
||||
}, {type: 'directory'}));
|
||||
//=> '/Users/sindresorhus'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### findUp(name, options?)
|
||||
### findUp(matcher, options?)
|
||||
|
||||
Returns a `Promise` for either the path or `undefined` if it couldn't be found.
|
||||
|
||||
### findUp([...name], options?)
|
||||
|
||||
Returns a `Promise` for either the first path found (by respecting the order of the array) or `undefined` if none could be found.
|
||||
|
||||
### findUpMultiple(name, options?)
|
||||
### findUpMultiple(matcher, options?)
|
||||
|
||||
Returns a `Promise` for either an array of paths or an empty array if none could be found.
|
||||
|
||||
### findUpMultiple([...name], options?)
|
||||
|
||||
Returns a `Promise` for either an array of the first paths found (by respecting the order of the array) or an empty array if none could be found.
|
||||
|
||||
### findUpSync(name, options?)
|
||||
### findUpSync(matcher, options?)
|
||||
|
||||
Returns a path or `undefined` if it couldn't be found.
|
||||
|
||||
### findUpSync([...name], options?)
|
||||
|
||||
Returns the first path found (by respecting the order of the array) or `undefined` if none could be found.
|
||||
|
||||
### findUpMultipleSync(name, options?)
|
||||
### findUpMultipleSync(matcher, options?)
|
||||
|
||||
Returns an array of paths or an empty array if none could be found.
|
||||
|
||||
### findUpMultipleSync([...name], options?)
|
||||
|
||||
Returns an array of the first paths found (by respecting the order of the array) or an empty array if none could be found.
|
||||
|
||||
#### name
|
||||
|
||||
Type: `string`
|
||||
|
||||
The name of the file or directory to find.
|
||||
|
||||
#### matcher
|
||||
|
||||
Type: `Function`
|
||||
|
||||
A function that will be called with each directory until it returns a `string` with the path, which stops the search, or the root directory has been reached and nothing was found. Useful if you want to match files with certain patterns, set of permissions, or other advanced use-cases.
|
||||
|
||||
When using async mode, the `matcher` may optionally be an async or promise-returning function that returns the path.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `URL | string`\
|
||||
Default: `process.cwd()`
|
||||
|
||||
The directory to start from.
|
||||
|
||||
##### type
|
||||
|
||||
Type: `string`\
|
||||
Default: `'file'`\
|
||||
Values: `'file'` `'directory'`
|
||||
|
||||
The type of paths that can match.
|
||||
|
||||
##### allowSymlinks
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
Allow symbolic links to match if they point to the chosen path type.
|
||||
|
||||
##### stopAt
|
||||
|
||||
Type: `string`\
|
||||
Default: `path.parse(cwd).root`
|
||||
|
||||
The path to the directory to stop the search before reaching root if there were no matches before the `stopAt` directory.
|
||||
|
||||
### pathExists(path)
|
||||
|
||||
Returns a `Promise<boolean>` of whether the path exists.
|
||||
|
||||
### pathExistsSync(path)
|
||||
|
||||
Returns a `boolean` of whether the path exists.
|
||||
|
||||
#### path
|
||||
|
||||
Type: `string`
|
||||
|
||||
The path to a file or directory.
|
||||
|
||||
### findUpStop
|
||||
|
||||
A [`Symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) that can be returned by a `matcher` function to stop the search and cause `findUp` to immediately return `undefined`. Useful as a performance optimization in case the current working directory is deeply nested in the filesystem.
|
||||
|
||||
```js
|
||||
import path from 'node:path';
|
||||
import {findUp, findUpStop} from 'find-up';
|
||||
|
||||
await findUp(directory => {
|
||||
return path.basename(directory) === 'work' ? findUpStop : 'logo.png';
|
||||
});
|
||||
```
|
||||
|
||||
## 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
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-find-up?utm_source=npm-find-up&utm_medium=referral&utm_campaign=readme">Get professional support for 'find-up' with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
92
my-app/node_modules/pkg-dir/node_modules/locate-path/index.d.ts
generated
vendored
Executable file
92
my-app/node_modules/pkg-dir/node_modules/locate-path/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,92 @@
|
|||
export interface Options {
|
||||
/**
|
||||
The current working directory.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: URL | string;
|
||||
|
||||
/**
|
||||
The type of path to match.
|
||||
|
||||
@default 'file'
|
||||
*/
|
||||
readonly type?: 'file' | 'directory';
|
||||
|
||||
/**
|
||||
Allow symbolic links to match if they point to the requested path type.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly allowSymlinks?: boolean;
|
||||
}
|
||||
|
||||
export interface AsyncOptions extends Options {
|
||||
/**
|
||||
The number of concurrently pending promises.
|
||||
|
||||
Minimum: `1`
|
||||
|
||||
@default Infinity
|
||||
*/
|
||||
readonly concurrency?: number;
|
||||
|
||||
/**
|
||||
Preserve `paths` order when searching.
|
||||
|
||||
Disable this to improve performance if you don't care about the order.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly preserveOrder?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
Get the first path that exists on disk of multiple paths.
|
||||
|
||||
@param paths - The paths to check.
|
||||
@returns The first path that exists or `undefined` if none exists.
|
||||
|
||||
@example
|
||||
```
|
||||
import {locatePath} from 'locate-path';
|
||||
|
||||
const files = [
|
||||
'unicorn.png',
|
||||
'rainbow.png', // Only this one actually exists on disk
|
||||
'pony.png'
|
||||
];
|
||||
|
||||
console(await locatePath(files));
|
||||
//=> 'rainbow'
|
||||
```
|
||||
*/
|
||||
export function locatePath(
|
||||
paths: Iterable<string>,
|
||||
options?: AsyncOptions
|
||||
): Promise<string | undefined>;
|
||||
|
||||
/**
|
||||
Synchronously get the first path that exists on disk of multiple paths.
|
||||
|
||||
@param paths - The paths to check.
|
||||
@returns The first path that exists or `undefined` if none exists.
|
||||
|
||||
@example
|
||||
```
|
||||
import {locatePathSync} from 'locate-path';
|
||||
|
||||
const files = [
|
||||
'unicorn.png',
|
||||
'rainbow.png', // Only this one actually exists on disk
|
||||
'pony.png'
|
||||
];
|
||||
|
||||
console(locatePathSync(files));
|
||||
//=> 'rainbow'
|
||||
```
|
||||
*/
|
||||
export function locatePathSync(
|
||||
paths: Iterable<string>,
|
||||
options?: Options
|
||||
): string | undefined;
|
77
my-app/node_modules/pkg-dir/node_modules/locate-path/index.js
generated
vendored
Executable file
77
my-app/node_modules/pkg-dir/node_modules/locate-path/index.js
generated
vendored
Executable file
|
@ -0,0 +1,77 @@
|
|||
import process from 'node:process';
|
||||
import path from 'node:path';
|
||||
import fs, {promises as fsPromises} from 'node:fs';
|
||||
import {fileURLToPath} from 'node:url';
|
||||
import pLocate from 'p-locate';
|
||||
|
||||
const typeMappings = {
|
||||
directory: 'isDirectory',
|
||||
file: 'isFile',
|
||||
};
|
||||
|
||||
function checkType(type) {
|
||||
if (Object.hasOwnProperty.call(typeMappings, type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new Error(`Invalid type specified: ${type}`);
|
||||
}
|
||||
|
||||
const matchType = (type, stat) => stat[typeMappings[type]]();
|
||||
|
||||
const toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
||||
|
||||
export async function locatePath(
|
||||
paths,
|
||||
{
|
||||
cwd = process.cwd(),
|
||||
type = 'file',
|
||||
allowSymlinks = true,
|
||||
concurrency,
|
||||
preserveOrder,
|
||||
} = {},
|
||||
) {
|
||||
checkType(type);
|
||||
cwd = toPath(cwd);
|
||||
|
||||
const statFunction = allowSymlinks ? fsPromises.stat : fsPromises.lstat;
|
||||
|
||||
return pLocate(paths, async path_ => {
|
||||
try {
|
||||
const stat = await statFunction(path.resolve(cwd, path_));
|
||||
return matchType(type, stat);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}, {concurrency, preserveOrder});
|
||||
}
|
||||
|
||||
export function locatePathSync(
|
||||
paths,
|
||||
{
|
||||
cwd = process.cwd(),
|
||||
type = 'file',
|
||||
allowSymlinks = true,
|
||||
} = {},
|
||||
) {
|
||||
checkType(type);
|
||||
cwd = toPath(cwd);
|
||||
|
||||
const statFunction = allowSymlinks ? fs.statSync : fs.lstatSync;
|
||||
|
||||
for (const path_ of paths) {
|
||||
try {
|
||||
const stat = statFunction(path.resolve(cwd, path_), {
|
||||
throwIfNoEntry: false,
|
||||
});
|
||||
|
||||
if (!stat) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (matchType(type, stat)) {
|
||||
return path_;
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
}
|
9
my-app/node_modules/pkg-dir/node_modules/locate-path/license
generated
vendored
Executable file
9
my-app/node_modules/pkg-dir/node_modules/locate-path/license
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://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.
|
48
my-app/node_modules/pkg-dir/node_modules/locate-path/package.json
generated
vendored
Executable file
48
my-app/node_modules/pkg-dir/node_modules/locate-path/package.json
generated
vendored
Executable file
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"name": "locate-path",
|
||||
"version": "7.2.0",
|
||||
"description": "Get the first path that exists on disk of multiple paths",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/locate-path",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"locate",
|
||||
"path",
|
||||
"paths",
|
||||
"file",
|
||||
"files",
|
||||
"exists",
|
||||
"find",
|
||||
"finder",
|
||||
"search",
|
||||
"searcher",
|
||||
"array",
|
||||
"iterable",
|
||||
"iterator"
|
||||
],
|
||||
"dependencies": {
|
||||
"p-locate": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^3.15.0",
|
||||
"tsd": "^0.17.0",
|
||||
"xo": "^0.44.0"
|
||||
}
|
||||
}
|
123
my-app/node_modules/pkg-dir/node_modules/locate-path/readme.md
generated
vendored
Executable file
123
my-app/node_modules/pkg-dir/node_modules/locate-path/readme.md
generated
vendored
Executable file
|
@ -0,0 +1,123 @@
|
|||
# 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
|
||||
import {locatePath} from 'locate-path';
|
||||
|
||||
const files = [
|
||||
'unicorn.png',
|
||||
'rainbow.png', // Only this one actually exists on disk
|
||||
'pony.png'
|
||||
];
|
||||
|
||||
console(await locatePath(files));
|
||||
//=> 'rainbow'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### locatePath(paths, options?)
|
||||
|
||||
Returns a `Promise<string>` for the first path that exists or `undefined` if none exists.
|
||||
|
||||
#### paths
|
||||
|
||||
Type: `Iterable<string>`
|
||||
|
||||
The paths to check.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### concurrency
|
||||
|
||||
Type: `number`\
|
||||
Default: `Infinity`\
|
||||
Minimum: `1`
|
||||
|
||||
The number of concurrently pending promises.
|
||||
|
||||
##### preserveOrder
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
Preserve `paths` order when searching.
|
||||
|
||||
Disable this to improve performance if you don't care about the order.
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `URL | string`\
|
||||
Default: `process.cwd()`
|
||||
|
||||
The current working directory.
|
||||
|
||||
##### type
|
||||
|
||||
Type: `string`\
|
||||
Default: `'file'`\
|
||||
Values: `'file' | 'directory'`
|
||||
|
||||
The type of paths that can match.
|
||||
|
||||
##### allowSymlinks
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
Allow symbolic links to match if they point to the chosen path type.
|
||||
|
||||
### locatePathSync(paths, options?)
|
||||
|
||||
Returns the first path that exists or `undefined` if none exists.
|
||||
|
||||
#### paths
|
||||
|
||||
Type: `Iterable<string>`
|
||||
|
||||
The paths to check.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Same as above.
|
||||
|
||||
##### type
|
||||
|
||||
Same as above.
|
||||
|
||||
##### allowSymlinks
|
||||
|
||||
Same as above.
|
||||
|
||||
## Related
|
||||
|
||||
- [path-exists](https://github.com/sindresorhus/path-exists) - Check if a path exists
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-locate-path?utm_source=npm-locate-path&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
40
my-app/node_modules/pkg-dir/node_modules/p-limit/index.d.ts
generated
vendored
Executable file
40
my-app/node_modules/pkg-dir/node_modules/p-limit/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,40 @@
|
|||
/* eslint-disable @typescript-eslint/member-ordering */
|
||||
|
||||
export interface LimitFunction {
|
||||
/**
|
||||
The number of promises that are currently running.
|
||||
*/
|
||||
readonly activeCount: number;
|
||||
|
||||
/**
|
||||
The number of promises that are waiting to run (i.e. their internal `fn` was not called yet).
|
||||
*/
|
||||
readonly pendingCount: number;
|
||||
|
||||
/**
|
||||
Discard pending promises that are waiting to run.
|
||||
|
||||
This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app.
|
||||
|
||||
Note: This does not cancel promises that are already running.
|
||||
*/
|
||||
clearQueue: () => void;
|
||||
|
||||
/**
|
||||
@param fn - Promise-returning/async function.
|
||||
@param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a lot of functions.
|
||||
@returns The promise returned by calling `fn(...arguments)`.
|
||||
*/
|
||||
<Arguments extends unknown[], ReturnType>(
|
||||
fn: (...arguments: Arguments) => PromiseLike<ReturnType> | ReturnType,
|
||||
...arguments: Arguments
|
||||
): Promise<ReturnType>;
|
||||
}
|
||||
|
||||
/**
|
||||
Run multiple promise-returning & async functions with limited concurrency.
|
||||
|
||||
@param concurrency - Concurrency limit. Minimum: `1`.
|
||||
@returns A `limit` function.
|
||||
*/
|
||||
export default function pLimit(concurrency: number): LimitFunction;
|
68
my-app/node_modules/pkg-dir/node_modules/p-limit/index.js
generated
vendored
Executable file
68
my-app/node_modules/pkg-dir/node_modules/p-limit/index.js
generated
vendored
Executable file
|
@ -0,0 +1,68 @@
|
|||
import Queue from 'yocto-queue';
|
||||
|
||||
export default function pLimit(concurrency) {
|
||||
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
||||
throw new TypeError('Expected `concurrency` to be a number from 1 and up');
|
||||
}
|
||||
|
||||
const queue = new Queue();
|
||||
let activeCount = 0;
|
||||
|
||||
const next = () => {
|
||||
activeCount--;
|
||||
|
||||
if (queue.size > 0) {
|
||||
queue.dequeue()();
|
||||
}
|
||||
};
|
||||
|
||||
const run = async (fn, resolve, args) => {
|
||||
activeCount++;
|
||||
|
||||
const result = (async () => fn(...args))();
|
||||
|
||||
resolve(result);
|
||||
|
||||
try {
|
||||
await result;
|
||||
} catch {}
|
||||
|
||||
next();
|
||||
};
|
||||
|
||||
const enqueue = (fn, resolve, args) => {
|
||||
queue.enqueue(run.bind(undefined, fn, resolve, args));
|
||||
|
||||
(async () => {
|
||||
// This function needs to wait until the next microtask before comparing
|
||||
// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
|
||||
// when the run function is dequeued and called. The comparison in the if-statement
|
||||
// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
|
||||
await Promise.resolve();
|
||||
|
||||
if (activeCount < concurrency && queue.size > 0) {
|
||||
queue.dequeue()();
|
||||
}
|
||||
})();
|
||||
};
|
||||
|
||||
const generator = (fn, ...args) => new Promise(resolve => {
|
||||
enqueue(fn, resolve, args);
|
||||
});
|
||||
|
||||
Object.defineProperties(generator, {
|
||||
activeCount: {
|
||||
get: () => activeCount,
|
||||
},
|
||||
pendingCount: {
|
||||
get: () => queue.size,
|
||||
},
|
||||
clearQueue: {
|
||||
value: () => {
|
||||
queue.clear();
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return generator;
|
||||
}
|
9
my-app/node_modules/pkg-dir/node_modules/p-limit/license
generated
vendored
Executable file
9
my-app/node_modules/pkg-dir/node_modules/p-limit/license
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://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.
|
54
my-app/node_modules/pkg-dir/node_modules/p-limit/package.json
generated
vendored
Executable file
54
my-app/node_modules/pkg-dir/node_modules/p-limit/package.json
generated
vendored
Executable file
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
"name": "p-limit",
|
||||
"version": "4.0.0",
|
||||
"description": "Run multiple promise-returning & async functions with limited concurrency",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/p-limit",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"limit",
|
||||
"limited",
|
||||
"concurrency",
|
||||
"throttle",
|
||||
"throat",
|
||||
"rate",
|
||||
"batch",
|
||||
"ratelimit",
|
||||
"task",
|
||||
"queue",
|
||||
"async",
|
||||
"await",
|
||||
"promises",
|
||||
"bluebird"
|
||||
],
|
||||
"dependencies": {
|
||||
"yocto-queue": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^3.15.0",
|
||||
"delay": "^5.0.0",
|
||||
"in-range": "^3.0.0",
|
||||
"random-int": "^3.0.0",
|
||||
"time-span": "^5.0.0",
|
||||
"tsd": "^0.17.0",
|
||||
"xo": "^0.44.0"
|
||||
}
|
||||
}
|
99
my-app/node_modules/pkg-dir/node_modules/p-limit/readme.md
generated
vendored
Executable file
99
my-app/node_modules/pkg-dir/node_modules/p-limit/readme.md
generated
vendored
Executable file
|
@ -0,0 +1,99 @@
|
|||
# p-limit
|
||||
|
||||
> Run multiple promise-returning & async functions with limited concurrency
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install p-limit
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import pLimit from 'p-limit';
|
||||
|
||||
const limit = pLimit(1);
|
||||
|
||||
const input = [
|
||||
limit(() => fetchSomething('foo')),
|
||||
limit(() => fetchSomething('bar')),
|
||||
limit(() => doSomething())
|
||||
];
|
||||
|
||||
// Only one promise is run at once
|
||||
const result = await Promise.all(input);
|
||||
console.log(result);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### pLimit(concurrency)
|
||||
|
||||
Returns a `limit` function.
|
||||
|
||||
#### concurrency
|
||||
|
||||
Type: `number`\
|
||||
Minimum: `1`\
|
||||
Default: `Infinity`
|
||||
|
||||
Concurrency limit.
|
||||
|
||||
### limit(fn, ...args)
|
||||
|
||||
Returns the promise returned by calling `fn(...args)`.
|
||||
|
||||
#### fn
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Promise-returning/async function.
|
||||
|
||||
#### args
|
||||
|
||||
Any arguments to pass through to `fn`.
|
||||
|
||||
Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a *lot* of functions.
|
||||
|
||||
### limit.activeCount
|
||||
|
||||
The number of promises that are currently running.
|
||||
|
||||
### limit.pendingCount
|
||||
|
||||
The number of promises that are waiting to run (i.e. their internal `fn` was not called yet).
|
||||
|
||||
### limit.clearQueue()
|
||||
|
||||
Discard pending promises that are waiting to run.
|
||||
|
||||
This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app.
|
||||
|
||||
Note: This does not cancel promises that are already running.
|
||||
|
||||
## FAQ
|
||||
|
||||
### How is this different from the [`p-queue`](https://github.com/sindresorhus/p-queue) package?
|
||||
|
||||
This package is only about limiting the number of concurrent executions, while `p-queue` is a fully featured queue implementation with lots of different options, introspection, and ability to pause the queue.
|
||||
|
||||
## Related
|
||||
|
||||
- [p-queue](https://github.com/sindresorhus/p-queue) - Promise queue with concurrency control
|
||||
- [p-throttle](https://github.com/sindresorhus/p-throttle) - Throttle promise-returning & async functions
|
||||
- [p-debounce](https://github.com/sindresorhus/p-debounce) - Debounce promise-returning & async functions
|
||||
- [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency
|
||||
- [More…](https://github.com/sindresorhus/promise-fun)
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-p-limit?utm_source=npm-p-limit&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
49
my-app/node_modules/pkg-dir/node_modules/p-locate/index.d.ts
generated
vendored
Executable file
49
my-app/node_modules/pkg-dir/node_modules/p-locate/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,49 @@
|
|||
export interface Options {
|
||||
/**
|
||||
The number of concurrently pending promises returned by `tester`.
|
||||
|
||||
Minimum: `1`
|
||||
|
||||
@default Infinity
|
||||
*/
|
||||
readonly concurrency?: number;
|
||||
|
||||
/**
|
||||
Preserve `input` order when searching.
|
||||
|
||||
Disable this to improve performance if you don't care about the order.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly preserveOrder?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
Get the first fulfilled promise that satisfies the provided testing function.
|
||||
|
||||
@param input - An iterable of promises/values to test.
|
||||
@param tester - This function will receive resolved values from `input` and is expected to return a `Promise<boolean>` or `boolean`.
|
||||
@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`.
|
||||
|
||||
@example
|
||||
```
|
||||
import {pathExists} from 'path-exists';
|
||||
import pLocate from 'p-locate';
|
||||
|
||||
const files = [
|
||||
'unicorn.png',
|
||||
'rainbow.png', // Only this one actually exists on disk
|
||||
'pony.png'
|
||||
];
|
||||
|
||||
const foundPath = await pLocate(files, file => pathExists(file));
|
||||
|
||||
console.log(foundPath);
|
||||
//=> 'rainbow'
|
||||
```
|
||||
*/
|
||||
export default function pLocate<ValueType>(
|
||||
input: Iterable<PromiseLike<ValueType> | ValueType>,
|
||||
tester: (element: ValueType) => PromiseLike<boolean> | boolean,
|
||||
options?: Options
|
||||
): Promise<ValueType | undefined>;
|
48
my-app/node_modules/pkg-dir/node_modules/p-locate/index.js
generated
vendored
Executable file
48
my-app/node_modules/pkg-dir/node_modules/p-locate/index.js
generated
vendored
Executable file
|
@ -0,0 +1,48 @@
|
|||
import pLimit from 'p-limit';
|
||||
|
||||
class EndError extends Error {
|
||||
constructor(value) {
|
||||
super();
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
// The input can also be a promise, so we await it.
|
||||
const testElement = async (element, tester) => tester(await element);
|
||||
|
||||
// The input can also be a promise, so we `Promise.all()` them both.
|
||||
const finder = async element => {
|
||||
const values = await Promise.all(element);
|
||||
if (values[1] === true) {
|
||||
throw new EndError(values[0]);
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
export default async function pLocate(
|
||||
iterable,
|
||||
tester,
|
||||
{
|
||||
concurrency = Number.POSITIVE_INFINITY,
|
||||
preserveOrder = true,
|
||||
} = {},
|
||||
) {
|
||||
const limit = pLimit(concurrency);
|
||||
|
||||
// Start all the promises concurrently with optional limit.
|
||||
const items = [...iterable].map(element => [element, limit(testElement, element, tester)]);
|
||||
|
||||
// Check the promises either serially or concurrently.
|
||||
const checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);
|
||||
|
||||
try {
|
||||
await Promise.all(items.map(element => checkLimit(finder, element)));
|
||||
} catch (error) {
|
||||
if (error instanceof EndError) {
|
||||
return error.value;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
9
my-app/node_modules/pkg-dir/node_modules/p-locate/license
generated
vendored
Executable file
9
my-app/node_modules/pkg-dir/node_modules/p-locate/license
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://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.
|
56
my-app/node_modules/pkg-dir/node_modules/p-locate/package.json
generated
vendored
Executable file
56
my-app/node_modules/pkg-dir/node_modules/p-locate/package.json
generated
vendored
Executable file
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"name": "p-locate",
|
||||
"version": "6.0.0",
|
||||
"description": "Get the first fulfilled promise that satisfies the provided testing function",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/p-locate",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"locate",
|
||||
"find",
|
||||
"finder",
|
||||
"search",
|
||||
"searcher",
|
||||
"test",
|
||||
"array",
|
||||
"collection",
|
||||
"iterable",
|
||||
"iterator",
|
||||
"race",
|
||||
"fulfilled",
|
||||
"fastest",
|
||||
"async",
|
||||
"await",
|
||||
"promises",
|
||||
"bluebird"
|
||||
],
|
||||
"dependencies": {
|
||||
"p-limit": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^3.15.0",
|
||||
"delay": "^5.0.0",
|
||||
"in-range": "^3.0.0",
|
||||
"time-span": "^5.0.0",
|
||||
"tsd": "^0.17.0",
|
||||
"xo": "^0.44.0"
|
||||
}
|
||||
}
|
91
my-app/node_modules/pkg-dir/node_modules/p-locate/readme.md
generated
vendored
Executable file
91
my-app/node_modules/pkg-dir/node_modules/p-locate/readme.md
generated
vendored
Executable file
|
@ -0,0 +1,91 @@
|
|||
# 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
|
||||
import {pathExists} from 'path-exists';
|
||||
import pLocate from 'p-locate';
|
||||
|
||||
const files = [
|
||||
'unicorn.png',
|
||||
'rainbow.png', // Only this one actually exists on disk
|
||||
'pony.png'
|
||||
];
|
||||
|
||||
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 | unknown>`
|
||||
|
||||
An iterable of promises/values to test.
|
||||
|
||||
#### tester(element)
|
||||
|
||||
Type: `Function`
|
||||
|
||||
This function will receive resolved values from `input` and is expected to return a `Promise<boolean>` or `boolean`.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### concurrency
|
||||
|
||||
Type: `number`\
|
||||
Default: `Infinity`\
|
||||
Minimum: `1`
|
||||
|
||||
The number of concurrently pending promises returned by `tester`.
|
||||
|
||||
##### preserveOrder
|
||||
|
||||
Type: `boolean`\
|
||||
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)
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-p-locate?utm_source=npm-p-locate&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
31
my-app/node_modules/pkg-dir/node_modules/path-exists/index.d.ts
generated
vendored
Executable file
31
my-app/node_modules/pkg-dir/node_modules/path-exists/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
Check if a path exists.
|
||||
|
||||
@returns Whether the path exists.
|
||||
|
||||
@example
|
||||
```
|
||||
// foo.ts
|
||||
import {pathExists} from 'path-exists';
|
||||
|
||||
console.log(await pathExists('foo.ts'));
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
export function pathExists(path: string): Promise<boolean>;
|
||||
|
||||
/**
|
||||
Synchronously check if a path exists.
|
||||
|
||||
@returns Whether the path exists.
|
||||
|
||||
@example
|
||||
```
|
||||
// foo.ts
|
||||
import {pathExistsSync} from 'path-exists';
|
||||
|
||||
console.log(pathExistsSync('foo.ts'));
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
export function pathExistsSync(path: string): boolean;
|
19
my-app/node_modules/pkg-dir/node_modules/path-exists/index.js
generated
vendored
Executable file
19
my-app/node_modules/pkg-dir/node_modules/path-exists/index.js
generated
vendored
Executable file
|
@ -0,0 +1,19 @@
|
|||
import fs, {promises as fsPromises} from 'node:fs';
|
||||
|
||||
export async function pathExists(path) {
|
||||
try {
|
||||
await fsPromises.access(path);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function pathExistsSync(path) {
|
||||
try {
|
||||
fs.accessSync(path);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
9
my-app/node_modules/pkg-dir/node_modules/path-exists/license
generated
vendored
Executable file
9
my-app/node_modules/pkg-dir/node_modules/path-exists/license
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://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.
|
41
my-app/node_modules/pkg-dir/node_modules/path-exists/package.json
generated
vendored
Executable file
41
my-app/node_modules/pkg-dir/node_modules/path-exists/package.json
generated
vendored
Executable file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"name": "path-exists",
|
||||
"version": "5.0.0",
|
||||
"description": "Check if a path exists",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/path-exists",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"path",
|
||||
"exists",
|
||||
"exist",
|
||||
"file",
|
||||
"filepath",
|
||||
"fs",
|
||||
"filesystem",
|
||||
"file-system",
|
||||
"access",
|
||||
"stat"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^3.15.0",
|
||||
"tsd": "^0.17.0",
|
||||
"xo": "^0.44.0"
|
||||
}
|
||||
}
|
52
my-app/node_modules/pkg-dir/node_modules/path-exists/readme.md
generated
vendored
Executable file
52
my-app/node_modules/pkg-dir/node_modules/path-exists/readme.md
generated
vendored
Executable file
|
@ -0,0 +1,52 @@
|
|||
# path-exists
|
||||
|
||||
> Check if a path exists
|
||||
|
||||
NOTE: `fs.existsSync` has been un-deprecated in Node.js since 6.8.0. If you only need to check synchronously, this module is not needed.
|
||||
|
||||
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 path-exists
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// foo.js
|
||||
import {pathExists} from 'path-exists';
|
||||
|
||||
console.log(await pathExists('foo.js'));
|
||||
//=> true
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### pathExists(path)
|
||||
|
||||
Returns a `Promise<boolean>` of whether the path exists.
|
||||
|
||||
### pathExistsSync(path)
|
||||
|
||||
Returns a `boolean` of whether the path exists.
|
||||
|
||||
## Related
|
||||
|
||||
- [path-exists-cli](https://github.com/sindresorhus/path-exists-cli) - CLI for this module
|
||||
- [path-type](https://github.com/sindresorhus/path-type) - Check if a path exists and whether it's a file, directory, or symlink
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-path-exists?utm_source=npm-path-exists&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
59
my-app/node_modules/pkg-dir/package.json
generated
vendored
Executable file
59
my-app/node_modules/pkg-dir/package.json
generated
vendored
Executable file
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
"name": "pkg-dir",
|
||||
"version": "7.0.0",
|
||||
"description": "Find the root directory of a Node.js project or npm package",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/pkg-dir",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": ">=14.16"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"package",
|
||||
"json",
|
||||
"root",
|
||||
"npm",
|
||||
"entry",
|
||||
"find",
|
||||
"up",
|
||||
"find-up",
|
||||
"findup",
|
||||
"look-up",
|
||||
"look",
|
||||
"file",
|
||||
"search",
|
||||
"match",
|
||||
"resolve",
|
||||
"parent",
|
||||
"parents",
|
||||
"folder",
|
||||
"directory",
|
||||
"walk",
|
||||
"walking",
|
||||
"path"
|
||||
],
|
||||
"dependencies": {
|
||||
"find-up": "^6.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^4.3.1",
|
||||
"tempy": "^3.0.0",
|
||||
"tsd": "^0.22.0",
|
||||
"typescript": "^4.7.4",
|
||||
"xo": "^0.51.0"
|
||||
}
|
||||
}
|
69
my-app/node_modules/pkg-dir/readme.md
generated
vendored
Executable file
69
my-app/node_modules/pkg-dir/readme.md
generated
vendored
Executable file
|
@ -0,0 +1,69 @@
|
|||
# pkg-dir
|
||||
|
||||
> Find the root directory of a Node.js project or npm package
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install pkg-dir
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
/
|
||||
└── Users
|
||||
└── sindresorhus
|
||||
└── foo
|
||||
├── package.json
|
||||
└── bar
|
||||
├── baz
|
||||
└── example.js
|
||||
```
|
||||
|
||||
```js
|
||||
// example.js
|
||||
import {packageDirectory} from 'pkg-dir';
|
||||
|
||||
console.log(await packageDirectory());
|
||||
//=> '/Users/sindresorhus/foo'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### packageDirectory(option?)
|
||||
|
||||
Returns a `Promise` for either the project root path or `undefined` if it could not be found.
|
||||
|
||||
### packageDirectorySync(options?)
|
||||
|
||||
Returns the project root path or `undefined` if it could not be found.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`\
|
||||
Default: `process.cwd()`
|
||||
|
||||
The directory to start searching from.
|
||||
|
||||
## Related
|
||||
|
||||
- [pkg-dir-cli](https://github.com/sindresorhus/pkg-dir-cli) - CLI for this module
|
||||
- [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
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-pkg-dir?utm_source=npm-pkg-dir&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue