This commit is contained in:
2024-03-22 03:47:51 +05:30
parent 8bcf3d211e
commit 89819f6fe2
28440 changed files with 3211033 additions and 2 deletions

58
node_modules/pkg-dir/index.d.ts generated vendored Normal file
View 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
node_modules/pkg-dir/index.js generated vendored Normal file
View 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
node_modules/pkg-dir/license generated vendored Normal file
View 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.

59
node_modules/pkg-dir/package.json generated vendored Normal file
View 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
node_modules/pkg-dir/readme.md generated vendored Normal file
View 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>