Updated the project.

This commit is contained in:
Batuhan Berk Başoğlu 2024-06-03 15:44:25 -04:00
parent 5dfe9f128d
commit 7919556077
1550 changed files with 17063 additions and 40183 deletions

53
my-app/node_modules/jackspeak/dist/commonjs/index.d.ts generated vendored Executable file → Normal file
View file

@ -9,7 +9,7 @@ import { inspect, InspectOptions } from 'node:util';
* Defines the type of value that is valid, given a config definition's
* {@link ConfigType} and boolean multiple setting
*/
export type ValidValue<T extends ConfigType, M extends boolean> = [
export type ValidValue<T extends ConfigType = ConfigType, M extends boolean = boolean> = [
T,
M
] extends ['number', true] ? number[] : [T, M] extends ['string', true] ? string[] : [T, M] extends ['boolean', true] ? boolean[] : [T, M] extends ['number', false] ? number : [T, M] extends ['string', false] ? string : [T, M] extends ['boolean', false] ? boolean : [T, M] extends ['string', boolean] ? string | string[] : [T, M] extends ['boolean', boolean] ? boolean | boolean[] : [T, M] extends ['number', boolean] ? number | number[] : [T, M] extends [ConfigType, false] ? string | number | boolean : [T, M] extends [ConfigType, true] ? string[] | number[] | boolean[] : string | number | boolean | string[] | number[] | boolean[];
@ -17,23 +17,27 @@ export type ValidValue<T extends ConfigType, M extends boolean> = [
* The meta information for a config option definition, when the
* type and multiple values can be inferred by the method being used
*/
export type ConfigOptionMeta<T extends ConfigType, M extends boolean> = {
default?: ValidValue<T, M> | undefined;
export type ConfigOptionMeta<T extends ConfigType, M extends boolean = boolean, O extends undefined | (T extends 'boolean' ? never : T extends 'string' ? readonly string[] : T extends 'number' ? readonly number[] : readonly number[] | readonly string[]) = undefined | (T extends 'boolean' ? never : T extends 'string' ? readonly string[] : T extends 'number' ? readonly number[] : readonly number[] | readonly string[])> = {
default?: undefined | (ValidValue<T, M> & (O extends number[] | string[] ? M extends false ? O[number] : O[number][] : unknown));
validOptions?: O;
description?: string;
validate?: ((v: any) => v is ValidValue<T, M>) | ((v: any) => boolean);
validate?: ((v: unknown) => v is ValidValue<T, M>) | ((v: unknown) => boolean);
short?: string | undefined;
type?: T;
} & (T extends 'boolean' ? {} : {
hint?: string | undefined;
}) & (M extends false ? {} : {
multiple?: M | undefined;
delim?: string | undefined;
hint?: T extends 'boolean' ? never : string;
delim?: M extends true ? string : never;
} & (M extends false ? {
multiple?: false | undefined;
} : M extends true ? {
multiple: true;
} : {
multiple?: boolean;
});
/**
* A set of {@link ConfigOptionMeta} fields, referenced by their longOption
* string values.
*/
export type ConfigMetaSet<T extends ConfigType, M extends boolean> = {
export type ConfigMetaSet<T extends ConfigType, M extends boolean = boolean> = {
[longOption: string]: ConfigOptionMeta<T, M>;
};
/**
@ -60,13 +64,14 @@ export type MultiType<M extends boolean> = M extends true ? {
/**
* A config field definition, in its full representation.
*/
export type ConfigOptionBase<T extends ConfigType, M extends boolean> = {
export type ConfigOptionBase<T extends ConfigType, M extends boolean = boolean> = {
type: T;
short?: string | undefined;
default?: ValidValue<T, M> | undefined;
description?: string;
hint?: T extends 'boolean' ? undefined : string | undefined;
validate?: (v: any) => v is ValidValue<T, M>;
validate?: (v: unknown) => v is ValidValue<T, M>;
validOptions?: T extends 'boolean' ? undefined : T extends 'string' ? readonly string[] : T extends 'number' ? readonly number[] : readonly number[] | readonly string[];
} & MultiType<M>;
export declare const isConfigType: (t: string) => t is ConfigType;
export declare const isConfigOption: <T extends ConfigType, M extends boolean>(o: any, type: T, multi: M) => o is ConfigOptionBase<T, M>;
@ -75,13 +80,13 @@ export declare const isConfigOption: <T extends ConfigType, M extends boolean>(o
* string values.
*/
export type ConfigSet = {
[longOption: string]: ConfigOptionBase<ConfigType, boolean>;
[longOption: string]: ConfigOptionBase<ConfigType>;
};
/**
* The 'values' field returned by {@link Jack#parse}
*/
export type OptionsResults<T extends ConfigSet> = {
[k in keyof T]?: T[k] extends ConfigOptionBase<'string', false> ? string : T[k] extends ConfigOptionBase<'string', true> ? string[] : T[k] extends ConfigOptionBase<'number', false> ? number : T[k] extends ConfigOptionBase<'number', true> ? number[] : T[k] extends ConfigOptionBase<'boolean', false> ? boolean : T[k] extends ConfigOptionBase<'boolean', true> ? boolean[] : never;
[k in keyof T]?: T[k]['validOptions'] extends (readonly string[] | readonly number[]) ? T[k] extends ConfigOptionBase<'string' | 'number', false> ? T[k]['validOptions'][number] : T[k] extends ConfigOptionBase<'string' | 'number', true> ? T[k]['validOptions'][number][] : never : T[k] extends ConfigOptionBase<'string', false> ? string : T[k] extends ConfigOptionBase<'string', true> ? string[] : T[k] extends ConfigOptionBase<'number', false> ? number : T[k] extends ConfigOptionBase<'number', true> ? number[] : T[k] extends ConfigOptionBase<'boolean', false> ? boolean : T[k] extends ConfigOptionBase<'boolean', true> ? boolean[] : never;
};
/**
* The object retured by {@link Jack#parse}
@ -140,7 +145,7 @@ export type TextRow = Heading | Description;
export type UsageField = TextRow | {
type: 'config';
name: string;
value: ConfigOptionBase<ConfigType, boolean>;
value: ConfigOptionBase<ConfigType>;
};
/**
* Options provided to the {@link Jack} constructor
@ -211,11 +216,18 @@ export declare class Jack<C extends ConfigSet = {}> {
* an explicit CLI setting.
*/
parse(args?: string[]): Parsed<C>;
/**
* Only parse the command line arguments passed in.
* Does not strip off the `node script.js` bits, so it must be just the
* arguments you wish to have parsed.
* Does not read from or write to the environment, or set defaults.
*/
parseRaw(args: string[]): Parsed<C>;
/**
* Validate that any arbitrary object is a valid configuration `values`
* object. Useful when loading config files or other sources.
*/
validate(o: any): asserts o is Parsed<C>['values'];
validate(o: unknown): asserts o is Parsed<C>['values'];
/**
* Add a heading to the usage output banner
*/
@ -235,7 +247,7 @@ export declare class Jack<C extends ConfigSet = {}> {
/**
* Add one or more multiple number fields.
*/
numList<F extends ConfigMetaSet<'number', true>>(fields: F): Jack<C & ConfigSetFromMetaSet<'number', true, F>>;
numList<F extends ConfigMetaSet<'number'>>(fields: F): Jack<C & ConfigSetFromMetaSet<'number', true, F>>;
/**
* Add one or more string option fields.
*/
@ -243,7 +255,7 @@ export declare class Jack<C extends ConfigSet = {}> {
/**
* Add one or more multiple string option fields.
*/
optList<F extends ConfigMetaSet<'string', true>>(fields: F): Jack<C & ConfigSetFromMetaSet<'string', true, F>>;
optList<F extends ConfigMetaSet<'string'>>(fields: F): Jack<C & ConfigSetFromMetaSet<'string', true, F>>;
/**
* Add one or more flag fields.
*/
@ -251,7 +263,7 @@ export declare class Jack<C extends ConfigSet = {}> {
/**
* Add one or more multiple flag fields.
*/
flagList<F extends ConfigMetaSet<'boolean', true>>(fields: F): Jack<C & ConfigSetFromMetaSet<'boolean', true, F>>;
flagList<F extends ConfigMetaSet<'boolean'>>(fields: F): Jack<C & ConfigSetFromMetaSet<'boolean', true, F>>;
/**
* Generic field definition method. Similar to flag/flagList/number/etc,
* but you must specify the `type` (and optionally `multiple` and `delim`)
@ -272,7 +284,8 @@ export declare class Jack<C extends ConfigSet = {}> {
toJSON(): {
[k: string]: {
default?: string | number | boolean | string[] | number[] | boolean[] | undefined;
validate?: ((v: any) => v is string | number | boolean | string[] | number[] | boolean[]) | undefined;
validOptions?: readonly number[] | readonly string[] | undefined;
validate?: ((v: unknown) => v is string | number | boolean | string[] | number[] | boolean[]) | undefined;
description?: string | undefined;
short?: string | undefined;
delim?: string | undefined;