zod-args-parser 1.1.0 → 1.2.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/README.md +597 -91
- package/lib/commonjs/autocomplete-scripts/bash-autocomplete-script.js +1 -1
- package/lib/commonjs/autocomplete-scripts/bash-autocomplete-script.js.map +1 -1
- package/lib/commonjs/autocomplete-scripts/powershell-autocomplete-script.js +1 -1
- package/lib/commonjs/autocomplete-scripts/powershell-autocomplete-script.js.map +1 -1
- package/lib/commonjs/autocomplete-scripts/zsh-autocomplete-script.js +1 -1
- package/lib/commonjs/autocomplete-scripts/zsh-autocomplete-script.js.map +1 -1
- package/lib/commonjs/help-message/format-arguments.js +1 -0
- package/lib/commonjs/help-message/format-arguments.js.map +1 -0
- package/lib/commonjs/help-message/format-cli.js +1 -0
- package/lib/commonjs/help-message/format-cli.js.map +1 -0
- package/lib/commonjs/help-message/format-options.js +1 -0
- package/lib/commonjs/help-message/format-options.js.map +1 -0
- package/lib/commonjs/help-message/format-subcommands.js +1 -0
- package/lib/commonjs/help-message/format-subcommands.js.map +1 -0
- package/lib/commonjs/help-message/styles.js +1 -0
- package/lib/commonjs/help-message/styles.js.map +1 -0
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/markdown/generate-markdown.js.map +1 -1
- package/lib/commonjs/metadata/get-arguments-metadata.js +1 -1
- package/lib/commonjs/metadata/get-arguments-metadata.js.map +1 -1
- package/lib/commonjs/metadata/get-cli-metadata.js +1 -1
- package/lib/commonjs/metadata/get-cli-metadata.js.map +1 -1
- package/lib/commonjs/metadata/get-options-metadata.js +1 -1
- package/lib/commonjs/metadata/get-options-metadata.js.map +1 -1
- package/lib/commonjs/metadata/get-subcommands-metadata.js.map +1 -1
- package/lib/commonjs/parser/parse/parse.js +1 -0
- package/lib/commonjs/parser/parse/parse.js.map +1 -0
- package/lib/commonjs/parser/parse/parser-helpers.js +1 -0
- package/lib/commonjs/parser/parse/parser-helpers.js.map +1 -0
- package/lib/commonjs/parser/safe-parse.js +1 -1
- package/lib/commonjs/parser/safe-parse.js.map +1 -1
- package/lib/commonjs/parser/unsafe-parse.js +1 -0
- package/lib/commonjs/parser/unsafe-parse.js.map +1 -0
- package/lib/commonjs/parser/validate/validate-type.js +1 -0
- package/lib/commonjs/parser/validate/validate-type.js.map +1 -0
- package/lib/commonjs/parser/validate/validate.js +1 -0
- package/lib/commonjs/parser/validate/validate.js.map +1 -0
- package/lib/commonjs/utils.js +1 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/zod-utils.js +1 -0
- package/lib/commonjs/zod-utils.js.map +1 -0
- package/lib/module/autocomplete-scripts/bash-autocomplete-script.js +1 -1
- package/lib/module/autocomplete-scripts/bash-autocomplete-script.js.map +1 -1
- package/lib/module/autocomplete-scripts/powershell-autocomplete-script.js +1 -1
- package/lib/module/autocomplete-scripts/powershell-autocomplete-script.js.map +1 -1
- package/lib/module/autocomplete-scripts/zsh-autocomplete-script.js +1 -1
- package/lib/module/autocomplete-scripts/zsh-autocomplete-script.js.map +1 -1
- package/lib/module/help-message/format-arguments.js +1 -0
- package/lib/module/help-message/format-arguments.js.map +1 -0
- package/lib/module/help-message/format-cli.js +1 -0
- package/lib/module/help-message/format-cli.js.map +1 -0
- package/lib/module/help-message/format-options.js +1 -0
- package/lib/module/help-message/format-options.js.map +1 -0
- package/lib/module/help-message/{print-subcommands.js → format-subcommands.js} +1 -1
- package/lib/module/help-message/format-subcommands.js.map +1 -0
- package/lib/module/help-message/styles.js +1 -0
- package/lib/module/help-message/styles.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/markdown/generate-markdown.js.map +1 -1
- package/lib/module/metadata/get-arguments-metadata.js +1 -1
- package/lib/module/metadata/get-arguments-metadata.js.map +1 -1
- package/lib/module/metadata/get-cli-metadata.js +1 -1
- package/lib/module/metadata/get-cli-metadata.js.map +1 -1
- package/lib/module/metadata/get-options-metadata.js +1 -1
- package/lib/module/metadata/get-options-metadata.js.map +1 -1
- package/lib/module/metadata/get-subcommands-metadata.js.map +1 -1
- package/lib/module/parser/parse/parse.js +1 -0
- package/lib/module/parser/parse/parse.js.map +1 -0
- package/lib/module/parser/parse/parser-helpers.js +1 -0
- package/lib/module/parser/parse/parser-helpers.js.map +1 -0
- package/lib/module/parser/safe-parse.js +1 -1
- package/lib/module/parser/safe-parse.js.map +1 -1
- package/lib/module/parser/unsafe-parse.js +1 -0
- package/lib/module/parser/unsafe-parse.js.map +1 -0
- package/lib/module/parser/validate/validate-type.js +1 -0
- package/lib/module/parser/validate/validate-type.js.map +1 -0
- package/lib/module/parser/validate/validate.js +1 -0
- package/lib/module/parser/validate/validate.js.map +1 -0
- package/lib/module/utils.js +1 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/module/zod-utils.js +1 -0
- package/lib/module/zod-utils.js.map +1 -0
- package/lib/typescript/help-message/format-arguments.d.ts +4 -0
- package/lib/typescript/help-message/format-arguments.d.ts.map +1 -0
- package/lib/typescript/help-message/format-cli.d.ts +6 -0
- package/lib/typescript/help-message/format-cli.d.ts.map +1 -0
- package/lib/typescript/help-message/format-options.d.ts +4 -0
- package/lib/typescript/help-message/format-options.d.ts.map +1 -0
- package/lib/typescript/help-message/format-subcommands.d.ts +4 -0
- package/lib/typescript/help-message/format-subcommands.d.ts.map +1 -0
- package/lib/typescript/help-message/styles.d.ts +108 -0
- package/lib/typescript/help-message/styles.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +18 -29
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/markdown/generate-markdown.d.ts.map +1 -1
- package/lib/typescript/metadata/get-arguments-metadata.d.ts +2 -1
- package/lib/typescript/metadata/get-arguments-metadata.d.ts.map +1 -1
- package/lib/typescript/metadata/get-cli-metadata.d.ts +3 -2
- package/lib/typescript/metadata/get-cli-metadata.d.ts.map +1 -1
- package/lib/typescript/metadata/get-options-metadata.d.ts +2 -1
- package/lib/typescript/metadata/get-options-metadata.d.ts.map +1 -1
- package/lib/typescript/metadata/get-subcommands-metadata.d.ts +2 -1
- package/lib/typescript/metadata/get-subcommands-metadata.d.ts.map +1 -1
- package/lib/typescript/metadata/metadata-types.d.ts +80 -0
- package/lib/typescript/metadata/metadata-types.d.ts.map +1 -0
- package/lib/typescript/parser/parse/parse-types.d.ts +85 -0
- package/lib/typescript/parser/parse/parse-types.d.ts.map +1 -0
- package/lib/typescript/parser/parse/parse.d.ts +4 -0
- package/lib/typescript/parser/parse/parse.d.ts.map +1 -0
- package/lib/typescript/parser/parse/parser-helpers.d.ts +40 -0
- package/lib/typescript/parser/parse/parser-helpers.d.ts.map +1 -0
- package/lib/typescript/parser/safe-parse.d.ts +1 -0
- package/lib/typescript/parser/safe-parse.d.ts.map +1 -1
- package/lib/typescript/parser/unsafe-parse.d.ts +4 -0
- package/lib/typescript/parser/unsafe-parse.d.ts.map +1 -0
- package/lib/typescript/parser/validate/validate-type.d.ts +22 -0
- package/lib/typescript/parser/validate/validate-type.d.ts.map +1 -0
- package/lib/typescript/parser/validate/validate.d.ts +11 -0
- package/lib/typescript/parser/validate/validate.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +66 -181
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils.d.ts +20 -19
- package/lib/typescript/utils.d.ts.map +1 -1
- package/lib/typescript/zod-utils.d.ts +27 -0
- package/lib/typescript/zod-utils.d.ts.map +1 -0
- package/package.json +7 -6
- package/src/autocomplete-scripts/bash-autocomplete-script.ts +1 -1
- package/src/autocomplete-scripts/powershell-autocomplete-script.ts +1 -1
- package/src/autocomplete-scripts/zsh-autocomplete-script.ts +1 -1
- package/src/help-message/format-arguments.ts +38 -0
- package/src/help-message/{print-help-message.ts → format-cli.ts} +43 -48
- package/src/help-message/{print-options.ts → format-options.ts} +16 -14
- package/src/help-message/format-subcommands.ts +37 -0
- package/src/help-message/styles.ts +120 -0
- package/src/index.ts +50 -44
- package/src/markdown/generate-markdown.ts +2 -1
- package/src/metadata/get-arguments-metadata.ts +3 -2
- package/src/metadata/get-cli-metadata.ts +4 -4
- package/src/metadata/get-options-metadata.ts +4 -3
- package/src/metadata/get-subcommands-metadata.ts +2 -1
- package/src/metadata/metadata-types.ts +114 -0
- package/src/parser/parse/parse-types.ts +89 -0
- package/src/parser/parse/parse.ts +227 -0
- package/src/parser/parse/parser-helpers.ts +167 -0
- package/src/parser/safe-parse.ts +60 -8
- package/src/parser/unsafe-parse.ts +98 -0
- package/src/parser/validate/validate-type.ts +21 -0
- package/src/parser/validate/validate.ts +66 -0
- package/src/types.ts +90 -231
- package/src/utils.ts +33 -65
- package/src/{zodUtils.ts → zod-utils.ts} +65 -17
- package/lib/commonjs/help-message/colors.js +0 -1
- package/lib/commonjs/help-message/colors.js.map +0 -1
- package/lib/commonjs/help-message/print-arguments.js +0 -1
- package/lib/commonjs/help-message/print-arguments.js.map +0 -1
- package/lib/commonjs/help-message/print-help-message.js +0 -1
- package/lib/commonjs/help-message/print-help-message.js.map +0 -1
- package/lib/commonjs/help-message/print-options.js +0 -1
- package/lib/commonjs/help-message/print-options.js.map +0 -1
- package/lib/commonjs/help-message/print-subcommands.js +0 -1
- package/lib/commonjs/help-message/print-subcommands.js.map +0 -1
- package/lib/commonjs/help-message/utils.js +0 -1
- package/lib/commonjs/help-message/utils.js.map +0 -1
- package/lib/commonjs/parser/parse.js +0 -1
- package/lib/commonjs/parser/parse.js.map +0 -1
- package/lib/commonjs/zodUtils.js +0 -1
- package/lib/commonjs/zodUtils.js.map +0 -1
- package/lib/module/help-message/colors.js +0 -1
- package/lib/module/help-message/colors.js.map +0 -1
- package/lib/module/help-message/print-arguments.js +0 -1
- package/lib/module/help-message/print-arguments.js.map +0 -1
- package/lib/module/help-message/print-help-message.js +0 -1
- package/lib/module/help-message/print-help-message.js.map +0 -1
- package/lib/module/help-message/print-options.js +0 -1
- package/lib/module/help-message/print-options.js.map +0 -1
- package/lib/module/help-message/print-subcommands.js.map +0 -1
- package/lib/module/help-message/utils.js +0 -1
- package/lib/module/help-message/utils.js.map +0 -1
- package/lib/module/parser/parse.js +0 -1
- package/lib/module/parser/parse.js.map +0 -1
- package/lib/module/zodUtils.js +0 -1
- package/lib/module/zodUtils.js.map +0 -1
- package/lib/typescript/help-message/colors.d.ts +0 -17
- package/lib/typescript/help-message/colors.d.ts.map +0 -1
- package/lib/typescript/help-message/print-arguments.d.ts +0 -4
- package/lib/typescript/help-message/print-arguments.d.ts.map +0 -1
- package/lib/typescript/help-message/print-help-message.d.ts +0 -4
- package/lib/typescript/help-message/print-help-message.d.ts.map +0 -1
- package/lib/typescript/help-message/print-options.d.ts +0 -4
- package/lib/typescript/help-message/print-options.d.ts.map +0 -1
- package/lib/typescript/help-message/print-subcommands.d.ts +0 -4
- package/lib/typescript/help-message/print-subcommands.d.ts.map +0 -1
- package/lib/typescript/help-message/utils.d.ts +0 -13
- package/lib/typescript/help-message/utils.d.ts.map +0 -1
- package/lib/typescript/parser/parse.d.ts +0 -3
- package/lib/typescript/parser/parse.d.ts.map +0 -1
- package/lib/typescript/zodUtils.d.ts +0 -14
- package/lib/typescript/zodUtils.d.ts.map +0 -1
- package/src/help-message/colors.ts +0 -24
- package/src/help-message/print-arguments.ts +0 -35
- package/src/help-message/print-subcommands.ts +0 -28
- package/src/help-message/utils.ts +0 -31
- package/src/parser/parse.ts +0 -272
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type { Cli,
|
|
2
|
-
|
|
1
|
+
import type { Cli, Subcommand } from "../types.js";
|
|
2
|
+
import type { CliMetadata } from "./metadata-types.js";
|
|
3
|
+
export declare function getCliMetadata(inputData: readonly [Cli, ...Subcommand[]]): CliMetadata;
|
|
3
4
|
//# sourceMappingURL=get-cli-metadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-cli-metadata.d.ts","sourceRoot":"","sources":["../../../src/metadata/get-cli-metadata.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"get-cli-metadata.d.ts","sourceRoot":"","sources":["../../../src/metadata/get-cli-metadata.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAgB,cAAc,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,UAAU,EAAE,CAAC,GAAG,WAAW,CAetF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type { Option
|
|
1
|
+
import type { Option } from "../types.js";
|
|
2
|
+
import type { OptionMetadata } from "./metadata-types.js";
|
|
2
3
|
export declare function getOptionsMetadata(options: Option[]): OptionMetadata[];
|
|
3
4
|
//# sourceMappingURL=get-options-metadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-options-metadata.d.ts","sourceRoot":"","sources":["../../../src/metadata/get-options-metadata.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"get-options-metadata.d.ts","sourceRoot":"","sources":["../../../src/metadata/get-options-metadata.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,CAyBtE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type { Subcommand
|
|
1
|
+
import type { Subcommand } from "../types.js";
|
|
2
|
+
import type { SubcommandMetadata } from "./metadata-types.js";
|
|
2
3
|
export declare function getSubcommandsMetadata(subcommands: Subcommand[]): SubcommandMetadata[];
|
|
3
4
|
//# sourceMappingURL=get-subcommands-metadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-subcommands-metadata.d.ts","sourceRoot":"","sources":["../../../src/metadata/get-subcommands-metadata.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"get-subcommands-metadata.d.ts","sourceRoot":"","sources":["../../../src/metadata/get-subcommands-metadata.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,kBAAkB,EAAE,CAuBtF"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { Schema } from "../types.js";
|
|
2
|
+
export interface CliMetadata {
|
|
3
|
+
/** The name of the cli program. */
|
|
4
|
+
readonly name: string;
|
|
5
|
+
/** - The description of the cli program. Empty string if not provided */
|
|
6
|
+
readonly description: string;
|
|
7
|
+
/** - The usage of the cli program. Empty string if not provided */
|
|
8
|
+
readonly usage: string;
|
|
9
|
+
/** - The example of the cli program. Empty string if not provided */
|
|
10
|
+
readonly example: string;
|
|
11
|
+
/** - Whether the cli program allows positional arguments. */
|
|
12
|
+
readonly allowPositional: boolean;
|
|
13
|
+
/** - The options of the cli program. Empty array if not provided */
|
|
14
|
+
readonly options: OptionMetadata[];
|
|
15
|
+
/** - The arguments of the cli program. Empty array if not provided */
|
|
16
|
+
readonly arguments: ArgumentMetadata[];
|
|
17
|
+
/** - The subcommands of the cli program. Empty array if not provided */
|
|
18
|
+
readonly subcommands: SubcommandMetadata[];
|
|
19
|
+
}
|
|
20
|
+
export interface SubcommandMetadata {
|
|
21
|
+
/** The subcommand name. */
|
|
22
|
+
readonly name: string;
|
|
23
|
+
/** - The aliases of the subcommand. Empty array if not provided */
|
|
24
|
+
readonly aliases: string[];
|
|
25
|
+
/** - The description of the subcommand. Empty string if not provided */
|
|
26
|
+
readonly description: string;
|
|
27
|
+
/** - The placeholder of the subcommand. Empty string if not provided */
|
|
28
|
+
readonly placeholder: string;
|
|
29
|
+
/** - The usage of the subcommand. Empty string if not provided */
|
|
30
|
+
readonly usage: string;
|
|
31
|
+
/** - The example of the subcommand. Empty string if not provided */
|
|
32
|
+
readonly example: string;
|
|
33
|
+
/** - Whether the subcommand allows positional arguments. */
|
|
34
|
+
readonly allowPositional: boolean;
|
|
35
|
+
/** - The options of the subcommand. Empty array if not provided */
|
|
36
|
+
readonly options: OptionMetadata[];
|
|
37
|
+
/** - The arguments of the subcommand. Empty array if not provided */
|
|
38
|
+
readonly arguments: ArgumentMetadata[];
|
|
39
|
+
}
|
|
40
|
+
export interface OptionMetadata {
|
|
41
|
+
/** The option name in camelCase. E.g. `optionName` */
|
|
42
|
+
readonly name: string;
|
|
43
|
+
/** The option name in kebab-case. E.g. `--option-name` */
|
|
44
|
+
readonly nameAsArg: string;
|
|
45
|
+
/** - The aliases of the option in camelCase. Empty array if not provided. E.g. `[aliasName, ...]` */
|
|
46
|
+
readonly aliases: string[];
|
|
47
|
+
/** - The aliases of the option in kebab-case. Empty array if not provided. E.g. `[--alias-name, ...]` */
|
|
48
|
+
readonly aliasesAsArgs: string[];
|
|
49
|
+
/** - The description of the option. Empty string if not provided */
|
|
50
|
+
readonly description: string;
|
|
51
|
+
/** - The placeholder of the option. Empty string if not provided */
|
|
52
|
+
readonly placeholder: string;
|
|
53
|
+
/** - The example of the option. Empty string if not provided */
|
|
54
|
+
readonly example: string;
|
|
55
|
+
/** - The default value of the option. */
|
|
56
|
+
readonly defaultValue: unknown;
|
|
57
|
+
/** - The default value of the option as string. */
|
|
58
|
+
readonly defaultValueAsString: string;
|
|
59
|
+
/** - Whether the option is optional. */
|
|
60
|
+
readonly optional: boolean;
|
|
61
|
+
/** - The zod type of the option. */
|
|
62
|
+
readonly type: Schema;
|
|
63
|
+
}
|
|
64
|
+
export interface ArgumentMetadata {
|
|
65
|
+
/** The argument name. */
|
|
66
|
+
readonly name: string;
|
|
67
|
+
/** - The description of the argument. Empty string if not provided */
|
|
68
|
+
readonly description: string;
|
|
69
|
+
/** - The example of the argument. Empty string if not provided */
|
|
70
|
+
readonly example: string;
|
|
71
|
+
/** - The default value of the argument. */
|
|
72
|
+
readonly defaultValue: unknown;
|
|
73
|
+
/** - The default value of the argument as string. */
|
|
74
|
+
readonly defaultValueAsString: string;
|
|
75
|
+
/** - Whether the argument is optional. */
|
|
76
|
+
readonly optional: boolean;
|
|
77
|
+
/** - The zod type of the argument. */
|
|
78
|
+
readonly type: Schema;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=metadata-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata-types.d.ts","sourceRoot":"","sources":["../../../src/metadata/metadata-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,WAAW;IAC1B,mCAAmC;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,yEAAyE;IACzE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,mEAAmE;IACnE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,qEAAqE;IACrE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,6DAA6D;IAC7D,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAElC,oEAAoE;IACpE,QAAQ,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC;IAEnC,sEAAsE;IACtE,QAAQ,CAAC,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAEvC,wEAAwE;IACxE,QAAQ,CAAC,WAAW,EAAE,kBAAkB,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,kBAAkB;IACjC,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAE3B,wEAAwE;IACxE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,wEAAwE;IACxE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,oEAAoE;IACpE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,4DAA4D;IAC5D,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAElC,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC;IAEnC,qEAAqE;IACrE,QAAQ,CAAC,SAAS,EAAE,gBAAgB,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,cAAc;IAC7B,sDAAsD;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,qGAAqG;IACrG,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAE3B,yGAAyG;IACzG,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC;IAEjC,oEAAoE;IACpE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,oEAAoE;IACpE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,gEAAgE;IAChE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,yCAAyC;IACzC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAE/B,mDAAmD;IACnD,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IAEtC,wCAAwC;IACxC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B,oCAAoC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC/B,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,2CAA2C;IAC3C,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAE/B,qDAAqD;IACrD,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IAEtC,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B,sCAAsC;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { Argument, Option, Prettify, Schema, Subcommand } from "../../types.js";
|
|
2
|
+
type ParsedOption<S extends Schema = Schema, N extends string = string> = {
|
|
3
|
+
/** The name of the option as provided by the user. */
|
|
4
|
+
name: N;
|
|
5
|
+
/** The CLI flag as provided by the user (e.g. `--foo` or `-f`). */
|
|
6
|
+
flag: string;
|
|
7
|
+
/** The schema that validates this option. */
|
|
8
|
+
schema: S;
|
|
9
|
+
/** The raw string value supplied for this option from the CLI. */
|
|
10
|
+
rawValue: string;
|
|
11
|
+
/**
|
|
12
|
+
* The source of the option:
|
|
13
|
+
*
|
|
14
|
+
* - `cli`: provided explicitly in the CLI
|
|
15
|
+
* - `default`: not provided, and the schema has a default.
|
|
16
|
+
*/
|
|
17
|
+
source: "cli";
|
|
18
|
+
} | {
|
|
19
|
+
/** The name of the option as provided by the user. */
|
|
20
|
+
name: N;
|
|
21
|
+
/** Undefined when the source is `default`. */
|
|
22
|
+
flag?: never;
|
|
23
|
+
/** The schema that validates this option. */
|
|
24
|
+
schema: S;
|
|
25
|
+
/** Undefined when the source is `default`. */
|
|
26
|
+
rawValue?: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The source of the option:
|
|
29
|
+
*
|
|
30
|
+
* - `cli`: provided explicitly in the CLI
|
|
31
|
+
* - `default`: not provided, and the schema has a default.
|
|
32
|
+
*/
|
|
33
|
+
source: "default";
|
|
34
|
+
};
|
|
35
|
+
type ParsedArgument<S extends Schema = Schema> = {
|
|
36
|
+
/** The raw string value provided directly from the CLI. */
|
|
37
|
+
rawValue: string;
|
|
38
|
+
/** The schema that validates this argument. */
|
|
39
|
+
schema: S;
|
|
40
|
+
/**
|
|
41
|
+
* The source of the option:
|
|
42
|
+
*
|
|
43
|
+
* - `cli`: provided explicitly in the CLI
|
|
44
|
+
* - `default`: not provided, and the schema has a default.
|
|
45
|
+
*/
|
|
46
|
+
source: "cli";
|
|
47
|
+
} | {
|
|
48
|
+
/** Undefined when the source is `default`. */
|
|
49
|
+
rawValue?: never;
|
|
50
|
+
/** The schema that validates this argument. */
|
|
51
|
+
schema: S;
|
|
52
|
+
/**
|
|
53
|
+
* The source of the option:
|
|
54
|
+
*
|
|
55
|
+
* - `cli`: provided explicitly in the CLI
|
|
56
|
+
* - `default`: not provided, and the schema has a default.
|
|
57
|
+
*/
|
|
58
|
+
source: "default";
|
|
59
|
+
};
|
|
60
|
+
type OptionsArr2Record<T extends Option[] | undefined> = T extends Option[] ? {
|
|
61
|
+
[K in T[number]["name"]]: ParsedOption<Extract<T[number], {
|
|
62
|
+
name: K;
|
|
63
|
+
}>["type"], K>;
|
|
64
|
+
} : Record<never, never>;
|
|
65
|
+
type ArgumentsArr2ArrType<T extends Argument[] | undefined> = T extends Argument[] ? {
|
|
66
|
+
[K in keyof T]: ParsedArgument<T[K] extends {
|
|
67
|
+
type: Schema;
|
|
68
|
+
} ? T[K]["type"] : never>;
|
|
69
|
+
} : never;
|
|
70
|
+
export type ParseResult<S extends Partial<Subcommand>[]> = {
|
|
71
|
+
[K in keyof S]: Prettify<{
|
|
72
|
+
subcommand: S[K]["name"] extends string ? S[K]["name"] : undefined;
|
|
73
|
+
positional: S[K]["allowPositional"] extends true ? string[] : never;
|
|
74
|
+
options: OptionsArr2Record<S[K]["options"]>;
|
|
75
|
+
arguments: ArgumentsArr2ArrType<S[K]["arguments"]>;
|
|
76
|
+
}>;
|
|
77
|
+
}[number];
|
|
78
|
+
export type ParseCtx = {
|
|
79
|
+
subcommand: string | undefined;
|
|
80
|
+
options: Record<string, ParsedOption>;
|
|
81
|
+
arguments?: ParsedArgument[];
|
|
82
|
+
positional?: string[];
|
|
83
|
+
};
|
|
84
|
+
export {};
|
|
85
|
+
//# sourceMappingURL=parse-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-types.d.ts","sourceRoot":"","sources":["../../../../src/parser/parse/parse-types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/parser/parse/parse.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,UAAU,EAAE,CAAC,YAoNtE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Option, Subcommand } from "../../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves a subcommand object from an array of subcommands by matching the provided subcommand name against the
|
|
4
|
+
* subcommand's name or its aliases.
|
|
5
|
+
*
|
|
6
|
+
* @param subCmdName - The name or alias of the subcommand to search for.
|
|
7
|
+
* @param subcommandArr - An array of `Subcommand` objects to search within.
|
|
8
|
+
* @returns The matching `Subcommand` object if found; otherwise, `undefined`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function findSubcommand(subCmdName: string | undefined, subcommandArr: Subcommand[]): Subcommand | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Finds and returns an `Option` object from the provided list that matches the given argument string.
|
|
13
|
+
*
|
|
14
|
+
* The function supports matching by option name, aliases, and their negated forms (e.g., `--no-` prefix).
|
|
15
|
+
*
|
|
16
|
+
* @param optionArg - The argument string to match (e.g., `--foo`, `--no-bar`, `-f`).
|
|
17
|
+
* @param options - An array of `Option` objects to search through.
|
|
18
|
+
* @returns The matching `Option` object if found; otherwise, `undefined`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function findOption(optionArg: string, options: [Option, ...Option[]]): Option | undefined;
|
|
21
|
+
/** - Decouple flags E.g. `-rf` -> `-r, -f` */
|
|
22
|
+
export declare function decoupleFlags(args: string[]): string[];
|
|
23
|
+
/**
|
|
24
|
+
* - Transforms an option argument name to a valid JavaScript variable name
|
|
25
|
+
*
|
|
26
|
+
* @param name - Should start with `'--'` or `'-'`
|
|
27
|
+
*/
|
|
28
|
+
export declare function optionArgToVarNames(name: string): Set<string>;
|
|
29
|
+
/** - Check if an arg string is a short arg. E.g. `-i` -> `true` */
|
|
30
|
+
export declare function isFlagArg(name: string): boolean;
|
|
31
|
+
/** - Check if an arg string is an options arg. E.g. `--input-dir` -> `true` , `-i` -> `true` */
|
|
32
|
+
export declare function isOptionArg(name: string | boolean): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* - Transform option name to no name. E.g. `include` -> `noInclude`
|
|
35
|
+
* - For short name like `-i` it will be ignored
|
|
36
|
+
*/
|
|
37
|
+
export declare function negateOption(name: string): string;
|
|
38
|
+
/** - Reverse of `transformArg`. E.g. `InputDir` -> `--input-dir` , `i` -> `-i` */
|
|
39
|
+
export declare function transformOptionToArg(name: string): string;
|
|
40
|
+
//# sourceMappingURL=parser-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser-helpers.d.ts","sourceRoot":"","sources":["../../../../src/parser/parse/parser-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEzD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,UAAU,GAAG,SAAS,CAUlH;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,GAAG,MAAM,GAAG,SAAS,CA6BhG;AAED,8CAA8C;AAC9C,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAsBtD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAyB7D;AAED,mEAAmE;AACnE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/C;AAOD,gGAAgG;AAChG,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAM3D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMjD;AAED,kFAAkF;AAClF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAezD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { Cli, NoSubcommand, SafeParseResult, Subcommand } from "../types.js";
|
|
2
2
|
export declare function safeParse<T extends Subcommand[], U extends Cli>(argsv: string[], ...params: [U, ...T]): SafeParseResult<[...T, NoSubcommand & U]>;
|
|
3
|
+
export declare function safeParseAsync<T extends Subcommand[], U extends Cli>(argsv: string[], ...params: [U, ...T]): Promise<SafeParseResult<[...T, NoSubcommand & U]>>;
|
|
3
4
|
//# sourceMappingURL=safe-parse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-parse.d.ts","sourceRoot":"","sources":["../../../src/parser/safe-parse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"safe-parse.d.ts","sourceRoot":"","sources":["../../../src/parser/safe-parse.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAgB,eAAe,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEhG,wBAAgB,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,EAAE,CAAC,SAAS,GAAG,EAC7D,KAAK,EAAE,MAAM,EAAE,EACf,GAAG,MAAM,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GACnB,eAAe,CAAC,CAAC,GAAG,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC,CAyC3C;AAED,wBAAsB,cAAc,CAAC,CAAC,SAAS,UAAU,EAAE,EAAE,CAAC,SAAS,GAAG,EACxE,KAAK,EAAE,MAAM,EAAE,EACf,GAAG,MAAM,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GACnB,OAAO,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,CAyCpD"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Cli, NoSubcommand, Subcommand, UnsafeParseResult } from "../types.js";
|
|
2
|
+
export declare function unsafeParse<T extends Subcommand[], U extends Cli>(argv: string[], ...params: [U, ...T]): UnsafeParseResult<[...T, NoSubcommand & U]>;
|
|
3
|
+
export declare function unsafeParseAsync<T extends Subcommand[], U extends Cli>(argv: string[], ...params: [U, ...T]): Promise<UnsafeParseResult<[...T, NoSubcommand & U]>>;
|
|
4
|
+
//# sourceMappingURL=unsafe-parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unsafe-parse.d.ts","sourceRoot":"","sources":["../../../src/parser/unsafe-parse.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAgB,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAElG,wBAAgB,WAAW,CAAC,CAAC,SAAS,UAAU,EAAE,EAAE,CAAC,SAAS,GAAG,EAC/D,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,MAAM,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GACnB,iBAAiB,CAAC,CAAC,GAAG,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC,CAyC7C;AAED,wBAAsB,gBAAgB,CAAC,CAAC,SAAS,UAAU,EAAE,EAAE,CAAC,SAAS,GAAG,EAC1E,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,MAAM,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GACnB,OAAO,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,CAyCtD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Argument, Option, Prettify, Schema, Subcommand, ToOptional, ZodInfer } from "../../types.js";
|
|
2
|
+
import type { ParseResult } from "../parse/parse-types.js";
|
|
3
|
+
type OptionsArr2RecordType<T extends Option[] | undefined> = T extends Option[] ? ToOptional<{
|
|
4
|
+
[K in T[number]["name"]]: ZodInfer<Extract<T[number], {
|
|
5
|
+
name: K;
|
|
6
|
+
}>["type"]>;
|
|
7
|
+
}> : object;
|
|
8
|
+
type ArgumentsArr2ArrType<T extends Argument[] | undefined> = T extends Argument[] ? {
|
|
9
|
+
[K in keyof T]: T[K] extends {
|
|
10
|
+
type: Schema;
|
|
11
|
+
} ? ZodInfer<T[K]["type"]> : never;
|
|
12
|
+
} : never;
|
|
13
|
+
export type ValidateResult<S extends Partial<Subcommand>[]> = {
|
|
14
|
+
[K in keyof S]: Prettify<{
|
|
15
|
+
subcommand: S[K]["name"] extends string ? S[K]["name"] : undefined;
|
|
16
|
+
arguments: ArgumentsArr2ArrType<S[K]["arguments"]>;
|
|
17
|
+
positional: S[K]["allowPositional"] extends true ? string[] : never;
|
|
18
|
+
ctx: ParseResult<S>;
|
|
19
|
+
} & OptionsArr2RecordType<S[K]["options"]>>;
|
|
20
|
+
}[number];
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=validate-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-type.d.ts","sourceRoot":"","sources":["../../../../src/parser/validate/validate-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC3G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,KAAK,qBAAqB,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,SAAS,IAAI,CAAC,SAAS,MAAM,EAAE,GAC3E,UAAU,CAAC;KAAG,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC,CAAC,MAAM,CAAC,CAAC;CAAE,CAAC,GAC3F,MAAM,CAAC;AAEX,KAAK,oBAAoB,CAAC,CAAC,SAAS,QAAQ,EAAE,GAAG,SAAS,IAAI,CAAC,SAAS,QAAQ,EAAE,GAC9E;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK;CAAE,GAClF,KAAK,CAAC;AAEV,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,OAAO,CAAC,UAAU,CAAC,EAAE,IAAI;KAC3D,CAAC,IAAI,MAAM,CAAC,GAAG,QAAQ,CACtB;QACE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;QACnE,SAAS,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;QACnD,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,SAAS,IAAI,GAAG,MAAM,EAAE,GAAG,KAAK,CAAC;QACpE,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;KACrB,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAC3C;CACF,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ParseCtx } from "../parse/parse-types.js";
|
|
2
|
+
/** The return result object temporarily type. used inside the `parse` function */
|
|
3
|
+
type ResultsTempType = Record<string, unknown> & {
|
|
4
|
+
subcommand: string | undefined;
|
|
5
|
+
positional?: string[];
|
|
6
|
+
arguments?: unknown[];
|
|
7
|
+
ctx: ParseCtx;
|
|
8
|
+
};
|
|
9
|
+
export declare function validate(parsedData: ParseCtx): ResultsTempType;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/parser/validate/validate.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,kFAAkF;AAClF,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAC/C,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC;IACtB,GAAG,EAAE,QAAQ,CAAC;CACf,CAAC;AAEF,wBAAgB,QAAQ,CAAC,UAAU,EAAE,QAAQ,mBAkD5C"}
|