@shell-shock/core 0.11.0 → 0.12.1
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/components/docs.d.mts +5 -5
- package/dist/components/helpers.cjs +9 -0
- package/dist/components/helpers.cjs.map +1 -1
- package/dist/components/helpers.d.cts +15 -7
- package/dist/components/helpers.d.cts.map +1 -1
- package/dist/components/helpers.d.mts +15 -7
- package/dist/components/helpers.d.mts.map +1 -1
- package/dist/components/helpers.mjs +9 -1
- package/dist/components/helpers.mjs.map +1 -1
- package/dist/components/index.cjs +1 -0
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.mjs +2 -2
- package/dist/components/options-parser-logic.cjs +142 -62
- package/dist/components/options-parser-logic.cjs.map +1 -1
- package/dist/components/options-parser-logic.d.cts +17 -17
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts +17 -17
- package/dist/components/options-parser-logic.d.mts.map +1 -1
- package/dist/components/options-parser-logic.mjs +143 -63
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/usage.d.cts +2 -2
- package/dist/components/usage.d.mts +2 -2
- package/dist/components/usage.d.mts.map +1 -1
- package/dist/components/utils-builtin.cjs +5 -9
- package/dist/components/utils-builtin.cjs.map +1 -1
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts.map +1 -1
- package/dist/components/utils-builtin.mjs +5 -9
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/helpers/automd.cjs +1 -1
- package/dist/helpers/automd.cjs.map +1 -1
- package/dist/helpers/automd.mjs +1 -1
- package/dist/helpers/automd.mjs.map +1 -1
- package/dist/plugin-utils/description-helpers.cjs +105 -0
- package/dist/plugin-utils/description-helpers.cjs.map +1 -0
- package/dist/plugin-utils/description-helpers.d.cts +44 -0
- package/dist/plugin-utils/description-helpers.d.cts.map +1 -0
- package/dist/plugin-utils/description-helpers.d.mts +44 -0
- package/dist/plugin-utils/description-helpers.d.mts.map +1 -0
- package/dist/plugin-utils/description-helpers.mjs +101 -0
- package/dist/plugin-utils/description-helpers.mjs.map +1 -0
- package/dist/plugin-utils/get-command-tree.cjs +26 -0
- package/dist/plugin-utils/get-command-tree.cjs.map +1 -1
- package/dist/plugin-utils/get-command-tree.d.cts +8 -1
- package/dist/plugin-utils/get-command-tree.d.cts.map +1 -1
- package/dist/plugin-utils/get-command-tree.d.mts +8 -1
- package/dist/plugin-utils/get-command-tree.d.mts.map +1 -1
- package/dist/plugin-utils/get-command-tree.mjs +26 -1
- package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +7 -1
- package/dist/plugin-utils/index.d.cts +3 -2
- package/dist/plugin-utils/index.d.mts +3 -2
- package/dist/plugin-utils/index.mjs +3 -2
- package/dist/plugin-utils/type-checks.d.cts.map +1 -1
- package/dist/plugin.cjs +5 -7
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +5 -7
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/deepkit.cjs +6 -3
- package/dist/resolver/deepkit.cjs.map +1 -1
- package/dist/resolver/deepkit.mjs +6 -3
- package/dist/resolver/deepkit.mjs.map +1 -1
- package/dist/resolver/helpers.cjs +16 -22
- package/dist/resolver/helpers.cjs.map +1 -1
- package/dist/resolver/helpers.mjs +16 -22
- package/dist/resolver/helpers.mjs.map +1 -1
- package/dist/resolver/module.cjs +2 -2
- package/dist/resolver/module.cjs.map +1 -1
- package/dist/resolver/module.mjs +2 -2
- package/dist/resolver/module.mjs.map +1 -1
- package/dist/resolver/resolve.cjs +13 -13
- package/dist/resolver/resolve.cjs.map +1 -1
- package/dist/resolver/resolve.mjs +13 -13
- package/dist/resolver/resolve.mjs.map +1 -1
- package/dist/types/config.cjs +5 -3
- package/dist/types/config.cjs.map +1 -1
- package/dist/types/config.d.cts +7 -3
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +7 -3
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/config.mjs +5 -3
- package/dist/types/config.mjs.map +1 -1
- package/package.json +11 -11
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandOption, CommandTree } from "../types/command.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _alloy_js_core17 from "@alloy-js/core";
|
|
3
3
|
|
|
4
4
|
//#region src/components/options-parser-logic.d.ts
|
|
5
5
|
interface DynamicSegmentsParserLogicProps {
|
|
@@ -12,22 +12,22 @@ interface DynamicSegmentsParserLogicProps {
|
|
|
12
12
|
*/
|
|
13
13
|
isCaseSensitive: boolean;
|
|
14
14
|
}
|
|
15
|
-
declare function DynamicSegmentsParserLogic(props: DynamicSegmentsParserLogicProps):
|
|
15
|
+
declare function DynamicSegmentsParserLogic(props: DynamicSegmentsParserLogicProps): _alloy_js_core17.Children;
|
|
16
16
|
interface ArgumentsParserLogicProps {
|
|
17
17
|
/**
|
|
18
18
|
* The command to generate the positional parameters parser logic for.
|
|
19
19
|
*/
|
|
20
20
|
command: CommandTree;
|
|
21
21
|
/**
|
|
22
|
-
* The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${
|
|
22
|
+
* The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${appSpecificEnvPrefix}_OPTION_NAME`).
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
appSpecificEnvPrefix: string;
|
|
25
25
|
/**
|
|
26
26
|
* Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.
|
|
27
27
|
*/
|
|
28
28
|
isCaseSensitive: boolean;
|
|
29
29
|
}
|
|
30
|
-
declare function ArgumentsParserLogic(props: ArgumentsParserLogicProps):
|
|
30
|
+
declare function ArgumentsParserLogic(props: ArgumentsParserLogicProps): _alloy_js_core17.Children;
|
|
31
31
|
/**
|
|
32
32
|
* The command option interface property.
|
|
33
33
|
*/
|
|
@@ -35,7 +35,7 @@ declare function OptionsMember({
|
|
|
35
35
|
option
|
|
36
36
|
}: {
|
|
37
37
|
option: CommandOption;
|
|
38
|
-
}):
|
|
38
|
+
}): _alloy_js_core17.Children;
|
|
39
39
|
interface OptionsMemberParserLogicProps {
|
|
40
40
|
/**
|
|
41
41
|
* The option name to generate the parser logic for.
|
|
@@ -55,36 +55,36 @@ interface OptionsMemberParserLogicProps {
|
|
|
55
55
|
/**
|
|
56
56
|
* The command option property parser logic.
|
|
57
57
|
*/
|
|
58
|
-
declare function OptionsMemberParserLogic(props: OptionsMemberParserLogicProps):
|
|
58
|
+
declare function OptionsMemberParserLogic(props: OptionsMemberParserLogicProps): _alloy_js_core17.Children;
|
|
59
59
|
interface OptionsMemberParserConditionProps {
|
|
60
60
|
/**
|
|
61
61
|
* The option name to generate the parser logic for.
|
|
62
62
|
*/
|
|
63
63
|
name: string;
|
|
64
64
|
/**
|
|
65
|
-
* Aliases for the option, which will also be parsed in the generated code. This will affect how the generated code compares command
|
|
65
|
+
* Aliases for the option, which will also be parsed in the generated code. This will affect how the generated code compares command-line arguments to option names and aliases.
|
|
66
66
|
*/
|
|
67
67
|
alias?: string[];
|
|
68
68
|
/**
|
|
69
|
-
* Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command
|
|
69
|
+
* Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.
|
|
70
70
|
*
|
|
71
71
|
* @defaultValue false
|
|
72
72
|
*/
|
|
73
73
|
isCaseSensitive: boolean;
|
|
74
74
|
}
|
|
75
|
-
declare function OptionsMemberParserCondition(props: OptionsMemberParserConditionProps):
|
|
75
|
+
declare function OptionsMemberParserCondition(props: OptionsMemberParserConditionProps): _alloy_js_core17.Children;
|
|
76
76
|
declare function OptionsInterfaceDeclaration(props: {
|
|
77
77
|
command: CommandTree;
|
|
78
|
-
}):
|
|
78
|
+
}): _alloy_js_core17.Children;
|
|
79
79
|
interface OptionsParserLogicProps {
|
|
80
80
|
/**
|
|
81
81
|
* The command to generate the options parser logic for.
|
|
82
82
|
*/
|
|
83
83
|
command: CommandTree;
|
|
84
84
|
/**
|
|
85
|
-
* The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${
|
|
85
|
+
* The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${appSpecificEnvPrefix}_OPTION_NAME`).
|
|
86
86
|
*/
|
|
87
|
-
|
|
87
|
+
appSpecificEnvPrefix: string;
|
|
88
88
|
/**
|
|
89
89
|
* Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.
|
|
90
90
|
*
|
|
@@ -95,16 +95,16 @@ interface OptionsParserLogicProps {
|
|
|
95
95
|
/**
|
|
96
96
|
* The command options parser logic.
|
|
97
97
|
*/
|
|
98
|
-
declare function OptionsParserLogic(props: OptionsParserLogicProps):
|
|
98
|
+
declare function OptionsParserLogic(props: OptionsParserLogicProps): _alloy_js_core17.Children;
|
|
99
99
|
interface CommandParserLogicProps {
|
|
100
100
|
/**
|
|
101
101
|
* The command to generate the parser logic for.
|
|
102
102
|
*/
|
|
103
103
|
command: CommandTree;
|
|
104
104
|
/**
|
|
105
|
-
* The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${
|
|
105
|
+
* The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${appSpecificEnvPrefix}_OPTION_NAME`).
|
|
106
106
|
*/
|
|
107
|
-
|
|
107
|
+
appSpecificEnvPrefix: string;
|
|
108
108
|
/**
|
|
109
109
|
* Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.
|
|
110
110
|
*
|
|
@@ -115,7 +115,7 @@ interface CommandParserLogicProps {
|
|
|
115
115
|
/**
|
|
116
116
|
* The command parser logic, which includes parsing dynamic path segments, positional parameters, and options.
|
|
117
117
|
*/
|
|
118
|
-
declare function CommandParserLogic(props: CommandParserLogicProps):
|
|
118
|
+
declare function CommandParserLogic(props: CommandParserLogicProps): _alloy_js_core17.Children;
|
|
119
119
|
//#endregion
|
|
120
120
|
export { ArgumentsParserLogic, ArgumentsParserLogicProps, CommandParserLogic, CommandParserLogicProps, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps };
|
|
121
121
|
//# sourceMappingURL=options-parser-logic.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options-parser-logic.d.cts","names":[],"sources":["../../src/components/options-parser-logic.tsx"],"sourcesContent":[],"mappings":";;;;UA+CiB,+BAAA;;;AAAjB;EAYgB,OAAA,EARL,WAQK;EA6BC;AAiBjB;
|
|
1
|
+
{"version":3,"file":"options-parser-logic.d.cts","names":[],"sources":["../../src/components/options-parser-logic.tsx"],"sourcesContent":[],"mappings":";;;;UA+CiB,+BAAA;;;AAAjB;EAYgB,OAAA,EARL,WAQK;EA6BC;AAiBjB;AA+KA;EAAgC,eAAA,EAAA,OAAA;;AAAiC,iBA7NjD,0BAAA,CA6NmD,KAAA,EA5N1D,+BA4N0D,CAAA,EA5N3B,gBAAA,CAAA,QA4N2B;AAAA,UAhMlD,yBAAA,CAgMkD;EAmClD;AAsBjB;AAsOA;EAmBgB,OAAA,EA9eL,WA8eK;EAmEA;AAchB;AAsBA;EA0IiB,oBAAA,EAAA,MAAuB;EAsBxB;;;;;iBAxuBA,oBAAA,QAA4B,4BAAyB,gBAAA,CAAA;;;;iBA+KrD,aAAA;;;UAAoC;IAAa,gBAAA,CAAE;UAmClD,6BAAA;;;;;;;;UASP;;;;;;;;;;;iBAaM,wBAAA,QAAgC,gCAA6B,gBAAA,CAAA;UAsO5D,iCAAA;;;;;;;;;;;;;;;;iBAmBD,4BAAA,QACP,oCAAiC,gBAAA,CAAA;iBAkE1B,2BAAA;WAA8C;IAAW,gBAAA,CAAE;UAc1D,uBAAA;;;;WAIN;;;;;;;;;;;;;;;iBAkBK,kBAAA,QAA0B,0BAAuB,gBAAA,CAAA;UA0IhD,uBAAA;;;;WAIN;;;;;;;;;;;;;;;iBAkBK,kBAAA,QAA0B,0BAAuB,gBAAA,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandOption, CommandTree } from "../types/command.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _alloy_js_core18 from "@alloy-js/core";
|
|
3
3
|
|
|
4
4
|
//#region src/components/options-parser-logic.d.ts
|
|
5
5
|
interface DynamicSegmentsParserLogicProps {
|
|
@@ -12,22 +12,22 @@ interface DynamicSegmentsParserLogicProps {
|
|
|
12
12
|
*/
|
|
13
13
|
isCaseSensitive: boolean;
|
|
14
14
|
}
|
|
15
|
-
declare function DynamicSegmentsParserLogic(props: DynamicSegmentsParserLogicProps):
|
|
15
|
+
declare function DynamicSegmentsParserLogic(props: DynamicSegmentsParserLogicProps): _alloy_js_core18.Children;
|
|
16
16
|
interface ArgumentsParserLogicProps {
|
|
17
17
|
/**
|
|
18
18
|
* The command to generate the positional parameters parser logic for.
|
|
19
19
|
*/
|
|
20
20
|
command: CommandTree;
|
|
21
21
|
/**
|
|
22
|
-
* The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${
|
|
22
|
+
* The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${appSpecificEnvPrefix}_OPTION_NAME`).
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
appSpecificEnvPrefix: string;
|
|
25
25
|
/**
|
|
26
26
|
* Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.
|
|
27
27
|
*/
|
|
28
28
|
isCaseSensitive: boolean;
|
|
29
29
|
}
|
|
30
|
-
declare function ArgumentsParserLogic(props: ArgumentsParserLogicProps):
|
|
30
|
+
declare function ArgumentsParserLogic(props: ArgumentsParserLogicProps): _alloy_js_core18.Children;
|
|
31
31
|
/**
|
|
32
32
|
* The command option interface property.
|
|
33
33
|
*/
|
|
@@ -35,7 +35,7 @@ declare function OptionsMember({
|
|
|
35
35
|
option
|
|
36
36
|
}: {
|
|
37
37
|
option: CommandOption;
|
|
38
|
-
}):
|
|
38
|
+
}): _alloy_js_core18.Children;
|
|
39
39
|
interface OptionsMemberParserLogicProps {
|
|
40
40
|
/**
|
|
41
41
|
* The option name to generate the parser logic for.
|
|
@@ -55,36 +55,36 @@ interface OptionsMemberParserLogicProps {
|
|
|
55
55
|
/**
|
|
56
56
|
* The command option property parser logic.
|
|
57
57
|
*/
|
|
58
|
-
declare function OptionsMemberParserLogic(props: OptionsMemberParserLogicProps):
|
|
58
|
+
declare function OptionsMemberParserLogic(props: OptionsMemberParserLogicProps): _alloy_js_core18.Children;
|
|
59
59
|
interface OptionsMemberParserConditionProps {
|
|
60
60
|
/**
|
|
61
61
|
* The option name to generate the parser logic for.
|
|
62
62
|
*/
|
|
63
63
|
name: string;
|
|
64
64
|
/**
|
|
65
|
-
* Aliases for the option, which will also be parsed in the generated code. This will affect how the generated code compares command
|
|
65
|
+
* Aliases for the option, which will also be parsed in the generated code. This will affect how the generated code compares command-line arguments to option names and aliases.
|
|
66
66
|
*/
|
|
67
67
|
alias?: string[];
|
|
68
68
|
/**
|
|
69
|
-
* Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command
|
|
69
|
+
* Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.
|
|
70
70
|
*
|
|
71
71
|
* @defaultValue false
|
|
72
72
|
*/
|
|
73
73
|
isCaseSensitive: boolean;
|
|
74
74
|
}
|
|
75
|
-
declare function OptionsMemberParserCondition(props: OptionsMemberParserConditionProps):
|
|
75
|
+
declare function OptionsMemberParserCondition(props: OptionsMemberParserConditionProps): _alloy_js_core18.Children;
|
|
76
76
|
declare function OptionsInterfaceDeclaration(props: {
|
|
77
77
|
command: CommandTree;
|
|
78
|
-
}):
|
|
78
|
+
}): _alloy_js_core18.Children;
|
|
79
79
|
interface OptionsParserLogicProps {
|
|
80
80
|
/**
|
|
81
81
|
* The command to generate the options parser logic for.
|
|
82
82
|
*/
|
|
83
83
|
command: CommandTree;
|
|
84
84
|
/**
|
|
85
|
-
* The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${
|
|
85
|
+
* The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${appSpecificEnvPrefix}_OPTION_NAME`).
|
|
86
86
|
*/
|
|
87
|
-
|
|
87
|
+
appSpecificEnvPrefix: string;
|
|
88
88
|
/**
|
|
89
89
|
* Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.
|
|
90
90
|
*
|
|
@@ -95,16 +95,16 @@ interface OptionsParserLogicProps {
|
|
|
95
95
|
/**
|
|
96
96
|
* The command options parser logic.
|
|
97
97
|
*/
|
|
98
|
-
declare function OptionsParserLogic(props: OptionsParserLogicProps):
|
|
98
|
+
declare function OptionsParserLogic(props: OptionsParserLogicProps): _alloy_js_core18.Children;
|
|
99
99
|
interface CommandParserLogicProps {
|
|
100
100
|
/**
|
|
101
101
|
* The command to generate the parser logic for.
|
|
102
102
|
*/
|
|
103
103
|
command: CommandTree;
|
|
104
104
|
/**
|
|
105
|
-
* The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${
|
|
105
|
+
* The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${appSpecificEnvPrefix}_OPTION_NAME`).
|
|
106
106
|
*/
|
|
107
|
-
|
|
107
|
+
appSpecificEnvPrefix: string;
|
|
108
108
|
/**
|
|
109
109
|
* Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.
|
|
110
110
|
*
|
|
@@ -115,7 +115,7 @@ interface CommandParserLogicProps {
|
|
|
115
115
|
/**
|
|
116
116
|
* The command parser logic, which includes parsing dynamic path segments, positional parameters, and options.
|
|
117
117
|
*/
|
|
118
|
-
declare function CommandParserLogic(props: CommandParserLogicProps):
|
|
118
|
+
declare function CommandParserLogic(props: CommandParserLogicProps): _alloy_js_core18.Children;
|
|
119
119
|
//#endregion
|
|
120
120
|
export { ArgumentsParserLogic, ArgumentsParserLogicProps, CommandParserLogic, CommandParserLogicProps, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps };
|
|
121
121
|
//# sourceMappingURL=options-parser-logic.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options-parser-logic.d.mts","names":[],"sources":["../../src/components/options-parser-logic.tsx"],"sourcesContent":[],"mappings":";;;;UA+CiB,+BAAA;;;AAAjB;EAYgB,OAAA,EARL,WAQK;EA6BC;AAiBjB;
|
|
1
|
+
{"version":3,"file":"options-parser-logic.d.mts","names":[],"sources":["../../src/components/options-parser-logic.tsx"],"sourcesContent":[],"mappings":";;;;UA+CiB,+BAAA;;;AAAjB;EAYgB,OAAA,EARL,WAQK;EA6BC;AAiBjB;AA+KA;EAAgC,eAAA,EAAA,OAAA;;AAAiC,iBA7NjD,0BAAA,CA6NmD,KAAA,EA5N1D,+BA4N0D,CAAA,EA5N3B,gBAAA,CAAA,QA4N2B;AAAA,UAhMlD,yBAAA,CAgMkD;EAmClD;AAsBjB;AAsOA;EAmBgB,OAAA,EA9eL,WA8eK;EAmEA;AAchB;AAsBA;EA0IiB,oBAAA,EAAA,MAAuB;EAsBxB;;;;;iBAxuBA,oBAAA,QAA4B,4BAAyB,gBAAA,CAAA;;;;iBA+KrD,aAAA;;;UAAoC;IAAa,gBAAA,CAAE;UAmClD,6BAAA;;;;;;;;UASP;;;;;;;;;;;iBAaM,wBAAA,QAAgC,gCAA6B,gBAAA,CAAA;UAsO5D,iCAAA;;;;;;;;;;;;;;;;iBAmBD,4BAAA,QACP,oCAAiC,gBAAA,CAAA;iBAkE1B,2BAAA;WAA8C;IAAW,gBAAA,CAAE;UAc1D,uBAAA;;;;WAIN;;;;;;;;;;;;;;;iBAkBK,kBAAA,QAA0B,0BAAuB,gBAAA,CAAA;UA0IhD,uBAAA;;;;WAIN;;;;;;;;;;;;;;;iBAkBK,kBAAA,QAA0B,0BAAuB,gBAAA,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getDynamicPathSegmentName, isDynamicPathSegment } from "../plugin-utils/context-helpers.mjs";
|
|
2
2
|
import { CommandParameterKinds } from "../types/command.mjs";
|
|
3
3
|
import { computedOptions } from "../contexts/options.mjs";
|
|
4
|
-
import { BooleanInputParserLogic } from "./helpers.mjs";
|
|
4
|
+
import { BooleanInputParserLogic, CommandParameterType } from "./helpers.mjs";
|
|
5
5
|
import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
|
|
6
6
|
import { camelCase } from "@stryke/string-format/camel-case";
|
|
7
7
|
import { constantCase } from "@stryke/string-format/constant-case";
|
|
@@ -46,7 +46,7 @@ function DynamicSegmentsParserLogic(props) {
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
function ArgumentsParserLogic(props) {
|
|
49
|
-
const { command,
|
|
49
|
+
const { command, appSpecificEnvPrefix, isCaseSensitive } = props;
|
|
50
50
|
return createComponent(Show, {
|
|
51
51
|
get when() {
|
|
52
52
|
return command.args && command.args.length > 0;
|
|
@@ -77,33 +77,47 @@ function ArgumentsParserLogic(props) {
|
|
|
77
77
|
},
|
|
78
78
|
hardline: true,
|
|
79
79
|
children: (arg, index) => [
|
|
80
|
-
createComponent(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return camelCase(arg.name);
|
|
80
|
+
createComponent(Show, {
|
|
81
|
+
get when() {
|
|
82
|
+
return isSetString(arg.env) || arg.default !== void 0 || (arg.kind === CommandParameterKinds.string || arg.kind === CommandParameterKinds.number) && arg.variadic;
|
|
84
83
|
},
|
|
85
|
-
get
|
|
86
|
-
return
|
|
84
|
+
get fallback() {
|
|
85
|
+
return [
|
|
86
|
+
memo(() => code`let ${camelCase(arg.name)}!: `),
|
|
87
|
+
createComponent(CommandParameterType, { parameter: arg }),
|
|
88
|
+
code`; `
|
|
89
|
+
];
|
|
87
90
|
},
|
|
88
|
-
get
|
|
89
|
-
return
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
get children() {
|
|
92
|
+
return createComponent(VarDeclaration, {
|
|
93
|
+
"let": true,
|
|
94
|
+
get name() {
|
|
95
|
+
return camelCase(arg.name);
|
|
92
96
|
},
|
|
93
|
-
get
|
|
94
|
-
return
|
|
95
|
-
}
|
|
96
|
-
}), createComponent(Show, {
|
|
97
|
-
get when() {
|
|
98
|
-
return arg.default !== void 0;
|
|
97
|
+
get type() {
|
|
98
|
+
return createComponent(CommandParameterType, { parameter: arg });
|
|
99
99
|
},
|
|
100
|
-
get
|
|
101
|
-
return (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
get initializer() {
|
|
101
|
+
return [createComponent(Show, {
|
|
102
|
+
get when() {
|
|
103
|
+
return isSetString(arg.env);
|
|
104
|
+
},
|
|
105
|
+
get children() {
|
|
106
|
+
return code`env.${appSpecificEnvPrefix}_${constantCase(String(arg.env))} ?? `;
|
|
107
|
+
}
|
|
108
|
+
}), createComponent(Show, {
|
|
109
|
+
get when() {
|
|
110
|
+
return arg.default !== void 0;
|
|
111
|
+
},
|
|
112
|
+
get fallback() {
|
|
113
|
+
return (arg.kind === CommandParameterKinds.string || arg.kind === CommandParameterKinds.number) && arg.variadic ? code`[]` : code`undefined;`;
|
|
114
|
+
},
|
|
115
|
+
get children() {
|
|
116
|
+
return arg.kind === CommandParameterKinds.string ? code`"${arg.default}"` : code`${arg.default}`;
|
|
117
|
+
}
|
|
118
|
+
})];
|
|
105
119
|
}
|
|
106
|
-
})
|
|
120
|
+
});
|
|
107
121
|
}
|
|
108
122
|
}),
|
|
109
123
|
createComponent(Spacing, {}),
|
|
@@ -168,7 +182,7 @@ function OptionsMember({ option }) {
|
|
|
168
182
|
},
|
|
169
183
|
doc,
|
|
170
184
|
get type() {
|
|
171
|
-
return
|
|
185
|
+
return createComponent(CommandParameterType, { parameter: option });
|
|
172
186
|
},
|
|
173
187
|
get optional() {
|
|
174
188
|
return option.optional;
|
|
@@ -187,7 +201,7 @@ function OptionsMember({ option }) {
|
|
|
187
201
|
},
|
|
188
202
|
doc,
|
|
189
203
|
get type() {
|
|
190
|
-
return
|
|
204
|
+
return createComponent(CommandParameterType, { parameter: option });
|
|
191
205
|
},
|
|
192
206
|
get optional() {
|
|
193
207
|
return option.optional;
|
|
@@ -205,7 +219,9 @@ function OptionsMember({ option }) {
|
|
|
205
219
|
return option.name;
|
|
206
220
|
},
|
|
207
221
|
doc,
|
|
208
|
-
type
|
|
222
|
+
get type() {
|
|
223
|
+
return createComponent(CommandParameterType, { parameter: option });
|
|
224
|
+
},
|
|
209
225
|
get optional() {
|
|
210
226
|
return option.optional;
|
|
211
227
|
}
|
|
@@ -264,6 +280,14 @@ function OptionsMemberParserLogic(props) {
|
|
|
264
280
|
},
|
|
265
281
|
children: code`...arg.replace(${equalsRegex}, "").split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean).map(Number).filter(value => !Number.isNaN(value)) `
|
|
266
282
|
}),
|
|
283
|
+
createComponent(Show, {
|
|
284
|
+
get when() {
|
|
285
|
+
return (option.kind === CommandParameterKinds.string || option.kind === CommandParameterKinds.number) && option.choices && option.choices.length > 0;
|
|
286
|
+
},
|
|
287
|
+
get children() {
|
|
288
|
+
return code` as ${option.choices?.map((choice) => isSetString(choice) ? `"${choice}"` : choice).join(" | ")} `;
|
|
289
|
+
}
|
|
290
|
+
}),
|
|
267
291
|
code`); `
|
|
268
292
|
];
|
|
269
293
|
}
|
|
@@ -291,6 +315,14 @@ function OptionsMemberParserLogic(props) {
|
|
|
291
315
|
},
|
|
292
316
|
children: code`...args[++i].split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean).map(Number).filter(value => !Number.isNaN(value)) `
|
|
293
317
|
}),
|
|
318
|
+
createComponent(Show, {
|
|
319
|
+
get when() {
|
|
320
|
+
return (option.kind === CommandParameterKinds.string || option.kind === CommandParameterKinds.number) && option.choices && option.choices.length > 0;
|
|
321
|
+
},
|
|
322
|
+
get children() {
|
|
323
|
+
return code` as ${option.choices?.map((choice) => isSetString(choice) ? `"${choice}"` : choice).join(" | ")} `;
|
|
324
|
+
}
|
|
325
|
+
}),
|
|
294
326
|
code`); `
|
|
295
327
|
];
|
|
296
328
|
}
|
|
@@ -311,13 +343,25 @@ function OptionsMemberParserLogic(props) {
|
|
|
311
343
|
return option.kind === CommandParameterKinds.string;
|
|
312
344
|
},
|
|
313
345
|
get children() {
|
|
314
|
-
return [
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
346
|
+
return [
|
|
347
|
+
createComponent(Show, {
|
|
348
|
+
get when() {
|
|
349
|
+
return name.includes("?") || name.includes("-");
|
|
350
|
+
},
|
|
351
|
+
fallback: code`options.${name}`,
|
|
352
|
+
children: code`options["${name}"]`
|
|
353
|
+
}),
|
|
354
|
+
code` = arg.replace(${equalsRegex}, "").trim().replace(/^("|')/, "").replace(/("|')$/, "")`,
|
|
355
|
+
createComponent(Show, {
|
|
356
|
+
get when() {
|
|
357
|
+
return option.choices && option.choices.length > 0;
|
|
358
|
+
},
|
|
359
|
+
get children() {
|
|
360
|
+
return code` as ${option.choices?.map((choice) => `"${choice}"`).join(" | ")}`;
|
|
361
|
+
}
|
|
362
|
+
}),
|
|
363
|
+
code`; `
|
|
364
|
+
];
|
|
321
365
|
}
|
|
322
366
|
}), createComponent(Show, {
|
|
323
367
|
get when() {
|
|
@@ -334,13 +378,25 @@ function OptionsMemberParserLogic(props) {
|
|
|
334
378
|
createComponent(IfStatement, {
|
|
335
379
|
condition: `!Number.isNaN(value)`,
|
|
336
380
|
get children() {
|
|
337
|
-
return [
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
381
|
+
return [
|
|
382
|
+
createComponent(Show, {
|
|
383
|
+
get when() {
|
|
384
|
+
return name.includes("?") || name.includes("-");
|
|
385
|
+
},
|
|
386
|
+
fallback: code`options.${name}`,
|
|
387
|
+
children: code`options["${name}"]`
|
|
388
|
+
}),
|
|
389
|
+
code` = value`,
|
|
390
|
+
createComponent(Show, {
|
|
391
|
+
get when() {
|
|
392
|
+
return option.choices && option.choices.length > 0;
|
|
393
|
+
},
|
|
394
|
+
get children() {
|
|
395
|
+
return code` as ${option.choices?.join(" | ")}`;
|
|
396
|
+
}
|
|
397
|
+
}),
|
|
398
|
+
code`; `
|
|
399
|
+
];
|
|
344
400
|
}
|
|
345
401
|
})
|
|
346
402
|
];
|
|
@@ -356,13 +412,25 @@ function OptionsMemberParserLogic(props) {
|
|
|
356
412
|
return option.kind === CommandParameterKinds.string;
|
|
357
413
|
},
|
|
358
414
|
get children() {
|
|
359
|
-
return [
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
415
|
+
return [
|
|
416
|
+
createComponent(Show, {
|
|
417
|
+
get when() {
|
|
418
|
+
return name.includes("?") || name.includes("-");
|
|
419
|
+
},
|
|
420
|
+
fallback: code`options.${name}`,
|
|
421
|
+
children: code`options["${name}"]`
|
|
422
|
+
}),
|
|
423
|
+
code` = args[++i].trim().replace(/^("|')/, "").replace(/("|')$/, "")`,
|
|
424
|
+
createComponent(Show, {
|
|
425
|
+
get when() {
|
|
426
|
+
return option.choices && option.choices.length > 0;
|
|
427
|
+
},
|
|
428
|
+
get children() {
|
|
429
|
+
return code` as ${option.choices?.map((choice) => `"${choice}"`).join(" | ")}`;
|
|
430
|
+
}
|
|
431
|
+
}),
|
|
432
|
+
code`; `
|
|
433
|
+
];
|
|
366
434
|
}
|
|
367
435
|
}), createComponent(Show, {
|
|
368
436
|
get when() {
|
|
@@ -379,13 +447,25 @@ function OptionsMemberParserLogic(props) {
|
|
|
379
447
|
createComponent(IfStatement, {
|
|
380
448
|
condition: `!Number.isNaN(value)`,
|
|
381
449
|
get children() {
|
|
382
|
-
return [
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
450
|
+
return [
|
|
451
|
+
createComponent(Show, {
|
|
452
|
+
get when() {
|
|
453
|
+
return name.includes("?") || name.includes("-");
|
|
454
|
+
},
|
|
455
|
+
fallback: code`options.${name}`,
|
|
456
|
+
children: code`options["${name}"]`
|
|
457
|
+
}),
|
|
458
|
+
code` = value`,
|
|
459
|
+
createComponent(Show, {
|
|
460
|
+
get when() {
|
|
461
|
+
return option.choices && option.choices.length > 0;
|
|
462
|
+
},
|
|
463
|
+
get children() {
|
|
464
|
+
return code` as ${option.choices?.join(" | ")}`;
|
|
465
|
+
}
|
|
466
|
+
}),
|
|
467
|
+
code`; `
|
|
468
|
+
];
|
|
389
469
|
}
|
|
390
470
|
})
|
|
391
471
|
];
|
|
@@ -493,7 +573,7 @@ function OptionsInterfaceDeclaration(props) {
|
|
|
493
573
|
* The command options parser logic.
|
|
494
574
|
*/
|
|
495
575
|
function OptionsParserLogic(props) {
|
|
496
|
-
const { command,
|
|
576
|
+
const { command, appSpecificEnvPrefix, isCaseSensitive = false } = props;
|
|
497
577
|
const options = computed(() => computedOptions(command));
|
|
498
578
|
return [
|
|
499
579
|
createComponent(VarDeclaration, {
|
|
@@ -501,10 +581,10 @@ function OptionsParserLogic(props) {
|
|
|
501
581
|
name: "options",
|
|
502
582
|
get initializer() {
|
|
503
583
|
return code` {
|
|
504
|
-
${Object.entries(options.value).map(([name, option]) => {
|
|
505
|
-
if (option.kind === CommandParameterKinds.string) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${
|
|
506
|
-
else if (option.kind === CommandParameterKinds.number) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${
|
|
507
|
-
else if (option.kind === CommandParameterKinds.boolean) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${
|
|
584
|
+
${Object.entries(options.value).filter(([, option]) => option.env || option.default !== void 0 || (option.kind === CommandParameterKinds.string || option.kind === CommandParameterKinds.number) && option.variadic).map(([name, option]) => {
|
|
585
|
+
if (option.kind === CommandParameterKinds.string) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${appSpecificEnvPrefix}_${option.env}` : ""}${option.variadic ? option.default !== void 0 ? `${option.env ? " ?? " : ""}${JSON.stringify(option.default)}` : option.env ? " ?? []" : "[]" : option.default !== void 0 ? `${option.env ? " ?? " : ""}"${option.default}"` : ""}, `;
|
|
586
|
+
else if (option.kind === CommandParameterKinds.number) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${appSpecificEnvPrefix}_${option.env}` : ""}${option.variadic ? option.default && Array.isArray(option.default) ? `${option.env ? " ?? " : ""}${JSON.stringify(option.default)}` : option.env ? " ?? []" : "[]" : option.default !== void 0 ? `${option.env ? " ?? " : ""}${option.default}` : ""}, `;
|
|
587
|
+
else if (option.kind === CommandParameterKinds.boolean) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${appSpecificEnvPrefix}_${option.env} ?? ` : ""}${option.default ? "true" : "false"},`;
|
|
508
588
|
return "";
|
|
509
589
|
}).join("")}
|
|
510
590
|
} as ${pascalCase(command.name)}Options;`;
|
|
@@ -582,7 +662,7 @@ function OptionsParserLogic(props) {
|
|
|
582
662
|
* The command parser logic, which includes parsing dynamic path segments, positional parameters, and options.
|
|
583
663
|
*/
|
|
584
664
|
function CommandParserLogic(props) {
|
|
585
|
-
const { command,
|
|
665
|
+
const { command, appSpecificEnvPrefix, isCaseSensitive = false } = props;
|
|
586
666
|
return [
|
|
587
667
|
createComponent(DynamicSegmentsParserLogic, {
|
|
588
668
|
command,
|
|
@@ -591,13 +671,13 @@ function CommandParserLogic(props) {
|
|
|
591
671
|
createComponent(Spacing, {}),
|
|
592
672
|
createComponent(OptionsParserLogic, {
|
|
593
673
|
command,
|
|
594
|
-
|
|
674
|
+
appSpecificEnvPrefix,
|
|
595
675
|
isCaseSensitive
|
|
596
676
|
}),
|
|
597
677
|
createComponent(Spacing, {}),
|
|
598
678
|
createComponent(ArgumentsParserLogic, {
|
|
599
679
|
command,
|
|
600
|
-
|
|
680
|
+
appSpecificEnvPrefix,
|
|
601
681
|
isCaseSensitive
|
|
602
682
|
}),
|
|
603
683
|
createComponent(Spacing, {})
|