@shell-shock/core 0.10.0 → 0.12.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/components/docs.cjs +4 -4
- package/dist/components/docs.cjs.map +1 -1
- package/dist/components/docs.d.cts +5 -5
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts +5 -5
- package/dist/components/docs.d.mts.map +1 -1
- 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 +167 -87
- package/dist/components/options-parser-logic.cjs.map +1 -1
- package/dist/components/options-parser-logic.d.cts +15 -15
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts +15 -15
- package/dist/components/options-parser-logic.d.mts.map +1 -1
- package/dist/components/options-parser-logic.mjs +163 -83
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/usage.cjs +5 -5
- package/dist/components/usage.cjs.map +1 -1
- package/dist/components/usage.d.cts +2 -2
- package/dist/components/usage.d.cts.map +1 -1
- package/dist/components/usage.d.mts +2 -2
- package/dist/components/usage.mjs +4 -4
- package/dist/components/usage.mjs.map +1 -1
- package/dist/components/utils-builtin.cjs +2 -2
- package/dist/components/utils-builtin.cjs.map +1 -1
- package/dist/components/utils-builtin.d.cts +9 -9
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts +9 -9
- package/dist/components/utils-builtin.d.mts.map +1 -1
- package/dist/components/utils-builtin.mjs +5 -5
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/contexts/options.cjs +2 -2
- package/dist/contexts/options.cjs.map +1 -1
- package/dist/contexts/options.d.cts +1 -1
- package/dist/contexts/options.d.cts.map +1 -1
- package/dist/contexts/options.d.mts +1 -1
- package/dist/contexts/options.d.mts.map +1 -1
- package/dist/contexts/options.mjs +4 -4
- package/dist/contexts/options.mjs.map +1 -1
- package/dist/helpers/automd.cjs +2 -2
- package/dist/helpers/automd.cjs.map +1 -1
- package/dist/helpers/automd.mjs.map +1 -1
- package/dist/helpers/paths.cjs +125 -0
- package/dist/helpers/paths.cjs.map +1 -0
- package/dist/helpers/paths.mjs +121 -0
- package/dist/helpers/paths.mjs.map +1 -0
- package/dist/helpers/persistence.cjs +68 -116
- package/dist/helpers/persistence.cjs.map +1 -1
- package/dist/helpers/persistence.mjs +68 -116
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/helpers/update-package-json.cjs +4 -4
- package/dist/helpers/update-package-json.cjs.map +1 -1
- package/dist/helpers/utilities.cjs +1 -1
- package/dist/helpers/utilities.mjs +1 -1
- package/dist/helpers/validations.cjs +2 -3
- package/dist/helpers/validations.cjs.map +1 -1
- package/dist/helpers/validations.mjs +2 -2
- package/dist/helpers/validations.mjs.map +1 -1
- package/dist/index.cjs +14 -11
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/plugin-utils/deepkit.cjs +72 -0
- package/dist/plugin-utils/deepkit.cjs.map +1 -0
- package/dist/plugin-utils/deepkit.d.cts +24 -0
- package/dist/plugin-utils/deepkit.d.cts.map +1 -0
- package/dist/plugin-utils/deepkit.d.mts +24 -0
- package/dist/plugin-utils/deepkit.d.mts.map +1 -0
- package/dist/plugin-utils/deepkit.mjs +70 -0
- package/dist/plugin-utils/deepkit.mjs.map +1 -0
- 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 +2 -2
- package/dist/plugin-utils/get-command-tree.cjs.map +1 -1
- package/dist/plugin-utils/index.cjs +32 -18
- package/dist/plugin-utils/index.d.cts +4 -1
- package/dist/plugin-utils/index.d.mts +4 -1
- package/dist/plugin-utils/index.mjs +4 -1
- package/dist/plugin-utils/reflect.cjs +4 -5
- package/dist/plugin-utils/reflect.cjs.map +1 -1
- package/dist/plugin-utils/reflect.mjs +4 -4
- package/dist/plugin-utils/reflect.mjs.map +1 -1
- package/dist/plugin-utils/type-checks.cjs +89 -0
- package/dist/plugin-utils/type-checks.cjs.map +1 -0
- package/dist/plugin-utils/type-checks.d.cts +42 -0
- package/dist/plugin-utils/type-checks.d.cts.map +1 -0
- package/dist/plugin-utils/type-checks.d.mts +42 -0
- package/dist/plugin-utils/type-checks.d.mts.map +1 -0
- package/dist/plugin-utils/type-checks.mjs +84 -0
- package/dist/plugin-utils/type-checks.mjs.map +1 -0
- package/dist/plugin.cjs +31 -29
- 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 +15 -13
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/deepkit.cjs +132 -0
- package/dist/resolver/deepkit.cjs.map +1 -0
- package/dist/resolver/deepkit.mjs +131 -0
- package/dist/resolver/deepkit.mjs.map +1 -0
- package/dist/resolver/helpers.cjs +167 -0
- package/dist/resolver/helpers.cjs.map +1 -0
- package/dist/resolver/helpers.mjs +162 -0
- package/dist/resolver/helpers.mjs.map +1 -0
- package/dist/resolver/module.cjs +144 -0
- package/dist/resolver/module.cjs.map +1 -0
- package/dist/resolver/module.mjs +143 -0
- package/dist/resolver/module.mjs.map +1 -0
- package/dist/resolver/resolve.cjs +209 -0
- package/dist/resolver/resolve.cjs.map +1 -0
- package/dist/resolver/resolve.mjs +208 -0
- package/dist/resolver/resolve.mjs.map +1 -0
- package/dist/types/command.cjs +127 -104
- package/dist/types/command.cjs.map +1 -1
- package/dist/types/command.d.cts +39 -78
- package/dist/types/command.d.cts.map +1 -1
- package/dist/types/command.d.mts +39 -78
- package/dist/types/command.d.mts.map +1 -1
- package/dist/types/command.mjs +115 -95
- package/dist/types/command.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/dist/types/context.cjs +1 -1
- package/dist/types/context.cjs.map +1 -1
- package/dist/types/context.d.cts +2 -2
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts +2 -2
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/context.mjs +1 -1
- package/dist/types/context.mjs.map +1 -1
- package/dist/types/index.cjs +13 -10
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +2 -2
- package/package.json +24 -75
- package/dist/helpers/resolve-command.cjs +0 -430
- package/dist/helpers/resolve-command.cjs.map +0 -1
- package/dist/helpers/resolve-command.mjs +0 -425
- package/dist/helpers/resolve-command.mjs.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const
|
|
2
|
+
const require_context_helpers = require('../plugin-utils/context-helpers.cjs');
|
|
3
|
+
const require_types_command = require('../types/command.cjs');
|
|
3
4
|
const require_contexts_options = require('../contexts/options.cjs');
|
|
4
5
|
const require_components_helpers = require('./helpers.cjs');
|
|
5
6
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
@@ -8,7 +9,6 @@ let __stryke_string_format_constant_case = require("@stryke/string-format/consta
|
|
|
8
9
|
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
9
10
|
let __alloy_js_core = require("@alloy-js/core");
|
|
10
11
|
let __powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
11
|
-
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
12
12
|
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
13
13
|
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
14
14
|
|
|
@@ -21,14 +21,14 @@ function DynamicSegmentsParserLogic(props) {
|
|
|
21
21
|
},
|
|
22
22
|
children: (segment, index) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
23
23
|
get when() {
|
|
24
|
-
return
|
|
24
|
+
return require_context_helpers.isDynamicPathSegment(segment);
|
|
25
25
|
},
|
|
26
26
|
get children() {
|
|
27
27
|
return [
|
|
28
28
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
29
29
|
"let": true,
|
|
30
30
|
get name() {
|
|
31
|
-
return (0, __stryke_string_format_camel_case.camelCase)(
|
|
31
|
+
return (0, __stryke_string_format_camel_case.camelCase)(require_context_helpers.getDynamicPathSegmentName(segment));
|
|
32
32
|
},
|
|
33
33
|
type: "string | undefined"
|
|
34
34
|
}),
|
|
@@ -36,7 +36,7 @@ function DynamicSegmentsParserLogic(props) {
|
|
|
36
36
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
37
37
|
condition: __alloy_js_core.code`args.length > ${2 + index} && args[${2 + index}]`,
|
|
38
38
|
get children() {
|
|
39
|
-
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(
|
|
39
|
+
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(require_context_helpers.getDynamicPathSegmentName(segment))} = args[${2 + index}];`;
|
|
40
40
|
}
|
|
41
41
|
}),
|
|
42
42
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
@@ -47,10 +47,10 @@ function DynamicSegmentsParserLogic(props) {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
function ArgumentsParserLogic(props) {
|
|
50
|
-
const { command,
|
|
50
|
+
const { command, appSpecificEnvPrefix, isCaseSensitive } = props;
|
|
51
51
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
52
52
|
get when() {
|
|
53
|
-
return command.
|
|
53
|
+
return command.args && command.args.length > 0;
|
|
54
54
|
},
|
|
55
55
|
get children() {
|
|
56
56
|
return [
|
|
@@ -74,37 +74,51 @@ function ArgumentsParserLogic(props) {
|
|
|
74
74
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
75
75
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
76
76
|
get each() {
|
|
77
|
-
return command.
|
|
77
|
+
return command.args ?? [];
|
|
78
78
|
},
|
|
79
79
|
hardline: true,
|
|
80
80
|
children: (arg, index) => [
|
|
81
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return (0, __stryke_string_format_camel_case.camelCase)(arg.name);
|
|
81
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
82
|
+
get when() {
|
|
83
|
+
return (0, __stryke_type_checks_is_set_string.isSetString)(arg.env) || arg.default !== void 0 || (arg.kind === require_types_command.CommandParameterKinds.string || arg.kind === require_types_command.CommandParameterKinds.number) && arg.variadic;
|
|
85
84
|
},
|
|
86
|
-
get
|
|
87
|
-
return
|
|
85
|
+
get fallback() {
|
|
86
|
+
return [
|
|
87
|
+
(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`let ${(0, __stryke_string_format_camel_case.camelCase)(arg.name)}!: `),
|
|
88
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: arg }),
|
|
89
|
+
__alloy_js_core.code`; `
|
|
90
|
+
];
|
|
88
91
|
},
|
|
89
|
-
get
|
|
90
|
-
return
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
get children() {
|
|
93
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
94
|
+
"let": true,
|
|
95
|
+
get name() {
|
|
96
|
+
return (0, __stryke_string_format_camel_case.camelCase)(arg.name);
|
|
93
97
|
},
|
|
94
|
-
get
|
|
95
|
-
return
|
|
96
|
-
}
|
|
97
|
-
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
98
|
-
get when() {
|
|
99
|
-
return arg.default !== void 0;
|
|
98
|
+
get type() {
|
|
99
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: arg });
|
|
100
100
|
},
|
|
101
|
-
get
|
|
102
|
-
return (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
get initializer() {
|
|
102
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
103
|
+
get when() {
|
|
104
|
+
return (0, __stryke_type_checks_is_set_string.isSetString)(arg.env);
|
|
105
|
+
},
|
|
106
|
+
get children() {
|
|
107
|
+
return __alloy_js_core.code`env.${appSpecificEnvPrefix}_${(0, __stryke_string_format_constant_case.constantCase)(String(arg.env))} ?? `;
|
|
108
|
+
}
|
|
109
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
110
|
+
get when() {
|
|
111
|
+
return arg.default !== void 0;
|
|
112
|
+
},
|
|
113
|
+
get fallback() {
|
|
114
|
+
return (arg.kind === require_types_command.CommandParameterKinds.string || arg.kind === require_types_command.CommandParameterKinds.number) && arg.variadic ? __alloy_js_core.code`[]` : __alloy_js_core.code`undefined;`;
|
|
115
|
+
},
|
|
116
|
+
get children() {
|
|
117
|
+
return arg.kind === require_types_command.CommandParameterKinds.string ? __alloy_js_core.code`"${arg.default}"` : __alloy_js_core.code`${arg.default}`;
|
|
118
|
+
}
|
|
119
|
+
})];
|
|
106
120
|
}
|
|
107
|
-
})
|
|
121
|
+
});
|
|
108
122
|
}
|
|
109
123
|
}),
|
|
110
124
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
@@ -113,7 +127,7 @@ function ArgumentsParserLogic(props) {
|
|
|
113
127
|
get children() {
|
|
114
128
|
return [(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(arg.name)} = `), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
115
129
|
get when() {
|
|
116
|
-
return arg.kind ===
|
|
130
|
+
return arg.kind === require_types_command.CommandParameterKinds.string || arg.kind === require_types_command.CommandParameterKinds.number;
|
|
117
131
|
},
|
|
118
132
|
get fallback() {
|
|
119
133
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.BooleanInputParserLogic, { name: `args[argsIndex + ${index}] ` });
|
|
@@ -121,19 +135,19 @@ function ArgumentsParserLogic(props) {
|
|
|
121
135
|
get children() {
|
|
122
136
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
123
137
|
get when() {
|
|
124
|
-
return (arg.kind ===
|
|
138
|
+
return (arg.kind === require_types_command.CommandParameterKinds.string || arg.kind === require_types_command.CommandParameterKinds.number) && arg.variadic;
|
|
125
139
|
},
|
|
126
140
|
get fallback() {
|
|
127
141
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
128
142
|
get when() {
|
|
129
|
-
return arg.kind ===
|
|
143
|
+
return arg.kind === require_types_command.CommandParameterKinds.number;
|
|
130
144
|
},
|
|
131
145
|
fallback: __alloy_js_core.code`args[argsIndex + ${index}]; `,
|
|
132
146
|
children: __alloy_js_core.code`Number(args[argsIndex + ${index}]); `
|
|
133
147
|
});
|
|
134
148
|
},
|
|
135
149
|
get children() {
|
|
136
|
-
return __alloy_js_core.code`args.slice(argsIndex + ${index}, (optionsIndex > argsIndex ? optionsIndex : args.length) - ${command.
|
|
150
|
+
return __alloy_js_core.code`args.slice(argsIndex + ${index}, (optionsIndex > argsIndex ? optionsIndex : args.length) - ${command.args.length - index}).join(" ").split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean)`;
|
|
137
151
|
}
|
|
138
152
|
});
|
|
139
153
|
}
|
|
@@ -160,7 +174,7 @@ function OptionsMember({ option }) {
|
|
|
160
174
|
return [
|
|
161
175
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
162
176
|
get when() {
|
|
163
|
-
return option.kind ===
|
|
177
|
+
return option.kind === require_types_command.CommandParameterKinds.string;
|
|
164
178
|
},
|
|
165
179
|
get children() {
|
|
166
180
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.InterfaceMember, {
|
|
@@ -169,7 +183,7 @@ function OptionsMember({ option }) {
|
|
|
169
183
|
},
|
|
170
184
|
doc,
|
|
171
185
|
get type() {
|
|
172
|
-
return
|
|
186
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: option });
|
|
173
187
|
},
|
|
174
188
|
get optional() {
|
|
175
189
|
return option.optional;
|
|
@@ -179,7 +193,7 @@ function OptionsMember({ option }) {
|
|
|
179
193
|
}),
|
|
180
194
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
181
195
|
get when() {
|
|
182
|
-
return option.kind ===
|
|
196
|
+
return option.kind === require_types_command.CommandParameterKinds.number;
|
|
183
197
|
},
|
|
184
198
|
get children() {
|
|
185
199
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.InterfaceMember, {
|
|
@@ -188,7 +202,7 @@ function OptionsMember({ option }) {
|
|
|
188
202
|
},
|
|
189
203
|
doc,
|
|
190
204
|
get type() {
|
|
191
|
-
return
|
|
205
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: option });
|
|
192
206
|
},
|
|
193
207
|
get optional() {
|
|
194
208
|
return option.optional;
|
|
@@ -198,7 +212,7 @@ function OptionsMember({ option }) {
|
|
|
198
212
|
}),
|
|
199
213
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
200
214
|
get when() {
|
|
201
|
-
return option.kind ===
|
|
215
|
+
return option.kind === require_types_command.CommandParameterKinds.boolean;
|
|
202
216
|
},
|
|
203
217
|
get children() {
|
|
204
218
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.InterfaceMember, {
|
|
@@ -206,7 +220,9 @@ function OptionsMember({ option }) {
|
|
|
206
220
|
return option.name;
|
|
207
221
|
},
|
|
208
222
|
doc,
|
|
209
|
-
type
|
|
223
|
+
get type() {
|
|
224
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: option });
|
|
225
|
+
},
|
|
210
226
|
get optional() {
|
|
211
227
|
return option.optional;
|
|
212
228
|
}
|
|
@@ -225,7 +241,7 @@ function OptionsMemberParserLogic(props) {
|
|
|
225
241
|
const equalsRegex = `/^--?(${isCaseSensitive || name.length === 1 ? name : name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}${option.alias && option.alias.length > 0 ? "|" : ""}${option.alias?.map((a) => (isCaseSensitive || name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", "")) === "?" ? "\\?" : isCaseSensitive || name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", "")).join("|")})=/`;
|
|
226
242
|
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
227
243
|
get when() {
|
|
228
|
-
return option.kind ===
|
|
244
|
+
return option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number;
|
|
229
245
|
},
|
|
230
246
|
get children() {
|
|
231
247
|
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
@@ -255,16 +271,24 @@ function OptionsMemberParserLogic(props) {
|
|
|
255
271
|
}),
|
|
256
272
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
257
273
|
get when() {
|
|
258
|
-
return option.kind ===
|
|
274
|
+
return option.kind === require_types_command.CommandParameterKinds.string;
|
|
259
275
|
},
|
|
260
276
|
children: __alloy_js_core.code`...arg.replace(${equalsRegex}, "").split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean) `
|
|
261
277
|
}),
|
|
262
278
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
263
279
|
get when() {
|
|
264
|
-
return option.kind ===
|
|
280
|
+
return option.kind === require_types_command.CommandParameterKinds.number;
|
|
265
281
|
},
|
|
266
282
|
children: __alloy_js_core.code`...arg.replace(${equalsRegex}, "").split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean).map(Number).filter(value => !Number.isNaN(value)) `
|
|
267
283
|
}),
|
|
284
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
285
|
+
get when() {
|
|
286
|
+
return (option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number) && option.choices && option.choices.length > 0;
|
|
287
|
+
},
|
|
288
|
+
get children() {
|
|
289
|
+
return __alloy_js_core.code` as ${option.choices?.map((choice) => (0, __stryke_type_checks_is_set_string.isSetString)(choice) ? `"${choice}"` : choice).join(" | ")} `;
|
|
290
|
+
}
|
|
291
|
+
}),
|
|
268
292
|
__alloy_js_core.code`); `
|
|
269
293
|
];
|
|
270
294
|
}
|
|
@@ -282,16 +306,24 @@ function OptionsMemberParserLogic(props) {
|
|
|
282
306
|
}),
|
|
283
307
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
284
308
|
get when() {
|
|
285
|
-
return option.kind ===
|
|
309
|
+
return option.kind === require_types_command.CommandParameterKinds.string;
|
|
286
310
|
},
|
|
287
311
|
children: __alloy_js_core.code`...args[++i].split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean) `
|
|
288
312
|
}),
|
|
289
313
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
290
314
|
get when() {
|
|
291
|
-
return option.kind ===
|
|
315
|
+
return option.kind === require_types_command.CommandParameterKinds.number;
|
|
292
316
|
},
|
|
293
317
|
children: __alloy_js_core.code`...args[++i].split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean).map(Number).filter(value => !Number.isNaN(value)) `
|
|
294
318
|
}),
|
|
319
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
320
|
+
get when() {
|
|
321
|
+
return (option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number) && option.choices && option.choices.length > 0;
|
|
322
|
+
},
|
|
323
|
+
get children() {
|
|
324
|
+
return __alloy_js_core.code` as ${option.choices?.map((choice) => (0, __stryke_type_checks_is_set_string.isSetString)(choice) ? `"${choice}"` : choice).join(" | ")} `;
|
|
325
|
+
}
|
|
326
|
+
}),
|
|
295
327
|
__alloy_js_core.code`); `
|
|
296
328
|
];
|
|
297
329
|
}
|
|
@@ -309,20 +341,32 @@ function OptionsMemberParserLogic(props) {
|
|
|
309
341
|
get children() {
|
|
310
342
|
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
311
343
|
get when() {
|
|
312
|
-
return option.kind ===
|
|
344
|
+
return option.kind === require_types_command.CommandParameterKinds.string;
|
|
313
345
|
},
|
|
314
346
|
get children() {
|
|
315
|
-
return [
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
347
|
+
return [
|
|
348
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
349
|
+
get when() {
|
|
350
|
+
return name.includes("?") || name.includes("-");
|
|
351
|
+
},
|
|
352
|
+
fallback: __alloy_js_core.code`options.${name}`,
|
|
353
|
+
children: __alloy_js_core.code`options["${name}"]`
|
|
354
|
+
}),
|
|
355
|
+
__alloy_js_core.code` = arg.replace(${equalsRegex}, "").trim().replace(/^("|')/, "").replace(/("|')$/, "")`,
|
|
356
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
357
|
+
get when() {
|
|
358
|
+
return option.choices && option.choices.length > 0;
|
|
359
|
+
},
|
|
360
|
+
get children() {
|
|
361
|
+
return __alloy_js_core.code` as ${option.choices?.map((choice) => `"${choice}"`).join(" | ")}`;
|
|
362
|
+
}
|
|
363
|
+
}),
|
|
364
|
+
__alloy_js_core.code`; `
|
|
365
|
+
];
|
|
322
366
|
}
|
|
323
367
|
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
324
368
|
get when() {
|
|
325
|
-
return option.kind ===
|
|
369
|
+
return option.kind === require_types_command.CommandParameterKinds.number;
|
|
326
370
|
},
|
|
327
371
|
get children() {
|
|
328
372
|
return [
|
|
@@ -335,13 +379,25 @@ function OptionsMemberParserLogic(props) {
|
|
|
335
379
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
336
380
|
condition: `!Number.isNaN(value)`,
|
|
337
381
|
get children() {
|
|
338
|
-
return [
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
382
|
+
return [
|
|
383
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
384
|
+
get when() {
|
|
385
|
+
return name.includes("?") || name.includes("-");
|
|
386
|
+
},
|
|
387
|
+
fallback: __alloy_js_core.code`options.${name}`,
|
|
388
|
+
children: __alloy_js_core.code`options["${name}"]`
|
|
389
|
+
}),
|
|
390
|
+
__alloy_js_core.code` = value`,
|
|
391
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
392
|
+
get when() {
|
|
393
|
+
return option.choices && option.choices.length > 0;
|
|
394
|
+
},
|
|
395
|
+
get children() {
|
|
396
|
+
return __alloy_js_core.code` as ${option.choices?.join(" | ")}`;
|
|
397
|
+
}
|
|
398
|
+
}),
|
|
399
|
+
__alloy_js_core.code`; `
|
|
400
|
+
];
|
|
345
401
|
}
|
|
346
402
|
})
|
|
347
403
|
];
|
|
@@ -354,20 +410,32 @@ function OptionsMemberParserLogic(props) {
|
|
|
354
410
|
get children() {
|
|
355
411
|
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
356
412
|
get when() {
|
|
357
|
-
return option.kind ===
|
|
413
|
+
return option.kind === require_types_command.CommandParameterKinds.string;
|
|
358
414
|
},
|
|
359
415
|
get children() {
|
|
360
|
-
return [
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
416
|
+
return [
|
|
417
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
418
|
+
get when() {
|
|
419
|
+
return name.includes("?") || name.includes("-");
|
|
420
|
+
},
|
|
421
|
+
fallback: __alloy_js_core.code`options.${name}`,
|
|
422
|
+
children: __alloy_js_core.code`options["${name}"]`
|
|
423
|
+
}),
|
|
424
|
+
__alloy_js_core.code` = args[++i].trim().replace(/^("|')/, "").replace(/("|')$/, "")`,
|
|
425
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
426
|
+
get when() {
|
|
427
|
+
return option.choices && option.choices.length > 0;
|
|
428
|
+
},
|
|
429
|
+
get children() {
|
|
430
|
+
return __alloy_js_core.code` as ${option.choices?.map((choice) => `"${choice}"`).join(" | ")}`;
|
|
431
|
+
}
|
|
432
|
+
}),
|
|
433
|
+
__alloy_js_core.code`; `
|
|
434
|
+
];
|
|
367
435
|
}
|
|
368
436
|
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
369
437
|
get when() {
|
|
370
|
-
return option.kind ===
|
|
438
|
+
return option.kind === require_types_command.CommandParameterKinds.number;
|
|
371
439
|
},
|
|
372
440
|
get children() {
|
|
373
441
|
return [
|
|
@@ -380,13 +448,25 @@ function OptionsMemberParserLogic(props) {
|
|
|
380
448
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
381
449
|
condition: `!Number.isNaN(value)`,
|
|
382
450
|
get children() {
|
|
383
|
-
return [
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
451
|
+
return [
|
|
452
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
453
|
+
get when() {
|
|
454
|
+
return name.includes("?") || name.includes("-");
|
|
455
|
+
},
|
|
456
|
+
fallback: __alloy_js_core.code`options.${name}`,
|
|
457
|
+
children: __alloy_js_core.code`options["${name}"]`
|
|
458
|
+
}),
|
|
459
|
+
__alloy_js_core.code` = value`,
|
|
460
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
461
|
+
get when() {
|
|
462
|
+
return option.choices && option.choices.length > 0;
|
|
463
|
+
},
|
|
464
|
+
get children() {
|
|
465
|
+
return __alloy_js_core.code` as ${option.choices?.join(" | ")}`;
|
|
466
|
+
}
|
|
467
|
+
}),
|
|
468
|
+
__alloy_js_core.code`; `
|
|
469
|
+
];
|
|
390
470
|
}
|
|
391
471
|
})
|
|
392
472
|
];
|
|
@@ -401,7 +481,7 @@ function OptionsMemberParserLogic(props) {
|
|
|
401
481
|
}
|
|
402
482
|
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
403
483
|
get when() {
|
|
404
|
-
return option.kind ===
|
|
484
|
+
return option.kind === require_types_command.CommandParameterKinds.boolean;
|
|
405
485
|
},
|
|
406
486
|
get children() {
|
|
407
487
|
return [
|
|
@@ -494,7 +574,7 @@ function OptionsInterfaceDeclaration(props) {
|
|
|
494
574
|
* The command options parser logic.
|
|
495
575
|
*/
|
|
496
576
|
function OptionsParserLogic(props) {
|
|
497
|
-
const { command,
|
|
577
|
+
const { command, appSpecificEnvPrefix, isCaseSensitive = false } = props;
|
|
498
578
|
const options = (0, __alloy_js_core.computed)(() => require_contexts_options.computedOptions(command));
|
|
499
579
|
return [
|
|
500
580
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
@@ -502,17 +582,17 @@ function OptionsParserLogic(props) {
|
|
|
502
582
|
name: "options",
|
|
503
583
|
get initializer() {
|
|
504
584
|
return __alloy_js_core.code` {
|
|
505
|
-
${Object.entries(options.value).map(([name, option]) => {
|
|
506
|
-
if (option.kind ===
|
|
507
|
-
else if (option.kind ===
|
|
508
|
-
else if (option.kind ===
|
|
585
|
+
${Object.entries(options.value).filter(([, option]) => option.env || option.default !== void 0 || (option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number) && option.variadic).map(([name, option]) => {
|
|
586
|
+
if (option.kind === require_types_command.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}"` : ""}, `;
|
|
587
|
+
else if (option.kind === require_types_command.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}` : ""}, `;
|
|
588
|
+
else if (option.kind === require_types_command.CommandParameterKinds.boolean) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${appSpecificEnvPrefix}_${option.env} ?? ` : ""}${option.default ? "true" : "false"},`;
|
|
509
589
|
return "";
|
|
510
590
|
}).join("")}
|
|
511
591
|
} as ${(0, __stryke_string_format_pascal_case.pascalCase)(command.name)}Options;`;
|
|
512
592
|
}
|
|
513
593
|
}),
|
|
514
594
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
515
|
-
(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`for (let i = 0; i < args.slice(${command.segments.filter((segment) =>
|
|
595
|
+
(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`for (let i = 0; i < args.slice(${command.segments.filter((segment) => require_context_helpers.isDynamicPathSegment(segment)).length}).length; i++) { `),
|
|
516
596
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
517
597
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
518
598
|
"const": true,
|
|
@@ -583,7 +663,7 @@ function OptionsParserLogic(props) {
|
|
|
583
663
|
* The command parser logic, which includes parsing dynamic path segments, positional parameters, and options.
|
|
584
664
|
*/
|
|
585
665
|
function CommandParserLogic(props) {
|
|
586
|
-
const { command,
|
|
666
|
+
const { command, appSpecificEnvPrefix, isCaseSensitive = false } = props;
|
|
587
667
|
return [
|
|
588
668
|
(0, __alloy_js_core_jsx_runtime.createComponent)(DynamicSegmentsParserLogic, {
|
|
589
669
|
command,
|
|
@@ -592,13 +672,13 @@ function CommandParserLogic(props) {
|
|
|
592
672
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
593
673
|
(0, __alloy_js_core_jsx_runtime.createComponent)(OptionsParserLogic, {
|
|
594
674
|
command,
|
|
595
|
-
|
|
675
|
+
appSpecificEnvPrefix,
|
|
596
676
|
isCaseSensitive
|
|
597
677
|
}),
|
|
598
678
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
599
679
|
(0, __alloy_js_core_jsx_runtime.createComponent)(ArgumentsParserLogic, {
|
|
600
680
|
command,
|
|
601
|
-
|
|
681
|
+
appSpecificEnvPrefix,
|
|
602
682
|
isCaseSensitive
|
|
603
683
|
}),
|
|
604
684
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|