Upgrade Ava to v4
This commit is contained in:
parent
9a40cc5274
commit
ce89f1b611
1153 changed files with 27264 additions and 95308 deletions
165
node_modules/pkg-conf/index.d.ts
generated
vendored
165
node_modules/pkg-conf/index.d.ts
generated
vendored
|
|
@ -1,92 +1,99 @@
|
|||
declare namespace pkgConf {
|
||||
type Config = {[key: string]: unknown};
|
||||
export type Config = Record<string, unknown>;
|
||||
|
||||
interface Options<ConfigType extends Config> {
|
||||
/**
|
||||
Directory to start looking up for a `package.json` file.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
cwd?: string;
|
||||
|
||||
/**
|
||||
Default config.
|
||||
|
||||
@default {}
|
||||
*/
|
||||
defaults?: ConfigType;
|
||||
|
||||
/**
|
||||
Skip `package.json` files that have the namespaced config explicitly set to `false`.
|
||||
|
||||
Continues searching upwards until the next `package.json` file is reached. This can be useful when you need to support the ability for users to have nested `package.json` files, but only read from the root one, like in the case of [`electron-builder`](https://github.com/electron-userland/electron-builder/wiki/Options#AppMetadata) where you have one `package.json` file for the app and one top-level for development.
|
||||
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
{
|
||||
"name": "some-package",
|
||||
"version": "1.0.0",
|
||||
"unicorn": false
|
||||
}
|
||||
```
|
||||
*/
|
||||
skipOnFalse?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare const pkgConf: {
|
||||
export interface Options<ConfigType extends Config> {
|
||||
/**
|
||||
It [walks up](https://github.com/sindresorhus/find-up) parent directories until a `package.json` can be found, reads it, and returns the user specified namespace or an empty object if not found.
|
||||
The directory to start looking up for a `package.json` file.
|
||||
|
||||
@param namespace - The `package.json` namespace you want.
|
||||
@returns A `Promise` for the config.
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: string;
|
||||
|
||||
/**
|
||||
The default config.
|
||||
|
||||
@default {}
|
||||
*/
|
||||
readonly defaults?: ConfigType;
|
||||
|
||||
/**
|
||||
Skip `package.json` files that have the namespaced config explicitly set to `false`.
|
||||
|
||||
Continues searching upwards until the next `package.json` file is reached. This can be useful when you need to support the ability for users to have nested `package.json` files, but only read from the root one, like in the case of [`electron-builder`](https://github.com/electron-userland/electron-builder/wiki/Options#AppMetadata) where you have one `package.json` file for the app and one top-level for development.
|
||||
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
// {
|
||||
// "name": "some-package",
|
||||
// "version": "1.0.0",
|
||||
// "unicorn": {
|
||||
// "rainbow": true
|
||||
// }
|
||||
// }
|
||||
|
||||
import pkgConf = require('pkg-conf');
|
||||
|
||||
(async () => {
|
||||
const config = await pkgConf('unicorn');
|
||||
|
||||
console.log(config.rainbow);
|
||||
//=> true
|
||||
})();
|
||||
{
|
||||
"name": "some-package",
|
||||
"version": "1.0.0",
|
||||
"unicorn": false
|
||||
}
|
||||
```
|
||||
*/
|
||||
<ConfigType extends pkgConf.Config = pkgConf.Config>(
|
||||
namespace: string,
|
||||
options?: pkgConf.Options<ConfigType>
|
||||
): Promise<ConfigType & pkgConf.Config>;
|
||||
readonly skipOnFalse?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
Same as `pkgConf()`, but runs synchronously.
|
||||
/**
|
||||
It [walks up](https://github.com/sindresorhus/find-up) parent directories until a `package.json` can be found, reads it, and returns the user specified namespace or an empty object if not found.
|
||||
|
||||
@param namespace - The `package.json` namespace you want.
|
||||
@returns Returns the config.
|
||||
*/
|
||||
sync<ConfigType extends pkgConf.Config = pkgConf.Config>(
|
||||
namespace: string,
|
||||
options?: pkgConf.Options<ConfigType>
|
||||
): ConfigType & pkgConf.Config;
|
||||
@param namespace - The `package.json` namespace you want.
|
||||
@returns A `Promise` for the config.
|
||||
|
||||
/**
|
||||
@param config - The `config` returned from any of the above methods.
|
||||
@returns The filepath to the `package.json` file or `null` when not found.
|
||||
*/
|
||||
filepath(config: pkgConf.Config): string | null;
|
||||
@example
|
||||
```
|
||||
// {
|
||||
// "name": "some-package",
|
||||
// "version": "1.0.0",
|
||||
// "unicorn": {
|
||||
// "rainbow": true
|
||||
// }
|
||||
// }
|
||||
|
||||
// TODO: Remove this for the next major release
|
||||
default: typeof pkgConf;
|
||||
};
|
||||
import {packageConfig} from 'pkg-conf';
|
||||
|
||||
export = pkgConf;
|
||||
const config = await packageConfig('unicorn');
|
||||
|
||||
console.log(config.rainbow);
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
export function packageConfig<ConfigType extends Config = Config>(
|
||||
namespace: string,
|
||||
options?: Options<ConfigType>
|
||||
): Promise<ConfigType & Config>;
|
||||
|
||||
/**
|
||||
It [walks up](https://github.com/sindresorhus/find-up) parent directories until a `package.json` can be found, reads it, and returns the user specified namespace or an empty object if not found.
|
||||
|
||||
@param namespace - The `package.json` namespace you want.
|
||||
@returns Returns the config.
|
||||
|
||||
@example
|
||||
```
|
||||
// {
|
||||
// "name": "some-package",
|
||||
// "version": "1.0.0",
|
||||
// "unicorn": {
|
||||
// "rainbow": true
|
||||
// }
|
||||
// }
|
||||
|
||||
import {packageConfigSync} from 'pkg-conf';
|
||||
|
||||
const config = packageConfigSync('unicorn');
|
||||
|
||||
console.log(config.rainbow);
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
export function packageConfigSync<ConfigType extends Config = Config>(
|
||||
namespace: string,
|
||||
options?: Options<ConfigType>
|
||||
): ConfigType & Config;
|
||||
|
||||
/**
|
||||
@param config - The config returned from any of the above methods.
|
||||
@returns The file path to the `package.json` file or `undefined` if not found.
|
||||
*/
|
||||
export function packageJsonPath(config: Config): string | undefined;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue