@gunshi/combinators 0.37.0 → 0.37.2
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/lib/index.d.ts +17 -9
- package/lib/index.js +9 -7
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.28.
|
|
2
|
-
|
|
1
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.28.2/node_modules/args-tokens/lib/resolver.d.ts
|
|
3
2
|
//#region src/resolver.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* An argument schema definition for command-line argument parsing.
|
|
@@ -473,7 +472,7 @@ interface Args {
|
|
|
473
472
|
* @typeParam T - {@link Args | Arguments} which is an object that defines the command line arguments.
|
|
474
473
|
*/
|
|
475
474
|
//#endregion
|
|
476
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.28.
|
|
475
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.28.2/node_modules/args-tokens/lib/combinators.d.ts
|
|
477
476
|
//#region src/combinators.d.ts
|
|
478
477
|
/**
|
|
479
478
|
* A combinator produced by combinator factory functions.
|
|
@@ -863,6 +862,13 @@ type CombinatorWithDefault<T> = {
|
|
|
863
862
|
* @experimental
|
|
864
863
|
*/
|
|
865
864
|
declare function withDefault<T extends string | boolean | number>(schema: CombinatorSchema<T>, defaultValue: T): CombinatorSchema<T> & CombinatorWithDefault<T>;
|
|
865
|
+
/**
|
|
866
|
+
* Overlay a flag onto a combinator schema without dropping other modifiers.
|
|
867
|
+
*
|
|
868
|
+
* Omits the flag keys from `S` first so optional `ArgSchema` fields
|
|
869
|
+
* (`multiple?: true`, `required?: boolean`) cannot stay as unions.
|
|
870
|
+
*/
|
|
871
|
+
type WithFlag<S, F> = Omit<S, keyof F> & F;
|
|
866
872
|
/**
|
|
867
873
|
* Options for the {@link multiple} combinator.
|
|
868
874
|
*/
|
|
@@ -873,10 +879,11 @@ type CombinatorMultiple = {
|
|
|
873
879
|
* Mark a combinator schema as accepting multiple values.
|
|
874
880
|
*
|
|
875
881
|
* The resolved value becomes an array. The original schema is not modified.
|
|
882
|
+
* Other modifiers on `schema` (for example {@link required}) are kept.
|
|
876
883
|
*
|
|
877
|
-
* @typeParam
|
|
884
|
+
* @typeParam S - The input combinator schema.
|
|
878
885
|
* @param schema - The base combinator schema.
|
|
879
|
-
* @returns A
|
|
886
|
+
* @returns A copy of `schema` with `multiple: true`.
|
|
880
887
|
*
|
|
881
888
|
* @example
|
|
882
889
|
* ```ts
|
|
@@ -888,7 +895,7 @@ type CombinatorMultiple = {
|
|
|
888
895
|
*
|
|
889
896
|
* @experimental
|
|
890
897
|
*/
|
|
891
|
-
declare function multiple<
|
|
898
|
+
declare function multiple<S extends CombinatorSchema<unknown>>(schema: S): WithFlag<S, CombinatorMultiple>;
|
|
892
899
|
/**
|
|
893
900
|
* Options for the {@link required} combinator.
|
|
894
901
|
*/
|
|
@@ -899,11 +906,12 @@ type CombinatorRequired = {
|
|
|
899
906
|
* Mark a combinator schema as required.
|
|
900
907
|
*
|
|
901
908
|
* The original schema is not modified.
|
|
909
|
+
* Other modifiers on `schema` (for example {@link multiple}) are kept.
|
|
902
910
|
*
|
|
903
|
-
* @typeParam
|
|
911
|
+
* @typeParam S - The input combinator schema.
|
|
904
912
|
*
|
|
905
913
|
* @param schema - The base combinator schema.
|
|
906
|
-
* @returns A
|
|
914
|
+
* @returns A copy of `schema` with `required: true`.
|
|
907
915
|
*
|
|
908
916
|
* @example
|
|
909
917
|
* ```ts
|
|
@@ -914,7 +922,7 @@ type CombinatorRequired = {
|
|
|
914
922
|
*
|
|
915
923
|
* @experimental
|
|
916
924
|
*/
|
|
917
|
-
declare function required<
|
|
925
|
+
declare function required<S extends CombinatorSchema<unknown>>(schema: S): WithFlag<S, CombinatorRequired>;
|
|
918
926
|
/**
|
|
919
927
|
* Options for the {@link short} combinator.
|
|
920
928
|
*/
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.28.
|
|
1
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.28.2/node_modules/args-tokens/lib/utils.js
|
|
2
2
|
/**
|
|
3
3
|
* @author kazuya kawaguchi (a.k.a. kazupon)
|
|
4
4
|
* @license MIT
|
|
@@ -23,7 +23,7 @@ function formatChoices(choices) {
|
|
|
23
23
|
"-".codePointAt(0);
|
|
24
24
|
"=".codePointAt(0);
|
|
25
25
|
//#endregion
|
|
26
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.28.
|
|
26
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.28.2/node_modules/args-tokens/lib/resolver.js
|
|
27
27
|
/**
|
|
28
28
|
* Entry point of argument options resolver.
|
|
29
29
|
*
|
|
@@ -79,7 +79,7 @@ var ArgsValidationError = class extends Error {
|
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
81
|
//#endregion
|
|
82
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.28.
|
|
82
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.28.2/node_modules/args-tokens/lib/combinators.js
|
|
83
83
|
/**
|
|
84
84
|
* Parser combinator factory functions for composable argument schema construction.
|
|
85
85
|
*
|
|
@@ -491,10 +491,11 @@ function withDefault(schema, defaultValue) {
|
|
|
491
491
|
* Mark a combinator schema as accepting multiple values.
|
|
492
492
|
*
|
|
493
493
|
* The resolved value becomes an array. The original schema is not modified.
|
|
494
|
+
* Other modifiers on `schema` (for example {@link required}) are kept.
|
|
494
495
|
*
|
|
495
|
-
* @typeParam
|
|
496
|
+
* @typeParam S - The input combinator schema.
|
|
496
497
|
* @param schema - The base combinator schema.
|
|
497
|
-
* @returns A
|
|
498
|
+
* @returns A copy of `schema` with `multiple: true`.
|
|
498
499
|
*
|
|
499
500
|
* @example
|
|
500
501
|
* ```ts
|
|
@@ -517,11 +518,12 @@ function multiple(schema) {
|
|
|
517
518
|
* Mark a combinator schema as required.
|
|
518
519
|
*
|
|
519
520
|
* The original schema is not modified.
|
|
521
|
+
* Other modifiers on `schema` (for example {@link multiple}) are kept.
|
|
520
522
|
*
|
|
521
|
-
* @typeParam
|
|
523
|
+
* @typeParam S - The input combinator schema.
|
|
522
524
|
*
|
|
523
525
|
* @param schema - The base combinator schema.
|
|
524
|
-
* @returns A
|
|
526
|
+
* @returns A copy of `schema` with `required: true`.
|
|
525
527
|
*
|
|
526
528
|
* @example
|
|
527
529
|
* ```ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gunshi/combinators",
|
|
3
3
|
"description": "parser combinators for gunshi argument schema",
|
|
4
|
-
"version": "0.37.
|
|
4
|
+
"version": "0.37.2",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "kazuya kawaguchi",
|
|
7
7
|
"email": "kawakazu80@gmail.com"
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"jsr-exports-lint": "^0.4.2",
|
|
58
58
|
"publint": "^0.3.20",
|
|
59
59
|
"tsdown": "0.21.0",
|
|
60
|
-
"gunshi": "0.37.
|
|
60
|
+
"gunshi": "0.37.2"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "tsdown",
|