bob-core 2.1.0 → 3.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/package-I_hjzzxG.cjs +1 -0
- package/dist/cjs/src/Cli.d.ts +4 -6
- package/dist/cjs/src/Command.d.ts +27 -50
- package/dist/cjs/src/CommandParser.d.ts +48 -50
- package/dist/cjs/src/CommandRegistry.d.ts +5 -5
- package/dist/cjs/src/CommandSignatureParser.d.ts +22 -25
- package/dist/cjs/src/CommandWithSignature.d.ts +21 -25
- package/dist/cjs/src/Flags.d.ts +25 -0
- package/dist/cjs/src/commands/HelpCommand.d.ts +2 -0
- package/dist/cjs/src/contracts/index.d.ts +0 -1
- package/dist/cjs/src/errors/BadCommandArgument.d.ts +14 -0
- package/dist/cjs/src/errors/BadCommandFlag.d.ts +14 -0
- package/dist/cjs/src/errors/InvalidFlag.d.ts +9 -0
- package/dist/cjs/src/errors/MissingRequiredFlagValue.d.ts +7 -0
- package/dist/cjs/src/errors/index.d.ts +4 -4
- package/dist/cjs/src/index.d.ts +3 -2
- package/dist/cjs/src/index.js +5 -14
- package/dist/cjs/src/lib/helpers.d.ts +1 -0
- package/dist/cjs/src/lib/types.d.ts +72 -18
- package/dist/cjs/src/options/HelpOption.d.ts +11 -10
- package/dist/esm/package-DXx2gXIL.js +59 -0
- package/dist/esm/src/Cli.d.ts +4 -6
- package/dist/esm/src/Command.d.ts +27 -50
- package/dist/esm/src/CommandParser.d.ts +48 -50
- package/dist/esm/src/CommandRegistry.d.ts +5 -5
- package/dist/esm/src/CommandSignatureParser.d.ts +22 -25
- package/dist/esm/src/CommandWithSignature.d.ts +21 -25
- package/dist/esm/src/Flags.d.ts +25 -0
- package/dist/esm/src/commands/HelpCommand.d.ts +2 -0
- package/dist/esm/src/contracts/index.d.ts +0 -1
- package/dist/esm/src/errors/BadCommandArgument.d.ts +14 -0
- package/dist/esm/src/errors/BadCommandFlag.d.ts +14 -0
- package/dist/esm/src/errors/InvalidFlag.d.ts +9 -0
- package/dist/esm/src/errors/MissingRequiredFlagValue.d.ts +7 -0
- package/dist/esm/src/errors/index.d.ts +4 -4
- package/dist/esm/src/index.d.ts +3 -2
- package/dist/esm/src/index.js +926 -1070
- package/dist/esm/src/lib/helpers.d.ts +1 -0
- package/dist/esm/src/lib/types.d.ts +72 -18
- package/dist/esm/src/options/HelpOption.d.ts +11 -10
- package/package.json +11 -12
- package/dist/cjs/package-DYSfqWOt.cjs +0 -1
- package/dist/cjs/src/contracts/CommandOption.d.ts +0 -6
- package/dist/cjs/src/errors/BadCommandOption.d.ts +0 -12
- package/dist/cjs/src/errors/BadCommandParameter.d.ts +0 -12
- package/dist/cjs/src/errors/InvalidOption.d.ts +0 -9
- package/dist/cjs/src/errors/MissingRequiredOptionValue.d.ts +0 -7
- package/dist/cjs/src/lib/optionHelpers.d.ts +0 -5
- package/dist/cjs/src/lib/valueConverter.d.ts +0 -10
- package/dist/esm/package-uVOgoItG.js +0 -33
- package/dist/esm/src/contracts/CommandOption.d.ts +0 -6
- package/dist/esm/src/errors/BadCommandOption.d.ts +0 -12
- package/dist/esm/src/errors/BadCommandParameter.d.ts +0 -12
- package/dist/esm/src/errors/InvalidOption.d.ts +0 -9
- package/dist/esm/src/errors/MissingRequiredOptionValue.d.ts +0 -7
- package/dist/esm/src/lib/optionHelpers.d.ts +0 -5
- package/dist/esm/src/lib/valueConverter.d.ts +0 -10
|
@@ -2,3 +2,4 @@ import { Command } from '../Command.js';
|
|
|
2
2
|
import { BobError } from '../errors/index.js';
|
|
3
3
|
export declare function isBobError(err: Error): err is BobError;
|
|
4
4
|
export declare function isBobCommand(obj: unknown): obj is Command;
|
|
5
|
+
export declare function isBobCommandClass(cls: unknown): cls is typeof Command;
|
|
@@ -1,31 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
export type
|
|
3
|
-
type: OptionPrimitive;
|
|
1
|
+
import { Command } from '../Command.js';
|
|
2
|
+
export type BaseFlagConfig<T> = {
|
|
4
3
|
description?: string;
|
|
5
4
|
alias?: string | Array<string>;
|
|
6
5
|
required?: boolean;
|
|
6
|
+
default?: T | T[] | null | (() => Promise<T | T[] | null>);
|
|
7
|
+
multiple?: boolean;
|
|
8
|
+
help?: string;
|
|
9
|
+
parse: (input: string, ctx: ContextDefinition) => T;
|
|
10
|
+
validate?(value: T): FlagValidationResult;
|
|
11
|
+
handler?(value: T, ctx: ContextDefinition, cmd: typeof Command): {
|
|
12
|
+
shouldStop: boolean;
|
|
13
|
+
} | void;
|
|
14
|
+
};
|
|
15
|
+
export type StringFlagDef = BaseFlagConfig<string> & {
|
|
16
|
+
type: 'string';
|
|
7
17
|
secret?: boolean;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
};
|
|
19
|
+
export type NumberFlagDef = BaseFlagConfig<number> & {
|
|
20
|
+
type: 'number';
|
|
21
|
+
min?: number;
|
|
22
|
+
max?: number;
|
|
23
|
+
};
|
|
24
|
+
export type BooleanFlagDef = BaseFlagConfig<boolean> & {
|
|
25
|
+
type: 'boolean';
|
|
26
|
+
};
|
|
27
|
+
export type EnumFlagDef<T extends readonly string[] = readonly string[]> = BaseFlagConfig<T[number]> & {
|
|
28
|
+
type: 'enum';
|
|
29
|
+
options: T;
|
|
30
|
+
};
|
|
31
|
+
export type FileFlagDef = BaseFlagConfig<string> & {
|
|
32
|
+
type: 'file';
|
|
33
|
+
exists?: boolean;
|
|
34
|
+
};
|
|
35
|
+
export type DirectoryFlagDef = BaseFlagConfig<string> & {
|
|
36
|
+
type: 'directory';
|
|
37
|
+
exists?: boolean;
|
|
38
|
+
};
|
|
39
|
+
export type UrlFlagDef = BaseFlagConfig<URL> & {
|
|
40
|
+
type: 'url';
|
|
41
|
+
};
|
|
42
|
+
export type CustomFlagDef<R = unknown> = BaseFlagConfig<R> & {
|
|
43
|
+
type: 'custom';
|
|
44
|
+
};
|
|
45
|
+
export type FlagDefinition = StringFlagDef | NumberFlagDef | BooleanFlagDef | EnumFlagDef | FileFlagDef | DirectoryFlagDef | UrlFlagDef | CustomFlagDef<any>;
|
|
46
|
+
export type FlagInput<T extends FlagDefinition, K extends string = never> = Partial<Omit<T, 'type' | K>>;
|
|
47
|
+
export type FlagValidationResult = true | string | Promise<true | string>;
|
|
48
|
+
type MaybeArray<T, O> = O extends {
|
|
49
|
+
multiple: true;
|
|
50
|
+
} ? T[] : T;
|
|
51
|
+
type InferParseReturn<O> = O extends {
|
|
52
|
+
parse: (...args: any[]) => infer R;
|
|
53
|
+
} ? R : never;
|
|
54
|
+
export type FlagType<O extends FlagDefinition> = O extends {
|
|
55
|
+
type: 'enum';
|
|
56
|
+
options: infer T extends readonly string[];
|
|
57
|
+
} ? MaybeArray<T[number], O> : MaybeArray<InferParseReturn<O>, O>;
|
|
58
|
+
export type IsRequired<O extends FlagDefinition> = O extends {
|
|
16
59
|
required: true;
|
|
17
60
|
} ? true : false;
|
|
18
|
-
export type
|
|
19
|
-
export type
|
|
20
|
-
[key: string]:
|
|
61
|
+
export type FlagReturnType<O extends FlagDefinition> = IsRequired<O> extends true ? FlagType<O> : FlagType<O> | null;
|
|
62
|
+
export type FlagsSchema = {
|
|
63
|
+
[key: string]: FlagDefinition;
|
|
21
64
|
};
|
|
22
|
-
export type
|
|
23
|
-
[Key in keyof Options]:
|
|
65
|
+
export type FlagsObject<Options extends FlagsSchema> = {
|
|
66
|
+
[Key in keyof Options]: FlagReturnType<Options[Key]>;
|
|
24
67
|
};
|
|
25
68
|
export type ArgumentsSchema = {
|
|
26
|
-
[key: string]:
|
|
69
|
+
[key: string]: FlagDefinition;
|
|
27
70
|
};
|
|
28
71
|
export type ArgumentsObject<Arguments extends ArgumentsSchema> = {
|
|
29
|
-
[Key in keyof Arguments]:
|
|
72
|
+
[Key in keyof Arguments]: FlagReturnType<Arguments[Key]>;
|
|
30
73
|
};
|
|
31
74
|
export type ContextDefinition = any;
|
|
75
|
+
export type InferFlags<T> = T extends {
|
|
76
|
+
flags: infer O extends FlagsSchema;
|
|
77
|
+
} ? O : any;
|
|
78
|
+
export type InferArgs<T> = T extends {
|
|
79
|
+
args: infer A extends ArgumentsSchema;
|
|
80
|
+
} ? A : any;
|
|
81
|
+
export type Parsed<T> = {
|
|
82
|
+
flags: FlagsObject<InferFlags<T>>;
|
|
83
|
+
args: ArgumentsObject<InferArgs<T>>;
|
|
84
|
+
};
|
|
85
|
+
export {};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Command } from '../Command.js';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
2
|
+
import { ContextDefinition } from '../lib/types.js';
|
|
3
|
+
export declare const HelpCommandFlag: import('../lib/types.js').BaseFlagConfig<boolean> & {
|
|
4
|
+
type: "boolean";
|
|
5
|
+
} & {
|
|
6
|
+
readonly alias: ["h"];
|
|
7
|
+
readonly handler: (value: boolean, ctx: ContextDefinition, cmd: typeof Command) => {
|
|
8
|
+
shouldStop: false;
|
|
9
|
+
} | {
|
|
10
|
+
shouldStop: true;
|
|
11
|
+
};
|
|
12
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bob-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
4
4
|
"description": "BOB Core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/src/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"start": "node -r @swc-node/register debug/main.ts",
|
|
24
|
-
"build": "
|
|
24
|
+
"build": "rm -rf ./dist && vite build",
|
|
25
25
|
"typecheck": "tsc --noEmit",
|
|
26
26
|
"prepack": "npm run build",
|
|
27
27
|
"test": "vitest run",
|
|
@@ -31,26 +31,25 @@
|
|
|
31
31
|
"author": "Léo Hubert",
|
|
32
32
|
"license": "ISC",
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@eslint/js": "^9.
|
|
35
|
-
"@faker-js/faker": "^10.
|
|
34
|
+
"@eslint/js": "^9.39.4",
|
|
35
|
+
"@faker-js/faker": "^10.3.0",
|
|
36
36
|
"@swc-node/register": "^1.11.1",
|
|
37
37
|
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
|
38
38
|
"@types/minimist": "^1.2.5",
|
|
39
39
|
"@types/node": "^20.14.5",
|
|
40
40
|
"@types/prompts": "^2.4.9",
|
|
41
41
|
"@types/string-similarity": "^4.0.2",
|
|
42
|
-
"@vitest/coverage-v8": "^
|
|
43
|
-
"eslint": "^9.
|
|
42
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
43
|
+
"eslint": "^9.39.4",
|
|
44
44
|
"eslint-config-prettier": "^10.1.8",
|
|
45
|
-
"eslint-plugin-prettier": "^5.5.
|
|
45
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
46
46
|
"prettier": "^3.6.2",
|
|
47
|
-
"
|
|
48
|
-
"tsx": "^4.20.6",
|
|
47
|
+
"tsx": "^4.21.0",
|
|
49
48
|
"typescript": "^5.9.3",
|
|
50
|
-
"typescript-eslint": "^8.
|
|
51
|
-
"vite": "^
|
|
49
|
+
"typescript-eslint": "^8.57.0",
|
|
50
|
+
"vite": "^8.0.0",
|
|
52
51
|
"vite-plugin-dts": "^4.5.4",
|
|
53
|
-
"vitest": "^
|
|
52
|
+
"vitest": "^4.1.0"
|
|
54
53
|
},
|
|
55
54
|
"dependencies": {
|
|
56
55
|
"chalk": "^4.1.2",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="bob-core",t="2.1.0",s="BOB Core",i="module",n="./dist/cjs/src/index.js",r="./dist/esm/src/index.js",c="./dist/esm/src/index.d.ts",o=["dist"],d={".":{import:{types:"./dist/esm/src/index.d.ts",default:"./dist/esm/src/index.js"},require:{types:"./dist/cjs/src/index.d.ts",default:"./dist/cjs/src/index.js"}}},p={start:"node -r @swc-node/register debug/main.ts",build:"rimraf ./dist && vite build",typecheck:"tsc --noEmit",prepack:"npm run build",test:"vitest run",lint:"eslint .","lint:fix":"eslint . --fix"},l="Léo Hubert",m="ISC",a={"@eslint/js":"^9.37.0","@faker-js/faker":"^10.0.0","@swc-node/register":"^1.11.1","@trivago/prettier-plugin-sort-imports":"^5.2.2","@types/minimist":"^1.2.5","@types/node":"^20.14.5","@types/prompts":"^2.4.9","@types/string-similarity":"^4.0.2","@vitest/coverage-v8":"^3.2.4",eslint:"^9.37.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4",prettier:"^3.6.2",rimraf:"^6.0.1",tsx:"^4.20.6",typescript:"^5.9.3","typescript-eslint":"^8.46.0",vite:"^7.2.7","vite-plugin-dts":"^4.5.4",vitest:"^3.2.4"},u={chalk:"^4.1.2",minimist:"^1.2.8",prompts:"^2.4.2"},y={name:e,version:t,description:s,type:i,main:n,module:r,types:c,files:o,exports:d,scripts:p,author:l,license:m,devDependencies:a,dependencies:u};exports.author=l;exports.default=y;exports.dependencies=u;exports.description=s;exports.devDependencies=a;exports.exports=d;exports.files=o;exports.license=m;exports.main=n;exports.module=r;exports.name=e;exports.scripts=p;exports.type=i;exports.types=c;exports.version=t;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Logger } from '../Logger.js';
|
|
2
|
-
import { BobError } from './BobError.js';
|
|
3
|
-
export type OptionProps = {
|
|
4
|
-
option: string;
|
|
5
|
-
value?: string;
|
|
6
|
-
reason?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare class BadCommandOption extends BobError {
|
|
9
|
-
readonly param: OptionProps;
|
|
10
|
-
constructor(param: OptionProps);
|
|
11
|
-
pretty(logger: Logger): void;
|
|
12
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Logger } from '../Logger.js';
|
|
2
|
-
import { BobError } from './BobError.js';
|
|
3
|
-
export type ParameterProps = {
|
|
4
|
-
param: string;
|
|
5
|
-
value?: string;
|
|
6
|
-
reason?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare class BadCommandParameter extends BobError {
|
|
9
|
-
readonly param: ParameterProps;
|
|
10
|
-
constructor(param: ParameterProps);
|
|
11
|
-
pretty(logger: Logger): void;
|
|
12
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Logger } from '../Logger.js';
|
|
2
|
-
import { BobError } from './BobError.js';
|
|
3
|
-
import { OptionsSchema } from '../lib/types.js';
|
|
4
|
-
export declare class InvalidOption extends BobError {
|
|
5
|
-
private option;
|
|
6
|
-
private optionsSchema;
|
|
7
|
-
constructor(option: string, optionsSchema?: OptionsSchema);
|
|
8
|
-
pretty(logger: Logger): void;
|
|
9
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Option, OptionDefinition, OptionReturnType } from './types.js';
|
|
2
|
-
export declare function getOptionPrimitiveDefaultValue<Opts extends Option>(type: Opts): OptionReturnType<Opts>;
|
|
3
|
-
export declare function getOptionDefaultValue<Opts extends Option>(option: Opts): OptionReturnType<Opts> | null;
|
|
4
|
-
export type OptionDetails = Required<OptionDefinition>;
|
|
5
|
-
export declare function getOptionDetails(option: Option): OptionDetails;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { OptionPrimitive } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Converts a value to the specified type with validation
|
|
4
|
-
* @param value - The value to convert
|
|
5
|
-
* @param type - The target type
|
|
6
|
-
* @param name - The parameter name (for error messages)
|
|
7
|
-
* @param defaultValue - Optional default value if value is null/undefined
|
|
8
|
-
* @returns The converted value
|
|
9
|
-
*/
|
|
10
|
-
export declare function convertValue(value: any, type: OptionPrimitive, name: string, defaultValue?: any): any;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const t = "bob-core", s = "2.1.0", e = "BOB Core", i = "module", n = "./dist/cjs/src/index.js", r = "./dist/esm/src/index.js", c = "./dist/esm/src/index.d.ts", o = ["dist"], d = { ".": { import: { types: "./dist/esm/src/index.d.ts", default: "./dist/esm/src/index.js" }, require: { types: "./dist/cjs/src/index.d.ts", default: "./dist/cjs/src/index.js" } } }, p = { start: "node -r @swc-node/register debug/main.ts", build: "rimraf ./dist && vite build", typecheck: "tsc --noEmit", prepack: "npm run build", test: "vitest run", lint: "eslint .", "lint:fix": "eslint . --fix" }, l = "Léo Hubert", m = "ISC", a = { "@eslint/js": "^9.37.0", "@faker-js/faker": "^10.0.0", "@swc-node/register": "^1.11.1", "@trivago/prettier-plugin-sort-imports": "^5.2.2", "@types/minimist": "^1.2.5", "@types/node": "^20.14.5", "@types/prompts": "^2.4.9", "@types/string-similarity": "^4.0.2", "@vitest/coverage-v8": "^3.2.4", eslint: "^9.37.0", "eslint-config-prettier": "^10.1.8", "eslint-plugin-prettier": "^5.5.4", prettier: "^3.6.2", rimraf: "^6.0.1", tsx: "^4.20.6", typescript: "^5.9.3", "typescript-eslint": "^8.46.0", vite: "^7.2.7", "vite-plugin-dts": "^4.5.4", vitest: "^3.2.4" }, u = { chalk: "^4.1.2", minimist: "^1.2.8", prompts: "^2.4.2" }, x = {
|
|
2
|
-
name: t,
|
|
3
|
-
version: s,
|
|
4
|
-
description: e,
|
|
5
|
-
type: i,
|
|
6
|
-
main: n,
|
|
7
|
-
module: r,
|
|
8
|
-
types: c,
|
|
9
|
-
files: o,
|
|
10
|
-
exports: d,
|
|
11
|
-
scripts: p,
|
|
12
|
-
author: l,
|
|
13
|
-
license: m,
|
|
14
|
-
devDependencies: a,
|
|
15
|
-
dependencies: u
|
|
16
|
-
};
|
|
17
|
-
export {
|
|
18
|
-
l as author,
|
|
19
|
-
x as default,
|
|
20
|
-
u as dependencies,
|
|
21
|
-
e as description,
|
|
22
|
-
a as devDependencies,
|
|
23
|
-
d as exports,
|
|
24
|
-
o as files,
|
|
25
|
-
m as license,
|
|
26
|
-
n as main,
|
|
27
|
-
r as module,
|
|
28
|
-
t as name,
|
|
29
|
-
p as scripts,
|
|
30
|
-
i as type,
|
|
31
|
-
c as types,
|
|
32
|
-
s as version
|
|
33
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Logger } from '../Logger.js';
|
|
2
|
-
import { BobError } from './BobError.js';
|
|
3
|
-
export type OptionProps = {
|
|
4
|
-
option: string;
|
|
5
|
-
value?: string;
|
|
6
|
-
reason?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare class BadCommandOption extends BobError {
|
|
9
|
-
readonly param: OptionProps;
|
|
10
|
-
constructor(param: OptionProps);
|
|
11
|
-
pretty(logger: Logger): void;
|
|
12
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Logger } from '../Logger.js';
|
|
2
|
-
import { BobError } from './BobError.js';
|
|
3
|
-
export type ParameterProps = {
|
|
4
|
-
param: string;
|
|
5
|
-
value?: string;
|
|
6
|
-
reason?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare class BadCommandParameter extends BobError {
|
|
9
|
-
readonly param: ParameterProps;
|
|
10
|
-
constructor(param: ParameterProps);
|
|
11
|
-
pretty(logger: Logger): void;
|
|
12
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Logger } from '../Logger.js';
|
|
2
|
-
import { BobError } from './BobError.js';
|
|
3
|
-
import { OptionsSchema } from '../lib/types.js';
|
|
4
|
-
export declare class InvalidOption extends BobError {
|
|
5
|
-
private option;
|
|
6
|
-
private optionsSchema;
|
|
7
|
-
constructor(option: string, optionsSchema?: OptionsSchema);
|
|
8
|
-
pretty(logger: Logger): void;
|
|
9
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Option, OptionDefinition, OptionReturnType } from './types.js';
|
|
2
|
-
export declare function getOptionPrimitiveDefaultValue<Opts extends Option>(type: Opts): OptionReturnType<Opts>;
|
|
3
|
-
export declare function getOptionDefaultValue<Opts extends Option>(option: Opts): OptionReturnType<Opts> | null;
|
|
4
|
-
export type OptionDetails = Required<OptionDefinition>;
|
|
5
|
-
export declare function getOptionDetails(option: Option): OptionDetails;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { OptionPrimitive } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Converts a value to the specified type with validation
|
|
4
|
-
* @param value - The value to convert
|
|
5
|
-
* @param type - The target type
|
|
6
|
-
* @param name - The parameter name (for error messages)
|
|
7
|
-
* @param defaultValue - Optional default value if value is null/undefined
|
|
8
|
-
* @returns The converted value
|
|
9
|
-
*/
|
|
10
|
-
export declare function convertValue(value: any, type: OptionPrimitive, name: string, defaultValue?: any): any;
|