forked from olcxjas-softworks/LarpixClient
Add capacitorjs runtime
This commit is contained in:
parent
d0ece489ee
commit
f90c0e6c40
8362 changed files with 1502407 additions and 1 deletions
313
node_modules/meow/index.d.ts
generated
vendored
Normal file
313
node_modules/meow/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,313 @@
|
|||
import {PackageJson} from 'type-fest';
|
||||
|
||||
declare namespace meow {
|
||||
type FlagType = 'string' | 'boolean' | 'number';
|
||||
|
||||
/**
|
||||
Callback function to determine if a flag is required during runtime.
|
||||
|
||||
@param flags - Contains the flags converted to camel-case excluding aliases.
|
||||
@param input - Contains the non-flag arguments.
|
||||
|
||||
@returns True if the flag is required, otherwise false.
|
||||
*/
|
||||
type IsRequiredPredicate = (flags: Readonly<AnyFlags>, input: readonly string[]) => boolean;
|
||||
|
||||
interface Flag<Type extends FlagType, Default> {
|
||||
readonly type?: Type;
|
||||
readonly alias?: string;
|
||||
readonly default?: Default;
|
||||
readonly isRequired?: boolean | IsRequiredPredicate;
|
||||
readonly isMultiple?: boolean;
|
||||
}
|
||||
|
||||
type StringFlag = Flag<'string', string>;
|
||||
type BooleanFlag = Flag<'boolean', boolean>;
|
||||
type NumberFlag = Flag<'number', number>;
|
||||
|
||||
type AnyFlag = StringFlag | BooleanFlag | NumberFlag;
|
||||
type AnyFlags = Record<string, AnyFlag>;
|
||||
|
||||
interface Options<Flags extends AnyFlags> {
|
||||
/**
|
||||
Define argument flags.
|
||||
|
||||
The key is the flag name and the value is an object with any of:
|
||||
|
||||
- `type`: Type of value. (Possible values: `string` `boolean` `number`)
|
||||
- `alias`: Usually used to define a short flag alias.
|
||||
- `default`: Default value when the flag is not specified.
|
||||
- `isRequired`: Determine if the flag is required.
|
||||
If it's only known at runtime whether the flag is required or not you can pass a Function instead of a boolean, which based on the given flags and other non-flag arguments should decide if the flag is required.
|
||||
- `isMultiple`: Indicates a flag can be set multiple times. Values are turned into an array. (Default: false)
|
||||
Multiple values are provided by specifying the flag multiple times, for example, `$ foo -u rainbow -u cat`. Space- or comma-separated values are *not* supported.
|
||||
|
||||
@example
|
||||
```
|
||||
flags: {
|
||||
unicorn: {
|
||||
type: 'string',
|
||||
alias: 'u',
|
||||
default: ['rainbow', 'cat'],
|
||||
isMultiple: true,
|
||||
isRequired: (flags, input) => {
|
||||
if (flags.otherFlag) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
*/
|
||||
readonly flags?: Flags;
|
||||
|
||||
/**
|
||||
Description to show above the help text. Default: The package.json `"description"` property.
|
||||
|
||||
Set it to `false` to disable it altogether.
|
||||
*/
|
||||
readonly description?: string | false;
|
||||
|
||||
/**
|
||||
The help text you want shown.
|
||||
|
||||
The input is reindented and starting/ending newlines are trimmed which means you can use a [template literal](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/template_strings) without having to care about using the correct amount of indent.
|
||||
|
||||
The description will be shown above your help text automatically.
|
||||
|
||||
Set it to `false` to disable it altogether.
|
||||
*/
|
||||
readonly help?: string | false;
|
||||
|
||||
/**
|
||||
Set a custom version output. Default: The package.json `"version"` property.
|
||||
|
||||
Set it to `false` to disable it altogether.
|
||||
*/
|
||||
readonly version?: string | false;
|
||||
|
||||
/**
|
||||
Automatically show the help text when the `--help` flag is present. Useful to set this value to `false` when a CLI manages child CLIs with their own help text.
|
||||
|
||||
This option is only considered when there is only one argument in `process.argv`.
|
||||
*/
|
||||
readonly autoHelp?: boolean;
|
||||
|
||||
/**
|
||||
Automatically show the version text when the `--version` flag is present. Useful to set this value to `false` when a CLI manages child CLIs with their own version text.
|
||||
|
||||
This option is only considered when there is only one argument in `process.argv`.
|
||||
*/
|
||||
readonly autoVersion?: boolean;
|
||||
|
||||
/**
|
||||
`package.json` as an `Object`. Default: Closest `package.json` upwards.
|
||||
|
||||
_You most likely don't need this option._
|
||||
*/
|
||||
readonly pkg?: Record<string, unknown>;
|
||||
|
||||
/**
|
||||
Custom arguments object.
|
||||
|
||||
@default process.argv.slice(2)
|
||||
*/
|
||||
readonly argv?: readonly string[];
|
||||
|
||||
/**
|
||||
Infer the argument type.
|
||||
|
||||
By default, the argument `5` in `$ foo 5` becomes a string. Enabling this would infer it as a number.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly inferType?: boolean;
|
||||
|
||||
/**
|
||||
Value of `boolean` flags not defined in `argv`.
|
||||
|
||||
If set to `undefined`, the flags not defined in `argv` will be excluded from the result. The `default` value set in `boolean` flags take precedence over `booleanDefault`.
|
||||
|
||||
_Note: If used in conjunction with `isMultiple`, the default flag value is set to `[]`._
|
||||
|
||||
__Caution: Explicitly specifying `undefined` for `booleanDefault` has different meaning from omitting key itself.__
|
||||
|
||||
@example
|
||||
```
|
||||
import meow = require('meow');
|
||||
|
||||
const cli = meow(`
|
||||
Usage
|
||||
$ foo
|
||||
|
||||
Options
|
||||
--rainbow, -r Include a rainbow
|
||||
--unicorn, -u Include a unicorn
|
||||
--no-sparkles Exclude sparkles
|
||||
|
||||
Examples
|
||||
$ foo
|
||||
🌈 unicorns✨🌈
|
||||
`, {
|
||||
booleanDefault: undefined,
|
||||
flags: {
|
||||
rainbow: {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
alias: 'r'
|
||||
},
|
||||
unicorn: {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
alias: 'u'
|
||||
},
|
||||
cake: {
|
||||
type: 'boolean',
|
||||
alias: 'c'
|
||||
},
|
||||
sparkles: {
|
||||
type: 'boolean',
|
||||
default: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//{
|
||||
// flags: {
|
||||
// rainbow: true,
|
||||
// unicorn: false,
|
||||
// sparkles: true
|
||||
// },
|
||||
// unnormalizedFlags: {
|
||||
// rainbow: true,
|
||||
// r: true,
|
||||
// unicorn: false,
|
||||
// u: false,
|
||||
// sparkles: true
|
||||
// },
|
||||
// …
|
||||
//}
|
||||
```
|
||||
*/
|
||||
readonly booleanDefault?: boolean | null | undefined;
|
||||
|
||||
/**
|
||||
Whether to use [hard-rejection](https://github.com/sindresorhus/hard-rejection) or not. Disabling this can be useful if you need to handle `process.on('unhandledRejection')` yourself.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly hardRejection?: boolean;
|
||||
|
||||
/**
|
||||
Whether to allow unknown flags or not.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly allowUnknownFlags?: boolean;
|
||||
}
|
||||
|
||||
type TypedFlag<Flag extends AnyFlag> =
|
||||
Flag extends {type: 'number'}
|
||||
? number
|
||||
: Flag extends {type: 'string'}
|
||||
? string
|
||||
: Flag extends {type: 'boolean'}
|
||||
? boolean
|
||||
: unknown;
|
||||
|
||||
type PossiblyOptionalFlag<Flag extends AnyFlag, FlagType> =
|
||||
Flag extends {isRequired: true}
|
||||
? FlagType
|
||||
: Flag extends {default: any}
|
||||
? FlagType
|
||||
: FlagType | undefined;
|
||||
|
||||
type TypedFlags<Flags extends AnyFlags> = {
|
||||
[F in keyof Flags]: Flags[F] extends {isMultiple: true}
|
||||
? PossiblyOptionalFlag<Flags[F], Array<TypedFlag<Flags[F]>>>
|
||||
: PossiblyOptionalFlag<Flags[F], TypedFlag<Flags[F]>>
|
||||
};
|
||||
|
||||
interface Result<Flags extends AnyFlags> {
|
||||
/**
|
||||
Non-flag arguments.
|
||||
*/
|
||||
input: string[];
|
||||
|
||||
/**
|
||||
Flags converted to camelCase excluding aliases.
|
||||
*/
|
||||
flags: TypedFlags<Flags> & Record<string, unknown>;
|
||||
|
||||
/**
|
||||
Flags converted camelCase including aliases.
|
||||
*/
|
||||
unnormalizedFlags: TypedFlags<Flags> & Record<string, unknown>;
|
||||
|
||||
/**
|
||||
The `package.json` object.
|
||||
*/
|
||||
pkg: PackageJson;
|
||||
|
||||
/**
|
||||
The help text used with `--help`.
|
||||
*/
|
||||
help: string;
|
||||
|
||||
/**
|
||||
Show the help text and exit with code.
|
||||
|
||||
@param exitCode - The exit code to use. Default: `2`.
|
||||
*/
|
||||
showHelp: (exitCode?: number) => void;
|
||||
|
||||
/**
|
||||
Show the version text and exit.
|
||||
*/
|
||||
showVersion: () => void;
|
||||
}
|
||||
}
|
||||
/**
|
||||
@param helpMessage - Shortcut for the `help` option.
|
||||
|
||||
@example
|
||||
```
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
import meow = require('meow');
|
||||
import foo = require('.');
|
||||
|
||||
const cli = meow(`
|
||||
Usage
|
||||
$ foo <input>
|
||||
|
||||
Options
|
||||
--rainbow, -r Include a rainbow
|
||||
|
||||
Examples
|
||||
$ foo unicorns --rainbow
|
||||
🌈 unicorns 🌈
|
||||
`, {
|
||||
flags: {
|
||||
rainbow: {
|
||||
type: 'boolean',
|
||||
alias: 'r'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//{
|
||||
// input: ['unicorns'],
|
||||
// flags: {rainbow: true},
|
||||
// ...
|
||||
//}
|
||||
|
||||
foo(cli.input[0], cli.flags);
|
||||
```
|
||||
*/
|
||||
declare function meow<Flags extends meow.AnyFlags>(helpMessage: string, options?: meow.Options<Flags>): meow.Result<Flags>;
|
||||
declare function meow<Flags extends meow.AnyFlags>(options?: meow.Options<Flags>): meow.Result<Flags>;
|
||||
|
||||
export = meow;
|
||||
227
node_modules/meow/index.js
generated
vendored
Normal file
227
node_modules/meow/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
'use strict';
|
||||
const path = require('path');
|
||||
const buildParserOptions = require('minimist-options');
|
||||
const parseArguments = require('yargs-parser');
|
||||
const camelCaseKeys = require('camelcase-keys');
|
||||
const decamelizeKeys = require('decamelize-keys');
|
||||
const trimNewlines = require('trim-newlines');
|
||||
const redent = require('redent');
|
||||
const readPkgUp = require('read-pkg-up');
|
||||
const hardRejection = require('hard-rejection');
|
||||
const normalizePackageData = require('normalize-package-data');
|
||||
|
||||
// Prevent caching of this module so module.parent is always accurate
|
||||
delete require.cache[__filename];
|
||||
const parentDir = path.dirname(module.parent && module.parent.filename ? module.parent.filename : '.');
|
||||
|
||||
const isFlagMissing = (flagName, definedFlags, receivedFlags, input) => {
|
||||
const flag = definedFlags[flagName];
|
||||
let isFlagRequired = true;
|
||||
|
||||
if (typeof flag.isRequired === 'function') {
|
||||
isFlagRequired = flag.isRequired(receivedFlags, input);
|
||||
if (typeof isFlagRequired !== 'boolean') {
|
||||
throw new TypeError(`Return value for isRequired callback should be of type boolean, but ${typeof isFlagRequired} was returned.`);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof receivedFlags[flagName] === 'undefined') {
|
||||
return isFlagRequired;
|
||||
}
|
||||
|
||||
return flag.isMultiple && receivedFlags[flagName].length === 0;
|
||||
};
|
||||
|
||||
const getMissingRequiredFlags = (flags, receivedFlags, input) => {
|
||||
const missingRequiredFlags = [];
|
||||
if (typeof flags === 'undefined') {
|
||||
return [];
|
||||
}
|
||||
|
||||
for (const flagName of Object.keys(flags)) {
|
||||
if (flags[flagName].isRequired && isFlagMissing(flagName, flags, receivedFlags, input)) {
|
||||
missingRequiredFlags.push({key: flagName, ...flags[flagName]});
|
||||
}
|
||||
}
|
||||
|
||||
return missingRequiredFlags;
|
||||
};
|
||||
|
||||
const reportMissingRequiredFlags = missingRequiredFlags => {
|
||||
console.error(`Missing required flag${missingRequiredFlags.length > 1 ? 's' : ''}`);
|
||||
for (const flag of missingRequiredFlags) {
|
||||
console.error(`\t--${flag.key}${flag.alias ? `, -${flag.alias}` : ''}`);
|
||||
}
|
||||
};
|
||||
|
||||
const reportUnknownFlags = unknownFlags => {
|
||||
console.error([
|
||||
`Unknown flag${unknownFlags.length > 1 ? 's' : ''}`,
|
||||
...unknownFlags
|
||||
].join('\n'));
|
||||
};
|
||||
|
||||
const buildParserFlags = ({flags, booleanDefault}) => {
|
||||
const parserFlags = {};
|
||||
|
||||
for (const [flagKey, flagValue] of Object.entries(flags)) {
|
||||
const flag = {...flagValue};
|
||||
|
||||
if (
|
||||
typeof booleanDefault !== 'undefined' &&
|
||||
flag.type === 'boolean' &&
|
||||
!Object.prototype.hasOwnProperty.call(flag, 'default')
|
||||
) {
|
||||
flag.default = flag.isMultiple ? [booleanDefault] : booleanDefault;
|
||||
}
|
||||
|
||||
if (flag.isMultiple) {
|
||||
flag.type = flag.type ? `${flag.type}-array` : 'array';
|
||||
flag.default = flag.default || [];
|
||||
delete flag.isMultiple;
|
||||
}
|
||||
|
||||
parserFlags[flagKey] = flag;
|
||||
}
|
||||
|
||||
return parserFlags;
|
||||
};
|
||||
|
||||
const validateFlags = (flags, options) => {
|
||||
for (const [flagKey, flagValue] of Object.entries(options.flags)) {
|
||||
if (flagKey !== '--' && !flagValue.isMultiple && Array.isArray(flags[flagKey])) {
|
||||
throw new Error(`The flag --${flagKey} can only be set once.`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const meow = (helpText, options) => {
|
||||
if (typeof helpText !== 'string') {
|
||||
options = helpText;
|
||||
helpText = '';
|
||||
}
|
||||
|
||||
const foundPkg = readPkgUp.sync({
|
||||
cwd: parentDir,
|
||||
normalize: false
|
||||
});
|
||||
|
||||
options = {
|
||||
pkg: foundPkg ? foundPkg.packageJson : {},
|
||||
argv: process.argv.slice(2),
|
||||
flags: {},
|
||||
inferType: false,
|
||||
input: 'string',
|
||||
help: helpText,
|
||||
autoHelp: true,
|
||||
autoVersion: true,
|
||||
booleanDefault: false,
|
||||
hardRejection: true,
|
||||
allowUnknownFlags: true,
|
||||
...options
|
||||
};
|
||||
|
||||
if (options.hardRejection) {
|
||||
hardRejection();
|
||||
}
|
||||
|
||||
let parserOptions = {
|
||||
arguments: options.input,
|
||||
...buildParserFlags(options)
|
||||
};
|
||||
|
||||
parserOptions = decamelizeKeys(parserOptions, '-', {exclude: ['stopEarly', '--']});
|
||||
|
||||
if (options.inferType) {
|
||||
delete parserOptions.arguments;
|
||||
}
|
||||
|
||||
parserOptions = buildParserOptions(parserOptions);
|
||||
|
||||
parserOptions.configuration = {
|
||||
...parserOptions.configuration,
|
||||
'greedy-arrays': false
|
||||
};
|
||||
|
||||
if (parserOptions['--']) {
|
||||
parserOptions.configuration['populate--'] = true;
|
||||
}
|
||||
|
||||
if (!options.allowUnknownFlags) {
|
||||
// Collect unknown options in `argv._` to be checked later.
|
||||
parserOptions.configuration['unknown-options-as-args'] = true;
|
||||
}
|
||||
|
||||
const {pkg} = options;
|
||||
const argv = parseArguments(options.argv, parserOptions);
|
||||
let help = redent(trimNewlines((options.help || '').replace(/\t+\n*$/, '')), 2);
|
||||
|
||||
normalizePackageData(pkg);
|
||||
|
||||
process.title = pkg.bin ? Object.keys(pkg.bin)[0] : pkg.name;
|
||||
|
||||
let {description} = options;
|
||||
if (!description && description !== false) {
|
||||
({description} = pkg);
|
||||
}
|
||||
|
||||
help = (description ? `\n ${description}\n` : '') + (help ? `\n${help}\n` : '\n');
|
||||
|
||||
const showHelp = code => {
|
||||
console.log(help);
|
||||
process.exit(typeof code === 'number' ? code : 2);
|
||||
};
|
||||
|
||||
const showVersion = () => {
|
||||
console.log(typeof options.version === 'string' ? options.version : pkg.version);
|
||||
process.exit(0);
|
||||
};
|
||||
|
||||
if (argv._.length === 0 && options.argv.length === 1) {
|
||||
if (argv.version === true && options.autoVersion) {
|
||||
showVersion();
|
||||
}
|
||||
|
||||
if (argv.help === true && options.autoHelp) {
|
||||
showHelp(0);
|
||||
}
|
||||
}
|
||||
|
||||
const input = argv._;
|
||||
delete argv._;
|
||||
|
||||
if (!options.allowUnknownFlags) {
|
||||
const unknownFlags = input.filter(item => typeof item === 'string' && item.startsWith('-'));
|
||||
if (unknownFlags.length > 0) {
|
||||
reportUnknownFlags(unknownFlags);
|
||||
process.exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
const flags = camelCaseKeys(argv, {exclude: ['--', /^\w$/]});
|
||||
const unnormalizedFlags = {...flags};
|
||||
|
||||
validateFlags(flags, options);
|
||||
|
||||
for (const flagValue of Object.values(options.flags)) {
|
||||
delete flags[flagValue.alias];
|
||||
}
|
||||
|
||||
const missingRequiredFlags = getMissingRequiredFlags(options.flags, flags, input);
|
||||
if (missingRequiredFlags.length > 0) {
|
||||
reportMissingRequiredFlags(missingRequiredFlags);
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
return {
|
||||
input,
|
||||
flags,
|
||||
unnormalizedFlags,
|
||||
pkg,
|
||||
help,
|
||||
showHelp,
|
||||
showVersion
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = meow;
|
||||
9
node_modules/meow/license
generated
vendored
Normal file
9
node_modules/meow/license
generated
vendored
Normal 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.
|
||||
1
node_modules/meow/node_modules/.bin/semver
generated
vendored
Symbolic link
1
node_modules/meow/node_modules/.bin/semver
generated
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../semver/bin/semver
|
||||
137
node_modules/meow/node_modules/find-up/index.d.ts
generated
vendored
Normal file
137
node_modules/meow/node_modules/find-up/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
import {Options as LocatePathOptions} from 'locate-path';
|
||||
|
||||
declare const stop: unique symbol;
|
||||
|
||||
declare namespace findUp {
|
||||
interface Options extends LocatePathOptions {}
|
||||
|
||||
type StopSymbol = typeof stop;
|
||||
|
||||
type Match = string | StopSymbol | undefined;
|
||||
}
|
||||
|
||||
declare const findUp: {
|
||||
/**
|
||||
Find a file or directory by walking up parent directories.
|
||||
|
||||
@param name - 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 = 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'
|
||||
})();
|
||||
```
|
||||
*/
|
||||
(name: string | string[], options?: findUp.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 `findUp.stop` to stop the search.
|
||||
@returns The first path found or `undefined` if none could be found.
|
||||
|
||||
@example
|
||||
```
|
||||
import path = require('path');
|
||||
import findUp = require('find-up');
|
||||
|
||||
(async () => {
|
||||
console.log(await findUp(async directory => {
|
||||
const hasUnicorns = await findUp.exists(path.join(directory, 'unicorn.png'));
|
||||
return hasUnicorns && directory;
|
||||
}, {type: 'directory'}));
|
||||
//=> '/Users/sindresorhus'
|
||||
})();
|
||||
```
|
||||
*/
|
||||
(matcher: (directory: string) => (findUp.Match | Promise<findUp.Match>), options?: findUp.Options): Promise<string | undefined>;
|
||||
|
||||
sync: {
|
||||
/**
|
||||
Synchronously find a file or directory by walking up parent directories.
|
||||
|
||||
@param name - 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.
|
||||
*/
|
||||
(name: string | string[], options?: findUp.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 `findUp.stop` to stop the search.
|
||||
@returns The first path found or `undefined` if none could be found.
|
||||
|
||||
@example
|
||||
```
|
||||
import path = require('path');
|
||||
import findUp = require('find-up');
|
||||
|
||||
console.log(findUp.sync(directory => {
|
||||
const hasUnicorns = findUp.sync.exists(path.join(directory, 'unicorn.png'));
|
||||
return hasUnicorns && directory;
|
||||
}, {type: 'directory'}));
|
||||
//=> '/Users/sindresorhus'
|
||||
```
|
||||
*/
|
||||
(matcher: (directory: string) => findUp.Match, options?: findUp.Options): string | undefined;
|
||||
|
||||
/**
|
||||
Synchronously check if a path exists.
|
||||
|
||||
@param path - Path to the file or directory.
|
||||
@returns Whether the path exists.
|
||||
|
||||
@example
|
||||
```
|
||||
import findUp = require('find-up');
|
||||
|
||||
console.log(findUp.sync.exists('/Users/sindresorhus/unicorn.png'));
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
exists(path: string): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
Check if a path exists.
|
||||
|
||||
@param path - Path to a file or directory.
|
||||
@returns Whether the path exists.
|
||||
|
||||
@example
|
||||
```
|
||||
import findUp = require('find-up');
|
||||
|
||||
(async () => {
|
||||
console.log(await findUp.exists('/Users/sindresorhus/unicorn.png'));
|
||||
//=> true
|
||||
})();
|
||||
```
|
||||
*/
|
||||
exists(path: string): Promise<boolean>;
|
||||
|
||||
/**
|
||||
Return this in a `matcher` function to stop the search and force `findUp` to immediately return `undefined`.
|
||||
*/
|
||||
readonly stop: findUp.StopSymbol;
|
||||
};
|
||||
|
||||
export = findUp;
|
||||
89
node_modules/meow/node_modules/find-up/index.js
generated
vendored
Normal file
89
node_modules/meow/node_modules/find-up/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
'use strict';
|
||||
const path = require('path');
|
||||
const locatePath = require('locate-path');
|
||||
const pathExists = require('path-exists');
|
||||
|
||||
const stop = Symbol('findUp.stop');
|
||||
|
||||
module.exports = async (name, options = {}) => {
|
||||
let directory = path.resolve(options.cwd || '');
|
||||
const {root} = path.parse(directory);
|
||||
const paths = [].concat(name);
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
// 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 === stop) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (foundPath) {
|
||||
return path.resolve(directory, foundPath);
|
||||
}
|
||||
|
||||
if (directory === root) {
|
||||
return;
|
||||
}
|
||||
|
||||
directory = path.dirname(directory);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.sync = (name, options = {}) => {
|
||||
let directory = path.resolve(options.cwd || '');
|
||||
const {root} = path.parse(directory);
|
||||
const paths = [].concat(name);
|
||||
|
||||
const runMatcher = locateOptions => {
|
||||
if (typeof name !== 'function') {
|
||||
return locatePath.sync(paths, locateOptions);
|
||||
}
|
||||
|
||||
const foundPath = name(locateOptions.cwd);
|
||||
if (typeof foundPath === 'string') {
|
||||
return locatePath.sync([foundPath], locateOptions);
|
||||
}
|
||||
|
||||
return foundPath;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
const foundPath = runMatcher({...options, cwd: directory});
|
||||
|
||||
if (foundPath === stop) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (foundPath) {
|
||||
return path.resolve(directory, foundPath);
|
||||
}
|
||||
|
||||
if (directory === root) {
|
||||
return;
|
||||
}
|
||||
|
||||
directory = path.dirname(directory);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.exists = pathExists;
|
||||
|
||||
module.exports.sync.exists = pathExists.sync;
|
||||
|
||||
module.exports.stop = stop;
|
||||
9
node_modules/meow/node_modules/find-up/license
generated
vendored
Normal file
9
node_modules/meow/node_modules/find-up/license
generated
vendored
Normal 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.
|
||||
53
node_modules/meow/node_modules/find-up/package.json
generated
vendored
Normal file
53
node_modules/meow/node_modules/find-up/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
"name": "find-up",
|
||||
"version": "4.1.0",
|
||||
"description": "Find a file or directory by walking up parent directories",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/find-up",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"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": "^5.0.0",
|
||||
"path-exists": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.1.0",
|
||||
"is-path-inside": "^2.1.0",
|
||||
"tempy": "^0.3.0",
|
||||
"tsd": "^0.7.3",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
156
node_modules/meow/node_modules/find-up/readme.md
generated
vendored
Normal file
156
node_modules/meow/node_modules/find-up/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
# find-up [](https://travis-ci.org/sindresorhus/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
|
||||
const path = require('path');
|
||||
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'
|
||||
|
||||
console.log(await findUp(async directory => {
|
||||
const hasUnicorns = await findUp.exists(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.
|
||||
|
||||
### findUp.sync(name, options?)
|
||||
### findUp.sync(matcher, options?)
|
||||
|
||||
Returns a path or `undefined` if it couldn't be found.
|
||||
|
||||
### findUp.sync([...name], options?)
|
||||
|
||||
Returns the first path found (by respecting the order of the array) or `undefined` if none could be found.
|
||||
|
||||
#### name
|
||||
|
||||
Type: `string`
|
||||
|
||||
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: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Directory to start from.
|
||||
|
||||
##### type
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `'file'`<br>
|
||||
Values: `'file'` `'directory'`
|
||||
|
||||
The type of paths that can match.
|
||||
|
||||
##### allowSymlinks
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Allow symbolic links to match if they point to the chosen path type.
|
||||
|
||||
### findUp.exists(path)
|
||||
|
||||
Returns a `Promise<boolean>` of whether the path exists.
|
||||
|
||||
### findUp.sync.exists(path)
|
||||
|
||||
Returns a `boolean` of whether the path exists.
|
||||
|
||||
#### path
|
||||
|
||||
Type: `string`
|
||||
|
||||
Path to a file or directory.
|
||||
|
||||
### findUp.stop
|
||||
|
||||
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
|
||||
const path = require('path');
|
||||
const findUp = require('find-up');
|
||||
|
||||
(async () => {
|
||||
await findUp(directory => {
|
||||
return path.basename(directory) === 'work' ? findUp.stop : '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>
|
||||
151
node_modules/meow/node_modules/hosted-git-info/CHANGELOG.md
generated
vendored
Normal file
151
node_modules/meow/node_modules/hosted-git-info/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
<a name="2.8.9"></a>
|
||||
## [2.8.9](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9) (2021-04-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* backport regex fix from [#76](https://github.com/npm/hosted-git-info/issues/76) ([29adfe5](https://github.com/npm/hosted-git-info/commit/29adfe5)), closes [#84](https://github.com/npm/hosted-git-info/issues/84)
|
||||
|
||||
|
||||
|
||||
<a name="2.8.8"></a>
|
||||
## [2.8.8](https://github.com/npm/hosted-git-info/compare/v2.8.7...v2.8.8) (2020-02-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* [#61](https://github.com/npm/hosted-git-info/issues/61) & [#65](https://github.com/npm/hosted-git-info/issues/65) addressing issues w/ url.URL implmentation which regressed node 6 support ([5038b18](https://github.com/npm/hosted-git-info/commit/5038b18)), closes [#66](https://github.com/npm/hosted-git-info/issues/66)
|
||||
|
||||
|
||||
|
||||
<a name="2.8.7"></a>
|
||||
## [2.8.7](https://github.com/npm/hosted-git-info/compare/v2.8.6...v2.8.7) (2020-02-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Do not attempt to use url.URL when unavailable ([2d0bb66](https://github.com/npm/hosted-git-info/commit/2d0bb66)), closes [#61](https://github.com/npm/hosted-git-info/issues/61) [#62](https://github.com/npm/hosted-git-info/issues/62)
|
||||
* Do not pass scp-style URLs to the WhatWG url.URL ([f2cdfcf](https://github.com/npm/hosted-git-info/commit/f2cdfcf)), closes [#60](https://github.com/npm/hosted-git-info/issues/60)
|
||||
|
||||
|
||||
|
||||
<a name="2.8.6"></a>
|
||||
## [2.8.6](https://github.com/npm/hosted-git-info/compare/v2.8.5...v2.8.6) (2020-02-25)
|
||||
|
||||
|
||||
|
||||
<a name="2.8.5"></a>
|
||||
## [2.8.5](https://github.com/npm/hosted-git-info/compare/v2.8.4...v2.8.5) (2019-10-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* updated pathmatch for gitlab ([e8325b5](https://github.com/npm/hosted-git-info/commit/e8325b5)), closes [#51](https://github.com/npm/hosted-git-info/issues/51)
|
||||
* updated pathmatch for gitlab ([ffe056f](https://github.com/npm/hosted-git-info/commit/ffe056f))
|
||||
|
||||
|
||||
|
||||
<a name="2.8.4"></a>
|
||||
## [2.8.4](https://github.com/npm/hosted-git-info/compare/v2.8.3...v2.8.4) (2019-08-12)
|
||||
|
||||
|
||||
|
||||
<a name="2.8.3"></a>
|
||||
## [2.8.3](https://github.com/npm/hosted-git-info/compare/v2.8.2...v2.8.3) (2019-08-12)
|
||||
|
||||
|
||||
|
||||
<a name="2.8.2"></a>
|
||||
## [2.8.2](https://github.com/npm/hosted-git-info/compare/v2.8.1...v2.8.2) (2019-08-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* http protocol use sshurl by default ([3b1d629](https://github.com/npm/hosted-git-info/commit/3b1d629)), closes [#48](https://github.com/npm/hosted-git-info/issues/48)
|
||||
|
||||
|
||||
|
||||
<a name="2.8.1"></a>
|
||||
## [2.8.1](https://github.com/npm/hosted-git-info/compare/v2.8.0...v2.8.1) (2019-08-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* ignore noCommittish on tarball url generation ([5d4a8d7](https://github.com/npm/hosted-git-info/commit/5d4a8d7))
|
||||
* use gist tarball url that works for anonymous gists ([1692435](https://github.com/npm/hosted-git-info/commit/1692435))
|
||||
|
||||
|
||||
|
||||
<a name="2.8.0"></a>
|
||||
# [2.8.0](https://github.com/npm/hosted-git-info/compare/v2.7.1...v2.8.0) (2019-08-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Allow slashes in gitlab project section ([bbcf7b2](https://github.com/npm/hosted-git-info/commit/bbcf7b2)), closes [#46](https://github.com/npm/hosted-git-info/issues/46) [#43](https://github.com/npm/hosted-git-info/issues/43)
|
||||
* **git-host:** disallow URI-encoded slash (%2F) in `path` ([3776fa5](https://github.com/npm/hosted-git-info/commit/3776fa5)), closes [#44](https://github.com/npm/hosted-git-info/issues/44)
|
||||
* **gitlab:** Do not URL encode slashes in project name for GitLab https URL ([cbf04f9](https://github.com/npm/hosted-git-info/commit/cbf04f9)), closes [#47](https://github.com/npm/hosted-git-info/issues/47)
|
||||
* do not allow invalid gist urls ([d5cf830](https://github.com/npm/hosted-git-info/commit/d5cf830))
|
||||
* **cache:** Switch to lru-cache to save ourselves from unlimited memory consumption ([e518222](https://github.com/npm/hosted-git-info/commit/e518222)), closes [#38](https://github.com/npm/hosted-git-info/issues/38)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* give these objects a name ([60abaea](https://github.com/npm/hosted-git-info/commit/60abaea))
|
||||
|
||||
|
||||
|
||||
<a name="2.7.1"></a>
|
||||
## [2.7.1](https://github.com/npm/hosted-git-info/compare/v2.7.0...v2.7.1) (2018-07-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **index:** Guard against non-string types ([5bc580d](https://github.com/npm/hosted-git-info/commit/5bc580d))
|
||||
* **parse:** Crash on strings that parse to having no host ([c931482](https://github.com/npm/hosted-git-info/commit/c931482)), closes [#35](https://github.com/npm/hosted-git-info/issues/35)
|
||||
|
||||
|
||||
|
||||
<a name="2.7.0"></a>
|
||||
# [2.7.0](https://github.com/npm/hosted-git-info/compare/v2.6.1...v2.7.0) (2018-07-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **github tarball:** update github tarballtemplate ([6efd582](https://github.com/npm/hosted-git-info/commit/6efd582)), closes [#34](https://github.com/npm/hosted-git-info/issues/34)
|
||||
* **gitlab docs:** switched to lowercase anchors for readmes ([701bcd1](https://github.com/npm/hosted-git-info/commit/701bcd1))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **all:** Support www. prefixes on hostnames ([3349575](https://github.com/npm/hosted-git-info/commit/3349575)), closes [#32](https://github.com/npm/hosted-git-info/issues/32)
|
||||
|
||||
|
||||
|
||||
<a name="2.6.1"></a>
|
||||
## [2.6.1](https://github.com/npm/hosted-git-info/compare/v2.6.0...v2.6.1) (2018-06-25)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **Revert:** "compat: remove Object.assign fallback ([#25](https://github.com/npm/hosted-git-info/issues/25))" ([cce5a62](https://github.com/npm/hosted-git-info/commit/cce5a62))
|
||||
* **Revert:** "git-host: fix forgotten extend()" ([a815ec9](https://github.com/npm/hosted-git-info/commit/a815ec9))
|
||||
|
||||
|
||||
|
||||
<a name="2.6.0"></a>
|
||||
# [2.6.0](https://github.com/npm/hosted-git-info/compare/v2.5.0...v2.6.0) (2018-03-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compat:** remove Object.assign fallback ([#25](https://github.com/npm/hosted-git-info/issues/25)) ([627ab55](https://github.com/npm/hosted-git-info/commit/627ab55))
|
||||
* **git-host:** fix forgotten extend() ([eba1f7b](https://github.com/npm/hosted-git-info/commit/eba1f7b))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **browse:** fragment support for browse() ([#28](https://github.com/npm/hosted-git-info/issues/28)) ([cd5e5bb](https://github.com/npm/hosted-git-info/commit/cd5e5bb))
|
||||
13
node_modules/meow/node_modules/hosted-git-info/LICENSE
generated
vendored
Normal file
13
node_modules/meow/node_modules/hosted-git-info/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
Copyright (c) 2015, Rebecca Turner
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
133
node_modules/meow/node_modules/hosted-git-info/README.md
generated
vendored
Normal file
133
node_modules/meow/node_modules/hosted-git-info/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
# hosted-git-info
|
||||
|
||||
This will let you identify and transform various git hosts URLs between
|
||||
protocols. It also can tell you what the URL is for the raw path for
|
||||
particular file for direct access without git.
|
||||
|
||||
## Example
|
||||
|
||||
```javascript
|
||||
var hostedGitInfo = require("hosted-git-info")
|
||||
var info = hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git", opts)
|
||||
/* info looks like:
|
||||
{
|
||||
type: "github",
|
||||
domain: "github.com",
|
||||
user: "npm",
|
||||
project: "hosted-git-info"
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
If the URL can't be matched with a git host, `null` will be returned. We
|
||||
can match git, ssh and https urls. Additionally, we can match ssh connect
|
||||
strings (`git@github.com:npm/hosted-git-info`) and shortcuts (eg,
|
||||
`github:npm/hosted-git-info`). Github specifically, is detected in the case
|
||||
of a third, unprefixed, form: `npm/hosted-git-info`.
|
||||
|
||||
If it does match, the returned object has properties of:
|
||||
|
||||
* info.type -- The short name of the service
|
||||
* info.domain -- The domain for git protocol use
|
||||
* info.user -- The name of the user/org on the git host
|
||||
* info.project -- The name of the project on the git host
|
||||
|
||||
## Version Contract
|
||||
|
||||
The major version will be bumped any time…
|
||||
|
||||
* The constructor stops accepting URLs that it previously accepted.
|
||||
* A method is removed.
|
||||
* A method can no longer accept the number and type of arguments it previously accepted.
|
||||
* A method can return a different type than it currently returns.
|
||||
|
||||
Implications:
|
||||
|
||||
* I do not consider the specific format of the urls returned from, say
|
||||
`.https()` to be a part of the contract. The contract is that it will
|
||||
return a string that can be used to fetch the repo via HTTPS. But what
|
||||
that string looks like, specifically, can change.
|
||||
* Dropping support for a hosted git provider would constitute a breaking
|
||||
change.
|
||||
|
||||
## Usage
|
||||
|
||||
### var info = hostedGitInfo.fromUrl(gitSpecifier[, options])
|
||||
|
||||
* *gitSpecifer* is a URL of a git repository or a SCP-style specifier of one.
|
||||
* *options* is an optional object. It can have the following properties:
|
||||
* *noCommittish* — If true then committishes won't be included in generated URLs.
|
||||
* *noGitPlus* — If true then `git+` won't be prefixed on URLs.
|
||||
|
||||
## Methods
|
||||
|
||||
All of the methods take the same options as the `fromUrl` factory. Options
|
||||
provided to a method override those provided to the constructor.
|
||||
|
||||
* info.file(path, opts)
|
||||
|
||||
Given the path of a file relative to the repository, returns a URL for
|
||||
directly fetching it from the githost. If no committish was set then
|
||||
`master` will be used as the default.
|
||||
|
||||
For example `hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git#v1.0.0").file("package.json")`
|
||||
would return `https://raw.githubusercontent.com/npm/hosted-git-info/v1.0.0/package.json`
|
||||
|
||||
* info.shortcut(opts)
|
||||
|
||||
eg, `github:npm/hosted-git-info`
|
||||
|
||||
* info.browse(path, fragment, opts)
|
||||
|
||||
eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0`,
|
||||
`https://github.com/npm/hosted-git-info/tree/v1.2.0/package.json`,
|
||||
`https://github.com/npm/hosted-git-info/tree/v1.2.0/REAMDE.md#supported-hosts`
|
||||
|
||||
* info.bugs(opts)
|
||||
|
||||
eg, `https://github.com/npm/hosted-git-info/issues`
|
||||
|
||||
* info.docs(opts)
|
||||
|
||||
eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0#readme`
|
||||
|
||||
* info.https(opts)
|
||||
|
||||
eg, `git+https://github.com/npm/hosted-git-info.git`
|
||||
|
||||
* info.sshurl(opts)
|
||||
|
||||
eg, `git+ssh://git@github.com/npm/hosted-git-info.git`
|
||||
|
||||
* info.ssh(opts)
|
||||
|
||||
eg, `git@github.com:npm/hosted-git-info.git`
|
||||
|
||||
* info.path(opts)
|
||||
|
||||
eg, `npm/hosted-git-info`
|
||||
|
||||
* info.tarball(opts)
|
||||
|
||||
eg, `https://github.com/npm/hosted-git-info/archive/v1.2.0.tar.gz`
|
||||
|
||||
* info.getDefaultRepresentation()
|
||||
|
||||
Returns the default output type. The default output type is based on the
|
||||
string you passed in to be parsed
|
||||
|
||||
* info.toString(opts)
|
||||
|
||||
Uses the getDefaultRepresentation to call one of the other methods to get a URL for
|
||||
this resource. As such `hostedGitInfo.fromUrl(url).toString()` will give
|
||||
you a normalized version of the URL that still uses the same protocol.
|
||||
|
||||
Shortcuts will still be returned as shortcuts, but the special case github
|
||||
form of `org/project` will be normalized to `github:org/project`.
|
||||
|
||||
SSH connect strings will be normalized into `git+ssh` URLs.
|
||||
|
||||
## Supported hosts
|
||||
|
||||
Currently this supports Github, Bitbucket and Gitlab. Pull requests for
|
||||
additional hosts welcome.
|
||||
79
node_modules/meow/node_modules/hosted-git-info/git-host-info.js
generated
vendored
Normal file
79
node_modules/meow/node_modules/hosted-git-info/git-host-info.js
generated
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
'use strict'
|
||||
|
||||
var gitHosts = module.exports = {
|
||||
github: {
|
||||
// First two are insecure and generally shouldn't be used any more, but
|
||||
// they are still supported.
|
||||
'protocols': [ 'git', 'http', 'git+ssh', 'git+https', 'ssh', 'https' ],
|
||||
'domain': 'github.com',
|
||||
'treepath': 'tree',
|
||||
'filetemplate': 'https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}',
|
||||
'bugstemplate': 'https://{domain}/{user}/{project}/issues',
|
||||
'gittemplate': 'git://{auth@}{domain}/{user}/{project}.git{#committish}',
|
||||
'tarballtemplate': 'https://codeload.{domain}/{user}/{project}/tar.gz/{committish}'
|
||||
},
|
||||
bitbucket: {
|
||||
'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ],
|
||||
'domain': 'bitbucket.org',
|
||||
'treepath': 'src',
|
||||
'tarballtemplate': 'https://{domain}/{user}/{project}/get/{committish}.tar.gz'
|
||||
},
|
||||
gitlab: {
|
||||
'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ],
|
||||
'domain': 'gitlab.com',
|
||||
'treepath': 'tree',
|
||||
'bugstemplate': 'https://{domain}/{user}/{project}/issues',
|
||||
'httpstemplate': 'git+https://{auth@}{domain}/{user}/{projectPath}.git{#committish}',
|
||||
'tarballtemplate': 'https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}',
|
||||
'pathmatch': /^[/]([^/]+)[/]((?!.*(\/-\/|\/repository\/archive\.tar\.gz\?=.*|\/repository\/[^/]+\/archive.tar.gz$)).*?)(?:[.]git|[/])?$/
|
||||
},
|
||||
gist: {
|
||||
'protocols': [ 'git', 'git+ssh', 'git+https', 'ssh', 'https' ],
|
||||
'domain': 'gist.github.com',
|
||||
'pathmatch': /^[/](?:([^/]+)[/])?([a-z0-9]{32,})(?:[.]git)?$/,
|
||||
'filetemplate': 'https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}',
|
||||
'bugstemplate': 'https://{domain}/{project}',
|
||||
'gittemplate': 'git://{domain}/{project}.git{#committish}',
|
||||
'sshtemplate': 'git@{domain}:/{project}.git{#committish}',
|
||||
'sshurltemplate': 'git+ssh://git@{domain}/{project}.git{#committish}',
|
||||
'browsetemplate': 'https://{domain}/{project}{/committish}',
|
||||
'browsefiletemplate': 'https://{domain}/{project}{/committish}{#path}',
|
||||
'docstemplate': 'https://{domain}/{project}{/committish}',
|
||||
'httpstemplate': 'git+https://{domain}/{project}.git{#committish}',
|
||||
'shortcuttemplate': '{type}:{project}{#committish}',
|
||||
'pathtemplate': '{project}{#committish}',
|
||||
'tarballtemplate': 'https://codeload.github.com/gist/{project}/tar.gz/{committish}',
|
||||
'hashformat': function (fragment) {
|
||||
return 'file-' + formatHashFragment(fragment)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var gitHostDefaults = {
|
||||
'sshtemplate': 'git@{domain}:{user}/{project}.git{#committish}',
|
||||
'sshurltemplate': 'git+ssh://git@{domain}/{user}/{project}.git{#committish}',
|
||||
'browsetemplate': 'https://{domain}/{user}/{project}{/tree/committish}',
|
||||
'browsefiletemplate': 'https://{domain}/{user}/{project}/{treepath}/{committish}/{path}{#fragment}',
|
||||
'docstemplate': 'https://{domain}/{user}/{project}{/tree/committish}#readme',
|
||||
'httpstemplate': 'git+https://{auth@}{domain}/{user}/{project}.git{#committish}',
|
||||
'filetemplate': 'https://{domain}/{user}/{project}/raw/{committish}/{path}',
|
||||
'shortcuttemplate': '{type}:{user}/{project}{#committish}',
|
||||
'pathtemplate': '{user}/{project}{#committish}',
|
||||
'pathmatch': /^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/,
|
||||
'hashformat': formatHashFragment
|
||||
}
|
||||
|
||||
Object.keys(gitHosts).forEach(function (name) {
|
||||
Object.keys(gitHostDefaults).forEach(function (key) {
|
||||
if (gitHosts[name][key]) return
|
||||
gitHosts[name][key] = gitHostDefaults[key]
|
||||
})
|
||||
gitHosts[name].protocols_re = RegExp('^(' +
|
||||
gitHosts[name].protocols.map(function (protocol) {
|
||||
return protocol.replace(/([\\+*{}()[\]$^|])/g, '\\$1')
|
||||
}).join('|') + '):$')
|
||||
})
|
||||
|
||||
function formatHashFragment (fragment) {
|
||||
return fragment.toLowerCase().replace(/^\W+|\/|\W+$/g, '').replace(/\W+/g, '-')
|
||||
}
|
||||
156
node_modules/meow/node_modules/hosted-git-info/git-host.js
generated
vendored
Normal file
156
node_modules/meow/node_modules/hosted-git-info/git-host.js
generated
vendored
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
'use strict'
|
||||
var gitHosts = require('./git-host-info.js')
|
||||
/* eslint-disable node/no-deprecated-api */
|
||||
|
||||
// copy-pasta util._extend from node's source, to avoid pulling
|
||||
// the whole util module into peoples' webpack bundles.
|
||||
/* istanbul ignore next */
|
||||
var extend = Object.assign || function _extend (target, source) {
|
||||
// Don't do anything if source isn't an object
|
||||
if (source === null || typeof source !== 'object') return target
|
||||
|
||||
var keys = Object.keys(source)
|
||||
var i = keys.length
|
||||
while (i--) {
|
||||
target[keys[i]] = source[keys[i]]
|
||||
}
|
||||
return target
|
||||
}
|
||||
|
||||
module.exports = GitHost
|
||||
function GitHost (type, user, auth, project, committish, defaultRepresentation, opts) {
|
||||
var gitHostInfo = this
|
||||
gitHostInfo.type = type
|
||||
Object.keys(gitHosts[type]).forEach(function (key) {
|
||||
gitHostInfo[key] = gitHosts[type][key]
|
||||
})
|
||||
gitHostInfo.user = user
|
||||
gitHostInfo.auth = auth
|
||||
gitHostInfo.project = project
|
||||
gitHostInfo.committish = committish
|
||||
gitHostInfo.default = defaultRepresentation
|
||||
gitHostInfo.opts = opts || {}
|
||||
}
|
||||
|
||||
GitHost.prototype.hash = function () {
|
||||
return this.committish ? '#' + this.committish : ''
|
||||
}
|
||||
|
||||
GitHost.prototype._fill = function (template, opts) {
|
||||
if (!template) return
|
||||
var vars = extend({}, opts)
|
||||
vars.path = vars.path ? vars.path.replace(/^[/]+/g, '') : ''
|
||||
opts = extend(extend({}, this.opts), opts)
|
||||
var self = this
|
||||
Object.keys(this).forEach(function (key) {
|
||||
if (self[key] != null && vars[key] == null) vars[key] = self[key]
|
||||
})
|
||||
var rawAuth = vars.auth
|
||||
var rawcommittish = vars.committish
|
||||
var rawFragment = vars.fragment
|
||||
var rawPath = vars.path
|
||||
var rawProject = vars.project
|
||||
Object.keys(vars).forEach(function (key) {
|
||||
var value = vars[key]
|
||||
if ((key === 'path' || key === 'project') && typeof value === 'string') {
|
||||
vars[key] = value.split('/').map(function (pathComponent) {
|
||||
return encodeURIComponent(pathComponent)
|
||||
}).join('/')
|
||||
} else {
|
||||
vars[key] = encodeURIComponent(value)
|
||||
}
|
||||
})
|
||||
vars['auth@'] = rawAuth ? rawAuth + '@' : ''
|
||||
vars['#fragment'] = rawFragment ? '#' + this.hashformat(rawFragment) : ''
|
||||
vars.fragment = vars.fragment ? vars.fragment : ''
|
||||
vars['#path'] = rawPath ? '#' + this.hashformat(rawPath) : ''
|
||||
vars['/path'] = vars.path ? '/' + vars.path : ''
|
||||
vars.projectPath = rawProject.split('/').map(encodeURIComponent).join('/')
|
||||
if (opts.noCommittish) {
|
||||
vars['#committish'] = ''
|
||||
vars['/tree/committish'] = ''
|
||||
vars['/committish'] = ''
|
||||
vars.committish = ''
|
||||
} else {
|
||||
vars['#committish'] = rawcommittish ? '#' + rawcommittish : ''
|
||||
vars['/tree/committish'] = vars.committish
|
||||
? '/' + vars.treepath + '/' + vars.committish
|
||||
: ''
|
||||
vars['/committish'] = vars.committish ? '/' + vars.committish : ''
|
||||
vars.committish = vars.committish || 'master'
|
||||
}
|
||||
var res = template
|
||||
Object.keys(vars).forEach(function (key) {
|
||||
res = res.replace(new RegExp('[{]' + key + '[}]', 'g'), vars[key])
|
||||
})
|
||||
if (opts.noGitPlus) {
|
||||
return res.replace(/^git[+]/, '')
|
||||
} else {
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
||||
GitHost.prototype.ssh = function (opts) {
|
||||
return this._fill(this.sshtemplate, opts)
|
||||
}
|
||||
|
||||
GitHost.prototype.sshurl = function (opts) {
|
||||
return this._fill(this.sshurltemplate, opts)
|
||||
}
|
||||
|
||||
GitHost.prototype.browse = function (P, F, opts) {
|
||||
if (typeof P === 'string') {
|
||||
if (typeof F !== 'string') {
|
||||
opts = F
|
||||
F = null
|
||||
}
|
||||
return this._fill(this.browsefiletemplate, extend({
|
||||
fragment: F,
|
||||
path: P
|
||||
}, opts))
|
||||
} else {
|
||||
return this._fill(this.browsetemplate, P)
|
||||
}
|
||||
}
|
||||
|
||||
GitHost.prototype.docs = function (opts) {
|
||||
return this._fill(this.docstemplate, opts)
|
||||
}
|
||||
|
||||
GitHost.prototype.bugs = function (opts) {
|
||||
return this._fill(this.bugstemplate, opts)
|
||||
}
|
||||
|
||||
GitHost.prototype.https = function (opts) {
|
||||
return this._fill(this.httpstemplate, opts)
|
||||
}
|
||||
|
||||
GitHost.prototype.git = function (opts) {
|
||||
return this._fill(this.gittemplate, opts)
|
||||
}
|
||||
|
||||
GitHost.prototype.shortcut = function (opts) {
|
||||
return this._fill(this.shortcuttemplate, opts)
|
||||
}
|
||||
|
||||
GitHost.prototype.path = function (opts) {
|
||||
return this._fill(this.pathtemplate, opts)
|
||||
}
|
||||
|
||||
GitHost.prototype.tarball = function (opts_) {
|
||||
var opts = extend({}, opts_, { noCommittish: false })
|
||||
return this._fill(this.tarballtemplate, opts)
|
||||
}
|
||||
|
||||
GitHost.prototype.file = function (P, opts) {
|
||||
return this._fill(this.filetemplate, extend({ path: P }, opts))
|
||||
}
|
||||
|
||||
GitHost.prototype.getDefaultRepresentation = function () {
|
||||
return this.default
|
||||
}
|
||||
|
||||
GitHost.prototype.toString = function (opts) {
|
||||
if (this.default && typeof this[this.default] === 'function') return this[this.default](opts)
|
||||
return this.sshurl(opts)
|
||||
}
|
||||
148
node_modules/meow/node_modules/hosted-git-info/index.js
generated
vendored
Normal file
148
node_modules/meow/node_modules/hosted-git-info/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
'use strict'
|
||||
var url = require('url')
|
||||
var gitHosts = require('./git-host-info.js')
|
||||
var GitHost = module.exports = require('./git-host.js')
|
||||
|
||||
var protocolToRepresentationMap = {
|
||||
'git+ssh:': 'sshurl',
|
||||
'git+https:': 'https',
|
||||
'ssh:': 'sshurl',
|
||||
'git:': 'git'
|
||||
}
|
||||
|
||||
function protocolToRepresentation (protocol) {
|
||||
return protocolToRepresentationMap[protocol] || protocol.slice(0, -1)
|
||||
}
|
||||
|
||||
var authProtocols = {
|
||||
'git:': true,
|
||||
'https:': true,
|
||||
'git+https:': true,
|
||||
'http:': true,
|
||||
'git+http:': true
|
||||
}
|
||||
|
||||
var cache = {}
|
||||
|
||||
module.exports.fromUrl = function (giturl, opts) {
|
||||
if (typeof giturl !== 'string') return
|
||||
var key = giturl + JSON.stringify(opts || {})
|
||||
|
||||
if (!(key in cache)) {
|
||||
cache[key] = fromUrl(giturl, opts)
|
||||
}
|
||||
|
||||
return cache[key]
|
||||
}
|
||||
|
||||
function fromUrl (giturl, opts) {
|
||||
if (giturl == null || giturl === '') return
|
||||
var url = fixupUnqualifiedGist(
|
||||
isGitHubShorthand(giturl) ? 'github:' + giturl : giturl
|
||||
)
|
||||
var parsed = parseGitUrl(url)
|
||||
var shortcutMatch = url.match(/^([^:]+):(?:[^@]+@)?(?:([^/]*)\/)?([^#]+)/)
|
||||
var matches = Object.keys(gitHosts).map(function (gitHostName) {
|
||||
try {
|
||||
var gitHostInfo = gitHosts[gitHostName]
|
||||
var auth = null
|
||||
if (parsed.auth && authProtocols[parsed.protocol]) {
|
||||
auth = parsed.auth
|
||||
}
|
||||
var committish = parsed.hash ? decodeURIComponent(parsed.hash.substr(1)) : null
|
||||
var user = null
|
||||
var project = null
|
||||
var defaultRepresentation = null
|
||||
if (shortcutMatch && shortcutMatch[1] === gitHostName) {
|
||||
user = shortcutMatch[2] && decodeURIComponent(shortcutMatch[2])
|
||||
project = decodeURIComponent(shortcutMatch[3].replace(/\.git$/, ''))
|
||||
defaultRepresentation = 'shortcut'
|
||||
} else {
|
||||
if (parsed.host && parsed.host !== gitHostInfo.domain && parsed.host.replace(/^www[.]/, '') !== gitHostInfo.domain) return
|
||||
if (!gitHostInfo.protocols_re.test(parsed.protocol)) return
|
||||
if (!parsed.path) return
|
||||
var pathmatch = gitHostInfo.pathmatch
|
||||
var matched = parsed.path.match(pathmatch)
|
||||
if (!matched) return
|
||||
/* istanbul ignore else */
|
||||
if (matched[1] !== null && matched[1] !== undefined) {
|
||||
user = decodeURIComponent(matched[1].replace(/^:/, ''))
|
||||
}
|
||||
project = decodeURIComponent(matched[2])
|
||||
defaultRepresentation = protocolToRepresentation(parsed.protocol)
|
||||
}
|
||||
return new GitHost(gitHostName, user, auth, project, committish, defaultRepresentation, opts)
|
||||
} catch (ex) {
|
||||
/* istanbul ignore else */
|
||||
if (ex instanceof URIError) {
|
||||
} else throw ex
|
||||
}
|
||||
}).filter(function (gitHostInfo) { return gitHostInfo })
|
||||
if (matches.length !== 1) return
|
||||
return matches[0]
|
||||
}
|
||||
|
||||
function isGitHubShorthand (arg) {
|
||||
// Note: This does not fully test the git ref format.
|
||||
// See https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
|
||||
//
|
||||
// The only way to do this properly would be to shell out to
|
||||
// git-check-ref-format, and as this is a fast sync function,
|
||||
// we don't want to do that. Just let git fail if it turns
|
||||
// out that the commit-ish is invalid.
|
||||
// GH usernames cannot start with . or -
|
||||
return /^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(arg)
|
||||
}
|
||||
|
||||
function fixupUnqualifiedGist (giturl) {
|
||||
// necessary for round-tripping gists
|
||||
var parsed = url.parse(giturl)
|
||||
if (parsed.protocol === 'gist:' && parsed.host && !parsed.path) {
|
||||
return parsed.protocol + '/' + parsed.host
|
||||
} else {
|
||||
return giturl
|
||||
}
|
||||
}
|
||||
|
||||
function parseGitUrl (giturl) {
|
||||
var matched = giturl.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/)
|
||||
if (!matched) {
|
||||
var legacy = url.parse(giturl)
|
||||
// If we don't have url.URL, then sorry, this is just not fixable.
|
||||
// This affects Node <= 6.12.
|
||||
if (legacy.auth && typeof url.URL === 'function') {
|
||||
// git urls can be in the form of scp-style/ssh-connect strings, like
|
||||
// git+ssh://user@host.com:some/path, which the legacy url parser
|
||||
// supports, but WhatWG url.URL class does not. However, the legacy
|
||||
// parser de-urlencodes the username and password, so something like
|
||||
// https://user%3An%40me:p%40ss%3Aword@x.com/ becomes
|
||||
// https://user:n@me:p@ss:word@x.com/ which is all kinds of wrong.
|
||||
// Pull off just the auth and host, so we dont' get the confusing
|
||||
// scp-style URL, then pass that to the WhatWG parser to get the
|
||||
// auth properly escaped.
|
||||
var authmatch = giturl.match(/[^@]+@[^:/]+/)
|
||||
/* istanbul ignore else - this should be impossible */
|
||||
if (authmatch) {
|
||||
var whatwg = new url.URL(authmatch[0])
|
||||
legacy.auth = whatwg.username || ''
|
||||
if (whatwg.password) legacy.auth += ':' + whatwg.password
|
||||
}
|
||||
}
|
||||
return legacy
|
||||
}
|
||||
return {
|
||||
protocol: 'git+ssh:',
|
||||
slashes: true,
|
||||
auth: matched[1],
|
||||
host: matched[2],
|
||||
port: null,
|
||||
hostname: matched[2],
|
||||
hash: matched[4],
|
||||
search: null,
|
||||
query: null,
|
||||
pathname: '/' + matched[3],
|
||||
path: '/' + matched[3],
|
||||
href: 'git+ssh://' + matched[1] + '@' + matched[2] +
|
||||
'/' + matched[3] + (matched[4] || '')
|
||||
}
|
||||
}
|
||||
40
node_modules/meow/node_modules/hosted-git-info/package.json
generated
vendored
Normal file
40
node_modules/meow/node_modules/hosted-git-info/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"name": "hosted-git-info",
|
||||
"version": "2.8.9",
|
||||
"description": "Provides metadata and conversions from repository urls for Github, Bitbucket and Gitlab",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/npm/hosted-git-info.git"
|
||||
},
|
||||
"keywords": [
|
||||
"git",
|
||||
"github",
|
||||
"bitbucket",
|
||||
"gitlab"
|
||||
],
|
||||
"author": "Rebecca Turner <me@re-becca.org> (http://re-becca.org)",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/npm/hosted-git-info/issues"
|
||||
},
|
||||
"homepage": "https://github.com/npm/hosted-git-info",
|
||||
"scripts": {
|
||||
"prerelease": "npm t",
|
||||
"postrelease": "npm publish --tag=ancient-legacy-fixes && git push --follow-tags",
|
||||
"posttest": "standard",
|
||||
"release": "standard-version -s",
|
||||
"test:coverage": "tap --coverage-report=html -J --coverage=90 --no-esm test/*.js",
|
||||
"test": "tap -J --coverage=90 --no-esm test/*.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"standard": "^11.0.1",
|
||||
"standard-version": "^4.4.0",
|
||||
"tap": "^12.7.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"git-host.js",
|
||||
"git-host-info.js"
|
||||
]
|
||||
}
|
||||
83
node_modules/meow/node_modules/locate-path/index.d.ts
generated
vendored
Normal file
83
node_modules/meow/node_modules/locate-path/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
declare namespace locatePath {
|
||||
interface Options {
|
||||
/**
|
||||
Current working directory.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: string;
|
||||
|
||||
/**
|
||||
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;
|
||||
}
|
||||
|
||||
interface AsyncOptions extends Options {
|
||||
/**
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
declare const locatePath: {
|
||||
/**
|
||||
Get the first path that exists on disk of multiple paths.
|
||||
|
||||
@param paths - Paths to check.
|
||||
@returns The first path that exists or `undefined` if none exists.
|
||||
|
||||
@example
|
||||
```
|
||||
import 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'
|
||||
})();
|
||||
```
|
||||
*/
|
||||
(paths: Iterable<string>, options?: locatePath.AsyncOptions): Promise<
|
||||
string | undefined
|
||||
>;
|
||||
|
||||
/**
|
||||
Synchronously get the first path that exists on disk of multiple paths.
|
||||
|
||||
@param paths - Paths to check.
|
||||
@returns The first path that exists or `undefined` if none exists.
|
||||
*/
|
||||
sync(
|
||||
paths: Iterable<string>,
|
||||
options?: locatePath.Options
|
||||
): string | undefined;
|
||||
};
|
||||
|
||||
export = locatePath;
|
||||
65
node_modules/meow/node_modules/locate-path/index.js
generated
vendored
Normal file
65
node_modules/meow/node_modules/locate-path/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
'use strict';
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const {promisify} = require('util');
|
||||
const pLocate = require('p-locate');
|
||||
|
||||
const fsStat = promisify(fs.stat);
|
||||
const fsLStat = promisify(fs.lstat);
|
||||
|
||||
const typeMappings = {
|
||||
directory: 'isDirectory',
|
||||
file: 'isFile'
|
||||
};
|
||||
|
||||
function checkType({type}) {
|
||||
if (type in typeMappings) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new Error(`Invalid type specified: ${type}`);
|
||||
}
|
||||
|
||||
const matchType = (type, stat) => type === undefined || stat[typeMappings[type]]();
|
||||
|
||||
module.exports = async (paths, options) => {
|
||||
options = {
|
||||
cwd: process.cwd(),
|
||||
type: 'file',
|
||||
allowSymlinks: true,
|
||||
...options
|
||||
};
|
||||
checkType(options);
|
||||
const statFn = options.allowSymlinks ? fsStat : fsLStat;
|
||||
|
||||
return pLocate(paths, async path_ => {
|
||||
try {
|
||||
const stat = await statFn(path.resolve(options.cwd, path_));
|
||||
return matchType(options.type, stat);
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
}, options);
|
||||
};
|
||||
|
||||
module.exports.sync = (paths, options) => {
|
||||
options = {
|
||||
cwd: process.cwd(),
|
||||
allowSymlinks: true,
|
||||
type: 'file',
|
||||
...options
|
||||
};
|
||||
checkType(options);
|
||||
const statFn = options.allowSymlinks ? fs.statSync : fs.lstatSync;
|
||||
|
||||
for (const path_ of paths) {
|
||||
try {
|
||||
const stat = statFn(path.resolve(options.cwd, path_));
|
||||
|
||||
if (matchType(options.type, stat)) {
|
||||
return path_;
|
||||
}
|
||||
} catch (_) {
|
||||
}
|
||||
}
|
||||
};
|
||||
9
node_modules/meow/node_modules/locate-path/license
generated
vendored
Normal file
9
node_modules/meow/node_modules/locate-path/license
generated
vendored
Normal 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.
|
||||
45
node_modules/meow/node_modules/locate-path/package.json
generated
vendored
Normal file
45
node_modules/meow/node_modules/locate-path/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "locate-path",
|
||||
"version": "5.0.0",
|
||||
"description": "Get the first path that exists on disk of multiple paths",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/locate-path",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"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": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
122
node_modules/meow/node_modules/locate-path/readme.md
generated
vendored
Normal file
122
node_modules/meow/node_modules/locate-path/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
# locate-path [](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(paths, [options])
|
||||
|
||||
Returns a `Promise<string>` for the first path that exists or `undefined` if none exists.
|
||||
|
||||
#### paths
|
||||
|
||||
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 `paths` 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.
|
||||
|
||||
##### type
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `file`<br>
|
||||
Values: `file` `directory`
|
||||
|
||||
The type of paths that can match.
|
||||
|
||||
##### allowSymlinks
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Allow symbolic links to match if they point to the chosen path type.
|
||||
|
||||
### locatePath.sync(paths, [options])
|
||||
|
||||
Returns the first path that exists or `undefined` if none exists.
|
||||
|
||||
#### paths
|
||||
|
||||
Type: `Iterable<string>`
|
||||
|
||||
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
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
38
node_modules/meow/node_modules/p-limit/index.d.ts
generated
vendored
Normal file
38
node_modules/meow/node_modules/p-limit/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
export interface Limit {
|
||||
/**
|
||||
@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>;
|
||||
|
||||
/**
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
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): Limit;
|
||||
57
node_modules/meow/node_modules/p-limit/index.js
generated
vendored
Normal file
57
node_modules/meow/node_modules/p-limit/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
'use strict';
|
||||
const pTry = require('p-try');
|
||||
|
||||
const pLimit = concurrency => {
|
||||
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
||||
return Promise.reject(new TypeError('Expected `concurrency` to be a number from 1 and up'));
|
||||
}
|
||||
|
||||
const queue = [];
|
||||
let activeCount = 0;
|
||||
|
||||
const next = () => {
|
||||
activeCount--;
|
||||
|
||||
if (queue.length > 0) {
|
||||
queue.shift()();
|
||||
}
|
||||
};
|
||||
|
||||
const run = (fn, resolve, ...args) => {
|
||||
activeCount++;
|
||||
|
||||
const result = pTry(fn, ...args);
|
||||
|
||||
resolve(result);
|
||||
|
||||
result.then(next, next);
|
||||
};
|
||||
|
||||
const enqueue = (fn, resolve, ...args) => {
|
||||
if (activeCount < concurrency) {
|
||||
run(fn, resolve, ...args);
|
||||
} else {
|
||||
queue.push(run.bind(null, fn, resolve, ...args));
|
||||
}
|
||||
};
|
||||
|
||||
const generator = (fn, ...args) => new Promise(resolve => enqueue(fn, resolve, ...args));
|
||||
Object.defineProperties(generator, {
|
||||
activeCount: {
|
||||
get: () => activeCount
|
||||
},
|
||||
pendingCount: {
|
||||
get: () => queue.length
|
||||
},
|
||||
clearQueue: {
|
||||
value: () => {
|
||||
queue.length = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return generator;
|
||||
};
|
||||
|
||||
module.exports = pLimit;
|
||||
module.exports.default = pLimit;
|
||||
9
node_modules/meow/node_modules/p-limit/license
generated
vendored
Normal file
9
node_modules/meow/node_modules/p-limit/license
generated
vendored
Normal 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.
|
||||
52
node_modules/meow/node_modules/p-limit/package.json
generated
vendored
Normal file
52
node_modules/meow/node_modules/p-limit/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"name": "p-limit",
|
||||
"version": "2.3.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": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd-check"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"limit",
|
||||
"limited",
|
||||
"concurrency",
|
||||
"throttle",
|
||||
"throat",
|
||||
"rate",
|
||||
"batch",
|
||||
"ratelimit",
|
||||
"task",
|
||||
"queue",
|
||||
"async",
|
||||
"await",
|
||||
"promises",
|
||||
"bluebird"
|
||||
],
|
||||
"dependencies": {
|
||||
"p-try": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^1.2.1",
|
||||
"delay": "^4.1.0",
|
||||
"in-range": "^1.0.0",
|
||||
"random-int": "^1.0.0",
|
||||
"time-span": "^2.0.0",
|
||||
"tsd-check": "^0.3.0",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
101
node_modules/meow/node_modules/p-limit/readme.md
generated
vendored
Normal file
101
node_modules/meow/node_modules/p-limit/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
# p-limit [](https://travis-ci.org/sindresorhus/p-limit)
|
||||
|
||||
> Run multiple promise-returning & async functions with limited concurrency
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install p-limit
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const pLimit = require('p-limit');
|
||||
|
||||
const limit = pLimit(1);
|
||||
|
||||
const input = [
|
||||
limit(() => fetchSomething('foo')),
|
||||
limit(() => fetchSomething('bar')),
|
||||
limit(() => doSomething())
|
||||
];
|
||||
|
||||
(async () => {
|
||||
// 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>
|
||||
64
node_modules/meow/node_modules/p-locate/index.d.ts
generated
vendored
Normal file
64
node_modules/meow/node_modules/p-locate/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
declare namespace pLocate {
|
||||
interface Options {
|
||||
/**
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
declare const pLocate: {
|
||||
/**
|
||||
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 = require('path-exists');
|
||||
import 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'
|
||||
})();
|
||||
```
|
||||
*/
|
||||
<ValueType>(
|
||||
input: Iterable<PromiseLike<ValueType> | ValueType>,
|
||||
tester: (element: ValueType) => PromiseLike<boolean> | boolean,
|
||||
options?: pLocate.Options
|
||||
): Promise<ValueType | undefined>;
|
||||
|
||||
// TODO: Remove this for the next major release, refactor the whole definition to:
|
||||
// declare function pLocate<ValueType>(
|
||||
// input: Iterable<PromiseLike<ValueType> | ValueType>,
|
||||
// tester: (element: ValueType) => PromiseLike<boolean> | boolean,
|
||||
// options?: pLocate.Options
|
||||
// ): Promise<ValueType | undefined>;
|
||||
// export = pLocate;
|
||||
default: typeof pLocate;
|
||||
};
|
||||
|
||||
export = pLocate;
|
||||
52
node_modules/meow/node_modules/p-locate/index.js
generated
vendored
Normal file
52
node_modules/meow/node_modules/p-locate/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
'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 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;
|
||||
};
|
||||
|
||||
const pLocate = async (iterable, tester, options) => {
|
||||
options = {
|
||||
concurrency: Infinity,
|
||||
preserveOrder: true,
|
||||
...options
|
||||
};
|
||||
|
||||
const limit = pLimit(options.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(options.preserveOrder ? 1 : Infinity);
|
||||
|
||||
try {
|
||||
await Promise.all(items.map(element => checkLimit(finder, element)));
|
||||
} catch (error) {
|
||||
if (error instanceof EndError) {
|
||||
return error.value;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = pLocate;
|
||||
// TODO: Remove this for the next major release
|
||||
module.exports.default = pLocate;
|
||||
9
node_modules/meow/node_modules/p-locate/license
generated
vendored
Normal file
9
node_modules/meow/node_modules/p-locate/license
generated
vendored
Normal 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.
|
||||
53
node_modules/meow/node_modules/p-locate/package.json
generated
vendored
Normal file
53
node_modules/meow/node_modules/p-locate/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
"name": "p-locate",
|
||||
"version": "4.1.0",
|
||||
"description": "Get the first fulfilled promise that satisfies the provided testing function",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/p-locate",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"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": "^2.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"delay": "^4.1.0",
|
||||
"in-range": "^1.0.0",
|
||||
"time-span": "^3.0.0",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
90
node_modules/meow/node_modules/p-locate/readme.md
generated
vendored
Normal file
90
node_modules/meow/node_modules/p-locate/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
# p-locate [](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 | 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`<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)
|
||||
39
node_modules/meow/node_modules/p-try/index.d.ts
generated
vendored
Normal file
39
node_modules/meow/node_modules/p-try/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
declare const pTry: {
|
||||
/**
|
||||
Start a promise chain.
|
||||
|
||||
@param fn - The function to run to start the promise chain.
|
||||
@param arguments - Arguments to pass to `fn`.
|
||||
@returns The value of calling `fn(...arguments)`. If the function throws an error, the returned `Promise` will be rejected with that error.
|
||||
|
||||
@example
|
||||
```
|
||||
import pTry = require('p-try');
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
const value = await pTry(() => {
|
||||
return synchronousFunctionThatMightThrow();
|
||||
});
|
||||
console.log(value);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
})();
|
||||
```
|
||||
*/
|
||||
<ValueType, ArgumentsType extends unknown[]>(
|
||||
fn: (...arguments: ArgumentsType) => PromiseLike<ValueType> | ValueType,
|
||||
...arguments: ArgumentsType
|
||||
): Promise<ValueType>;
|
||||
|
||||
// TODO: remove this in the next major version, refactor the whole definition to:
|
||||
// declare function pTry<ValueType, ArgumentsType extends unknown[]>(
|
||||
// fn: (...arguments: ArgumentsType) => PromiseLike<ValueType> | ValueType,
|
||||
// ...arguments: ArgumentsType
|
||||
// ): Promise<ValueType>;
|
||||
// export = pTry;
|
||||
default: typeof pTry;
|
||||
};
|
||||
|
||||
export = pTry;
|
||||
9
node_modules/meow/node_modules/p-try/index.js
generated
vendored
Normal file
9
node_modules/meow/node_modules/p-try/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
const pTry = (fn, ...arguments_) => new Promise(resolve => {
|
||||
resolve(fn(...arguments_));
|
||||
});
|
||||
|
||||
module.exports = pTry;
|
||||
// TODO: remove this in the next major version
|
||||
module.exports.default = pTry;
|
||||
9
node_modules/meow/node_modules/p-try/license
generated
vendored
Normal file
9
node_modules/meow/node_modules/p-try/license
generated
vendored
Normal 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.
|
||||
42
node_modules/meow/node_modules/p-try/package.json
generated
vendored
Normal file
42
node_modules/meow/node_modules/p-try/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"name": "p-try",
|
||||
"version": "2.2.0",
|
||||
"description": "`Start a promise chain",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/p-try",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"try",
|
||||
"resolve",
|
||||
"function",
|
||||
"catch",
|
||||
"async",
|
||||
"await",
|
||||
"promises",
|
||||
"settled",
|
||||
"ponyfill",
|
||||
"polyfill",
|
||||
"shim",
|
||||
"bluebird"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.1",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
58
node_modules/meow/node_modules/p-try/readme.md
generated
vendored
Normal file
58
node_modules/meow/node_modules/p-try/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# p-try [](https://travis-ci.org/sindresorhus/p-try)
|
||||
|
||||
> Start a promise chain
|
||||
|
||||
[How is it useful?](http://cryto.net/~joepie91/blog/2016/05/11/what-is-promise-try-and-why-does-it-matter/)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install p-try
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const pTry = require('p-try');
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
const value = await pTry(() => {
|
||||
return synchronousFunctionThatMightThrow();
|
||||
});
|
||||
console.log(value);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
})();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### pTry(fn, ...arguments)
|
||||
|
||||
Returns a `Promise` resolved with the value of calling `fn(...arguments)`. If the function throws an error, the returned `Promise` will be rejected with that error.
|
||||
|
||||
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.
|
||||
|
||||
#### fn
|
||||
|
||||
The function to run to start the promise chain.
|
||||
|
||||
#### arguments
|
||||
|
||||
Arguments to pass to `fn`.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [p-finally](https://github.com/sindresorhus/p-finally) - `Promise#finally()` ponyfill - Invoked when the promise is settled regardless of outcome
|
||||
- [More…](https://github.com/sindresorhus/promise-fun)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
54
node_modules/meow/node_modules/parse-json/index.js
generated
vendored
Normal file
54
node_modules/meow/node_modules/parse-json/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
'use strict';
|
||||
const errorEx = require('error-ex');
|
||||
const fallback = require('json-parse-even-better-errors');
|
||||
const {default: LinesAndColumns} = require('lines-and-columns');
|
||||
const {codeFrameColumns} = require('@babel/code-frame');
|
||||
|
||||
const JSONError = errorEx('JSONError', {
|
||||
fileName: errorEx.append('in %s'),
|
||||
codeFrame: errorEx.append('\n\n%s\n')
|
||||
});
|
||||
|
||||
const parseJson = (string, reviver, filename) => {
|
||||
if (typeof reviver === 'string') {
|
||||
filename = reviver;
|
||||
reviver = null;
|
||||
}
|
||||
|
||||
try {
|
||||
try {
|
||||
return JSON.parse(string, reviver);
|
||||
} catch (error) {
|
||||
fallback(string, reviver);
|
||||
throw error;
|
||||
}
|
||||
} catch (error) {
|
||||
error.message = error.message.replace(/\n/g, '');
|
||||
const indexMatch = error.message.match(/in JSON at position (\d+) while parsing/);
|
||||
|
||||
const jsonError = new JSONError(error);
|
||||
if (filename) {
|
||||
jsonError.fileName = filename;
|
||||
}
|
||||
|
||||
if (indexMatch && indexMatch.length > 0) {
|
||||
const lines = new LinesAndColumns(string);
|
||||
const index = Number(indexMatch[1]);
|
||||
const location = lines.locationForIndex(index);
|
||||
|
||||
const codeFrame = codeFrameColumns(
|
||||
string,
|
||||
{start: {line: location.line + 1, column: location.column + 1}},
|
||||
{highlightCode: true}
|
||||
);
|
||||
|
||||
jsonError.codeFrame = codeFrame;
|
||||
}
|
||||
|
||||
throw jsonError;
|
||||
}
|
||||
};
|
||||
|
||||
parseJson.JSONError = JSONError;
|
||||
|
||||
module.exports = parseJson;
|
||||
9
node_modules/meow/node_modules/parse-json/license
generated
vendored
Normal file
9
node_modules/meow/node_modules/parse-json/license
generated
vendored
Normal 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.
|
||||
45
node_modules/meow/node_modules/parse-json/package.json
generated
vendored
Normal file
45
node_modules/meow/node_modules/parse-json/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "parse-json",
|
||||
"version": "5.2.0",
|
||||
"description": "Parse JSON with more helpful errors",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/parse-json",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"vendor"
|
||||
],
|
||||
"keywords": [
|
||||
"parse",
|
||||
"json",
|
||||
"graceful",
|
||||
"error",
|
||||
"message",
|
||||
"humanize",
|
||||
"friendly",
|
||||
"helpful",
|
||||
"string"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
"error-ex": "^1.3.1",
|
||||
"json-parse-even-better-errors": "^2.3.0",
|
||||
"lines-and-columns": "^1.1.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"nyc": "^14.1.1",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
119
node_modules/meow/node_modules/parse-json/readme.md
generated
vendored
Normal file
119
node_modules/meow/node_modules/parse-json/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
# parse-json
|
||||
|
||||
> Parse JSON with more helpful errors
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install parse-json
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const parseJson = require('parse-json');
|
||||
|
||||
const json = '{\n\t"foo": true,\n}';
|
||||
|
||||
|
||||
JSON.parse(json);
|
||||
/*
|
||||
undefined:3
|
||||
}
|
||||
^
|
||||
SyntaxError: Unexpected token }
|
||||
*/
|
||||
|
||||
|
||||
parseJson(json);
|
||||
/*
|
||||
JSONError: Unexpected token } in JSON at position 16 while parsing near '{ "foo": true,}'
|
||||
|
||||
1 | {
|
||||
2 | "foo": true,
|
||||
> 3 | }
|
||||
| ^
|
||||
*/
|
||||
|
||||
|
||||
parseJson(json, 'foo.json');
|
||||
/*
|
||||
JSONError: Unexpected token } in JSON at position 16 while parsing near '{ "foo": true,}' in foo.json
|
||||
|
||||
1 | {
|
||||
2 | "foo": true,
|
||||
> 3 | }
|
||||
| ^
|
||||
*/
|
||||
|
||||
|
||||
// You can also add the filename at a later point
|
||||
try {
|
||||
parseJson(json);
|
||||
} catch (error) {
|
||||
if (error instanceof parseJson.JSONError) {
|
||||
error.fileName = 'foo.json';
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
/*
|
||||
JSONError: Unexpected token } in JSON at position 16 while parsing near '{ "foo": true,}' in foo.json
|
||||
|
||||
1 | {
|
||||
2 | "foo": true,
|
||||
> 3 | }
|
||||
| ^
|
||||
*/
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### parseJson(string, reviver?, filename?)
|
||||
|
||||
Throws a `JSONError` when there is a parsing error.
|
||||
|
||||
#### string
|
||||
|
||||
Type: `string`
|
||||
|
||||
#### reviver
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Prescribes how the value originally produced by parsing is transformed, before being returned. See [`JSON.parse` docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Using_the_reviver_parameter
|
||||
) for more.
|
||||
|
||||
#### filename
|
||||
|
||||
Type: `string`
|
||||
|
||||
Filename displayed in the error message.
|
||||
|
||||
### parseJson.JSONError
|
||||
|
||||
Exposed for `instanceof` checking.
|
||||
|
||||
#### fileName
|
||||
|
||||
Type: `string`
|
||||
|
||||
The filename displayed in the error message.
|
||||
|
||||
#### codeFrame
|
||||
|
||||
Type: `string`
|
||||
|
||||
The printable section of the JSON which produces the error.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-parse-json?utm_source=npm-parse-json&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>
|
||||
28
node_modules/meow/node_modules/path-exists/index.d.ts
generated
vendored
Normal file
28
node_modules/meow/node_modules/path-exists/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
declare const pathExists: {
|
||||
/**
|
||||
Check if a path exists.
|
||||
|
||||
@returns Whether the path exists.
|
||||
|
||||
@example
|
||||
```
|
||||
// foo.ts
|
||||
import pathExists = require('path-exists');
|
||||
|
||||
(async () => {
|
||||
console.log(await pathExists('foo.ts'));
|
||||
//=> true
|
||||
})();
|
||||
```
|
||||
*/
|
||||
(path: string): Promise<boolean>;
|
||||
|
||||
/**
|
||||
Synchronously check if a path exists.
|
||||
|
||||
@returns Whether the path exists.
|
||||
*/
|
||||
sync(path: string): boolean;
|
||||
};
|
||||
|
||||
export = pathExists;
|
||||
23
node_modules/meow/node_modules/path-exists/index.js
generated
vendored
Normal file
23
node_modules/meow/node_modules/path-exists/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
const fs = require('fs');
|
||||
const {promisify} = require('util');
|
||||
|
||||
const pAccess = promisify(fs.access);
|
||||
|
||||
module.exports = async path => {
|
||||
try {
|
||||
await pAccess(path);
|
||||
return true;
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.sync = path => {
|
||||
try {
|
||||
fs.accessSync(path);
|
||||
return true;
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
9
node_modules/meow/node_modules/path-exists/license
generated
vendored
Normal file
9
node_modules/meow/node_modules/path-exists/license
generated
vendored
Normal 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.
|
||||
39
node_modules/meow/node_modules/path-exists/package.json
generated
vendored
Normal file
39
node_modules/meow/node_modules/path-exists/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"name": "path-exists",
|
||||
"version": "4.0.0",
|
||||
"description": "Check if a path exists",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/path-exists",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"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": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
52
node_modules/meow/node_modules/path-exists/readme.md
generated
vendored
Normal file
52
node_modules/meow/node_modules/path-exists/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
# path-exists [](https://travis-ci.org/sindresorhus/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.
|
||||
|
||||
While [`fs.exists()`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback) is being [deprecated](https://github.com/iojs/io.js/issues/103), 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 path-exists
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// foo.js
|
||||
const pathExists = require('path-exists');
|
||||
|
||||
(async () => {
|
||||
console.log(await pathExists('foo.js'));
|
||||
//=> true
|
||||
})();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### pathExists(path)
|
||||
|
||||
Returns a `Promise<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)
|
||||
87
node_modules/meow/node_modules/read-pkg-up/index.d.ts
generated
vendored
Normal file
87
node_modules/meow/node_modules/read-pkg-up/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
import {Except} from 'type-fest';
|
||||
import readPkg = require('read-pkg');
|
||||
|
||||
declare namespace readPkgUp {
|
||||
type Options = {
|
||||
/**
|
||||
Directory to start looking for a package.json file.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
cwd?: string;
|
||||
} & Except<readPkg.Options, 'cwd'>;
|
||||
|
||||
type NormalizeOptions = {
|
||||
/**
|
||||
Directory to start looking for a package.json file.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
cwd?: string;
|
||||
} & Except<readPkg.NormalizeOptions, 'cwd'>;
|
||||
|
||||
type PackageJson = readPkg.PackageJson;
|
||||
type NormalizedPackageJson = readPkg.NormalizedPackageJson;
|
||||
|
||||
interface ReadResult {
|
||||
packageJson: PackageJson;
|
||||
path: string;
|
||||
}
|
||||
|
||||
interface NormalizedReadResult {
|
||||
packageJson: NormalizedPackageJson;
|
||||
path: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare const readPkgUp: {
|
||||
/**
|
||||
Read the closest `package.json` file.
|
||||
|
||||
@example
|
||||
```
|
||||
import readPkgUp = require('read-pkg-up');
|
||||
|
||||
(async () => {
|
||||
console.log(await readPkgUp());
|
||||
// {
|
||||
// packageJson: {
|
||||
// name: 'awesome-package',
|
||||
// version: '1.0.0',
|
||||
// …
|
||||
// },
|
||||
// path: '/Users/sindresorhus/dev/awesome-package/package.json'
|
||||
// }
|
||||
})();
|
||||
```
|
||||
*/
|
||||
(options?: readPkgUp.NormalizeOptions): Promise<
|
||||
readPkgUp.NormalizedReadResult | undefined
|
||||
>;
|
||||
(options: readPkgUp.Options): Promise<readPkgUp.ReadResult | undefined>;
|
||||
|
||||
/**
|
||||
Synchronously read the closest `package.json` file.
|
||||
|
||||
@example
|
||||
```
|
||||
import readPkgUp = require('read-pkg-up');
|
||||
|
||||
console.log(readPkgUp.sync());
|
||||
// {
|
||||
// packageJson: {
|
||||
// name: 'awesome-package',
|
||||
// version: '1.0.0',
|
||||
// …
|
||||
// },
|
||||
// path: '/Users/sindresorhus/dev/awesome-package/package.json'
|
||||
// }
|
||||
```
|
||||
*/
|
||||
sync(
|
||||
options?: readPkgUp.NormalizeOptions
|
||||
): readPkgUp.NormalizedReadResult | undefined;
|
||||
sync(options: readPkgUp.Options): readPkgUp.ReadResult | undefined;
|
||||
};
|
||||
|
||||
export = readPkgUp;
|
||||
30
node_modules/meow/node_modules/read-pkg-up/index.js
generated
vendored
Normal file
30
node_modules/meow/node_modules/read-pkg-up/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
'use strict';
|
||||
const path = require('path');
|
||||
const findUp = require('find-up');
|
||||
const readPkg = require('read-pkg');
|
||||
|
||||
module.exports = async options => {
|
||||
const filePath = await findUp('package.json', options);
|
||||
|
||||
if (!filePath) {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
packageJson: await readPkg({...options, cwd: path.dirname(filePath)}),
|
||||
path: filePath
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.sync = options => {
|
||||
const filePath = findUp.sync('package.json', options);
|
||||
|
||||
if (!filePath) {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
packageJson: readPkg.sync({...options, cwd: path.dirname(filePath)}),
|
||||
path: filePath
|
||||
};
|
||||
};
|
||||
9
node_modules/meow/node_modules/read-pkg-up/license
generated
vendored
Normal file
9
node_modules/meow/node_modules/read-pkg-up/license
generated
vendored
Normal 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.
|
||||
20
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/index.d.ts
generated
vendored
Normal file
20
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// Basic
|
||||
export * from './source/basic';
|
||||
|
||||
// Utilities
|
||||
export {Except} from './source/except';
|
||||
export {Mutable} from './source/mutable';
|
||||
export {Merge} from './source/merge';
|
||||
export {MergeExclusive} from './source/merge-exclusive';
|
||||
export {RequireAtLeastOne} from './source/require-at-least-one';
|
||||
export {RequireExactlyOne} from './source/require-exactly-one';
|
||||
export {PartialDeep} from './source/partial-deep';
|
||||
export {ReadonlyDeep} from './source/readonly-deep';
|
||||
export {LiteralUnion} from './source/literal-union';
|
||||
export {Promisable} from './source/promisable';
|
||||
export {Opaque} from './source/opaque';
|
||||
export {SetOptional} from './source/set-optional';
|
||||
export {SetRequired} from './source/set-required';
|
||||
|
||||
// Miscellaneous
|
||||
export {PackageJson} from './source/package-json';
|
||||
9
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/license
generated
vendored
Normal file
9
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/license
generated
vendored
Normal 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.
|
||||
51
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/package.json
generated
vendored
Normal file
51
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"name": "type-fest",
|
||||
"version": "0.8.1",
|
||||
"description": "A collection of essential TypeScript types",
|
||||
"license": "(MIT OR CC0-1.0)",
|
||||
"repository": "sindresorhus/type-fest",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"source"
|
||||
],
|
||||
"keywords": [
|
||||
"typescript",
|
||||
"ts",
|
||||
"types",
|
||||
"utility",
|
||||
"util",
|
||||
"utilities",
|
||||
"omit",
|
||||
"merge",
|
||||
"json"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@sindresorhus/tsconfig": "^0.4.0",
|
||||
"@typescript-eslint/eslint-plugin": "^2.2.0",
|
||||
"@typescript-eslint/parser": "^2.2.0",
|
||||
"eslint-config-xo-typescript": "^0.18.0",
|
||||
"tsd": "^0.7.3",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"xo": {
|
||||
"extends": "xo-typescript",
|
||||
"extensions": [
|
||||
"ts"
|
||||
],
|
||||
"rules": {
|
||||
"import/no-unresolved": "off",
|
||||
"@typescript-eslint/indent": "off"
|
||||
}
|
||||
}
|
||||
}
|
||||
635
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/readme.md
generated
vendored
Normal file
635
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,635 @@
|
|||
<div align="center">
|
||||
<br>
|
||||
<br>
|
||||
<img src="media/logo.svg" alt="type-fest" height="300">
|
||||
<br>
|
||||
<br>
|
||||
<b>A collection of essential TypeScript types</b>
|
||||
<br>
|
||||
<hr>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
[](https://travis-ci.com/sindresorhus/type-fest)
|
||||
[](https://www.youtube.com/watch?v=9auOCbH5Ns4)
|
||||
<!-- Commented out until they actually show anything
|
||||
[](https://www.npmjs.com/package/type-fest?activeTab=dependents) [](https://www.npmjs.com/package/type-fest)
|
||||
-->
|
||||
|
||||
Many of the types here should have been built-in. You can help by suggesting some of them to the [TypeScript project](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
|
||||
|
||||
Either add this package as a dependency or copy-paste the needed types. No credit required. 👌
|
||||
|
||||
PR welcome for additional commonly needed types and docs improvements. Read the [contributing guidelines](.github/contributing.md) first.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install type-fest
|
||||
```
|
||||
|
||||
*Requires TypeScript >=3.2*
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import {Except} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
unicorn: string;
|
||||
rainbow: boolean;
|
||||
};
|
||||
|
||||
type FooWithoutRainbow = Except<Foo, 'rainbow'>;
|
||||
//=> {unicorn: string}
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
Click the type names for complete docs.
|
||||
|
||||
### Basic
|
||||
|
||||
- [`Primitive`](source/basic.d.ts) - Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
||||
- [`Class`](source/basic.d.ts) - Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
||||
- [`TypedArray`](source/basic.d.ts) - Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
|
||||
- [`JsonObject`](source/basic.d.ts) - Matches a JSON object.
|
||||
- [`JsonArray`](source/basic.d.ts) - Matches a JSON array.
|
||||
- [`JsonValue`](source/basic.d.ts) - Matches any valid JSON value.
|
||||
- [`ObservableLike`](source/basic.d.ts) - Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).
|
||||
|
||||
### Utilities
|
||||
|
||||
- [`Except`](source/except.d.ts) - Create a type from an object type without certain keys. This is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type).
|
||||
- [`Mutable`](source/mutable.d.ts) - Convert an object with `readonly` keys into a mutable object. The inverse of `Readonly<T>`.
|
||||
- [`Merge`](source/merge.d.ts) - Merge two types into a new type. Keys of the second type overrides keys of the first type.
|
||||
- [`MergeExclusive`](source/merge-exclusive.d.ts) - Create a type that has mutually exclusive keys.
|
||||
- [`RequireAtLeastOne`](source/require-at-least-one.d.ts) - Create a type that requires at least one of the given keys.
|
||||
- [`RequireExactlyOne`](source/require-one.d.ts) - Create a type that requires exactly a single key of the given keys and disallows more.
|
||||
- [`PartialDeep`](source/partial-deep.d.ts) - Create a deeply optional version of another type. Use [`Partial<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) if you only need one level deep.
|
||||
- [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of an `object`/`Map`/`Set`/`Array` type. Use [`Readonly<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) if you only need one level deep.
|
||||
- [`LiteralUnion`](source/literal-union.d.ts) - Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. Workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729).
|
||||
- [`Promisable`](source/promisable.d.ts) - Create a type that represents either the value or the value wrapped in `PromiseLike`.
|
||||
- [`Opaque`](source/opaque.d.ts) - Create an [opaque type](https://codemix.com/opaque-types-in-javascript/).
|
||||
- [`SetOptional`](source/set-optional.d.ts) - Create a type that makes the given keys optional.
|
||||
- [`SetRequired`](source/set-required.d.ts) - Create a type that makes the given keys required.
|
||||
|
||||
### Miscellaneous
|
||||
|
||||
- [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file).
|
||||
|
||||
|
||||
## Declined types
|
||||
|
||||
*If we decline a type addition, we will make sure to document the better solution here.*
|
||||
|
||||
- [`Diff` and `Spread`](https://github.com/sindresorhus/type-fest/pull/7) - The PR author didn't provide any real-world use-cases and the PR went stale. If you think this type is useful, provide some real-world use-cases and we might reconsider.
|
||||
- [`Dictionary`](https://github.com/sindresorhus/type-fest/issues/33) - You only save a few characters (`Dictionary<number>` vs `Record<string, number>`) from [`Record`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434), which is more flexible and well-known. Also, you shouldn't use an object as a dictionary. We have `Map` in JavaScript now.
|
||||
|
||||
|
||||
## Tips
|
||||
|
||||
### Built-in types
|
||||
|
||||
There are many advanced types most users don't know about.
|
||||
|
||||
- [`Partial<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) - Make all properties in `T` optional.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/KYOwrgtgBAMg9gcxsAbsANlA3gKClAeQDMiAaPKAEWACMwFz8BRAJxbhcagDEBDAF17ocAXxw4AliH7AWRXgGNgUAHJwAJsADCcEEQkJsFXgAcTK3hGAAuKAGd+LKQgDcFEx363wEGrLf46IjIaOi28EioGG5iOArovHZ2qhrAAIJmAEJgEuiaLEb4Jk4oAsoKuvoIYCwCErq2apo6egZQALyF+FCm5pY2UABETelmg1xFnrYAzAAM8xNQQZGh4cFR6AB0xEQUIm4UFa0IABRHVbYACrws-BJCADwjLVUAfACUXfhEHFBnug4oABrYAATygcCIhBoACtgAp+JsQaC7P9ju9Prhut0joCwCZ1GUAGpCMDKTrnAwAbWRPWSyMhKWalQMAF0Dtj8BIoSd8YSZCT0GSOu1OmAQJp9CBgOpPkc7uBgBzOfwABYSOybSnVWp3XQ0sF04FgxnPFkIVkdKB84mkpUUfCxbEsYD8GogKBqjUBKBiWIAen9UGut3u6CeqReBlePXQQQA7skwMl+HAoMU4CgJJoISB0ODeOmbvwIVC1cAcIGmdpzVApDI5IpgJscNL49WMiZsrl8id3lrzScsD0zBYrLZBgAVOCUOCdwa+95uIA)
|
||||
|
||||
```ts
|
||||
interface NodeConfig {
|
||||
appName: string;
|
||||
port: number;
|
||||
}
|
||||
|
||||
class NodeAppBuilder {
|
||||
private configuration: NodeConfig = {
|
||||
appName: 'NodeApp',
|
||||
port: 3000
|
||||
};
|
||||
|
||||
config(config: Partial<NodeConfig>) {
|
||||
type NodeConfigKey = keyof NodeConfig;
|
||||
|
||||
for (const key of Object.keys(config) as NodeConfigKey[]) {
|
||||
const updateValue = config[key];
|
||||
|
||||
if (updateValue === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
this.configuration[key] = updateValue;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
// `Partial<NodeConfig>`` allows us to provide only a part of the
|
||||
// NodeConfig interface.
|
||||
new NodeAppBuilder().config({appName: 'ToDoApp'});
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Required<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1408-L1413) - Make all properties in `T` required.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgGED21VQGJZwC2wA3gFCjXAzFJgA2A-AFzADOUckA5gNxUaIYjA4ckvGG07c+g6gF8KQkAgCuEFFDA5O6gEbEwUbLm2ESwABQIixACJIoSdgCUYAR3Vg4MACYAPGYuFvYAfACU5Ko0APRxwADKMBD+wFAAFuh2Vv7OSBlYGdmc8ABu8LHKsRyGxqY4oQT21pTCIHQMjOwA5DAAHgACxAAOjDAAdChYxL0ANLHUouKSMH0AEmAAhJhY6ozpAJ77GTCMjMCiV0ToSAb7UJPPC9WRgrEJwAAqR6MwSRQPFGUFocDgRHYxnEfGAowh-zgUCOwF6KwkUl6tXqJhCeEsxDaS1AXSYfUGI3GUxmc0WSneQA)
|
||||
|
||||
```ts
|
||||
interface ContactForm {
|
||||
email?: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
function submitContactForm(formData: Required<ContactForm>) {
|
||||
// Send the form data to the server.
|
||||
}
|
||||
|
||||
submitContactForm({
|
||||
email: 'ex@mple.com',
|
||||
message: 'Hi! Could you tell me more about…',
|
||||
});
|
||||
|
||||
// TypeScript error: missing property 'message'
|
||||
submitContactForm({
|
||||
email: 'ex@mple.com',
|
||||
});
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Readonly<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) - Make all properties in `T` readonly.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/AQ4UwOwVwW2AZA9gc3mAbmANsA3gKFCOAHkAzMgGkOJABEwAjKZa2kAUQCcvEu32AMQCGAF2FYBIAL4BufDRABLCKLBcywgMZgEKZOoDCiCGSXI8i4hGEwwALmABnUVxXJ57YFgzZHSVF8sT1BpBSItLGEnJz1kAy5LLy0TM2RHACUwYQATEywATwAeAITjU3MAPnkrCJMXLigtUT4AClxgGztKbyDgaX99I1TzAEokr1BRAAslJwA6FIqLAF48TtswHp9MHDla9hJGACswZvmyLjAwAC8wVpm5xZHkUZDaMKIwqyWXYCW0oN4sNlsA1h0ug5gAByACyBQAggAHJHQ7ZBIFoXbzBjMCz7OoQP5YIaJNYQMAAdziCVaALGNSIAHomcAACoFJFgADKWjcSNEwG4vC4ji0wggEEQguiTnMEGALWAV1yAFp8gVgEjeFyuKICvMrCTgVxnst5jtsGC4ljsPNhXxGaAWcAAOq6YRXYDCRg+RWIcA5JSC+kWdCepQ+v3RYCU3RInzRMCGwlpC19NYBW1Ye08R1AA)
|
||||
|
||||
```ts
|
||||
enum LogLevel {
|
||||
Off,
|
||||
Debug,
|
||||
Error,
|
||||
Fatal
|
||||
};
|
||||
|
||||
interface LoggerConfig {
|
||||
name: string;
|
||||
level: LogLevel;
|
||||
}
|
||||
|
||||
class Logger {
|
||||
config: Readonly<LoggerConfig>;
|
||||
|
||||
constructor({name, level}: LoggerConfig) {
|
||||
this.config = {name, level};
|
||||
Object.freeze(this.config);
|
||||
}
|
||||
}
|
||||
|
||||
const config: LoggerConfig = {
|
||||
name: 'MyApp',
|
||||
level: LogLevel.Debug
|
||||
};
|
||||
|
||||
const logger = new Logger(config);
|
||||
|
||||
// TypeScript Error: cannot assign to read-only property.
|
||||
logger.config.level = LogLevel.Error;
|
||||
|
||||
// We are able to edit config variable as we please.
|
||||
config.level = LogLevel.Error;
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Pick<T, K>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1422-L1427) - From `T`, pick a set of properties whose keys are in the union `K`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgEE5TCgNugN4BQoZwOUBAXMAM5RyQDmA3KeSFABYCuAtgCMISMHloMmENh04oA9tBjQJjFuzIBfYrOAB6PcADCcGElh1gEGAHcKATwAO6ebyjB5CTNlwFwSxFR0BX5HeToYABNgBDh5fm8cfBg6AHIKG3ldA2BHOOcfFNpUygJ0pAhokr4hETFUgDpswywkggAFUwA3MFtgAF5gQgowKhhVKTYKGuFRcXo1aVZgbTIoJ3RW3xhOmB6+wfbcAGsAHi3kgBpgEtGy4AAfG54BWfqAPnZm4AAlZUj4MAkMA8GAGB4vEgfMlLLw6CwPBA8PYRmMgZVgAC6CgmI4cIommQELwICh8RBgKZKvALh1ur0bHQABR5PYMui0Wk7em2ADaAF0AJS0AASABUALIAGQAogR+Mp3CROCAFBBwVC2ikBpj5CgBIqGjizLA5TAFdAmalImAuqlBRoVQh5HBgEy1eDWfs7J5cjzGYKhroVfpDEhHM4MV6GRR5NN0JrtnRg6BVirTFBeHAKYmYY6QNpdB73LmCJZBlSAXAubtvczeSmQMNSuMbmKNgBlHFgPEUNwusBIPAAQlS1xetTmxT0SDoESgdD0C4aACtHMwxytLrohawgA)
|
||||
|
||||
```ts
|
||||
interface Article {
|
||||
title: string;
|
||||
thumbnail: string;
|
||||
content: string;
|
||||
}
|
||||
|
||||
// Creates new type out of the `Article` interface composed
|
||||
// from the Articles' two properties: `title` and `thumbnail`.
|
||||
// `ArticlePreview = {title: string; thumbnail: string}`
|
||||
type ArticlePreview = Pick<Article, 'title' | 'thumbnail'>;
|
||||
|
||||
// Render a list of articles using only title and description.
|
||||
function renderArticlePreviews(previews: ArticlePreview[]): HTMLElement {
|
||||
const articles = document.createElement('div');
|
||||
|
||||
for (const preview of previews) {
|
||||
// Append preview to the articles.
|
||||
}
|
||||
|
||||
return articles;
|
||||
}
|
||||
|
||||
const articles = renderArticlePreviews([
|
||||
{
|
||||
title: 'TypeScript tutorial!',
|
||||
thumbnail: '/assets/ts.jpg'
|
||||
}
|
||||
]);
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Record<K, T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434) - Construct a type with a set of properties `K` of type `T`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/AQ4ejYAUHsGcCWAXBMB2dgwGbAKYC2ADgDYwCeeemCaWArgE7ADGMxAhmuQHQBQoYEnJE8wALKEARnkaxEKdMAC8wAOS0kstGuAAfdQBM8ANzxlRjXQbVaWACwC0JPB0NqA3HwGgIwAJJoWozYHCxixnAsjAhStADmwESMMJYo1Fi4HMCIaPEu+MRklHj8gpqyoeHAAKJFFFTAAN4+giDYCIxwSAByHAR4AFw5SDF5Xm2gJBzdfQPD3WPxE5PAlBxdAPLYNQAelgh4aOHDaPQEMowrIAC+3oJ+AMKMrlrAXFhSAFZ4LEhC9g4-0BmA4JBISXgiCkBQABpILrJ5MhUGhYcATGD6Bk4Hh-jNgABrPDkOBlXyQAAq9ngYmJpOAAHcEOCRjAXqwYODfoo6DhakUSph+Uh7GI4P0xER4Cj0OSQGwMP8tP1hgAlX7swwAHgRl2RvIANALSA08ABtAC6AD4VM1Wm0Kow0MMrYaHYJjGYLLJXZb3at1HYnC43Go-QHQDcvA6-JsmEJXARgCDgMYWAhjIYhDAU+YiMAAFIwex0ZmilMITCGF79TLAGRsAgJYAAZRwSEZGzEABFTOZUrJ5Yn+jwnWgeER6HB7AAKJrADpdXqS4ZqYultTG6azVfqHswPBbtauLY7fayQ7HIbAAAMwBuAEoYw9IBq2Ixs9h2eFMOQYPQObALQKJgggABeYhghCIpikkKRpOQRIknAsZUiIeCttECBEP8NSMCkjDDAARMGziuIYxHwYOjDCMBmDNnAuTxA6irdCOBB1Lh5Dqpqn66tISIykawBnOCtqqC0gbjqc9DgpGkxegOliyfJDrRkAA)
|
||||
|
||||
```ts
|
||||
// Positions of employees in our company.
|
||||
type MemberPosition = 'intern' | 'developer' | 'tech-lead';
|
||||
|
||||
// Interface describing properties of a single employee.
|
||||
interface Employee {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
yearsOfExperience: number;
|
||||
}
|
||||
|
||||
// Create an object that has all possible `MemberPosition` values set as keys.
|
||||
// Those keys will store a collection of Employees of the same position.
|
||||
const team: Record<MemberPosition, Employee[]> = {
|
||||
intern: [],
|
||||
developer: [],
|
||||
'tech-lead': [],
|
||||
};
|
||||
|
||||
// Our team has decided to help John with his dream of becoming Software Developer.
|
||||
team.intern.push({
|
||||
firstName: 'John',
|
||||
lastName: 'Doe',
|
||||
yearsOfExperience: 0
|
||||
});
|
||||
|
||||
// `Record` forces you to initialize all of the property keys.
|
||||
// TypeScript Error: "tech-lead" property is missing
|
||||
const teamEmpty: Record<MemberPosition, null> = {
|
||||
intern: null,
|
||||
developer: null,
|
||||
};
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Exclude<T, U>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1436-L1439) - Exclude from `T` those types that are assignable to `U`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgMrQG7QMIHsQzADmyA3gFDLIAOuUYAXMiAK4A2byAPsgM5hRQJHqwC2AI2gBucgF9y5MAE9qKAEoQAjiwj8AEnBAATNtGQBeZAAooWphu26wAGmS3e93bRC8IASgsAPmRDJRlyAHoI5ABRAA8ENhYjFFYOZGVVZBgoXFFkAAM0zh5+QRBhZhYJaAKAOkjogEkQZAQ4X2QAdwALCFbaemRgXmQtFjhOMFwq9K6ULuB0lk6U+HYwZAxJnQaYFhAEMGB8ZCIIMAAFOjAANR2IK0HGWISklIAedCgsKDwCYgAbQA5M9gQBdVzFQJ+JhiSRQMiUYYwayZCC4VHPCzmSzAspCYEBWxgFhQAZwKC+FpgJ43VwARgADH4ZFQSWSBjcZPJyPtDsdTvxKWBvr8rD1DCZoJ5HPopaYoK4EPhCEQmGKcKriLCtrhgEYkVQVT5Nr4fmZLLZtMBbFZgT0wGBqES6ghbHBIJqoBKFdBWQpjfh+DQbhY2tqiHVsbjLMVkAB+ZAAZiZaeQTHOVxu9ySjxNaujNwDVHNvzqbBGkBAdPoAfkQA)
|
||||
|
||||
```ts
|
||||
interface ServerConfig {
|
||||
port: null | string | number;
|
||||
}
|
||||
|
||||
type RequestHandler = (request: Request, response: Response) => void;
|
||||
|
||||
// Exclude `null` type from `null | string | number`.
|
||||
// In case the port is equal to `null`, we will use default value.
|
||||
function getPortValue(port: Exclude<ServerConfig['port'], null>): number {
|
||||
if (typeof port === 'string') {
|
||||
return parseInt(port, 10);
|
||||
}
|
||||
|
||||
return port;
|
||||
}
|
||||
|
||||
function startServer(handler: RequestHandler, config: ServerConfig): void {
|
||||
const server = require('http').createServer(handler);
|
||||
|
||||
const port = config.port === null ? 3000 : getPortValue(config.port);
|
||||
server.listen(port);
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Extract<T, U>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1441-L1444) - Extract from `T` those types that are assignable to `U`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXzSwEdkQBJYACgEoAueVZAWwCMQYBuAKDDwGcM8MgBF4AXngBlAJ6scESgHIRi6ty5ZUGdoihgEABXZ888AN5d48ANoiAuvUat23K6ihMQ9ATE0BzV3goPy8GZjZOLgBfLi4Aejj4AEEICBwAdz54MAALKFQQ+BxEeAAHY1NgKAwoIKy0grr4DByEUpgccpgMaXgAaxBerCzi+B9-ZulygDouFHRsU1z8kKMYE1RhaqgAHkt4AHkWACt4EAAPbVRgLLWNgBp9gGlBs8uQa6yAUUuYPQwdgNpKM7nh7mMML4CgA+R5WABqUAgpDeVxuhxO1he0jsXGh8EoOBO9COx3BQPo2PBADckaR6IjkSA6PBqTgsMBzPsicdrEC7OJWXSQNwYvFEgAVTS9JLXODpeDpKBZFg4GCoWa8VACIJykAKiQWKy2YQOAioYikCg0OEMDyhRSy4DyxS24KhAAMjyi6gS8AAwjh5OD0iBFHAkJoEOksC1mnkMJq8gUQKDNttKPlnfrwYp3J5XfBHXqoKpfYkAOI4ansTxaeDADmoRSCCBYAbxhC6TDx6rwYHIRX5bScjA4bLJwoDmDwDkfbA9JMrVMVdM1TN69LgkTgwgkchUahqIA)
|
||||
|
||||
```ts
|
||||
declare function uniqueId(): number;
|
||||
|
||||
const ID = Symbol('ID');
|
||||
|
||||
interface Person {
|
||||
[ID]: number;
|
||||
name: string;
|
||||
age: number;
|
||||
}
|
||||
|
||||
// Allows changing the person data as long as the property key is of string type.
|
||||
function changePersonData<
|
||||
Obj extends Person,
|
||||
Key extends Extract<keyof Person, string>,
|
||||
Value extends Obj[Key]
|
||||
> (obj: Obj, key: Key, value: Value): void {
|
||||
obj[key] = value;
|
||||
}
|
||||
|
||||
// Tiny Andrew was born.
|
||||
const andrew = {
|
||||
[ID]: uniqueId(),
|
||||
name: 'Andrew',
|
||||
age: 0,
|
||||
};
|
||||
|
||||
// Cool, we're fine with that.
|
||||
changePersonData(andrew, 'name', 'Pony');
|
||||
|
||||
// Goverment didn't like the fact that you wanted to change your identity.
|
||||
changePersonData(andrew, ID, uniqueId());
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`NonNullable<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1446-L1449) - Exclude `null` and `undefined` from `T`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
Works with <code>strictNullChecks</code> set to <code>true</code>. (Read more <a href="https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-0.html">here</a>)
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/C4TwDgpgBACg9gJ2AOQK4FsBGEFQLxQDOwCAlgHYDmUAPlORtrnQwDasDcAUFwPQBU-WAEMkUOADMowqAGNWwwoSgATCBIqlgpOOSjAAFsOBRSy1IQgr9cKJlSlW1mZYQA3HFH68u8xcoBlHA8EACEHJ08Aby4oKDBUTFZSWXjEFEYcAEIALihkXTR2YSSIAB54JDQsHAA+blj4xOTUsHSACkMzPKD3HHDHNQQAGjSkPMqMmoQASh7g-oihqBi4uNIpdraxPAI2VhmVxrX9AzMAOm2ppnwoAA4ABifuE4BfKAhWSyOTuK7CS7pao3AhXF5rV48E4ICDAVAIPT-cGQyG+XTEIgLMJLTx7CAAdygvRCA0iCHaMwarhJOIQjUBSHaACJHk8mYdeLwxtdcVAAOSsh58+lXdr7Dlcq7A3n3J4PEUdADMcspUE53OluAIUGVTx46oAKuAIAFZGQwCYAKIIBCILjUxaDHAMnla+iodjcIA)
|
||||
|
||||
```ts
|
||||
type PortNumber = string | number | null;
|
||||
|
||||
/** Part of a class definition that is used to build a server */
|
||||
class ServerBuilder {
|
||||
portNumber!: NonNullable<PortNumber>;
|
||||
|
||||
port(this: ServerBuilder, port: PortNumber): ServerBuilder {
|
||||
if (port == null) {
|
||||
this.portNumber = 8000;
|
||||
} else {
|
||||
this.portNumber = port;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
const serverBuilder = new ServerBuilder();
|
||||
|
||||
serverBuilder
|
||||
.port('8000') // portNumber = '8000'
|
||||
.port(null) // portNumber = 8000
|
||||
.port(3000); // portNumber = 3000
|
||||
|
||||
// TypeScript error
|
||||
serverBuilder.portNumber = null;
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Parameters<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1451-L1454) - Obtain the parameters of a function type in a tuple.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/GYVwdgxgLglg9mABAZwBYmMANgUwBQxgAOIUAXIgIZgCeA2gLoCUFAbnDACaIDeAUIkQB6IYgCypSlBxUATrMo1ECsJzgBbLEoipqAc0J7EMKMgDkiHLnU4wp46pwAPHMgB0fAL58+oSLARECEosLAA5ABUYG2QAHgAxJGdpVWREPDdMylk9ZApqemZEAF4APipacrw-CApEgBogkKwAYThwckQwEHUAIxxZJl4BYVEImiIZKF0oZRwiWVdbeygJmThgOYgcGFYcbhqApCJsyhtpWXcR1cnEePBoeDAABVPzgbTixFeFd8uEsClADcIxGiygIFkSEOT3SmTc2VydQeRx+ZxwF2QQ34gkEwDgsnSuFmMBKiAADEDjIhYk1Qm0OlSYABqZnYka4xA1DJZHJYkGc7yCbyeRA+CAIZCzNAYbA4CIAdxg2zJwVCkWirjwMswuEaACYmCCgA)
|
||||
|
||||
```ts
|
||||
function shuffle(input: any[]): void {
|
||||
// Mutate array randomly changing its' elements indexes.
|
||||
}
|
||||
|
||||
function callNTimes<Fn extends (...args: any[]) => any> (func: Fn, callCount: number) {
|
||||
// Type that represents the type of the received function parameters.
|
||||
type FunctionParameters = Parameters<Fn>;
|
||||
|
||||
return function (...args: FunctionParameters) {
|
||||
for (let i = 0; i < callCount; i++) {
|
||||
func(...args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const shuffleTwice = callNTimes(shuffle, 2);
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`ConstructorParameters<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1456-L1459) - Obtain the parameters of a constructor function type in a tuple.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECCBOAXAlqApgWQPYBM0mgG8AoaaFRENALmgkXmQDsBzAblOmCycTV4D8teo1YdO3JiICuwRFngAKClWENmLAJRFOZRAAtkEAHQq00ALzlklNBzIBfYk+KhIMAJJTEYJsDQAwmDA+mgAPAAq0GgAHnxMODCKTGgA7tCKxllg8CwQtL4AngDaALraFgB80EWa1SRkAA6MAG5gfNAB4FABPDJyCrQR9tDNyG0dwMGhtBhgjWEiGgA00F70vv4RhY3hEZXVVinpc42KmuJkkv3y8Bly8EPaDWTkhiZd7r3e8LK3llwGCMXGQWGhEOsfH5zJlsrl8p0+gw-goAAo5MAAW3BaHgEEilU0tEhmzQ212BJ0ry4SOg+kg+gBBiMximIGA0nAfAQLGk2N4EAAEgzYcYcnkLsRdDTvNEYkYUKwSdCme9WdM0MYwYhFPSIPpJdTkAAzDKxBUaZX+aAAQgsVmkCTQxuYaBw2ng4Ok8CYcotSu8pMur09iG9vuObxZnx6SN+AyUWTF8MN0CcZE4Ywm5jZHK5aB5fP4iCFIqT4oRRTKRLo6lYVNeAHpG50wOzOe1zHr9NLQ+HoABybsD4HOKXXRA1JCoKhBELmI5pNaB6Fz0KKBAodDYPAgSUTmqYsAALx4m5nC6nW9nGq14KtaEUA9gR9PvuNCjQ9BgACNvcwNBtAcLiAA)
|
||||
|
||||
```ts
|
||||
class ArticleModel {
|
||||
title: string;
|
||||
content?: string;
|
||||
|
||||
constructor(title: string) {
|
||||
this.title = title;
|
||||
}
|
||||
}
|
||||
|
||||
class InstanceCache<T extends (new (...args: any[]) => any)> {
|
||||
private ClassConstructor: T;
|
||||
private cache: Map<string, InstanceType<T>> = new Map();
|
||||
|
||||
constructor (ctr: T) {
|
||||
this.ClassConstructor = ctr;
|
||||
}
|
||||
|
||||
getInstance (...args: ConstructorParameters<T>): InstanceType<T> {
|
||||
const hash = this.calculateArgumentsHash(...args);
|
||||
|
||||
const existingInstance = this.cache.get(hash);
|
||||
if (existingInstance !== undefined) {
|
||||
return existingInstance;
|
||||
}
|
||||
|
||||
return new this.ClassConstructor(...args);
|
||||
}
|
||||
|
||||
private calculateArgumentsHash(...args: any[]): string {
|
||||
// Calculate hash.
|
||||
return 'hash';
|
||||
}
|
||||
}
|
||||
|
||||
const articleCache = new InstanceCache(ArticleModel);
|
||||
const amazonArticle = articleCache.getInstance('Amazon forests burining!');
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`ReturnType<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1461-L1464) – Obtain the return type of a function type.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA)
|
||||
|
||||
```ts
|
||||
/** Provides every element of the iterable `iter` into the `callback` function and stores the results in an array. */
|
||||
function mapIter<
|
||||
Elem,
|
||||
Func extends (elem: Elem) => any,
|
||||
Ret extends ReturnType<Func>
|
||||
>(iter: Iterable<Elem>, callback: Func): Ret[] {
|
||||
const mapped: Ret[] = [];
|
||||
|
||||
for (const elem of iter) {
|
||||
mapped.push(callback(elem));
|
||||
}
|
||||
|
||||
return mapped;
|
||||
}
|
||||
|
||||
const setObject: Set<string> = new Set();
|
||||
const mapObject: Map<number, string> = new Map();
|
||||
|
||||
mapIter(setObject, (value: string) => value.indexOf('Foo')); // number[]
|
||||
|
||||
mapIter(mapObject, ([key, value]: [number, string]) => {
|
||||
return key % 2 === 0 ? value : 'Odd';
|
||||
}); // string[]
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`InstanceType<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1466-L1469) – Obtain the instance type of a constructor function type.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA)
|
||||
|
||||
```ts
|
||||
class IdleService {
|
||||
doNothing (): void {}
|
||||
}
|
||||
|
||||
class News {
|
||||
title: string;
|
||||
content: string;
|
||||
|
||||
constructor(title: string, content: string) {
|
||||
this.title = title;
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
|
||||
const instanceCounter: Map<Function, number> = new Map();
|
||||
|
||||
interface Constructor {
|
||||
new(...args: any[]): any;
|
||||
}
|
||||
|
||||
// Keep track how many instances of `Constr` constructor have been created.
|
||||
function getInstance<
|
||||
Constr extends Constructor,
|
||||
Args extends ConstructorParameters<Constr>
|
||||
>(constructor: Constr, ...args: Args): InstanceType<Constr> {
|
||||
let count = instanceCounter.get(constructor) || 0;
|
||||
|
||||
const instance = new constructor(...args);
|
||||
|
||||
instanceCounter.set(constructor, count + 1);
|
||||
|
||||
console.log(`Created ${count + 1} instances of ${Constr.name} class`);
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
const idleService = getInstance(IdleService);
|
||||
// Will log: `Created 1 instances of IdleService class`
|
||||
const newsEntry = getInstance(News, 'New ECMAScript proposals!', 'Last month...');
|
||||
// Will log: `Created 1 instances of News class`
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Omit<T, K>`](https://github.com/microsoft/TypeScript/blob/71af02f7459dc812e85ac31365bfe23daf14b4e4/src/lib/es5.d.ts#L1446) – Constructs a type by picking all properties from T and then removing K.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgIImAWzgG2QbwChlks4BzCAVShwC5kBnMKUcgbmKYAcIFgIjBs1YgOXMpSFMWbANoBdTiW5woFddwAW0kfKWEAvoUIB6U8gDCUCHEiNkICAHdkYAJ69kz4GC3JcPG4oAHteKDABBxCYNAxsPFBIWEQUCAAPJG4wZABySUFcgJAAEzMLXNV1ck0dIuCw6EjBADpy5AB1FAQ4EGQAV0YUP2AHDy8wEOQbUugmBLwtEIA3OcmQnEjuZBgQqE7gAGtgZAhwKHdkHFGwNvGUdDIcAGUliIBJEF3kAF5kAHlML4ADyPBIAGjyBUYRQAPnkqho4NoYQA+TiEGD9EAISIhPozErQMG4AASK2gn2+AApek9pCSXm8wFSQooAJQMUkAFQAsgAZACiOAgmDOOSIJAQ+OYyGl4DgoDmf2QJRCCH6YvALQQNjsEGFovF1NyJWAy1y7OUyHMyE+yRAuFImG4Iq1YDswHxbRINjA-SgfXlHqVUE4xiAA)
|
||||
|
||||
```ts
|
||||
interface Animal {
|
||||
imageUrl: string;
|
||||
species: string;
|
||||
images: string[];
|
||||
paragraphs: string[];
|
||||
}
|
||||
|
||||
// Creates new type with all properties of the `Animal` interface
|
||||
// except 'images' and 'paragraphs' properties. We can use this
|
||||
// type to render small hover tooltip for a wiki entry list.
|
||||
type AnimalShortInfo = Omit<Animal, 'images' | 'paragraphs'>;
|
||||
|
||||
function renderAnimalHoverInfo (animals: AnimalShortInfo[]): HTMLElement {
|
||||
const container = document.createElement('div');
|
||||
// Internal implementation.
|
||||
return container;
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
You can find some examples in the [TypeScript docs](https://www.typescriptlang.org/docs/handbook/advanced-types.html#predefined-conditional-types).
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Jarek Radosz](https://github.com/CvX)
|
||||
- [Dimitri Benin](https://github.com/BendingBender)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
(MIT OR CC0-1.0)
|
||||
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-type-fest?utm_source=npm-type-fest&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>
|
||||
67
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/basic.d.ts
generated
vendored
Normal file
67
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/basic.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/// <reference lib="esnext"/>
|
||||
|
||||
// TODO: This can just be `export type Primitive = not object` when the `not` keyword is out.
|
||||
/**
|
||||
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
||||
*/
|
||||
export type Primitive =
|
||||
| null
|
||||
| undefined
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| symbol
|
||||
| bigint;
|
||||
|
||||
// TODO: Remove the `= unknown` sometime in the future when most users are on TS 3.5 as it's now the default
|
||||
/**
|
||||
Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
||||
*/
|
||||
export type Class<T = unknown, Arguments extends any[] = any[]> = new(...arguments_: Arguments) => T;
|
||||
|
||||
/**
|
||||
Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
|
||||
*/
|
||||
export type TypedArray =
|
||||
| Int8Array
|
||||
| Uint8Array
|
||||
| Uint8ClampedArray
|
||||
| Int16Array
|
||||
| Uint16Array
|
||||
| Int32Array
|
||||
| Uint32Array
|
||||
| Float32Array
|
||||
| Float64Array
|
||||
| BigInt64Array
|
||||
| BigUint64Array;
|
||||
|
||||
/**
|
||||
Matches a JSON object.
|
||||
|
||||
This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`.
|
||||
*/
|
||||
export type JsonObject = {[key: string]: JsonValue};
|
||||
|
||||
/**
|
||||
Matches a JSON array.
|
||||
*/
|
||||
export interface JsonArray extends Array<JsonValue> {}
|
||||
|
||||
/**
|
||||
Matches any valid JSON value.
|
||||
*/
|
||||
export type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
|
||||
|
||||
declare global {
|
||||
interface SymbolConstructor {
|
||||
readonly observable: symbol;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).
|
||||
*/
|
||||
export interface ObservableLike {
|
||||
subscribe(observer: (value: unknown) => void): void;
|
||||
[Symbol.observable](): ObservableLike;
|
||||
}
|
||||
22
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/except.d.ts
generated
vendored
Normal file
22
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/except.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
Create a type from an object type without certain keys.
|
||||
|
||||
This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
|
||||
|
||||
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/30825) if you want to have the stricter version as a built-in in TypeScript.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Except} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
a: number;
|
||||
b: string;
|
||||
c: boolean;
|
||||
};
|
||||
|
||||
type FooWithoutA = Except<Foo, 'a' | 'c'>;
|
||||
//=> {b: string};
|
||||
```
|
||||
*/
|
||||
export type Except<ObjectType, KeysType extends keyof ObjectType> = Pick<ObjectType, Exclude<keyof ObjectType, KeysType>>;
|
||||
33
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/literal-union.d.ts
generated
vendored
Normal file
33
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/literal-union.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import {Primitive} from './basic';
|
||||
|
||||
/**
|
||||
Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
|
||||
|
||||
Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
|
||||
|
||||
This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
|
||||
|
||||
@example
|
||||
```
|
||||
import {LiteralUnion} from 'type-fest';
|
||||
|
||||
// Before
|
||||
|
||||
type Pet = 'dog' | 'cat' | string;
|
||||
|
||||
const pet: Pet = '';
|
||||
// Start typing in your TypeScript-enabled IDE.
|
||||
// You **will not** get auto-completion for `dog` and `cat` literals.
|
||||
|
||||
// After
|
||||
|
||||
type Pet2 = LiteralUnion<'dog' | 'cat', string>;
|
||||
|
||||
const pet: Pet2 = '';
|
||||
// You **will** get auto-completion for `dog` and `cat` literals.
|
||||
```
|
||||
*/
|
||||
export type LiteralUnion<
|
||||
LiteralType extends BaseType,
|
||||
BaseType extends Primitive
|
||||
> = LiteralType | (BaseType & {_?: never});
|
||||
39
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/merge-exclusive.d.ts
generated
vendored
Normal file
39
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/merge-exclusive.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// Helper type. Not useful on its own.
|
||||
type Without<FirstType, SecondType> = {[KeyType in Exclude<keyof FirstType, keyof SecondType>]?: never};
|
||||
|
||||
/**
|
||||
Create a type that has mutually exclusive keys.
|
||||
|
||||
This type was inspired by [this comment](https://github.com/Microsoft/TypeScript/issues/14094#issuecomment-373782604).
|
||||
|
||||
This type works with a helper type, called `Without`. `Without<FirstType, SecondType>` produces a type that has only keys from `FirstType` which are not present on `SecondType` and sets the value type for these keys to `never`. This helper type is then used in `MergeExclusive` to remove keys from either `FirstType` or `SecondType`.
|
||||
|
||||
@example
|
||||
```
|
||||
import {MergeExclusive} from 'type-fest';
|
||||
|
||||
interface ExclusiveVariation1 {
|
||||
exclusive1: boolean;
|
||||
}
|
||||
|
||||
interface ExclusiveVariation2 {
|
||||
exclusive2: string;
|
||||
}
|
||||
|
||||
type ExclusiveOptions = MergeExclusive<ExclusiveVariation1, ExclusiveVariation2>;
|
||||
|
||||
let exclusiveOptions: ExclusiveOptions;
|
||||
|
||||
exclusiveOptions = {exclusive1: true};
|
||||
//=> Works
|
||||
exclusiveOptions = {exclusive2: 'hi'};
|
||||
//=> Works
|
||||
exclusiveOptions = {exclusive1: true, exclusive2: 'hi'};
|
||||
//=> Error
|
||||
```
|
||||
*/
|
||||
export type MergeExclusive<FirstType, SecondType> =
|
||||
(FirstType | SecondType) extends object ?
|
||||
(Without<FirstType, SecondType> & SecondType) | (Without<SecondType, FirstType> & FirstType) :
|
||||
FirstType | SecondType;
|
||||
|
||||
22
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/merge.d.ts
generated
vendored
Normal file
22
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/merge.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import {Except} from './except';
|
||||
|
||||
/**
|
||||
Merge two types into a new type. Keys of the second type overrides keys of the first type.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Merge} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
a: number;
|
||||
b: string;
|
||||
};
|
||||
|
||||
type Bar = {
|
||||
b: number;
|
||||
};
|
||||
|
||||
const ab: Merge<Foo, Bar> = {a: 1, b: 2};
|
||||
```
|
||||
*/
|
||||
export type Merge<FirstType, SecondType> = Except<FirstType, Extract<keyof FirstType, keyof SecondType>> & SecondType;
|
||||
22
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/mutable.d.ts
generated
vendored
Normal file
22
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/mutable.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
Convert an object with `readonly` keys into a mutable object. Inverse of `Readonly<T>`.
|
||||
|
||||
This can be used to [store and mutate options within a class](https://github.com/sindresorhus/pageres/blob/4a5d05fca19a5fbd2f53842cbf3eb7b1b63bddd2/source/index.ts#L72), [edit `readonly` objects within tests](https://stackoverflow.com/questions/50703834), and [construct a `readonly` object within a function](https://github.com/Microsoft/TypeScript/issues/24509).
|
||||
|
||||
@example
|
||||
```
|
||||
import {Mutable} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
readonly a: number;
|
||||
readonly b: string;
|
||||
};
|
||||
|
||||
const mutableFoo: Mutable<Foo> = {a: 1, b: '2'};
|
||||
mutableFoo.a = 3;
|
||||
```
|
||||
*/
|
||||
export type Mutable<ObjectType> = {
|
||||
// For each `Key` in the keys of `ObjectType`, make a mapped type by removing the `readonly` modifier from the key.
|
||||
-readonly [KeyType in keyof ObjectType]: ObjectType[KeyType];
|
||||
};
|
||||
40
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/opaque.d.ts
generated
vendored
Normal file
40
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/opaque.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
Create an opaque type, which hides its internal details from the public, and can only be created by being used explicitly.
|
||||
|
||||
The generic type parameter can be anything. It doesn't have to be an object.
|
||||
|
||||
[Read more about opaque types.](https://codemix.com/opaque-types-in-javascript/)
|
||||
|
||||
There have been several discussions about adding this feature to TypeScript via the `opaque type` operator, similar to how Flow does it. Unfortunately, nothing has (yet) moved forward:
|
||||
- [Microsoft/TypeScript#15408](https://github.com/Microsoft/TypeScript/issues/15408)
|
||||
- [Microsoft/TypeScript#15807](https://github.com/Microsoft/TypeScript/issues/15807)
|
||||
|
||||
@example
|
||||
```
|
||||
import {Opaque} from 'type-fest';
|
||||
|
||||
type AccountNumber = Opaque<number>;
|
||||
type AccountBalance = Opaque<number>;
|
||||
|
||||
function createAccountNumber(): AccountNumber {
|
||||
return 2 as AccountNumber;
|
||||
}
|
||||
|
||||
function getMoneyForAccount(accountNumber: AccountNumber): AccountBalance {
|
||||
return 4 as AccountBalance;
|
||||
}
|
||||
|
||||
// This will compile successfully.
|
||||
getMoneyForAccount(createAccountNumber());
|
||||
|
||||
// But this won't, because it has to be explicitly passed as an `AccountNumber` type.
|
||||
getMoneyForAccount(2);
|
||||
|
||||
// You can use opaque values like they aren't opaque too.
|
||||
const accountNumber = createAccountNumber();
|
||||
|
||||
// This will compile successfully.
|
||||
accountNumber + 2;
|
||||
```
|
||||
*/
|
||||
export type Opaque<Type> = Type & {readonly __opaque__: unique symbol};
|
||||
501
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/package-json.d.ts
generated
vendored
Normal file
501
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/package-json.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,501 @@
|
|||
import {LiteralUnion} from '..';
|
||||
|
||||
declare namespace PackageJson {
|
||||
/**
|
||||
A person who has been involved in creating or maintaining the package.
|
||||
*/
|
||||
export type Person =
|
||||
| string
|
||||
| {
|
||||
name: string;
|
||||
url?: string;
|
||||
email?: string;
|
||||
};
|
||||
|
||||
export type BugsLocation =
|
||||
| string
|
||||
| {
|
||||
/**
|
||||
The URL to the package's issue tracker.
|
||||
*/
|
||||
url?: string;
|
||||
|
||||
/**
|
||||
The email address to which issues should be reported.
|
||||
*/
|
||||
email?: string;
|
||||
};
|
||||
|
||||
export interface DirectoryLocations {
|
||||
/**
|
||||
Location for executable scripts. Sugar to generate entries in the `bin` property by walking the folder.
|
||||
*/
|
||||
bin?: string;
|
||||
|
||||
/**
|
||||
Location for Markdown files.
|
||||
*/
|
||||
doc?: string;
|
||||
|
||||
/**
|
||||
Location for example scripts.
|
||||
*/
|
||||
example?: string;
|
||||
|
||||
/**
|
||||
Location for the bulk of the library.
|
||||
*/
|
||||
lib?: string;
|
||||
|
||||
/**
|
||||
Location for man pages. Sugar to generate a `man` array by walking the folder.
|
||||
*/
|
||||
man?: string;
|
||||
|
||||
/**
|
||||
Location for test files.
|
||||
*/
|
||||
test?: string;
|
||||
|
||||
[directoryType: string]: unknown;
|
||||
}
|
||||
|
||||
export type Scripts = {
|
||||
/**
|
||||
Run **before** the package is published (Also run on local `npm install` without any arguments).
|
||||
*/
|
||||
prepublish?: string;
|
||||
|
||||
/**
|
||||
Run both **before** the package is packed and published, and on local `npm install` without any arguments. This is run **after** `prepublish`, but **before** `prepublishOnly`.
|
||||
*/
|
||||
prepare?: string;
|
||||
|
||||
/**
|
||||
Run **before** the package is prepared and packed, **only** on `npm publish`.
|
||||
*/
|
||||
prepublishOnly?: string;
|
||||
|
||||
/**
|
||||
Run **before** a tarball is packed (on `npm pack`, `npm publish`, and when installing git dependencies).
|
||||
*/
|
||||
prepack?: string;
|
||||
|
||||
/**
|
||||
Run **after** the tarball has been generated and moved to its final destination.
|
||||
*/
|
||||
postpack?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is published.
|
||||
*/
|
||||
publish?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is published.
|
||||
*/
|
||||
postpublish?: string;
|
||||
|
||||
/**
|
||||
Run **before** the package is installed.
|
||||
*/
|
||||
preinstall?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is installed.
|
||||
*/
|
||||
install?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is installed and after `install`.
|
||||
*/
|
||||
postinstall?: string;
|
||||
|
||||
/**
|
||||
Run **before** the package is uninstalled and before `uninstall`.
|
||||
*/
|
||||
preuninstall?: string;
|
||||
|
||||
/**
|
||||
Run **before** the package is uninstalled.
|
||||
*/
|
||||
uninstall?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is uninstalled.
|
||||
*/
|
||||
postuninstall?: string;
|
||||
|
||||
/**
|
||||
Run **before** bump the package version and before `version`.
|
||||
*/
|
||||
preversion?: string;
|
||||
|
||||
/**
|
||||
Run **before** bump the package version.
|
||||
*/
|
||||
version?: string;
|
||||
|
||||
/**
|
||||
Run **after** bump the package version.
|
||||
*/
|
||||
postversion?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm test` command, before `test`.
|
||||
*/
|
||||
pretest?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm test` command.
|
||||
*/
|
||||
test?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm test` command, after `test`.
|
||||
*/
|
||||
posttest?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm stop` command, before `stop`.
|
||||
*/
|
||||
prestop?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm stop` command.
|
||||
*/
|
||||
stop?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm stop` command, after `stop`.
|
||||
*/
|
||||
poststop?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm start` command, before `start`.
|
||||
*/
|
||||
prestart?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm start` command.
|
||||
*/
|
||||
start?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm start` command, after `start`.
|
||||
*/
|
||||
poststart?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm restart` command, before `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
|
||||
*/
|
||||
prerestart?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm restart` command. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
|
||||
*/
|
||||
restart?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm restart` command, after `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
|
||||
*/
|
||||
postrestart?: string;
|
||||
} & {
|
||||
[scriptName: string]: string;
|
||||
};
|
||||
|
||||
/**
|
||||
Dependencies of the package. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or Git URL.
|
||||
*/
|
||||
export interface Dependency {
|
||||
[packageName: string]: string;
|
||||
}
|
||||
|
||||
export interface NonStandardEntryPoints {
|
||||
/**
|
||||
An ECMAScript module ID that is the primary entry point to the program.
|
||||
*/
|
||||
module?: string;
|
||||
|
||||
/**
|
||||
A module ID with untranspiled code that is the primary entry point to the program.
|
||||
*/
|
||||
esnext?:
|
||||
| string
|
||||
| {
|
||||
main?: string;
|
||||
browser?: string;
|
||||
[moduleName: string]: string | undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
A hint to JavaScript bundlers or component tools when packaging modules for client side use.
|
||||
*/
|
||||
browser?:
|
||||
| string
|
||||
| {
|
||||
[moduleName: string]: string | false;
|
||||
};
|
||||
}
|
||||
|
||||
export interface TypeScriptConfiguration {
|
||||
/**
|
||||
Location of the bundled TypeScript declaration file.
|
||||
*/
|
||||
types?: string;
|
||||
|
||||
/**
|
||||
Location of the bundled TypeScript declaration file. Alias of `types`.
|
||||
*/
|
||||
typings?: string;
|
||||
}
|
||||
|
||||
export interface YarnConfiguration {
|
||||
/**
|
||||
If your package only allows one version of a given dependency, and you’d like to enforce the same behavior as `yarn install --flat` on the command line, set this to `true`.
|
||||
|
||||
Note that if your `package.json` contains `"flat": true` and other packages depend on yours (e.g. you are building a library rather than an application), those other packages will also need `"flat": true` in their `package.json` or be installed with `yarn install --flat` on the command-line.
|
||||
*/
|
||||
flat?: boolean;
|
||||
|
||||
/**
|
||||
Selective version resolutions. Allows the definition of custom package versions inside dependencies without manual edits in the `yarn.lock` file.
|
||||
*/
|
||||
resolutions?: Dependency;
|
||||
}
|
||||
|
||||
export interface JSPMConfiguration {
|
||||
/**
|
||||
JSPM configuration.
|
||||
*/
|
||||
jspm?: PackageJson;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Also includes types for fields used by other popular projects, like TypeScript and Yarn.
|
||||
*/
|
||||
export type PackageJson = {
|
||||
/**
|
||||
The name of the package.
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
Package version, parseable by [`node-semver`](https://github.com/npm/node-semver).
|
||||
*/
|
||||
version?: string;
|
||||
|
||||
/**
|
||||
Package description, listed in `npm search`.
|
||||
*/
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
Keywords associated with package, listed in `npm search`.
|
||||
*/
|
||||
keywords?: string[];
|
||||
|
||||
/**
|
||||
The URL to the package's homepage.
|
||||
*/
|
||||
homepage?: LiteralUnion<'.', string>;
|
||||
|
||||
/**
|
||||
The URL to the package's issue tracker and/or the email address to which issues should be reported.
|
||||
*/
|
||||
bugs?: PackageJson.BugsLocation;
|
||||
|
||||
/**
|
||||
The license for the package.
|
||||
*/
|
||||
license?: string;
|
||||
|
||||
/**
|
||||
The licenses for the package.
|
||||
*/
|
||||
licenses?: Array<{
|
||||
type?: string;
|
||||
url?: string;
|
||||
}>;
|
||||
|
||||
author?: PackageJson.Person;
|
||||
|
||||
/**
|
||||
A list of people who contributed to the package.
|
||||
*/
|
||||
contributors?: PackageJson.Person[];
|
||||
|
||||
/**
|
||||
A list of people who maintain the package.
|
||||
*/
|
||||
maintainers?: PackageJson.Person[];
|
||||
|
||||
/**
|
||||
The files included in the package.
|
||||
*/
|
||||
files?: string[];
|
||||
|
||||
/**
|
||||
The module ID that is the primary entry point to the program.
|
||||
*/
|
||||
main?: string;
|
||||
|
||||
/**
|
||||
The executable files that should be installed into the `PATH`.
|
||||
*/
|
||||
bin?:
|
||||
| string
|
||||
| {
|
||||
[binary: string]: string;
|
||||
};
|
||||
|
||||
/**
|
||||
Filenames to put in place for the `man` program to find.
|
||||
*/
|
||||
man?: string | string[];
|
||||
|
||||
/**
|
||||
Indicates the structure of the package.
|
||||
*/
|
||||
directories?: PackageJson.DirectoryLocations;
|
||||
|
||||
/**
|
||||
Location for the code repository.
|
||||
*/
|
||||
repository?:
|
||||
| string
|
||||
| {
|
||||
type: string;
|
||||
url: string;
|
||||
};
|
||||
|
||||
/**
|
||||
Script commands that are run at various times in the lifecycle of the package. The key is the lifecycle event, and the value is the command to run at that point.
|
||||
*/
|
||||
scripts?: PackageJson.Scripts;
|
||||
|
||||
/**
|
||||
Is used to set configuration parameters used in package scripts that persist across upgrades.
|
||||
*/
|
||||
config?: {
|
||||
[configKey: string]: unknown;
|
||||
};
|
||||
|
||||
/**
|
||||
The dependencies of the package.
|
||||
*/
|
||||
dependencies?: PackageJson.Dependency;
|
||||
|
||||
/**
|
||||
Additional tooling dependencies that are not required for the package to work. Usually test, build, or documentation tooling.
|
||||
*/
|
||||
devDependencies?: PackageJson.Dependency;
|
||||
|
||||
/**
|
||||
Dependencies that are skipped if they fail to install.
|
||||
*/
|
||||
optionalDependencies?: PackageJson.Dependency;
|
||||
|
||||
/**
|
||||
Dependencies that will usually be required by the package user directly or via another dependency.
|
||||
*/
|
||||
peerDependencies?: PackageJson.Dependency;
|
||||
|
||||
/**
|
||||
Package names that are bundled when the package is published.
|
||||
*/
|
||||
bundledDependencies?: string[];
|
||||
|
||||
/**
|
||||
Alias of `bundledDependencies`.
|
||||
*/
|
||||
bundleDependencies?: string[];
|
||||
|
||||
/**
|
||||
Engines that this package runs on.
|
||||
*/
|
||||
engines?: {
|
||||
[EngineName in 'npm' | 'node' | string]: string;
|
||||
};
|
||||
|
||||
/**
|
||||
@deprecated
|
||||
*/
|
||||
engineStrict?: boolean;
|
||||
|
||||
/**
|
||||
Operating systems the module runs on.
|
||||
*/
|
||||
os?: Array<LiteralUnion<
|
||||
| 'aix'
|
||||
| 'darwin'
|
||||
| 'freebsd'
|
||||
| 'linux'
|
||||
| 'openbsd'
|
||||
| 'sunos'
|
||||
| 'win32'
|
||||
| '!aix'
|
||||
| '!darwin'
|
||||
| '!freebsd'
|
||||
| '!linux'
|
||||
| '!openbsd'
|
||||
| '!sunos'
|
||||
| '!win32',
|
||||
string
|
||||
>>;
|
||||
|
||||
/**
|
||||
CPU architectures the module runs on.
|
||||
*/
|
||||
cpu?: Array<LiteralUnion<
|
||||
| 'arm'
|
||||
| 'arm64'
|
||||
| 'ia32'
|
||||
| 'mips'
|
||||
| 'mipsel'
|
||||
| 'ppc'
|
||||
| 'ppc64'
|
||||
| 's390'
|
||||
| 's390x'
|
||||
| 'x32'
|
||||
| 'x64'
|
||||
| '!arm'
|
||||
| '!arm64'
|
||||
| '!ia32'
|
||||
| '!mips'
|
||||
| '!mipsel'
|
||||
| '!ppc'
|
||||
| '!ppc64'
|
||||
| '!s390'
|
||||
| '!s390x'
|
||||
| '!x32'
|
||||
| '!x64',
|
||||
string
|
||||
>>;
|
||||
|
||||
/**
|
||||
If set to `true`, a warning will be shown if package is installed locally. Useful if the package is primarily a command-line application that should be installed globally.
|
||||
|
||||
@deprecated
|
||||
*/
|
||||
preferGlobal?: boolean;
|
||||
|
||||
/**
|
||||
If set to `true`, then npm will refuse to publish it.
|
||||
*/
|
||||
private?: boolean;
|
||||
|
||||
/**
|
||||
* A set of config values that will be used at publish-time. It's especially handy to set the tag, registry or access, to ensure that a given package is not tagged with 'latest', published to the global public registry or that a scoped module is private by default.
|
||||
*/
|
||||
publishConfig?: {
|
||||
[config: string]: unknown;
|
||||
};
|
||||
} &
|
||||
PackageJson.NonStandardEntryPoints &
|
||||
PackageJson.TypeScriptConfiguration &
|
||||
PackageJson.YarnConfiguration &
|
||||
PackageJson.JSPMConfiguration & {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
72
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/partial-deep.d.ts
generated
vendored
Normal file
72
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/partial-deep.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
import {Primitive} from './basic';
|
||||
|
||||
/**
|
||||
Create a type from another type with all keys and nested keys set to optional.
|
||||
|
||||
Use-cases:
|
||||
- Merging a default settings/config object with another object, the second object would be a deep partial of the default object.
|
||||
- Mocking and testing complex entities, where populating an entire object with its keys would be redundant in terms of the mock or test.
|
||||
|
||||
@example
|
||||
```
|
||||
import {PartialDeep} from 'type-fest';
|
||||
|
||||
const settings: Settings = {
|
||||
textEditor: {
|
||||
fontSize: 14;
|
||||
fontColor: '#000000';
|
||||
fontWeight: 400;
|
||||
}
|
||||
autocomplete: false;
|
||||
autosave: true;
|
||||
};
|
||||
|
||||
const applySavedSettings = (savedSettings: PartialDeep<Settings>) => {
|
||||
return {...settings, ...savedSettings};
|
||||
}
|
||||
|
||||
settings = applySavedSettings({textEditor: {fontWeight: 500}});
|
||||
```
|
||||
*/
|
||||
export type PartialDeep<T> = T extends Primitive
|
||||
? Partial<T>
|
||||
: T extends Map<infer KeyType, infer ValueType>
|
||||
? PartialMapDeep<KeyType, ValueType>
|
||||
: T extends Set<infer ItemType>
|
||||
? PartialSetDeep<ItemType>
|
||||
: T extends ReadonlyMap<infer KeyType, infer ValueType>
|
||||
? PartialReadonlyMapDeep<KeyType, ValueType>
|
||||
: T extends ReadonlySet<infer ItemType>
|
||||
? PartialReadonlySetDeep<ItemType>
|
||||
: T extends ((...arguments: any[]) => unknown)
|
||||
? T | undefined
|
||||
: T extends object
|
||||
? PartialObjectDeep<T>
|
||||
: unknown;
|
||||
|
||||
/**
|
||||
Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`.
|
||||
*/
|
||||
interface PartialMapDeep<KeyType, ValueType> extends Map<PartialDeep<KeyType>, PartialDeep<ValueType>> {}
|
||||
|
||||
/**
|
||||
Same as `PartialDeep`, but accepts only `Set`s as inputs. Internal helper for `PartialDeep`.
|
||||
*/
|
||||
interface PartialSetDeep<T> extends Set<PartialDeep<T>> {}
|
||||
|
||||
/**
|
||||
Same as `PartialDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `PartialDeep`.
|
||||
*/
|
||||
interface PartialReadonlyMapDeep<KeyType, ValueType> extends ReadonlyMap<PartialDeep<KeyType>, PartialDeep<ValueType>> {}
|
||||
|
||||
/**
|
||||
Same as `PartialDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `PartialDeep`.
|
||||
*/
|
||||
interface PartialReadonlySetDeep<T> extends ReadonlySet<PartialDeep<T>> {}
|
||||
|
||||
/**
|
||||
Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
|
||||
*/
|
||||
type PartialObjectDeep<ObjectType extends object> = {
|
||||
[KeyType in keyof ObjectType]?: PartialDeep<ObjectType[KeyType]>
|
||||
};
|
||||
23
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/promisable.d.ts
generated
vendored
Normal file
23
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/promisable.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
Create a type that represents either the value or the value wrapped in `PromiseLike`.
|
||||
|
||||
Use-cases:
|
||||
- A function accepts a callback that may either return a value synchronously or may return a promised value.
|
||||
- This type could be the return type of `Promise#then()`, `Promise#catch()`, and `Promise#finally()` callbacks.
|
||||
|
||||
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/31394) if you want to have this type as a built-in in TypeScript.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Promisable} from 'type-fest';
|
||||
|
||||
async function logger(getLogEntry: () => Promisable<string>): Promise<void> {
|
||||
const entry = await getLogEntry();
|
||||
console.log(entry);
|
||||
}
|
||||
|
||||
logger(() => 'foo');
|
||||
logger(() => Promise.resolve('bar'));
|
||||
```
|
||||
*/
|
||||
export type Promisable<T> = T | PromiseLike<T>;
|
||||
59
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/readonly-deep.d.ts
generated
vendored
Normal file
59
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/readonly-deep.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import {Primitive} from './basic';
|
||||
|
||||
/**
|
||||
Convert `object`s, `Map`s, `Set`s, and `Array`s and all of their keys/elements into immutable structures recursively.
|
||||
|
||||
This is useful when a deeply nested structure needs to be exposed as completely immutable, for example, an imported JSON module or when receiving an API response that is passed around.
|
||||
|
||||
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/13923) if you want to have this type as a built-in in TypeScript.
|
||||
|
||||
@example
|
||||
```
|
||||
// data.json
|
||||
{
|
||||
"foo": ["bar"]
|
||||
}
|
||||
|
||||
// main.ts
|
||||
import {ReadonlyDeep} from 'type-fest';
|
||||
import dataJson = require('./data.json');
|
||||
|
||||
const data: ReadonlyDeep<typeof dataJson> = dataJson;
|
||||
|
||||
export default data;
|
||||
|
||||
// test.ts
|
||||
import data from './main';
|
||||
|
||||
data.foo.push('bar');
|
||||
//=> error TS2339: Property 'push' does not exist on type 'readonly string[]'
|
||||
```
|
||||
*/
|
||||
export type ReadonlyDeep<T> = T extends Primitive | ((...arguments: any[]) => unknown)
|
||||
? T
|
||||
: T extends ReadonlyMap<infer KeyType, infer ValueType>
|
||||
? ReadonlyMapDeep<KeyType, ValueType>
|
||||
: T extends ReadonlySet<infer ItemType>
|
||||
? ReadonlySetDeep<ItemType>
|
||||
: T extends object
|
||||
? ReadonlyObjectDeep<T>
|
||||
: unknown;
|
||||
|
||||
/**
|
||||
Same as `ReadonlyDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `ReadonlyDeep`.
|
||||
*/
|
||||
interface ReadonlyMapDeep<KeyType, ValueType>
|
||||
extends ReadonlyMap<ReadonlyDeep<KeyType>, ReadonlyDeep<ValueType>> {}
|
||||
|
||||
/**
|
||||
Same as `ReadonlyDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `ReadonlyDeep`.
|
||||
*/
|
||||
interface ReadonlySetDeep<ItemType>
|
||||
extends ReadonlySet<ReadonlyDeep<ItemType>> {}
|
||||
|
||||
/**
|
||||
Same as `ReadonlyDeep`, but accepts only `object`s as inputs. Internal helper for `ReadonlyDeep`.
|
||||
*/
|
||||
type ReadonlyObjectDeep<ObjectType extends object> = {
|
||||
readonly [KeyType in keyof ObjectType]: ReadonlyDeep<ObjectType[KeyType]>
|
||||
};
|
||||
32
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/require-at-least-one.d.ts
generated
vendored
Normal file
32
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/require-at-least-one.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import {Except} from './except';
|
||||
|
||||
/**
|
||||
Create a type that requires at least one of the given keys. The remaining keys are kept as is.
|
||||
|
||||
@example
|
||||
```
|
||||
import {RequireAtLeastOne} from 'type-fest';
|
||||
|
||||
type Responder = {
|
||||
text?: () => string;
|
||||
json?: () => string;
|
||||
|
||||
secure?: boolean;
|
||||
};
|
||||
|
||||
const responder: RequireAtLeastOne<Responder, 'text' | 'json'> = {
|
||||
json: () => '{"message": "ok"}',
|
||||
secure: true
|
||||
};
|
||||
```
|
||||
*/
|
||||
export type RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> =
|
||||
{
|
||||
// For each Key in KeysType make a mapped type
|
||||
[Key in KeysType]: (
|
||||
// …by picking that Key's type and making it required
|
||||
Required<Pick<ObjectType, Key>>
|
||||
)
|
||||
}[KeysType]
|
||||
// …then, make intersection types by adding the remaining keys to each mapped type.
|
||||
& Except<ObjectType, KeysType>;
|
||||
36
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/require-exactly-one.d.ts
generated
vendored
Normal file
36
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/require-exactly-one.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
// TODO: Remove this when we target TypeScript >=3.5.
|
||||
// eslint-disable-next-line @typescript-eslint/generic-type-naming
|
||||
type _Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
|
||||
|
||||
/**
|
||||
Create a type that requires exactly one of the given keys and disallows more. The remaining keys are kept as is.
|
||||
|
||||
Use-cases:
|
||||
- Creating interfaces for components that only need one of the keys to display properly.
|
||||
- Declaring generic keys in a single place for a single use-case that gets narrowed down via `RequireExactlyOne`.
|
||||
|
||||
The caveat with `RequireExactlyOne` is that TypeScript doesn't always know at compile time every key that will exist at runtime. Therefore `RequireExactlyOne` can't do anything to prevent extra keys it doesn't know about.
|
||||
|
||||
@example
|
||||
```
|
||||
import {RequireExactlyOne} from 'type-fest';
|
||||
|
||||
type Responder = {
|
||||
text: () => string;
|
||||
json: () => string;
|
||||
secure: boolean;
|
||||
};
|
||||
|
||||
const responder: RequireExactlyOne<Responder, 'text' | 'json'> = {
|
||||
// Adding a `text` key here would cause a compile error.
|
||||
|
||||
json: () => '{"message": "ok"}',
|
||||
secure: true
|
||||
};
|
||||
```
|
||||
*/
|
||||
export type RequireExactlyOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> =
|
||||
{[Key in KeysType]: (
|
||||
Required<Pick<ObjectType, Key>> &
|
||||
Partial<Record<Exclude<KeysType, Key>, never>>
|
||||
)}[KeysType] & _Omit<ObjectType, KeysType>;
|
||||
32
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/set-optional.d.ts
generated
vendored
Normal file
32
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/set-optional.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
Create a type that makes the given keys optional. The remaining keys are kept as is. The sister of the `SetRequired` type.
|
||||
|
||||
Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are optional.
|
||||
|
||||
@example
|
||||
```
|
||||
import {SetOptional} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
a: number;
|
||||
b?: string;
|
||||
c: boolean;
|
||||
}
|
||||
|
||||
type SomeOptional = SetOptional<Foo, 'b' | 'c'>;
|
||||
// type SomeOptional = {
|
||||
// a: number;
|
||||
// b?: string; // Was already optional and still is.
|
||||
// c?: boolean; // Is now optional.
|
||||
// }
|
||||
```
|
||||
*/
|
||||
export type SetOptional<BaseType, Keys extends keyof BaseType = keyof BaseType> =
|
||||
// Pick just the keys that are not optional from the base type.
|
||||
Pick<BaseType, Exclude<keyof BaseType, Keys>> &
|
||||
// Pick the keys that should be optional from the base type and make them optional.
|
||||
Partial<Pick<BaseType, Keys>> extends
|
||||
// If `InferredType` extends the previous, then for each key, use the inferred type key.
|
||||
infer InferredType
|
||||
? {[KeyType in keyof InferredType]: InferredType[KeyType]}
|
||||
: never;
|
||||
32
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/set-required.d.ts
generated
vendored
Normal file
32
node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest/source/set-required.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
Create a type that makes the given keys required. The remaining keys are kept as is. The sister of the `SetOptional` type.
|
||||
|
||||
Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required.
|
||||
|
||||
@example
|
||||
```
|
||||
import {SetRequired} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
a?: number;
|
||||
b: string;
|
||||
c?: boolean;
|
||||
}
|
||||
|
||||
type SomeRequired = SetRequired<Foo, 'b' | 'c'>;
|
||||
// type SomeRequired = {
|
||||
// a?: number;
|
||||
// b: string; // Was already required and still is.
|
||||
// c: boolean; // Is now required.
|
||||
// }
|
||||
```
|
||||
*/
|
||||
export type SetRequired<BaseType, Keys extends keyof BaseType = keyof BaseType> =
|
||||
// Pick just the keys that are not required from the base type.
|
||||
Pick<BaseType, Exclude<keyof BaseType, Keys>> &
|
||||
// Pick the keys that should be required from the base type and make them required.
|
||||
Required<Pick<BaseType, Keys>> extends
|
||||
// If `InferredType` extends the previous, then for each key, use the inferred type key.
|
||||
infer InferredType
|
||||
? {[KeyType in keyof InferredType]: InferredType[KeyType]}
|
||||
: never;
|
||||
59
node_modules/meow/node_modules/read-pkg-up/package.json
generated
vendored
Normal file
59
node_modules/meow/node_modules/read-pkg-up/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
"name": "read-pkg-up",
|
||||
"version": "7.0.1",
|
||||
"description": "Read the closest package.json file",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/read-pkg-up",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"json",
|
||||
"read",
|
||||
"parse",
|
||||
"file",
|
||||
"fs",
|
||||
"graceful",
|
||||
"load",
|
||||
"package",
|
||||
"find",
|
||||
"up",
|
||||
"find-up",
|
||||
"findup",
|
||||
"look-up",
|
||||
"look",
|
||||
"search",
|
||||
"match",
|
||||
"resolve",
|
||||
"parent",
|
||||
"parents",
|
||||
"folder",
|
||||
"directory",
|
||||
"walk",
|
||||
"walking",
|
||||
"path"
|
||||
],
|
||||
"dependencies": {
|
||||
"find-up": "^4.1.0",
|
||||
"read-pkg": "^5.2.0",
|
||||
"type-fest": "^0.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.4.0",
|
||||
"tsd": "^0.9.0",
|
||||
"xo": "^0.25.3"
|
||||
}
|
||||
}
|
||||
77
node_modules/meow/node_modules/read-pkg-up/readme.md
generated
vendored
Normal file
77
node_modules/meow/node_modules/read-pkg-up/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
# read-pkg-up [](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)
|
||||
- [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());
|
||||
/*
|
||||
{
|
||||
packageJson: {
|
||||
name: 'awesome-package',
|
||||
version: '1.0.0',
|
||||
…
|
||||
},
|
||||
path: '/Users/sindresorhus/dev/awesome-package/package.json'
|
||||
}
|
||||
*/
|
||||
})();
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### readPkgUp(options?)
|
||||
|
||||
Returns a `Promise<object>` or `Promise<undefined>` if no `package.json` was found.
|
||||
|
||||
### readPkgUp.sync(options?)
|
||||
|
||||
Returns the result object or `undefined` if no `package.json` was found.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`\
|
||||
Default: `process.cwd()`
|
||||
|
||||
Directory to start looking for a package.json file.
|
||||
|
||||
##### normalize
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.
|
||||
|
||||
## read-pkg-up for enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of read-pkg-up and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-read-pkg-up?utm_source=npm-read-pkg-up&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
|
||||
## 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
|
||||
67
node_modules/meow/node_modules/read-pkg/index.d.ts
generated
vendored
Normal file
67
node_modules/meow/node_modules/read-pkg/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
import * as typeFest from 'type-fest';
|
||||
import normalize = require('normalize-package-data');
|
||||
|
||||
declare namespace readPkg {
|
||||
interface Options {
|
||||
/**
|
||||
[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly normalize?: boolean;
|
||||
|
||||
/**
|
||||
Current working directory.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: string;
|
||||
}
|
||||
|
||||
interface NormalizeOptions extends Options {
|
||||
readonly normalize?: true;
|
||||
}
|
||||
|
||||
type NormalizedPackageJson = PackageJson & normalize.Package;
|
||||
type PackageJson = typeFest.PackageJson;
|
||||
}
|
||||
|
||||
declare const readPkg: {
|
||||
/**
|
||||
@returns The parsed JSON.
|
||||
|
||||
@example
|
||||
```
|
||||
import readPkg = require('read-pkg');
|
||||
|
||||
(async () => {
|
||||
console.log(await readPkg());
|
||||
//=> {name: 'read-pkg', …}
|
||||
|
||||
console.log(await readPkg({cwd: 'some-other-directory'});
|
||||
//=> {name: 'unicorn', …}
|
||||
})();
|
||||
```
|
||||
*/
|
||||
(options?: readPkg.NormalizeOptions): Promise<readPkg.NormalizedPackageJson>;
|
||||
(options: readPkg.Options): Promise<readPkg.PackageJson>;
|
||||
|
||||
/**
|
||||
@returns The parsed JSON.
|
||||
|
||||
@example
|
||||
```
|
||||
import readPkg = require('read-pkg');
|
||||
|
||||
console.log(readPkg.sync());
|
||||
//=> {name: 'read-pkg', …}
|
||||
|
||||
console.log(readPkg.sync({cwd: 'some-other-directory'});
|
||||
//=> {name: 'unicorn', …}
|
||||
```
|
||||
*/
|
||||
sync(options?: readPkg.NormalizeOptions): readPkg.NormalizedPackageJson;
|
||||
sync(options: readPkg.Options): readPkg.PackageJson;
|
||||
};
|
||||
|
||||
export = readPkg;
|
||||
41
node_modules/meow/node_modules/read-pkg/index.js
generated
vendored
Normal file
41
node_modules/meow/node_modules/read-pkg/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
'use strict';
|
||||
const {promisify} = require('util');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const parseJson = require('parse-json');
|
||||
|
||||
const readFileAsync = promisify(fs.readFile);
|
||||
|
||||
module.exports = async options => {
|
||||
options = {
|
||||
cwd: process.cwd(),
|
||||
normalize: true,
|
||||
...options
|
||||
};
|
||||
|
||||
const filePath = path.resolve(options.cwd, 'package.json');
|
||||
const json = parseJson(await readFileAsync(filePath, 'utf8'));
|
||||
|
||||
if (options.normalize) {
|
||||
require('normalize-package-data')(json);
|
||||
}
|
||||
|
||||
return json;
|
||||
};
|
||||
|
||||
module.exports.sync = options => {
|
||||
options = {
|
||||
cwd: process.cwd(),
|
||||
normalize: true,
|
||||
...options
|
||||
};
|
||||
|
||||
const filePath = path.resolve(options.cwd, 'package.json');
|
||||
const json = parseJson(fs.readFileSync(filePath, 'utf8'));
|
||||
|
||||
if (options.normalize) {
|
||||
require('normalize-package-data')(json);
|
||||
}
|
||||
|
||||
return json;
|
||||
};
|
||||
9
node_modules/meow/node_modules/read-pkg/license
generated
vendored
Normal file
9
node_modules/meow/node_modules/read-pkg/license
generated
vendored
Normal 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.
|
||||
4
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/AUTHORS
generated
vendored
Normal file
4
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/AUTHORS
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# Names sorted by how much code was originally theirs.
|
||||
Isaac Z. Schlueter <i@izs.me>
|
||||
Meryn Stol <merynstol@gmail.com>
|
||||
Robert Kowalski <rok@kowalski.gd>
|
||||
30
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/LICENSE
generated
vendored
Normal file
30
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
This package contains code originally written by Isaac Z. Schlueter.
|
||||
Used with permission.
|
||||
|
||||
Copyright (c) Meryn Stol ("Author")
|
||||
All rights reserved.
|
||||
|
||||
The BSD License
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
106
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/README.md
generated
vendored
Normal file
106
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
# normalize-package-data [](https://travis-ci.org/npm/normalize-package-data)
|
||||
|
||||
normalize-package-data exports a function that normalizes package metadata. This data is typically found in a package.json file, but in principle could come from any source - for example the npm registry.
|
||||
|
||||
normalize-package-data is used by [read-package-json](https://npmjs.org/package/read-package-json) to normalize the data it reads from a package.json file. In turn, read-package-json is used by [npm](https://npmjs.org/package/npm) and various npm-related tools.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm install normalize-package-data
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Basic usage is really simple. You call the function that normalize-package-data exports. Let's call it `normalizeData`.
|
||||
|
||||
```javascript
|
||||
normalizeData = require('normalize-package-data')
|
||||
packageData = require("./package.json")
|
||||
normalizeData(packageData)
|
||||
// packageData is now normalized
|
||||
```
|
||||
|
||||
#### Strict mode
|
||||
|
||||
You may activate strict validation by passing true as the second argument.
|
||||
|
||||
```javascript
|
||||
normalizeData = require('normalize-package-data')
|
||||
packageData = require("./package.json")
|
||||
normalizeData(packageData, true)
|
||||
// packageData is now normalized
|
||||
```
|
||||
|
||||
If strict mode is activated, only Semver 2.0 version strings are accepted. Otherwise, Semver 1.0 strings are accepted as well. Packages must have a name, and the name field must not have contain leading or trailing whitespace.
|
||||
|
||||
#### Warnings
|
||||
|
||||
Optionally, you may pass a "warning" function. It gets called whenever the `normalizeData` function encounters something that doesn't look right. It indicates less than perfect input data.
|
||||
|
||||
```javascript
|
||||
normalizeData = require('normalize-package-data')
|
||||
packageData = require("./package.json")
|
||||
warnFn = function(msg) { console.error(msg) }
|
||||
normalizeData(packageData, warnFn)
|
||||
// packageData is now normalized. Any number of warnings may have been logged.
|
||||
```
|
||||
|
||||
You may combine strict validation with warnings by passing `true` as the second argument, and `warnFn` as third.
|
||||
|
||||
When `private` field is set to `true`, warnings will be suppressed.
|
||||
|
||||
### Potential exceptions
|
||||
|
||||
If the supplied data has an invalid name or version vield, `normalizeData` will throw an error. Depending on where you call `normalizeData`, you may want to catch these errors so can pass them to a callback.
|
||||
|
||||
## What normalization (currently) entails
|
||||
|
||||
* The value of `name` field gets trimmed (unless in strict mode).
|
||||
* The value of the `version` field gets cleaned by `semver.clean`. See [documentation for the semver module](https://github.com/isaacs/node-semver).
|
||||
* If `name` and/or `version` fields are missing, they are set to empty strings.
|
||||
* If `files` field is not an array, it will be removed.
|
||||
* If `bin` field is a string, then `bin` field will become an object with `name` set to the value of the `name` field, and `bin` set to the original string value.
|
||||
* If `man` field is a string, it will become an array with the original string as its sole member.
|
||||
* If `keywords` field is string, it is considered to be a list of keywords separated by one or more white-space characters. It gets converted to an array by splitting on `\s+`.
|
||||
* All people fields (`author`, `maintainers`, `contributors`) get converted into objects with name, email and url properties.
|
||||
* If `bundledDependencies` field (a typo) exists and `bundleDependencies` field does not, `bundledDependencies` will get renamed to `bundleDependencies`.
|
||||
* If the value of any of the dependencies fields (`dependencies`, `devDependencies`, `optionalDependencies`) is a string, it gets converted into an object with familiar `name=>value` pairs.
|
||||
* The values in `optionalDependencies` get added to `dependencies`. The `optionalDependencies` array is left untouched.
|
||||
* As of v2: Dependencies that point at known hosted git providers (currently: github, bitbucket, gitlab) will have their URLs canonicalized, but protocols will be preserved.
|
||||
* As of v2: Dependencies that use shortcuts for hosted git providers (`org/proj`, `github:org/proj`, `bitbucket:org/proj`, `gitlab:org/proj`, `gist:docid`) will have the shortcut left in place. (In the case of github, the `org/proj` form will be expanded to `github:org/proj`.) THIS MARKS A BREAKING CHANGE FROM V1, where the shorcut was previously expanded to a URL.
|
||||
* If `description` field does not exist, but `readme` field does, then (more or less) the first paragraph of text that's found in the readme is taken as value for `description`.
|
||||
* If `repository` field is a string, it will become an object with `url` set to the original string value, and `type` set to `"git"`.
|
||||
* If `repository.url` is not a valid url, but in the style of "[owner-name]/[repo-name]", `repository.url` will be set to git+https://github.com/[owner-name]/[repo-name].git
|
||||
* If `bugs` field is a string, the value of `bugs` field is changed into an object with `url` set to the original string value.
|
||||
* If `bugs` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `bugs` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]/issues . If the repository field points to a GitHub Gist repo url, the associated http url is chosen.
|
||||
* If `bugs` field is an object, the resulting value only has email and url properties. If email and url properties are not strings, they are ignored. If no valid values for either email or url is found, bugs field will be removed.
|
||||
* If `homepage` field is not a string, it will be removed.
|
||||
* If the url in the `homepage` field does not specify a protocol, then http is assumed. For example, `myproject.org` will be changed to `http://myproject.org`.
|
||||
* If `homepage` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `homepage` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]#readme . If the repository field points to a GitHub Gist repo url, the associated http url is chosen.
|
||||
|
||||
### Rules for name field
|
||||
|
||||
If `name` field is given, the value of the name field must be a string. The string may not:
|
||||
|
||||
* start with a period.
|
||||
* contain the following characters: `/@\s+%`
|
||||
* contain any characters that would need to be encoded for use in urls.
|
||||
* resemble the word `node_modules` or `favicon.ico` (case doesn't matter).
|
||||
|
||||
### Rules for version field
|
||||
|
||||
If `version` field is given, the value of the version field must be a valid *semver* string, as determined by the `semver.valid` method. See [documentation for the semver module](https://github.com/isaacs/node-semver).
|
||||
|
||||
### Rules for license field
|
||||
|
||||
The `license` field should be a valid *SPDX license expression* or one of the special values allowed by [validate-npm-package-license](https://npmjs.com/package/validate-npm-package-license). See [documentation for the license field in package.json](https://docs.npmjs.com/files/package.json#license).
|
||||
|
||||
## Credits
|
||||
|
||||
This package contains code based on read-package-json written by Isaac Z. Schlueter. Used with permisson.
|
||||
|
||||
## License
|
||||
|
||||
normalize-package-data is released under the [BSD 2-Clause License](http://opensource.org/licenses/MIT).
|
||||
Copyright (c) 2013 Meryn Stol
|
||||
14
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/lib/extract_description.js
generated
vendored
Normal file
14
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/lib/extract_description.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
module.exports = extractDescription
|
||||
|
||||
// Extracts description from contents of a readme file in markdown format
|
||||
function extractDescription (d) {
|
||||
if (!d) return;
|
||||
if (d === "ERROR: No README data found!") return;
|
||||
// the first block of text before the first heading
|
||||
// that isn't the first line heading
|
||||
d = d.trim().split('\n')
|
||||
for (var s = 0; d[s] && d[s].trim().match(/^(#|$)/); s ++);
|
||||
var l = d.length
|
||||
for (var e = s + 1; e < l && d[e].trim(); e ++);
|
||||
return d.slice(s, e).join(' ').trim()
|
||||
}
|
||||
418
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/lib/fixer.js
generated
vendored
Normal file
418
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/lib/fixer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,418 @@
|
|||
var semver = require("semver")
|
||||
var validateLicense = require('validate-npm-package-license');
|
||||
var hostedGitInfo = require("hosted-git-info")
|
||||
var isBuiltinModule = require("resolve").isCore
|
||||
var depTypes = ["dependencies","devDependencies","optionalDependencies"]
|
||||
var extractDescription = require("./extract_description")
|
||||
var url = require("url")
|
||||
var typos = require("./typos.json")
|
||||
|
||||
var fixer = module.exports = {
|
||||
// default warning function
|
||||
warn: function() {},
|
||||
|
||||
fixRepositoryField: function(data) {
|
||||
if (data.repositories) {
|
||||
this.warn("repositories");
|
||||
data.repository = data.repositories[0]
|
||||
}
|
||||
if (!data.repository) return this.warn("missingRepository")
|
||||
if (typeof data.repository === "string") {
|
||||
data.repository = {
|
||||
type: "git",
|
||||
url: data.repository
|
||||
}
|
||||
}
|
||||
var r = data.repository.url || ""
|
||||
if (r) {
|
||||
var hosted = hostedGitInfo.fromUrl(r)
|
||||
if (hosted) {
|
||||
r = data.repository.url
|
||||
= hosted.getDefaultRepresentation() == "shortcut" ? hosted.https() : hosted.toString()
|
||||
}
|
||||
}
|
||||
|
||||
if (r.match(/github.com\/[^\/]+\/[^\/]+\.git\.git$/)) {
|
||||
this.warn("brokenGitUrl", r)
|
||||
}
|
||||
}
|
||||
|
||||
, fixTypos: function(data) {
|
||||
Object.keys(typos.topLevel).forEach(function (d) {
|
||||
if (data.hasOwnProperty(d)) {
|
||||
this.warn("typo", d, typos.topLevel[d])
|
||||
}
|
||||
}, this)
|
||||
}
|
||||
|
||||
, fixScriptsField: function(data) {
|
||||
if (!data.scripts) return
|
||||
if (typeof data.scripts !== "object") {
|
||||
this.warn("nonObjectScripts")
|
||||
delete data.scripts
|
||||
return
|
||||
}
|
||||
Object.keys(data.scripts).forEach(function (k) {
|
||||
if (typeof data.scripts[k] !== "string") {
|
||||
this.warn("nonStringScript")
|
||||
delete data.scripts[k]
|
||||
} else if (typos.script[k] && !data.scripts[typos.script[k]]) {
|
||||
this.warn("typo", k, typos.script[k], "scripts")
|
||||
}
|
||||
}, this)
|
||||
}
|
||||
|
||||
, fixFilesField: function(data) {
|
||||
var files = data.files
|
||||
if (files && !Array.isArray(files)) {
|
||||
this.warn("nonArrayFiles")
|
||||
delete data.files
|
||||
} else if (data.files) {
|
||||
data.files = data.files.filter(function(file) {
|
||||
if (!file || typeof file !== "string") {
|
||||
this.warn("invalidFilename", file)
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}, this)
|
||||
}
|
||||
}
|
||||
|
||||
, fixBinField: function(data) {
|
||||
if (!data.bin) return;
|
||||
if (typeof data.bin === "string") {
|
||||
var b = {}
|
||||
var match
|
||||
if (match = data.name.match(/^@[^/]+[/](.*)$/)) {
|
||||
b[match[1]] = data.bin
|
||||
} else {
|
||||
b[data.name] = data.bin
|
||||
}
|
||||
data.bin = b
|
||||
}
|
||||
}
|
||||
|
||||
, fixManField: function(data) {
|
||||
if (!data.man) return;
|
||||
if (typeof data.man === "string") {
|
||||
data.man = [ data.man ]
|
||||
}
|
||||
}
|
||||
, fixBundleDependenciesField: function(data) {
|
||||
var bdd = "bundledDependencies"
|
||||
var bd = "bundleDependencies"
|
||||
if (data[bdd] && !data[bd]) {
|
||||
data[bd] = data[bdd]
|
||||
delete data[bdd]
|
||||
}
|
||||
if (data[bd] && !Array.isArray(data[bd])) {
|
||||
this.warn("nonArrayBundleDependencies")
|
||||
delete data[bd]
|
||||
} else if (data[bd]) {
|
||||
data[bd] = data[bd].filter(function(bd) {
|
||||
if (!bd || typeof bd !== 'string') {
|
||||
this.warn("nonStringBundleDependency", bd)
|
||||
return false
|
||||
} else {
|
||||
if (!data.dependencies) {
|
||||
data.dependencies = {}
|
||||
}
|
||||
if (!data.dependencies.hasOwnProperty(bd)) {
|
||||
this.warn("nonDependencyBundleDependency", bd)
|
||||
data.dependencies[bd] = "*"
|
||||
}
|
||||
return true
|
||||
}
|
||||
}, this)
|
||||
}
|
||||
}
|
||||
|
||||
, fixDependencies: function(data, strict) {
|
||||
var loose = !strict
|
||||
objectifyDeps(data, this.warn)
|
||||
addOptionalDepsToDeps(data, this.warn)
|
||||
this.fixBundleDependenciesField(data)
|
||||
|
||||
;['dependencies','devDependencies'].forEach(function(deps) {
|
||||
if (!(deps in data)) return
|
||||
if (!data[deps] || typeof data[deps] !== "object") {
|
||||
this.warn("nonObjectDependencies", deps)
|
||||
delete data[deps]
|
||||
return
|
||||
}
|
||||
Object.keys(data[deps]).forEach(function (d) {
|
||||
var r = data[deps][d]
|
||||
if (typeof r !== 'string') {
|
||||
this.warn("nonStringDependency", d, JSON.stringify(r))
|
||||
delete data[deps][d]
|
||||
}
|
||||
var hosted = hostedGitInfo.fromUrl(data[deps][d])
|
||||
if (hosted) data[deps][d] = hosted.toString()
|
||||
}, this)
|
||||
}, this)
|
||||
}
|
||||
|
||||
, fixModulesField: function (data) {
|
||||
if (data.modules) {
|
||||
this.warn("deprecatedModules")
|
||||
delete data.modules
|
||||
}
|
||||
}
|
||||
|
||||
, fixKeywordsField: function (data) {
|
||||
if (typeof data.keywords === "string") {
|
||||
data.keywords = data.keywords.split(/,\s+/)
|
||||
}
|
||||
if (data.keywords && !Array.isArray(data.keywords)) {
|
||||
delete data.keywords
|
||||
this.warn("nonArrayKeywords")
|
||||
} else if (data.keywords) {
|
||||
data.keywords = data.keywords.filter(function(kw) {
|
||||
if (typeof kw !== "string" || !kw) {
|
||||
this.warn("nonStringKeyword");
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}, this)
|
||||
}
|
||||
}
|
||||
|
||||
, fixVersionField: function(data, strict) {
|
||||
// allow "loose" semver 1.0 versions in non-strict mode
|
||||
// enforce strict semver 2.0 compliance in strict mode
|
||||
var loose = !strict
|
||||
if (!data.version) {
|
||||
data.version = ""
|
||||
return true
|
||||
}
|
||||
if (!semver.valid(data.version, loose)) {
|
||||
throw new Error('Invalid version: "'+ data.version + '"')
|
||||
}
|
||||
data.version = semver.clean(data.version, loose)
|
||||
return true
|
||||
}
|
||||
|
||||
, fixPeople: function(data) {
|
||||
modifyPeople(data, unParsePerson)
|
||||
modifyPeople(data, parsePerson)
|
||||
}
|
||||
|
||||
, fixNameField: function(data, options) {
|
||||
if (typeof options === "boolean") options = {strict: options}
|
||||
else if (typeof options === "undefined") options = {}
|
||||
var strict = options.strict
|
||||
if (!data.name && !strict) {
|
||||
data.name = ""
|
||||
return
|
||||
}
|
||||
if (typeof data.name !== "string") {
|
||||
throw new Error("name field must be a string.")
|
||||
}
|
||||
if (!strict)
|
||||
data.name = data.name.trim()
|
||||
ensureValidName(data.name, strict, options.allowLegacyCase)
|
||||
if (isBuiltinModule(data.name))
|
||||
this.warn("conflictingName", data.name)
|
||||
}
|
||||
|
||||
|
||||
, fixDescriptionField: function (data) {
|
||||
if (data.description && typeof data.description !== 'string') {
|
||||
this.warn("nonStringDescription")
|
||||
delete data.description
|
||||
}
|
||||
if (data.readme && !data.description)
|
||||
data.description = extractDescription(data.readme)
|
||||
if(data.description === undefined) delete data.description;
|
||||
if (!data.description) this.warn("missingDescription")
|
||||
}
|
||||
|
||||
, fixReadmeField: function (data) {
|
||||
if (!data.readme) {
|
||||
this.warn("missingReadme")
|
||||
data.readme = "ERROR: No README data found!"
|
||||
}
|
||||
}
|
||||
|
||||
, fixBugsField: function(data) {
|
||||
if (!data.bugs && data.repository && data.repository.url) {
|
||||
var hosted = hostedGitInfo.fromUrl(data.repository.url)
|
||||
if(hosted && hosted.bugs()) {
|
||||
data.bugs = {url: hosted.bugs()}
|
||||
}
|
||||
}
|
||||
else if(data.bugs) {
|
||||
var emailRe = /^.+@.*\..+$/
|
||||
if(typeof data.bugs == "string") {
|
||||
if(emailRe.test(data.bugs))
|
||||
data.bugs = {email:data.bugs}
|
||||
else if(url.parse(data.bugs).protocol)
|
||||
data.bugs = {url: data.bugs}
|
||||
else
|
||||
this.warn("nonEmailUrlBugsString")
|
||||
}
|
||||
else {
|
||||
bugsTypos(data.bugs, this.warn)
|
||||
var oldBugs = data.bugs
|
||||
data.bugs = {}
|
||||
if(oldBugs.url) {
|
||||
if(typeof(oldBugs.url) == "string" && url.parse(oldBugs.url).protocol)
|
||||
data.bugs.url = oldBugs.url
|
||||
else
|
||||
this.warn("nonUrlBugsUrlField")
|
||||
}
|
||||
if(oldBugs.email) {
|
||||
if(typeof(oldBugs.email) == "string" && emailRe.test(oldBugs.email))
|
||||
data.bugs.email = oldBugs.email
|
||||
else
|
||||
this.warn("nonEmailBugsEmailField")
|
||||
}
|
||||
}
|
||||
if(!data.bugs.email && !data.bugs.url) {
|
||||
delete data.bugs
|
||||
this.warn("emptyNormalizedBugs")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
, fixHomepageField: function(data) {
|
||||
if (!data.homepage && data.repository && data.repository.url) {
|
||||
var hosted = hostedGitInfo.fromUrl(data.repository.url)
|
||||
if (hosted && hosted.docs()) data.homepage = hosted.docs()
|
||||
}
|
||||
if (!data.homepage) return
|
||||
|
||||
if(typeof data.homepage !== "string") {
|
||||
this.warn("nonUrlHomepage")
|
||||
return delete data.homepage
|
||||
}
|
||||
if(!url.parse(data.homepage).protocol) {
|
||||
data.homepage = "http://" + data.homepage
|
||||
}
|
||||
}
|
||||
|
||||
, fixLicenseField: function(data) {
|
||||
if (!data.license) {
|
||||
return this.warn("missingLicense")
|
||||
} else{
|
||||
if (
|
||||
typeof(data.license) !== 'string' ||
|
||||
data.license.length < 1 ||
|
||||
data.license.trim() === ''
|
||||
) {
|
||||
this.warn("invalidLicense")
|
||||
} else {
|
||||
if (!validateLicense(data.license).validForNewPackages)
|
||||
this.warn("invalidLicense")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isValidScopedPackageName(spec) {
|
||||
if (spec.charAt(0) !== '@') return false
|
||||
|
||||
var rest = spec.slice(1).split('/')
|
||||
if (rest.length !== 2) return false
|
||||
|
||||
return rest[0] && rest[1] &&
|
||||
rest[0] === encodeURIComponent(rest[0]) &&
|
||||
rest[1] === encodeURIComponent(rest[1])
|
||||
}
|
||||
|
||||
function isCorrectlyEncodedName(spec) {
|
||||
return !spec.match(/[\/@\s\+%:]/) &&
|
||||
spec === encodeURIComponent(spec)
|
||||
}
|
||||
|
||||
function ensureValidName (name, strict, allowLegacyCase) {
|
||||
if (name.charAt(0) === "." ||
|
||||
!(isValidScopedPackageName(name) || isCorrectlyEncodedName(name)) ||
|
||||
(strict && (!allowLegacyCase) && name !== name.toLowerCase()) ||
|
||||
name.toLowerCase() === "node_modules" ||
|
||||
name.toLowerCase() === "favicon.ico") {
|
||||
throw new Error("Invalid name: " + JSON.stringify(name))
|
||||
}
|
||||
}
|
||||
|
||||
function modifyPeople (data, fn) {
|
||||
if (data.author) data.author = fn(data.author)
|
||||
;["maintainers", "contributors"].forEach(function (set) {
|
||||
if (!Array.isArray(data[set])) return;
|
||||
data[set] = data[set].map(fn)
|
||||
})
|
||||
return data
|
||||
}
|
||||
|
||||
function unParsePerson (person) {
|
||||
if (typeof person === "string") return person
|
||||
var name = person.name || ""
|
||||
var u = person.url || person.web
|
||||
var url = u ? (" ("+u+")") : ""
|
||||
var e = person.email || person.mail
|
||||
var email = e ? (" <"+e+">") : ""
|
||||
return name+email+url
|
||||
}
|
||||
|
||||
function parsePerson (person) {
|
||||
if (typeof person !== "string") return person
|
||||
var name = person.match(/^([^\(<]+)/)
|
||||
var url = person.match(/\(([^\)]+)\)/)
|
||||
var email = person.match(/<([^>]+)>/)
|
||||
var obj = {}
|
||||
if (name && name[0].trim()) obj.name = name[0].trim()
|
||||
if (email) obj.email = email[1];
|
||||
if (url) obj.url = url[1];
|
||||
return obj
|
||||
}
|
||||
|
||||
function addOptionalDepsToDeps (data, warn) {
|
||||
var o = data.optionalDependencies
|
||||
if (!o) return;
|
||||
var d = data.dependencies || {}
|
||||
Object.keys(o).forEach(function (k) {
|
||||
d[k] = o[k]
|
||||
})
|
||||
data.dependencies = d
|
||||
}
|
||||
|
||||
function depObjectify (deps, type, warn) {
|
||||
if (!deps) return {}
|
||||
if (typeof deps === "string") {
|
||||
deps = deps.trim().split(/[\n\r\s\t ,]+/)
|
||||
}
|
||||
if (!Array.isArray(deps)) return deps
|
||||
warn("deprecatedArrayDependencies", type)
|
||||
var o = {}
|
||||
deps.filter(function (d) {
|
||||
return typeof d === "string"
|
||||
}).forEach(function(d) {
|
||||
d = d.trim().split(/(:?[@\s><=])/)
|
||||
var dn = d.shift()
|
||||
var dv = d.join("")
|
||||
dv = dv.trim()
|
||||
dv = dv.replace(/^@/, "")
|
||||
o[dn] = dv
|
||||
})
|
||||
return o
|
||||
}
|
||||
|
||||
function objectifyDeps (data, warn) {
|
||||
depTypes.forEach(function (type) {
|
||||
if (!data[type]) return;
|
||||
data[type] = depObjectify(data[type], type, warn)
|
||||
})
|
||||
}
|
||||
|
||||
function bugsTypos(bugs, warn) {
|
||||
if (!bugs) return
|
||||
Object.keys(bugs).forEach(function (k) {
|
||||
if (typos.bugs[k]) {
|
||||
warn("typo", k, typos.bugs[k], "bugs")
|
||||
bugs[typos.bugs[k]] = bugs[k]
|
||||
delete bugs[k]
|
||||
}
|
||||
})
|
||||
}
|
||||
23
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/lib/make_warning.js
generated
vendored
Normal file
23
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/lib/make_warning.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
var util = require("util")
|
||||
var messages = require("./warning_messages.json")
|
||||
|
||||
module.exports = function() {
|
||||
var args = Array.prototype.slice.call(arguments, 0)
|
||||
var warningName = args.shift()
|
||||
if (warningName == "typo") {
|
||||
return makeTypoWarning.apply(null,args)
|
||||
}
|
||||
else {
|
||||
var msgTemplate = messages[warningName] ? messages[warningName] : warningName + ": '%s'"
|
||||
args.unshift(msgTemplate)
|
||||
return util.format.apply(null, args)
|
||||
}
|
||||
}
|
||||
|
||||
function makeTypoWarning (providedName, probableName, field) {
|
||||
if (field) {
|
||||
providedName = field + "['" + providedName + "']"
|
||||
probableName = field + "['" + probableName + "']"
|
||||
}
|
||||
return util.format(messages.typo, providedName, probableName)
|
||||
}
|
||||
39
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/lib/normalize.js
generated
vendored
Normal file
39
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/lib/normalize.js
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
module.exports = normalize
|
||||
|
||||
var fixer = require("./fixer")
|
||||
normalize.fixer = fixer
|
||||
|
||||
var makeWarning = require("./make_warning")
|
||||
|
||||
var fieldsToFix = ['name','version','description','repository','modules','scripts'
|
||||
,'files','bin','man','bugs','keywords','readme','homepage','license']
|
||||
var otherThingsToFix = ['dependencies','people', 'typos']
|
||||
|
||||
var thingsToFix = fieldsToFix.map(function(fieldName) {
|
||||
return ucFirst(fieldName) + "Field"
|
||||
})
|
||||
// two ways to do this in CoffeeScript on only one line, sub-70 chars:
|
||||
// thingsToFix = fieldsToFix.map (name) -> ucFirst(name) + "Field"
|
||||
// thingsToFix = (ucFirst(name) + "Field" for name in fieldsToFix)
|
||||
thingsToFix = thingsToFix.concat(otherThingsToFix)
|
||||
|
||||
function normalize (data, warn, strict) {
|
||||
if(warn === true) warn = null, strict = true
|
||||
if(!strict) strict = false
|
||||
if(!warn || data.private) warn = function(msg) { /* noop */ }
|
||||
|
||||
if (data.scripts &&
|
||||
data.scripts.install === "node-gyp rebuild" &&
|
||||
!data.scripts.preinstall) {
|
||||
data.gypfile = true
|
||||
}
|
||||
fixer.warn = function() { warn(makeWarning.apply(null, arguments)) }
|
||||
thingsToFix.forEach(function(thingName) {
|
||||
fixer["fix" + ucFirst(thingName)](data, strict)
|
||||
})
|
||||
data._id = data.name + "@" + data.version
|
||||
}
|
||||
|
||||
function ucFirst (string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
}
|
||||
9
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/lib/safe_format.js
generated
vendored
Normal file
9
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/lib/safe_format.js
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
var util = require('util')
|
||||
|
||||
module.exports = function() {
|
||||
var args = Array.prototype.slice.call(arguments, 0)
|
||||
args.forEach(function(arg) {
|
||||
if (!arg) throw new TypeError('Bad arguments.')
|
||||
})
|
||||
return util.format.apply(null, arguments)
|
||||
}
|
||||
25
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/lib/typos.json
generated
vendored
Normal file
25
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/lib/typos.json
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"topLevel": {
|
||||
"dependancies": "dependencies"
|
||||
,"dependecies": "dependencies"
|
||||
,"depdenencies": "dependencies"
|
||||
,"devEependencies": "devDependencies"
|
||||
,"depends": "dependencies"
|
||||
,"dev-dependencies": "devDependencies"
|
||||
,"devDependences": "devDependencies"
|
||||
,"devDepenencies": "devDependencies"
|
||||
,"devdependencies": "devDependencies"
|
||||
,"repostitory": "repository"
|
||||
,"repo": "repository"
|
||||
,"prefereGlobal": "preferGlobal"
|
||||
,"hompage": "homepage"
|
||||
,"hampage": "homepage"
|
||||
,"autohr": "author"
|
||||
,"autor": "author"
|
||||
,"contributers": "contributors"
|
||||
,"publicationConfig": "publishConfig"
|
||||
,"script": "scripts"
|
||||
},
|
||||
"bugs": { "web": "url", "name": "url" },
|
||||
"script": { "server": "start", "tests": "test" }
|
||||
}
|
||||
30
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/lib/warning_messages.json
generated
vendored
Normal file
30
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/lib/warning_messages.json
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"repositories": "'repositories' (plural) Not supported. Please pick one as the 'repository' field"
|
||||
,"missingRepository": "No repository field."
|
||||
,"brokenGitUrl": "Probably broken git url: %s"
|
||||
,"nonObjectScripts": "scripts must be an object"
|
||||
,"nonStringScript": "script values must be string commands"
|
||||
,"nonArrayFiles": "Invalid 'files' member"
|
||||
,"invalidFilename": "Invalid filename in 'files' list: %s"
|
||||
,"nonArrayBundleDependencies": "Invalid 'bundleDependencies' list. Must be array of package names"
|
||||
,"nonStringBundleDependency": "Invalid bundleDependencies member: %s"
|
||||
,"nonDependencyBundleDependency": "Non-dependency in bundleDependencies: %s"
|
||||
,"nonObjectDependencies": "%s field must be an object"
|
||||
,"nonStringDependency": "Invalid dependency: %s %s"
|
||||
,"deprecatedArrayDependencies": "specifying %s as array is deprecated"
|
||||
,"deprecatedModules": "modules field is deprecated"
|
||||
,"nonArrayKeywords": "keywords should be an array of strings"
|
||||
,"nonStringKeyword": "keywords should be an array of strings"
|
||||
,"conflictingName": "%s is also the name of a node core module."
|
||||
,"nonStringDescription": "'description' field should be a string"
|
||||
,"missingDescription": "No description"
|
||||
,"missingReadme": "No README data"
|
||||
,"missingLicense": "No license field."
|
||||
,"nonEmailUrlBugsString": "Bug string field must be url, email, or {email,url}"
|
||||
,"nonUrlBugsUrlField": "bugs.url field must be a string url. Deleted."
|
||||
,"nonEmailBugsEmailField": "bugs.email field must be a string email. Deleted."
|
||||
,"emptyNormalizedBugs": "Normalized value of bugs field is an empty object. Deleted."
|
||||
,"nonUrlHomepage": "homepage field must be a string url. Deleted."
|
||||
,"invalidLicense": "license should be a valid SPDX license expression"
|
||||
,"typo": "%s should probably be %s."
|
||||
}
|
||||
31
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/package.json
generated
vendored
Normal file
31
node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "normalize-package-data",
|
||||
"version": "2.5.0",
|
||||
"author": "Meryn Stol <merynstol@gmail.com>",
|
||||
"description": "Normalizes data that can be found in package.json files.",
|
||||
"license": "BSD-2-Clause",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/npm/normalize-package-data.git"
|
||||
},
|
||||
"main": "lib/normalize.js",
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"hosted-git-info": "^2.1.4",
|
||||
"resolve": "^1.10.0",
|
||||
"semver": "2 || 3 || 4 || 5",
|
||||
"validate-npm-package-license": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"async": "^2.6.1",
|
||||
"tap": "^12.4.0",
|
||||
"underscore": "^1.8.3"
|
||||
},
|
||||
"files": [
|
||||
"lib/*.js",
|
||||
"lib/*.json",
|
||||
"AUTHORS"
|
||||
]
|
||||
}
|
||||
15
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/index.d.ts
generated
vendored
Normal file
15
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Basic
|
||||
export * from './source/basic';
|
||||
|
||||
// Utilities
|
||||
export {Except} from './source/except';
|
||||
export {Mutable} from './source/mutable';
|
||||
export {Merge} from './source/merge';
|
||||
export {MergeExclusive} from './source/merge-exclusive';
|
||||
export {RequireAtLeastOne} from './source/require-at-least-one';
|
||||
export {ReadonlyDeep} from './source/readonly-deep';
|
||||
export {LiteralUnion} from './source/literal-union';
|
||||
export {Promisable} from './source/promisable';
|
||||
|
||||
// Miscellaneous
|
||||
export {PackageJson} from './source/package-json';
|
||||
9
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/license
generated
vendored
Normal file
9
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/license
generated
vendored
Normal 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.
|
||||
51
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/package.json
generated
vendored
Normal file
51
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"name": "type-fest",
|
||||
"version": "0.6.0",
|
||||
"description": "A collection of essential TypeScript types",
|
||||
"license": "(MIT OR CC0-1.0)",
|
||||
"repository": "sindresorhus/type-fest",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"source"
|
||||
],
|
||||
"keywords": [
|
||||
"typescript",
|
||||
"ts",
|
||||
"types",
|
||||
"utility",
|
||||
"util",
|
||||
"utilities",
|
||||
"omit",
|
||||
"merge",
|
||||
"json"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@sindresorhus/tsconfig": "^0.4.0",
|
||||
"@typescript-eslint/eslint-plugin": "^1.9.0",
|
||||
"@typescript-eslint/parser": "^1.10.2",
|
||||
"eslint-config-xo-typescript": "^0.14.0",
|
||||
"tsd": "^0.7.3",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"xo": {
|
||||
"extends": "xo-typescript",
|
||||
"extensions": [
|
||||
"ts"
|
||||
],
|
||||
"rules": {
|
||||
"import/no-unresolved": "off",
|
||||
"@typescript-eslint/indent": "off"
|
||||
}
|
||||
}
|
||||
}
|
||||
119
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/readme.md
generated
vendored
Normal file
119
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
<div align="center">
|
||||
<br>
|
||||
<br>
|
||||
<img src="media/logo.svg" alt="type-fest" height="300">
|
||||
<br>
|
||||
<br>
|
||||
<b>A collection of essential TypeScript types</b>
|
||||
<br>
|
||||
<hr>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
[](https://travis-ci.com/sindresorhus/type-fest)
|
||||
[](https://www.youtube.com/watch?v=9auOCbH5Ns4)
|
||||
<!-- Commented out until they actually show anything
|
||||
[](https://www.npmjs.com/package/type-fest?activeTab=dependents) [](https://www.npmjs.com/package/type-fest)
|
||||
-->
|
||||
|
||||
Many of the types here should have been built-in. You can help by suggesting some of them to the [TypeScript project](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
|
||||
|
||||
Either add this package as a dependency or copy-paste the needed types. No credit required. 👌
|
||||
|
||||
PR welcome for additional commonly needed types and docs improvements. Read the [contributing guidelines](.github/contributing.md) first.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install type-fest
|
||||
```
|
||||
|
||||
*Requires TypeScript >=3.2*
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import {Except} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
unicorn: string;
|
||||
rainbow: boolean;
|
||||
};
|
||||
|
||||
type FooWithoutRainbow = Except<Foo, 'rainbow'>;
|
||||
//=> {unicorn: string}
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
Click the type names for complete docs.
|
||||
|
||||
### Basic
|
||||
|
||||
- [`Primitive`](source/basic.d.ts) - Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
||||
- [`Class`](source/basic.d.ts) - Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
||||
- [`TypedArray`](source/basic.d.ts) - Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
|
||||
- [`JsonObject`](source/basic.d.ts) - Matches a JSON object.
|
||||
- [`JsonArray`](source/basic.d.ts) - Matches a JSON array.
|
||||
- [`JsonValue`](source/basic.d.ts) - Matches any valid JSON value.
|
||||
- [`ObservableLike`](source/basic.d.ts) - Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).
|
||||
|
||||
### Utilities
|
||||
|
||||
- [`Except`](source/except.d.ts) - Create a type from an object type without certain keys. This is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type).
|
||||
- [`Mutable`](source/mutable.d.ts) - Convert an object with `readonly` properties into a mutable object. Inverse of `Readonly<T>`.
|
||||
- [`Merge`](source/merge.d.ts) - Merge two types into a new type. Keys of the second type overrides keys of the first type.
|
||||
- [`MergeExclusive`](source/merge-exclusive.d.ts) - Create a type that has mutually exclusive properties.
|
||||
- [`RequireAtLeastOne`](source/require-at-least-one.d.ts) - Create a type that requires at least one of the given properties.
|
||||
- [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of a `object`/`Map`/`Set`/`Array` type.
|
||||
- [`LiteralUnion`](source/literal-union.d.ts) - Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. Workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729).
|
||||
- [`Promisable`](source/promisable.d.ts) - Create a type that represents either the value or the value wrapped in `PromiseLike`.
|
||||
|
||||
### Miscellaneous
|
||||
|
||||
- [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file).
|
||||
|
||||
|
||||
## Declined types
|
||||
|
||||
*If we decline a type addition, we will make sure to document the better solution here.*
|
||||
|
||||
- [`Diff` and `Spread`](https://github.com/sindresorhus/type-fest/pull/7) - The PR author didn't provide any real-world use-cases and the PR went stale. If you think this type is useful, provide some real-world use-cases and we might reconsider.
|
||||
|
||||
|
||||
## Tips
|
||||
|
||||
### Built-in types
|
||||
|
||||
There are many advanced types most users don't know about.
|
||||
|
||||
- [`Partial<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) - Make all properties in `T` optional.
|
||||
- [`Required<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1408-L1413) - Make all properties in `T` required.
|
||||
- [`Readonly<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) - Make all properties in `T` readonly.
|
||||
- [`Pick<T, K>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1422-L1427) - From `T`, pick a set of properties whose keys are in the union `K`.
|
||||
- [`Record<K, T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434) - Construct a type with a set of properties `K` of type `T`.
|
||||
- [`Exclude<T, U>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1436-L1439) - Exclude from `T` those types that are assignable to `U`.
|
||||
- [`Extract<T, U>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1441-L1444) - Extract from `T` those types that are assignable to `U`.
|
||||
- [`NonNullable<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1446-L1449) - Exclude `null` and `undefined` from `T`.
|
||||
- [`Parameters<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1451-L1454) - Obtain the parameters of a function type in a tuple.
|
||||
- [`ConstructorParameters<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1456-L1459) - Obtain the parameters of a constructor function type in a tuple.
|
||||
- [`ReturnType<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1461-L1464) – Obtain the return type of a function type.
|
||||
- [`InstanceType<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1466-L1469) – Obtain the instance type of a constructor function type.
|
||||
|
||||
You can find some examples in the [TypeScript docs](https://www.typescriptlang.org/docs/handbook/advanced-types.html#predefined-conditional-types).
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Jarek Radosz](https://github.com/CvX)
|
||||
- [Dimitri Benin](https://github.com/BendingBender)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
(MIT OR CC0-1.0)
|
||||
67
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/basic.d.ts
generated
vendored
Normal file
67
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/basic.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/// <reference lib="esnext"/>
|
||||
|
||||
// TODO: This can just be `export type Primitive = not object` when the `not` keyword is out.
|
||||
/**
|
||||
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
||||
*/
|
||||
export type Primitive =
|
||||
| null
|
||||
| undefined
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| symbol
|
||||
| bigint;
|
||||
|
||||
// TODO: Remove the `= unknown` sometime in the future when most users are on TS 3.5 as it's now the default
|
||||
/**
|
||||
Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
||||
*/
|
||||
export type Class<T = unknown> = new(...arguments_: any[]) => T;
|
||||
|
||||
/**
|
||||
Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
|
||||
*/
|
||||
export type TypedArray =
|
||||
| Int8Array
|
||||
| Uint8Array
|
||||
| Uint8ClampedArray
|
||||
| Int16Array
|
||||
| Uint16Array
|
||||
| Int32Array
|
||||
| Uint32Array
|
||||
| Float32Array
|
||||
| Float64Array
|
||||
| BigInt64Array
|
||||
| BigUint64Array;
|
||||
|
||||
/**
|
||||
Matches a JSON object.
|
||||
|
||||
This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`.
|
||||
*/
|
||||
export type JsonObject = {[key: string]: JsonValue};
|
||||
|
||||
/**
|
||||
Matches a JSON array.
|
||||
*/
|
||||
export interface JsonArray extends Array<JsonValue> {}
|
||||
|
||||
/**
|
||||
Matches any valid JSON value.
|
||||
*/
|
||||
export type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
|
||||
|
||||
declare global {
|
||||
interface SymbolConstructor {
|
||||
readonly observable: symbol;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).
|
||||
*/
|
||||
export interface ObservableLike {
|
||||
subscribe(observer: (value: unknown) => void): void;
|
||||
[Symbol.observable](): ObservableLike;
|
||||
}
|
||||
22
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/except.d.ts
generated
vendored
Normal file
22
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/except.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
Create a type from an object type without certain keys.
|
||||
|
||||
This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
|
||||
|
||||
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/30825) if you want to have the stricter version as a built-in in TypeScript.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Except} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
a: number;
|
||||
b: string;
|
||||
c: boolean;
|
||||
};
|
||||
|
||||
type FooWithoutA = Except<Foo, 'a' | 'c'>;
|
||||
//=> {b: string};
|
||||
```
|
||||
*/
|
||||
export type Except<ObjectType, KeysType extends keyof ObjectType> = Pick<ObjectType, Exclude<keyof ObjectType, KeysType>>;
|
||||
33
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/literal-union.d.ts
generated
vendored
Normal file
33
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/literal-union.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import {Primitive} from './basic';
|
||||
|
||||
/**
|
||||
Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
|
||||
|
||||
Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
|
||||
|
||||
This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
|
||||
|
||||
@example
|
||||
```
|
||||
import {LiteralUnion} from 'type-fest';
|
||||
|
||||
// Before
|
||||
|
||||
type Pet = 'dog' | 'cat' | string;
|
||||
|
||||
const pet: Pet = '';
|
||||
// Start typing in your TypeScript-enabled IDE.
|
||||
// You **will not** get auto-completion for `dog` and `cat` literals.
|
||||
|
||||
// After
|
||||
|
||||
type Pet2 = LiteralUnion<'dog' | 'cat', string>;
|
||||
|
||||
const pet: Pet2 = '';
|
||||
// You **will** get auto-completion for `dog` and `cat` literals.
|
||||
```
|
||||
*/
|
||||
export type LiteralUnion<
|
||||
LiteralType extends BaseType,
|
||||
BaseType extends Primitive
|
||||
> = LiteralType | (BaseType & {_?: never});
|
||||
39
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/merge-exclusive.d.ts
generated
vendored
Normal file
39
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/merge-exclusive.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// Helper type. Not useful on its own.
|
||||
type Without<FirstType, SecondType> = {[KeyType in Exclude<keyof FirstType, keyof SecondType>]?: never};
|
||||
|
||||
/**
|
||||
Create a type that has mutually exclusive properties.
|
||||
|
||||
This type was inspired by [this comment](https://github.com/Microsoft/TypeScript/issues/14094#issuecomment-373782604).
|
||||
|
||||
This type works with a helper type, called `Without`. `Without<FirstType, SecondType>` produces a type that has only keys from `FirstType` which are not present on `SecondType` and sets the value type for these keys to `never`. This helper type is then used in `MergeExclusive` to remove keys from either `FirstType` or `SecondType`.
|
||||
|
||||
@example
|
||||
```
|
||||
import {MergeExclusive} from 'type-fest';
|
||||
|
||||
interface ExclusiveVariation1 {
|
||||
exclusive1: boolean;
|
||||
}
|
||||
|
||||
interface ExclusiveVariation2 {
|
||||
exclusive2: string;
|
||||
}
|
||||
|
||||
type ExclusiveOptions = MergeExclusive<ExclusiveVariation1, ExclusiveVariation2>;
|
||||
|
||||
let exclusiveOptions: ExclusiveOptions;
|
||||
|
||||
exclusiveOptions = {exclusive1: true};
|
||||
//=> Works
|
||||
exclusiveOptions = {exclusive2: 'hi'};
|
||||
//=> Works
|
||||
exclusiveOptions = {exclusive1: true, exclusive2: 'hi'};
|
||||
//=> Error
|
||||
```
|
||||
*/
|
||||
export type MergeExclusive<FirstType, SecondType> =
|
||||
(FirstType | SecondType) extends object ?
|
||||
(Without<FirstType, SecondType> & SecondType) | (Without<SecondType, FirstType> & FirstType) :
|
||||
FirstType | SecondType;
|
||||
|
||||
22
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/merge.d.ts
generated
vendored
Normal file
22
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/merge.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import {Except} from './except';
|
||||
|
||||
/**
|
||||
Merge two types into a new type. Keys of the second type overrides keys of the first type.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Merge} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
a: number;
|
||||
b: string;
|
||||
};
|
||||
|
||||
type Bar = {
|
||||
b: number;
|
||||
};
|
||||
|
||||
const ab: Merge<Foo, Bar> = {a: 1, b: 2};
|
||||
```
|
||||
*/
|
||||
export type Merge<FirstType, SecondType> = Except<FirstType, Extract<keyof FirstType, keyof SecondType>> & SecondType;
|
||||
22
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/mutable.d.ts
generated
vendored
Normal file
22
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/mutable.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
Convert an object with `readonly` properties into a mutable object. Inverse of `Readonly<T>`.
|
||||
|
||||
This can be used to [store and mutate options within a class](https://github.com/sindresorhus/pageres/blob/4a5d05fca19a5fbd2f53842cbf3eb7b1b63bddd2/source/index.ts#L72), [edit `readonly` objects within tests](https://stackoverflow.com/questions/50703834), and [construct a `readonly` object within a function](https://github.com/Microsoft/TypeScript/issues/24509).
|
||||
|
||||
@example
|
||||
```
|
||||
import {Mutable} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
readonly a: number;
|
||||
readonly b: string;
|
||||
};
|
||||
|
||||
const mutableFoo: Mutable<Foo> = {a: 1, b: '2'};
|
||||
mutableFoo.a = 3;
|
||||
```
|
||||
*/
|
||||
export type Mutable<ObjectType> = {
|
||||
// For each `Key` in the keys of `ObjectType`, make a mapped type by removing the `readonly` modifier from the property.
|
||||
-readonly [KeyType in keyof ObjectType]: ObjectType[KeyType];
|
||||
};
|
||||
501
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/package-json.d.ts
generated
vendored
Normal file
501
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/package-json.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,501 @@
|
|||
import {LiteralUnion} from '..';
|
||||
|
||||
declare namespace PackageJson {
|
||||
/**
|
||||
A person who has been involved in creating or maintaining the package.
|
||||
*/
|
||||
export type Person =
|
||||
| string
|
||||
| {
|
||||
name: string;
|
||||
url?: string;
|
||||
email?: string;
|
||||
};
|
||||
|
||||
export type BugsLocation =
|
||||
| string
|
||||
| {
|
||||
/**
|
||||
The URL to the package's issue tracker.
|
||||
*/
|
||||
url?: string;
|
||||
|
||||
/**
|
||||
The email address to which issues should be reported.
|
||||
*/
|
||||
email?: string;
|
||||
};
|
||||
|
||||
export interface DirectoryLocations {
|
||||
/**
|
||||
Location for executable scripts. Sugar to generate entries in the `bin` property by walking the folder.
|
||||
*/
|
||||
bin?: string;
|
||||
|
||||
/**
|
||||
Location for Markdown files.
|
||||
*/
|
||||
doc?: string;
|
||||
|
||||
/**
|
||||
Location for example scripts.
|
||||
*/
|
||||
example?: string;
|
||||
|
||||
/**
|
||||
Location for the bulk of the library.
|
||||
*/
|
||||
lib?: string;
|
||||
|
||||
/**
|
||||
Location for man pages. Sugar to generate a `man` array by walking the folder.
|
||||
*/
|
||||
man?: string;
|
||||
|
||||
/**
|
||||
Location for test files.
|
||||
*/
|
||||
test?: string;
|
||||
|
||||
[directoryType: string]: unknown;
|
||||
}
|
||||
|
||||
export type Scripts = {
|
||||
/**
|
||||
Run **before** the package is published (Also run on local `npm install` without any arguments).
|
||||
*/
|
||||
prepublish?: string;
|
||||
|
||||
/**
|
||||
Run both **before** the package is packed and published, and on local `npm install` without any arguments. This is run **after** `prepublish`, but **before** `prepublishOnly`.
|
||||
*/
|
||||
prepare?: string;
|
||||
|
||||
/**
|
||||
Run **before** the package is prepared and packed, **only** on `npm publish`.
|
||||
*/
|
||||
prepublishOnly?: string;
|
||||
|
||||
/**
|
||||
Run **before** a tarball is packed (on `npm pack`, `npm publish`, and when installing git dependencies).
|
||||
*/
|
||||
prepack?: string;
|
||||
|
||||
/**
|
||||
Run **after** the tarball has been generated and moved to its final destination.
|
||||
*/
|
||||
postpack?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is published.
|
||||
*/
|
||||
publish?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is published.
|
||||
*/
|
||||
postpublish?: string;
|
||||
|
||||
/**
|
||||
Run **before** the package is installed.
|
||||
*/
|
||||
preinstall?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is installed.
|
||||
*/
|
||||
install?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is installed and after `install`.
|
||||
*/
|
||||
postinstall?: string;
|
||||
|
||||
/**
|
||||
Run **before** the package is uninstalled and before `uninstall`.
|
||||
*/
|
||||
preuninstall?: string;
|
||||
|
||||
/**
|
||||
Run **before** the package is uninstalled.
|
||||
*/
|
||||
uninstall?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is uninstalled.
|
||||
*/
|
||||
postuninstall?: string;
|
||||
|
||||
/**
|
||||
Run **before** bump the package version and before `version`.
|
||||
*/
|
||||
preversion?: string;
|
||||
|
||||
/**
|
||||
Run **before** bump the package version.
|
||||
*/
|
||||
version?: string;
|
||||
|
||||
/**
|
||||
Run **after** bump the package version.
|
||||
*/
|
||||
postversion?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm test` command, before `test`.
|
||||
*/
|
||||
pretest?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm test` command.
|
||||
*/
|
||||
test?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm test` command, after `test`.
|
||||
*/
|
||||
posttest?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm stop` command, before `stop`.
|
||||
*/
|
||||
prestop?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm stop` command.
|
||||
*/
|
||||
stop?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm stop` command, after `stop`.
|
||||
*/
|
||||
poststop?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm start` command, before `start`.
|
||||
*/
|
||||
prestart?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm start` command.
|
||||
*/
|
||||
start?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm start` command, after `start`.
|
||||
*/
|
||||
poststart?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm restart` command, before `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
|
||||
*/
|
||||
prerestart?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm restart` command. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
|
||||
*/
|
||||
restart?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm restart` command, after `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
|
||||
*/
|
||||
postrestart?: string;
|
||||
} & {
|
||||
[scriptName: string]: string;
|
||||
};
|
||||
|
||||
/**
|
||||
Dependencies of the package. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or Git URL.
|
||||
*/
|
||||
export interface Dependency {
|
||||
[packageName: string]: string;
|
||||
}
|
||||
|
||||
export interface NonStandardEntryPoints {
|
||||
/**
|
||||
An ECMAScript module ID that is the primary entry point to the program.
|
||||
*/
|
||||
module?: string;
|
||||
|
||||
/**
|
||||
A module ID with untranspiled code that is the primary entry point to the program.
|
||||
*/
|
||||
esnext?:
|
||||
| string
|
||||
| {
|
||||
main?: string;
|
||||
browser?: string;
|
||||
[moduleName: string]: string | undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
A hint to JavaScript bundlers or component tools when packaging modules for client side use.
|
||||
*/
|
||||
browser?:
|
||||
| string
|
||||
| {
|
||||
[moduleName: string]: string | false;
|
||||
};
|
||||
}
|
||||
|
||||
export interface TypeScriptConfiguration {
|
||||
/**
|
||||
Location of the bundled TypeScript declaration file.
|
||||
*/
|
||||
types?: string;
|
||||
|
||||
/**
|
||||
Location of the bundled TypeScript declaration file. Alias of `types`.
|
||||
*/
|
||||
typings?: string;
|
||||
}
|
||||
|
||||
export interface YarnConfiguration {
|
||||
/**
|
||||
If your package only allows one version of a given dependency, and you’d like to enforce the same behavior as `yarn install --flat` on the command line, set this to `true`.
|
||||
|
||||
Note that if your `package.json` contains `"flat": true` and other packages depend on yours (e.g. you are building a library rather than an application), those other packages will also need `"flat": true` in their `package.json` or be installed with `yarn install --flat` on the command-line.
|
||||
*/
|
||||
flat?: boolean;
|
||||
|
||||
/**
|
||||
Selective version resolutions. Allows the definition of custom package versions inside dependencies without manual edits in the `yarn.lock` file.
|
||||
*/
|
||||
resolutions?: Dependency;
|
||||
}
|
||||
|
||||
export interface JSPMConfiguration {
|
||||
/**
|
||||
JSPM configuration.
|
||||
*/
|
||||
jspm?: PackageJson;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Also includes types for fields used by other popular projects, like TypeScript and Yarn.
|
||||
*/
|
||||
export type PackageJson = {
|
||||
/**
|
||||
The name of the package.
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
Package version, parseable by [`node-semver`](https://github.com/npm/node-semver).
|
||||
*/
|
||||
version?: string;
|
||||
|
||||
/**
|
||||
Package description, listed in `npm search`.
|
||||
*/
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
Keywords associated with package, listed in `npm search`.
|
||||
*/
|
||||
keywords?: string[];
|
||||
|
||||
/**
|
||||
The URL to the package's homepage.
|
||||
*/
|
||||
homepage?: LiteralUnion<'.', string>;
|
||||
|
||||
/**
|
||||
The URL to the package's issue tracker and/or the email address to which issues should be reported.
|
||||
*/
|
||||
bugs?: PackageJson.BugsLocation;
|
||||
|
||||
/**
|
||||
The license for the package.
|
||||
*/
|
||||
license?: string;
|
||||
|
||||
/**
|
||||
The licenses for the package.
|
||||
*/
|
||||
licenses?: Array<{
|
||||
type?: string;
|
||||
url?: string;
|
||||
}>;
|
||||
|
||||
author?: PackageJson.Person;
|
||||
|
||||
/**
|
||||
A list of people who contributed to the package.
|
||||
*/
|
||||
contributors?: PackageJson.Person[];
|
||||
|
||||
/**
|
||||
A list of people who maintain the package.
|
||||
*/
|
||||
maintainers?: PackageJson.Person[];
|
||||
|
||||
/**
|
||||
The files included in the package.
|
||||
*/
|
||||
files?: string[];
|
||||
|
||||
/**
|
||||
The module ID that is the primary entry point to the program.
|
||||
*/
|
||||
main?: string;
|
||||
|
||||
/**
|
||||
The executable files that should be installed into the `PATH`.
|
||||
*/
|
||||
bin?:
|
||||
| string
|
||||
| {
|
||||
[binary: string]: string;
|
||||
};
|
||||
|
||||
/**
|
||||
Filenames to put in place for the `man` program to find.
|
||||
*/
|
||||
man?: string | string[];
|
||||
|
||||
/**
|
||||
Indicates the structure of the package.
|
||||
*/
|
||||
directories?: PackageJson.DirectoryLocations;
|
||||
|
||||
/**
|
||||
Location for the code repository.
|
||||
*/
|
||||
repository?:
|
||||
| string
|
||||
| {
|
||||
type: string;
|
||||
url: string;
|
||||
};
|
||||
|
||||
/**
|
||||
Script commands that are run at various times in the lifecycle of the package. The key is the lifecycle event, and the value is the command to run at that point.
|
||||
*/
|
||||
scripts?: PackageJson.Scripts;
|
||||
|
||||
/**
|
||||
Is used to set configuration parameters used in package scripts that persist across upgrades.
|
||||
*/
|
||||
config?: {
|
||||
[configKey: string]: unknown;
|
||||
};
|
||||
|
||||
/**
|
||||
The dependencies of the package.
|
||||
*/
|
||||
dependencies?: PackageJson.Dependency;
|
||||
|
||||
/**
|
||||
Additional tooling dependencies that are not required for the package to work. Usually test, build, or documentation tooling.
|
||||
*/
|
||||
devDependencies?: PackageJson.Dependency;
|
||||
|
||||
/**
|
||||
Dependencies that are skipped if they fail to install.
|
||||
*/
|
||||
optionalDependencies?: PackageJson.Dependency;
|
||||
|
||||
/**
|
||||
Dependencies that will usually be required by the package user directly or via another dependency.
|
||||
*/
|
||||
peerDependencies?: PackageJson.Dependency;
|
||||
|
||||
/**
|
||||
Package names that are bundled when the package is published.
|
||||
*/
|
||||
bundledDependencies?: string[];
|
||||
|
||||
/**
|
||||
Alias of `bundledDependencies`.
|
||||
*/
|
||||
bundleDependencies?: string[];
|
||||
|
||||
/**
|
||||
Engines that this package runs on.
|
||||
*/
|
||||
engines?: {
|
||||
[EngineName in 'npm' | 'node' | string]: string;
|
||||
};
|
||||
|
||||
/**
|
||||
@deprecated
|
||||
*/
|
||||
engineStrict?: boolean;
|
||||
|
||||
/**
|
||||
Operating systems the module runs on.
|
||||
*/
|
||||
os?: Array<LiteralUnion<
|
||||
| 'aix'
|
||||
| 'darwin'
|
||||
| 'freebsd'
|
||||
| 'linux'
|
||||
| 'openbsd'
|
||||
| 'sunos'
|
||||
| 'win32'
|
||||
| '!aix'
|
||||
| '!darwin'
|
||||
| '!freebsd'
|
||||
| '!linux'
|
||||
| '!openbsd'
|
||||
| '!sunos'
|
||||
| '!win32',
|
||||
string
|
||||
>>;
|
||||
|
||||
/**
|
||||
CPU architectures the module runs on.
|
||||
*/
|
||||
cpu?: Array<LiteralUnion<
|
||||
| 'arm'
|
||||
| 'arm64'
|
||||
| 'ia32'
|
||||
| 'mips'
|
||||
| 'mipsel'
|
||||
| 'ppc'
|
||||
| 'ppc64'
|
||||
| 's390'
|
||||
| 's390x'
|
||||
| 'x32'
|
||||
| 'x64'
|
||||
| '!arm'
|
||||
| '!arm64'
|
||||
| '!ia32'
|
||||
| '!mips'
|
||||
| '!mipsel'
|
||||
| '!ppc'
|
||||
| '!ppc64'
|
||||
| '!s390'
|
||||
| '!s390x'
|
||||
| '!x32'
|
||||
| '!x64',
|
||||
string
|
||||
>>;
|
||||
|
||||
/**
|
||||
If set to `true`, a warning will be shown if package is installed locally. Useful if the package is primarily a command-line application that should be installed globally.
|
||||
|
||||
@deprecated
|
||||
*/
|
||||
preferGlobal?: boolean;
|
||||
|
||||
/**
|
||||
If set to `true`, then npm will refuse to publish it.
|
||||
*/
|
||||
private?: boolean;
|
||||
|
||||
/**
|
||||
* A set of config values that will be used at publish-time. It's especially handy to set the tag, registry or access, to ensure that a given package is not tagged with 'latest', published to the global public registry or that a scoped module is private by default.
|
||||
*/
|
||||
publishConfig?: {
|
||||
[config: string]: unknown;
|
||||
};
|
||||
} &
|
||||
PackageJson.NonStandardEntryPoints &
|
||||
PackageJson.TypeScriptConfiguration &
|
||||
PackageJson.YarnConfiguration &
|
||||
PackageJson.JSPMConfiguration & {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
23
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/promisable.d.ts
generated
vendored
Normal file
23
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/promisable.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
Create a type that represents either the value or the value wrapped in `PromiseLike`.
|
||||
|
||||
Use-cases:
|
||||
- A function accepts a callback that may either return a value synchronously or may return a promised value.
|
||||
- This type could be the return type of `Promise#then()`, `Promise#catch()`, and `Promise#finally()` callbacks.
|
||||
|
||||
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/31394) if you want to have this type as a built-in in TypeScript.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Promisable} from 'type-fest';
|
||||
|
||||
async function logger(getLogEntry: () => Promisable<string>): Promise<void> {
|
||||
const entry = await getLogEntry();
|
||||
console.log(entry);
|
||||
}
|
||||
|
||||
logger(() => 'foo');
|
||||
logger(() => Promise.resolve('bar'));
|
||||
```
|
||||
*/
|
||||
export type Promisable<T> = T | PromiseLike<T>;
|
||||
59
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/readonly-deep.d.ts
generated
vendored
Normal file
59
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/readonly-deep.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import {Primitive} from './basic';
|
||||
|
||||
/**
|
||||
Convert `object`s, `Map`s, `Set`s, and `Array`s and all of their properties/elements into immutable structures recursively.
|
||||
|
||||
This is useful when a deeply nested structure needs to be exposed as completely immutable, for example, an imported JSON module or when receiving an API response that is passed around.
|
||||
|
||||
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/13923) if you want to have this type as a built-in in TypeScript.
|
||||
|
||||
@example
|
||||
```
|
||||
// data.json
|
||||
{
|
||||
"foo": ["bar"]
|
||||
}
|
||||
|
||||
// main.ts
|
||||
import {ReadonlyDeep} from 'type-fest';
|
||||
import dataJson = require('./data.json');
|
||||
|
||||
const data: ReadonlyDeep<typeof dataJson> = dataJson;
|
||||
|
||||
export default data;
|
||||
|
||||
// test.ts
|
||||
import data from './main';
|
||||
|
||||
data.foo.push('bar');
|
||||
//=> error TS2339: Property 'push' does not exist on type 'readonly string[]'
|
||||
```
|
||||
*/
|
||||
export type ReadonlyDeep<T> = T extends Primitive | ((...arguments: any[]) => unknown)
|
||||
? T
|
||||
: T extends ReadonlyMap<infer KeyType, infer ValueType>
|
||||
? ReadonlyMapDeep<KeyType, ValueType>
|
||||
: T extends ReadonlySet<infer ItemType>
|
||||
? ReadonlySetDeep<ItemType>
|
||||
: T extends object
|
||||
? ReadonlyObjectDeep<T>
|
||||
: unknown;
|
||||
|
||||
/**
|
||||
Same as `ReadonlyDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `ReadonlyDeep`.
|
||||
*/
|
||||
interface ReadonlyMapDeep<KeyType, ValueType>
|
||||
extends ReadonlyMap<ReadonlyDeep<KeyType>, ReadonlyDeep<ValueType>> {}
|
||||
|
||||
/**
|
||||
Same as `ReadonlyDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `ReadonlyDeep`.
|
||||
*/
|
||||
interface ReadonlySetDeep<ItemType>
|
||||
extends ReadonlySet<ReadonlyDeep<ItemType>> {}
|
||||
|
||||
/**
|
||||
Same as `ReadonlyDeep`, but accepts only `object`s as inputs. Internal helper for `ReadonlyDeep`.
|
||||
*/
|
||||
type ReadonlyObjectDeep<ObjectType extends object> = {
|
||||
readonly [PropertyType in keyof ObjectType]: ReadonlyDeep<ObjectType[PropertyType]>
|
||||
};
|
||||
32
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/require-at-least-one.d.ts
generated
vendored
Normal file
32
node_modules/meow/node_modules/read-pkg/node_modules/type-fest/source/require-at-least-one.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import {Except} from './except';
|
||||
|
||||
/**
|
||||
Create a type that requires at least one of the given properties. The remaining properties are kept as is.
|
||||
|
||||
@example
|
||||
```
|
||||
import {RequireAtLeastOne} from 'type-fest';
|
||||
|
||||
type Responder = {
|
||||
text?: () => string;
|
||||
json?: () => string;
|
||||
|
||||
secure?: boolean;
|
||||
};
|
||||
|
||||
const responder: RequireAtLeastOne<Responder, 'text' | 'json'> = {
|
||||
json: () => '{"message": "ok"}',
|
||||
secure: true
|
||||
};
|
||||
```
|
||||
*/
|
||||
export type RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> =
|
||||
{
|
||||
// For each Key in KeysType make a mapped type
|
||||
[Key in KeysType]: (
|
||||
// …by picking that Key's type and making it required
|
||||
Required<Pick<ObjectType, Key>>
|
||||
)
|
||||
}[KeysType]
|
||||
// …then, make intersection types by adding the remaining properties to each mapped type.
|
||||
& Except<ObjectType, KeysType>;
|
||||
49
node_modules/meow/node_modules/read-pkg/package.json
generated
vendored
Normal file
49
node_modules/meow/node_modules/read-pkg/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"name": "read-pkg",
|
||||
"version": "5.2.0",
|
||||
"description": "Read a package.json file",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/read-pkg",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"json",
|
||||
"read",
|
||||
"parse",
|
||||
"file",
|
||||
"fs",
|
||||
"graceful",
|
||||
"load",
|
||||
"package",
|
||||
"normalize"
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/normalize-package-data": "^2.4.0",
|
||||
"normalize-package-data": "^2.5.0",
|
||||
"parse-json": "^5.0.0",
|
||||
"type-fest": "^0.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.2.0",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"xo": {
|
||||
"ignores": [
|
||||
"test/test.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
81
node_modules/meow/node_modules/read-pkg/readme.md
generated
vendored
Normal file
81
node_modules/meow/node_modules/read-pkg/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
# read-pkg [](https://travis-ci.org/sindresorhus/read-pkg)
|
||||
|
||||
> Read a package.json file
|
||||
|
||||
|
||||
## Why
|
||||
|
||||
- [Gracefully handles filesystem issues](https://github.com/isaacs/node-graceful-fs)
|
||||
- [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');
|
||||
|
||||
(async () => {
|
||||
console.log(await readPkg());
|
||||
//=> {name: 'read-pkg', …}
|
||||
|
||||
console.log(await readPkg({cwd: 'some-other-directory'}));
|
||||
//=> {name: 'unicorn', …}
|
||||
})();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### readPkg(options?)
|
||||
|
||||
Returns a `Promise<object>` with the parsed JSON.
|
||||
|
||||
### readPkg.sync(options?)
|
||||
|
||||
Returns the parsed JSON.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Current working directory.
|
||||
|
||||
##### 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
|
||||
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-read-pkg?utm_source=npm-read-pkg&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>
|
||||
15
node_modules/meow/node_modules/semver/LICENSE
generated
vendored
Normal file
15
node_modules/meow/node_modules/semver/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue