@shell-shock/core 0.17.21 → 0.17.23
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 +16 -7
- package/dist/api.cjs +4 -5
- package/dist/api.d.cts +1 -1
- package/dist/api.d.mts +1 -1
- package/dist/api.mjs +2 -2
- package/dist/command-B6KYexlV.d.mts +308 -0
- package/dist/command-B6KYexlV.d.mts.map +1 -0
- package/dist/command-CtfR7hKM.d.cts +308 -0
- package/dist/command-CtfR7hKM.d.cts.map +1 -0
- package/dist/components/command-validation-logic.cjs +153 -216
- package/dist/components/command-validation-logic.d.cts +2 -1
- package/dist/components/command-validation-logic.d.cts.map +1 -1
- package/dist/components/command-validation-logic.d.mts +2 -1
- package/dist/components/command-validation-logic.mjs +153 -214
- package/dist/components/docs.cjs +6 -364
- package/dist/components/docs.d.cts +2 -3
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts +2 -3
- package/dist/components/docs.mjs +2 -356
- package/dist/components/exec-builtin.cjs +63 -100
- package/dist/components/exec-builtin.d.cts +1 -2
- package/dist/components/exec-builtin.d.cts.map +1 -1
- package/dist/components/exec-builtin.d.mts +1 -2
- package/dist/components/exec-builtin.mjs +7 -41
- package/dist/components/helpers.cjs +2 -52
- package/dist/components/helpers.d.cts +2 -1
- package/dist/components/helpers.d.cts.map +1 -1
- package/dist/components/helpers.d.mts +2 -1
- package/dist/components/helpers.mjs +2 -50
- package/dist/components/index.cjs +7 -23
- package/dist/components/index.mjs +9 -9
- package/dist/components/options-parser-logic.cjs +198 -420
- package/dist/components/options-parser-logic.d.cts +2 -5
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts +2 -5
- package/dist/components/options-parser-logic.mjs +192 -407
- package/dist/components/state-builtin.cjs +106 -164
- package/dist/components/state-builtin.d.cts +1 -2
- package/dist/components/state-builtin.d.cts.map +1 -1
- package/dist/components/state-builtin.d.mts +1 -2
- package/dist/components/state-builtin.mjs +12 -68
- package/dist/components/usage.cjs +4 -48
- package/dist/components/usage.d.cts +1 -2
- package/dist/components/usage.d.cts.map +1 -1
- package/dist/components/usage.d.mts +1 -2
- package/dist/components/usage.mjs +4 -46
- package/dist/components/utils-builtin.cjs +77 -144
- package/dist/components/utils-builtin.d.cts +1 -2
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts +1 -2
- package/dist/components/utils-builtin.mjs +9 -74
- package/dist/config-BIF9mEz0.d.cts +157 -0
- package/dist/config-BIF9mEz0.d.cts.map +1 -0
- package/dist/config-CnNYdfsL.d.mts +157 -0
- package/dist/config-CnNYdfsL.d.mts.map +1 -0
- package/dist/config.cjs +24 -58
- package/dist/config.d.cts +1 -2
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +1 -2
- package/dist/config.mjs +23 -55
- package/dist/{plugin-utils/context-helpers.mjs → context-helpers-D3EJxwbq.mjs} +5 -83
- package/dist/context-helpers-D3EJxwbq.mjs.map +1 -0
- package/dist/{plugin-utils/context-helpers.cjs → context-helpers-_wUuFRB8.cjs} +63 -92
- package/dist/contexts/command.cjs +3 -9
- package/dist/contexts/command.d.cts +1 -2
- package/dist/contexts/command.d.cts.map +1 -1
- package/dist/contexts/command.d.mts +1 -2
- package/dist/contexts/command.mjs +2 -7
- package/dist/contexts/index.cjs +19 -1
- package/dist/contexts/index.d.cts +2 -1
- package/dist/contexts/index.d.mts +2 -1
- package/dist/contexts/index.mjs +2 -1
- package/dist/contexts/options.cjs +7 -30
- package/dist/contexts/options.d.cts +1 -2
- package/dist/contexts/options.d.cts.map +1 -1
- package/dist/contexts/options.d.mts +1 -2
- package/dist/contexts/options.mjs +7 -27
- package/dist/contexts/power-plant.cjs +19 -0
- package/dist/contexts/power-plant.d.cts +2 -0
- package/dist/contexts/power-plant.d.mts +2 -0
- package/dist/contexts/power-plant.mjs +5 -0
- package/dist/docs-C6ZvsVMu.cjs +278 -0
- package/dist/docs-CGQ2HtEY.mjs +249 -0
- package/dist/docs-CGQ2HtEY.mjs.map +1 -0
- package/dist/engine.cjs +5 -39
- package/dist/engine.d.cts +1 -2
- package/dist/engine.d.cts.map +1 -1
- package/dist/engine.d.mts +1 -2
- package/dist/engine.mjs +4 -37
- package/dist/generator.cjs +68 -0
- package/dist/generator.d.cts +15 -0
- package/dist/generator.d.cts.map +1 -0
- package/dist/generator.d.mts +15 -0
- package/dist/generator.d.mts.map +1 -0
- package/dist/generator.mjs +66 -0
- package/dist/generator.mjs.map +1 -0
- package/dist/{helpers/get-framework.cjs → get-framework-CxZc2krd.cjs} +7 -8
- package/dist/{helpers/get-framework.mjs → get-framework-Dlqz2hVZ.mjs} +3 -8
- package/dist/get-framework-Dlqz2hVZ.mjs.map +1 -0
- package/dist/helpers/power-plant.cjs +102 -0
- package/dist/helpers/power-plant.d.cts +61 -0
- package/dist/helpers/power-plant.d.cts.map +1 -0
- package/dist/helpers/power-plant.d.mts +61 -0
- package/dist/helpers/power-plant.d.mts.map +1 -0
- package/dist/helpers/power-plant.mjs +99 -0
- package/dist/helpers/power-plant.mjs.map +1 -0
- package/dist/index-D4klH_pj.d.mts +2 -0
- package/dist/index-DYOBadKY.d.cts +2 -0
- package/dist/index.cjs +1 -37
- package/dist/index.d.cts +4 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -6
- package/dist/index.mjs +0 -35
- package/dist/package-B7Vu265G.mjs +6 -0
- package/dist/package-B7Vu265G.mjs.map +1 -0
- package/dist/{package.cjs → package-BLC4qc8t.cjs} +2 -4
- package/dist/plugin-B-hM2twc.mjs +1458 -0
- package/dist/plugin-B-hM2twc.mjs.map +1 -0
- package/dist/plugin-Bhfq0DMC.cjs +1490 -0
- package/dist/plugin-utils/index.cjs +359 -26
- package/dist/plugin-utils/index.d.cts +273 -9
- package/dist/plugin-utils/index.d.cts.map +1 -0
- package/dist/plugin-utils/index.d.mts +273 -9
- package/dist/plugin-utils/index.d.mts.map +1 -0
- package/dist/plugin-utils/index.mjs +346 -10
- package/dist/plugin-utils/index.mjs.map +1 -0
- package/dist/plugin.cjs +3 -496
- package/dist/plugin.d.cts +1 -3
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +1 -3
- package/dist/plugin.mjs +2 -491
- package/dist/power-plant-LgxcvlMN.d.cts +4 -0
- package/dist/power-plant-LgxcvlMN.d.mts +4 -0
- package/dist/reflect-CSiffeL9.cjs +27 -0
- package/dist/reflect-DXKSFgvS.mjs +23 -0
- package/dist/reflect-DXKSFgvS.mjs.map +1 -0
- package/dist/schemas/env.cjs +91 -0
- package/dist/schemas/env.d.cts +145 -0
- package/dist/schemas/env.d.cts.map +1 -0
- package/dist/schemas/env.d.mts +145 -0
- package/dist/{types → schemas}/env.d.mts.map +1 -1
- package/dist/schemas/env.mjs +91 -0
- package/dist/schemas/index.cjs +4 -0
- package/dist/schemas/index.d.cts +2 -0
- package/dist/schemas/index.d.mts +2 -0
- package/dist/schemas/index.mjs +3 -0
- package/dist/types/command.cjs +0 -402
- package/dist/types/command.d.cts +2 -309
- package/dist/types/command.d.mts +2 -309
- package/dist/types/command.mjs +1 -368
- package/dist/types/config.cjs +0 -175
- package/dist/types/config.d.cts +2 -126
- package/dist/types/config.d.mts +2 -126
- package/dist/types/config.mjs +1 -164
- package/dist/types/context.cjs +0 -45
- package/dist/types/context.d.cts +2 -31
- package/dist/types/context.d.mts +2 -31
- package/dist/types/context.mjs +1 -41
- package/dist/types/index.cjs +3 -53
- package/dist/types/index.d.cts +4 -5
- package/dist/types/index.d.mts +4 -5
- package/dist/types/index.mjs +4 -5
- package/package.json +106 -42
- package/dist/_virtual/_rolldown/runtime.cjs +0 -29
- package/dist/api.cjs.map +0 -1
- package/dist/components/command-validation-logic.cjs.map +0 -1
- package/dist/components/docs.cjs.map +0 -1
- package/dist/components/docs.mjs.map +0 -1
- package/dist/components/exec-builtin.cjs.map +0 -1
- package/dist/components/helpers.cjs.map +0 -1
- package/dist/components/options-parser-logic.cjs.map +0 -1
- package/dist/components/state-builtin.cjs.map +0 -1
- package/dist/components/usage.cjs.map +0 -1
- package/dist/components/utils-builtin.cjs.map +0 -1
- package/dist/config.cjs.map +0 -1
- package/dist/contexts/command.cjs.map +0 -1
- package/dist/contexts/options.cjs.map +0 -1
- package/dist/engine.cjs.map +0 -1
- package/dist/helpers/automd.cjs +0 -193
- package/dist/helpers/automd.cjs.map +0 -1
- package/dist/helpers/automd.mjs +0 -190
- package/dist/helpers/automd.mjs.map +0 -1
- package/dist/helpers/docs-helpers.cjs +0 -24
- package/dist/helpers/docs-helpers.cjs.map +0 -1
- package/dist/helpers/docs-helpers.mjs +0 -24
- package/dist/helpers/docs-helpers.mjs.map +0 -1
- package/dist/helpers/get-framework.cjs.map +0 -1
- package/dist/helpers/get-framework.mjs.map +0 -1
- package/dist/helpers/paths.cjs +0 -137
- package/dist/helpers/paths.cjs.map +0 -1
- package/dist/helpers/paths.mjs +0 -134
- package/dist/helpers/paths.mjs.map +0 -1
- package/dist/helpers/persistence.cjs +0 -114
- package/dist/helpers/persistence.cjs.map +0 -1
- package/dist/helpers/persistence.mjs +0 -113
- package/dist/helpers/persistence.mjs.map +0 -1
- package/dist/helpers/update-package-json.cjs +0 -65
- package/dist/helpers/update-package-json.cjs.map +0 -1
- package/dist/helpers/update-package-json.mjs +0 -64
- package/dist/helpers/update-package-json.mjs.map +0 -1
- package/dist/helpers/utilities.cjs +0 -95
- package/dist/helpers/utilities.cjs.map +0 -1
- package/dist/helpers/utilities.mjs +0 -94
- package/dist/helpers/utilities.mjs.map +0 -1
- package/dist/helpers/validations.cjs +0 -71
- package/dist/helpers/validations.cjs.map +0 -1
- package/dist/helpers/validations.mjs +0 -70
- package/dist/helpers/validations.mjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/package.cjs.map +0 -1
- package/dist/package.mjs +0 -6
- package/dist/package.mjs.map +0 -1
- package/dist/plugin-utils/compute-bin.cjs +0 -49
- package/dist/plugin-utils/compute-bin.cjs.map +0 -1
- package/dist/plugin-utils/compute-bin.d.cts +0 -13
- package/dist/plugin-utils/compute-bin.d.cts.map +0 -1
- package/dist/plugin-utils/compute-bin.d.mts +0 -13
- package/dist/plugin-utils/compute-bin.d.mts.map +0 -1
- package/dist/plugin-utils/compute-bin.mjs +0 -49
- package/dist/plugin-utils/compute-bin.mjs.map +0 -1
- package/dist/plugin-utils/context-helpers.cjs.map +0 -1
- package/dist/plugin-utils/context-helpers.d.cts +0 -106
- package/dist/plugin-utils/context-helpers.d.cts.map +0 -1
- package/dist/plugin-utils/context-helpers.d.mts +0 -106
- package/dist/plugin-utils/context-helpers.d.mts.map +0 -1
- package/dist/plugin-utils/context-helpers.mjs.map +0 -1
- package/dist/plugin-utils/deepkit.cjs +0 -70
- package/dist/plugin-utils/deepkit.cjs.map +0 -1
- package/dist/plugin-utils/deepkit.d.cts +0 -23
- package/dist/plugin-utils/deepkit.d.cts.map +0 -1
- package/dist/plugin-utils/deepkit.d.mts +0 -23
- package/dist/plugin-utils/deepkit.d.mts.map +0 -1
- package/dist/plugin-utils/deepkit.mjs +0 -69
- package/dist/plugin-utils/deepkit.mjs.map +0 -1
- package/dist/plugin-utils/description-helpers.cjs +0 -112
- package/dist/plugin-utils/description-helpers.cjs.map +0 -1
- package/dist/plugin-utils/description-helpers.d.cts +0 -44
- package/dist/plugin-utils/description-helpers.d.cts.map +0 -1
- package/dist/plugin-utils/description-helpers.d.mts +0 -44
- package/dist/plugin-utils/description-helpers.d.mts.map +0 -1
- package/dist/plugin-utils/description-helpers.mjs +0 -108
- package/dist/plugin-utils/description-helpers.mjs.map +0 -1
- package/dist/plugin-utils/get-command-tree.cjs +0 -118
- package/dist/plugin-utils/get-command-tree.cjs.map +0 -1
- package/dist/plugin-utils/get-command-tree.d.cts +0 -36
- package/dist/plugin-utils/get-command-tree.d.cts.map +0 -1
- package/dist/plugin-utils/get-command-tree.d.mts +0 -36
- package/dist/plugin-utils/get-command-tree.d.mts.map +0 -1
- package/dist/plugin-utils/get-command-tree.mjs +0 -115
- package/dist/plugin-utils/get-command-tree.mjs.map +0 -1
- package/dist/plugin-utils/reflect.cjs +0 -54
- package/dist/plugin-utils/reflect.cjs.map +0 -1
- package/dist/plugin-utils/reflect.d.cts +0 -14
- package/dist/plugin-utils/reflect.d.cts.map +0 -1
- package/dist/plugin-utils/reflect.d.mts +0 -14
- package/dist/plugin-utils/reflect.d.mts.map +0 -1
- package/dist/plugin-utils/reflect.mjs +0 -53
- package/dist/plugin-utils/reflect.mjs.map +0 -1
- package/dist/plugin-utils/traverse-command-tree.cjs +0 -65
- package/dist/plugin-utils/traverse-command-tree.cjs.map +0 -1
- package/dist/plugin-utils/traverse-command-tree.d.cts +0 -22
- package/dist/plugin-utils/traverse-command-tree.d.cts.map +0 -1
- package/dist/plugin-utils/traverse-command-tree.d.mts +0 -22
- package/dist/plugin-utils/traverse-command-tree.d.mts.map +0 -1
- package/dist/plugin-utils/traverse-command-tree.mjs +0 -63
- package/dist/plugin-utils/traverse-command-tree.mjs.map +0 -1
- package/dist/plugin-utils/type-checks.cjs +0 -222
- package/dist/plugin-utils/type-checks.cjs.map +0 -1
- package/dist/plugin-utils/type-checks.d.cts +0 -41
- package/dist/plugin-utils/type-checks.d.cts.map +0 -1
- package/dist/plugin-utils/type-checks.d.mts +0 -41
- package/dist/plugin-utils/type-checks.d.mts.map +0 -1
- package/dist/plugin-utils/type-checks.mjs +0 -218
- package/dist/plugin-utils/type-checks.mjs.map +0 -1
- package/dist/plugin.cjs.map +0 -1
- package/dist/plugin.mjs.map +0 -1
- package/dist/resolver/deepkit.cjs +0 -110
- package/dist/resolver/deepkit.cjs.map +0 -1
- package/dist/resolver/deepkit.mjs +0 -109
- package/dist/resolver/deepkit.mjs.map +0 -1
- package/dist/resolver/helpers.cjs +0 -184
- package/dist/resolver/helpers.cjs.map +0 -1
- package/dist/resolver/helpers.mjs +0 -180
- package/dist/resolver/helpers.mjs.map +0 -1
- package/dist/resolver/resolve.cjs +0 -473
- package/dist/resolver/resolve.cjs.map +0 -1
- package/dist/resolver/resolve.mjs +0 -473
- package/dist/resolver/resolve.mjs.map +0 -1
- package/dist/types/command.cjs.map +0 -1
- package/dist/types/command.d.cts.map +0 -1
- package/dist/types/command.d.mts.map +0 -1
- package/dist/types/command.mjs.map +0 -1
- package/dist/types/config.cjs.map +0 -1
- package/dist/types/config.d.cts.map +0 -1
- package/dist/types/config.d.mts.map +0 -1
- package/dist/types/config.mjs.map +0 -1
- package/dist/types/context.cjs.map +0 -1
- package/dist/types/context.d.cts.map +0 -1
- package/dist/types/context.d.mts.map +0 -1
- package/dist/types/context.mjs.map +0 -1
- package/dist/types/env.cjs +0 -53
- package/dist/types/env.cjs.map +0 -1
- package/dist/types/env.d.cts +0 -71
- package/dist/types/env.d.cts.map +0 -1
- package/dist/types/env.d.mts +0 -71
- package/dist/types/env.mjs +0 -51
- /package/dist/{types → schemas}/env.mjs.map +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_context_helpers = require('../
|
|
2
|
+
const require_context_helpers = require('../context-helpers-_wUuFRB8.cjs');
|
|
3
3
|
const require_contexts_options = require('../contexts/options.cjs');
|
|
4
4
|
const require_components_helpers = require('./helpers.cjs');
|
|
5
5
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
@@ -7,81 +7,44 @@ let _alloy_js_core = require("@alloy-js/core");
|
|
|
7
7
|
let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
8
8
|
let _stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
|
|
9
9
|
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
10
|
-
let
|
|
10
|
+
let _power_plant_alloy_js_core_components_spacing = require("@power-plant/alloy-js/core/components/spacing");
|
|
11
11
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
12
12
|
let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
13
13
|
|
|
14
14
|
//#region src/components/options-parser-logic.tsx
|
|
15
|
-
function __assignType(fn, args) {
|
|
16
|
-
fn.__type = args;
|
|
17
|
-
return fn;
|
|
18
|
-
}
|
|
19
|
-
const __ΩDynamicSegmentsParserLogicProps = [
|
|
20
|
-
"CommandTree",
|
|
21
|
-
"command",
|
|
22
|
-
"The command to generate the dynamic path segments parser logic for. This is used to access the command options and parameters when generating the parser logic for dynamic path segments.",
|
|
23
|
-
"isCaseSensitive",
|
|
24
|
-
"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.",
|
|
25
|
-
"DynamicSegmentsParserLogicProps",
|
|
26
|
-
"P\"w!4\"?#)4$?%Mw&y"
|
|
27
|
-
];
|
|
28
15
|
function DynamicSegmentsParserLogic(props) {
|
|
29
16
|
const { command } = props;
|
|
30
17
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
31
18
|
get each() {
|
|
32
19
|
return command.segments ?? [];
|
|
33
20
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}), [
|
|
60
|
-
"segment",
|
|
61
|
-
"index",
|
|
62
|
-
"",
|
|
63
|
-
"P\"2!\"2\"\"/#"
|
|
64
|
-
]);
|
|
65
|
-
}
|
|
21
|
+
children: (segment, index) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
22
|
+
get when() {
|
|
23
|
+
return require_context_helpers.isDynamicPathSegment(segment);
|
|
24
|
+
},
|
|
25
|
+
get children() {
|
|
26
|
+
return [
|
|
27
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
28
|
+
"let": true,
|
|
29
|
+
get name() {
|
|
30
|
+
return (0, _stryke_string_format_camel_case.camelCase)(require_context_helpers.getDynamicPathSegmentName(segment));
|
|
31
|
+
},
|
|
32
|
+
type: "string | undefined"
|
|
33
|
+
}),
|
|
34
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
35
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
36
|
+
condition: _alloy_js_core.code`args.length > ${2 + index} && args[${2 + index}]`,
|
|
37
|
+
get children() {
|
|
38
|
+
return _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(require_context_helpers.getDynamicPathSegmentName(segment))} = args[${2 + index}];`;
|
|
39
|
+
}
|
|
40
|
+
}),
|
|
41
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
42
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
})
|
|
66
46
|
});
|
|
67
47
|
}
|
|
68
|
-
DynamicSegmentsParserLogic.__type = [
|
|
69
|
-
() => __ΩDynamicSegmentsParserLogicProps,
|
|
70
|
-
"props",
|
|
71
|
-
"DynamicSegmentsParserLogic",
|
|
72
|
-
"Pn!2\"\"/#"
|
|
73
|
-
];
|
|
74
|
-
const __ΩArgumentsParserLogicProps = [
|
|
75
|
-
"CommandTree",
|
|
76
|
-
"command",
|
|
77
|
-
"The command to generate the positional parameters parser logic for.",
|
|
78
|
-
"appSpecificEnvPrefix",
|
|
79
|
-
"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`).",
|
|
80
|
-
"isCaseSensitive",
|
|
81
|
-
"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.",
|
|
82
|
-
"ArgumentsParserLogicProps",
|
|
83
|
-
"P\"w!4\"?#&4$?%)4&?'Mw(y"
|
|
84
|
-
];
|
|
85
48
|
function ArgumentsParserLogic(props) {
|
|
86
49
|
const { command, appSpecificEnvPrefix, isCaseSensitive } = props;
|
|
87
50
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
@@ -95,170 +58,137 @@ function ArgumentsParserLogic(props) {
|
|
|
95
58
|
name: "optionsIndex",
|
|
96
59
|
type: "number",
|
|
97
60
|
get initializer() {
|
|
98
|
-
return _alloy_js_core.code`Math.max(0, args.slice(${command.segments.length + 1}).findIndex(arg => arg.startsWith("-") && /^(${Object.values(command.options ?? {}).map(
|
|
99
|
-
"a",
|
|
100
|
-
"",
|
|
101
|
-
"P\"2!\"/\""
|
|
102
|
-
])).join("|")}`, [
|
|
103
|
-
"option",
|
|
104
|
-
"",
|
|
105
|
-
"P\"2!\"/\""
|
|
106
|
-
])).join("|")})=?.*$/.test(arg${isCaseSensitive ? "" : ".toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"}))) + ${command.segments.length + 1};`;
|
|
61
|
+
return _alloy_js_core.code`Math.max(0, args.slice(${command.segments.length + 1}).findIndex(arg => arg.startsWith("-") && /^(${Object.values(command.options ?? {}).map((option) => `${isCaseSensitive || option.name.length === 1 ? option.name : option.name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}${option.alias && option.alias.length > 0 ? "|" : ""}${option.alias?.map((a) => (isCaseSensitive || option.name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", "")) === "?" ? "\\?" : isCaseSensitive || option.name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", "")).join("|")}`).join("|")})=?.*$/.test(arg${isCaseSensitive ? "" : ".toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"}))) + ${command.segments.length + 1};`;
|
|
107
62
|
}
|
|
108
63
|
}),
|
|
109
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
64
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
110
65
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
111
66
|
"let": true,
|
|
112
67
|
name: "argsIndex",
|
|
113
68
|
type: "number",
|
|
114
69
|
get initializer() {
|
|
115
|
-
return _alloy_js_core.code`optionsIndex > ${command.segments.length + 1} ? ${command.segments.length + 1} : (Math.max(0, args.slice(optionsIndex).findLastIndex(arg => arg.startsWith("-") && /^(${Object.values(command.options ?? {}).map(
|
|
116
|
-
"a",
|
|
117
|
-
"",
|
|
118
|
-
"P\"2!\"/\""
|
|
119
|
-
])).join("|")}`, [
|
|
120
|
-
"option",
|
|
121
|
-
"",
|
|
122
|
-
"P\"2!\"/\""
|
|
123
|
-
])).join("|")})=?.*$/.test(arg${isCaseSensitive ? "" : ".toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"}))) + ${command.segments.length + 1});`;
|
|
70
|
+
return _alloy_js_core.code`optionsIndex > ${command.segments.length + 1} ? ${command.segments.length + 1} : (Math.max(0, args.slice(optionsIndex).findLastIndex(arg => arg.startsWith("-") && /^(${Object.values(command.options ?? {}).map((option) => `${isCaseSensitive || option.name.length === 1 ? option.name : option.name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}${option.alias && option.alias.length > 0 ? "|" : ""}${option.alias?.map((a) => (isCaseSensitive || option.name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", "")) === "?" ? "\\?" : isCaseSensitive || option.name.length === 1 ? a : a.toLowerCase().replaceAll("-", "").replaceAll("_", "")).join("|")}`).join("|")})=?.*$/.test(arg${isCaseSensitive ? "" : ".toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"}))) + ${command.segments.length + 1});`;
|
|
124
71
|
}
|
|
125
72
|
}),
|
|
126
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
73
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
127
74
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
128
75
|
get each() {
|
|
129
76
|
return command.args ?? [];
|
|
130
77
|
},
|
|
131
78
|
hardline: true,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
79
|
+
children: (arg, index) => [
|
|
80
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
81
|
+
get when() {
|
|
82
|
+
return (0, _stryke_type_checks_is_set_string.isSetString)(arg.env) || arg.default !== void 0 || arg.variadic;
|
|
83
|
+
},
|
|
84
|
+
get fallback() {
|
|
85
|
+
return [
|
|
86
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`let ${(0, _stryke_string_format_camel_case.camelCase)(arg.name)}!: `),
|
|
87
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: arg }),
|
|
88
|
+
_alloy_js_core.code`; `
|
|
89
|
+
];
|
|
90
|
+
},
|
|
91
|
+
get children() {
|
|
92
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
93
|
+
"let": true,
|
|
94
|
+
get name() {
|
|
95
|
+
return (0, _stryke_string_format_camel_case.camelCase)(arg.name);
|
|
96
|
+
},
|
|
97
|
+
get type() {
|
|
98
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: arg });
|
|
99
|
+
},
|
|
100
|
+
get initializer() {
|
|
101
|
+
return [
|
|
102
|
+
_alloy_js_core.code` ( `,
|
|
103
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
104
|
+
get when() {
|
|
105
|
+
return (0, _stryke_type_checks_is_set_string.isSetString)(arg.env);
|
|
106
|
+
},
|
|
107
|
+
get children() {
|
|
108
|
+
return _alloy_js_core.code`env.${appSpecificEnvPrefix}_${(0, _stryke_string_format_constant_case.constantCase)(String(arg.env))} ?? `;
|
|
109
|
+
}
|
|
110
|
+
}),
|
|
111
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
112
|
+
get when() {
|
|
113
|
+
return arg.default !== void 0 && (!arg.variadic || arg.default.length > 0);
|
|
114
|
+
},
|
|
115
|
+
get fallback() {
|
|
116
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
117
|
+
get when() {
|
|
118
|
+
return arg.variadic;
|
|
119
|
+
},
|
|
120
|
+
fallback: _alloy_js_core.code`undefined`,
|
|
121
|
+
children: _alloy_js_core.code`[]`
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
get children() {
|
|
125
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
126
|
+
get when() {
|
|
127
|
+
return arg.variadic;
|
|
128
|
+
},
|
|
129
|
+
get fallback() {
|
|
130
|
+
return arg.type === "string" ? _alloy_js_core.code`"${arg.default}"` : _alloy_js_core.code`${arg.default}`;
|
|
131
|
+
},
|
|
132
|
+
get children() {
|
|
133
|
+
return _alloy_js_core.code`[${arg.default?.map((value) => arg.type === "string" ? `"${value}"` : value).join(", ")}]`;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}),
|
|
138
|
+
_alloy_js_core.code`) as `,
|
|
139
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: arg }),
|
|
140
|
+
_alloy_js_core.code`; `
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}),
|
|
146
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
147
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
148
|
+
condition: _alloy_js_core.code`argsIndex + ${index} < args.length && argsIndex + ${index} !== optionsIndex`,
|
|
149
|
+
get children() {
|
|
150
|
+
return [
|
|
151
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = `),
|
|
152
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
153
|
+
get when() {
|
|
154
|
+
return arg.type === "string" || arg.type === "number";
|
|
150
155
|
},
|
|
151
|
-
get
|
|
152
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.
|
|
156
|
+
get fallback() {
|
|
157
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.BooleanInputParserLogic, { name: `args[argsIndex + ${index}] ` });
|
|
153
158
|
},
|
|
154
|
-
get
|
|
155
|
-
return
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
return arg.variadic;
|
|
173
|
-
},
|
|
174
|
-
fallback: _alloy_js_core.code`undefined`,
|
|
175
|
-
children: _alloy_js_core.code`[]`
|
|
176
|
-
});
|
|
177
|
-
},
|
|
178
|
-
get children() {
|
|
179
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
180
|
-
get when() {
|
|
181
|
-
return arg.variadic;
|
|
182
|
-
},
|
|
183
|
-
get fallback() {
|
|
184
|
-
return arg.type === "string" ? _alloy_js_core.code`"${arg.default}"` : _alloy_js_core.code`${arg.default}`;
|
|
185
|
-
},
|
|
186
|
-
get children() {
|
|
187
|
-
return _alloy_js_core.code`[${arg.default?.map(__assignType((value) => arg.type === "string" ? `"${value}"` : value, [
|
|
188
|
-
"value",
|
|
189
|
-
"",
|
|
190
|
-
"P\"2!\"/\""
|
|
191
|
-
])).join(", ")}]`;
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
}),
|
|
196
|
-
_alloy_js_core.code`) as `,
|
|
197
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: arg }),
|
|
198
|
-
_alloy_js_core.code`; `
|
|
199
|
-
];
|
|
159
|
+
get children() {
|
|
160
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
161
|
+
get when() {
|
|
162
|
+
return arg.variadic;
|
|
163
|
+
},
|
|
164
|
+
get fallback() {
|
|
165
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
166
|
+
get when() {
|
|
167
|
+
return arg.type === "number";
|
|
168
|
+
},
|
|
169
|
+
fallback: _alloy_js_core.code`args[argsIndex + ${index}] `,
|
|
170
|
+
children: _alloy_js_core.code`Number(args[argsIndex + ${index}]) `
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
get children() {
|
|
174
|
+
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)`;
|
|
175
|
+
}
|
|
176
|
+
});
|
|
200
177
|
}
|
|
201
|
-
})
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
211
|
-
get when() {
|
|
212
|
-
return arg.type === "string" || arg.type === "number";
|
|
213
|
-
},
|
|
214
|
-
get fallback() {
|
|
215
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.BooleanInputParserLogic, { name: `args[argsIndex + ${index}] ` });
|
|
216
|
-
},
|
|
217
|
-
get children() {
|
|
218
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
219
|
-
get when() {
|
|
220
|
-
return arg.variadic;
|
|
221
|
-
},
|
|
222
|
-
get fallback() {
|
|
223
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
224
|
-
get when() {
|
|
225
|
-
return arg.type === "number";
|
|
226
|
-
},
|
|
227
|
-
fallback: _alloy_js_core.code`args[argsIndex + ${index}] `,
|
|
228
|
-
children: _alloy_js_core.code`Number(args[argsIndex + ${index}]) `
|
|
229
|
-
});
|
|
230
|
-
},
|
|
231
|
-
get children() {
|
|
232
|
-
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)`;
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
}),
|
|
237
|
-
_alloy_js_core.code` as `,
|
|
238
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: arg }),
|
|
239
|
-
_alloy_js_core.code`; `
|
|
240
|
-
];
|
|
241
|
-
}
|
|
242
|
-
}),
|
|
243
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
244
|
-
], [
|
|
245
|
-
"arg",
|
|
246
|
-
"index",
|
|
247
|
-
"",
|
|
248
|
-
"P\"2!\"2\"\"/#"
|
|
249
|
-
]);
|
|
250
|
-
}
|
|
178
|
+
}),
|
|
179
|
+
_alloy_js_core.code` as `,
|
|
180
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: arg }),
|
|
181
|
+
_alloy_js_core.code`; `
|
|
182
|
+
];
|
|
183
|
+
}
|
|
184
|
+
}),
|
|
185
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {})
|
|
186
|
+
]
|
|
251
187
|
})
|
|
252
188
|
];
|
|
253
189
|
}
|
|
254
190
|
});
|
|
255
191
|
}
|
|
256
|
-
ArgumentsParserLogic.__type = [
|
|
257
|
-
() => __ΩArgumentsParserLogicProps,
|
|
258
|
-
"props",
|
|
259
|
-
"ArgumentsParserLogic",
|
|
260
|
-
"Pn!2\"\"/#"
|
|
261
|
-
];
|
|
262
192
|
/**
|
|
263
193
|
* The command option interface property.
|
|
264
194
|
*/
|
|
@@ -331,36 +261,12 @@ function OptionsMember({ option }) {
|
|
|
331
261
|
}
|
|
332
262
|
})];
|
|
333
263
|
}
|
|
334
|
-
OptionsMember.__type = [
|
|
335
|
-
"CommandOption",
|
|
336
|
-
"option",
|
|
337
|
-
"param0",
|
|
338
|
-
"OptionsMember",
|
|
339
|
-
"The command option interface property.",
|
|
340
|
-
"PP\"w!4\"M2#\"/$?%"
|
|
341
|
-
];
|
|
342
|
-
const __ΩOptionsMemberParserLogicProps = [
|
|
343
|
-
"name",
|
|
344
|
-
"The option name to generate the parser logic for.",
|
|
345
|
-
"CommandOption",
|
|
346
|
-
"option",
|
|
347
|
-
"The command option to generate the parser logic for.",
|
|
348
|
-
"isCaseSensitive",
|
|
349
|
-
true,
|
|
350
|
-
"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.",
|
|
351
|
-
"OptionsMemberParserLogicProps",
|
|
352
|
-
"P&4!?\"\"w#4$?%)4&>'?(Mw)y"
|
|
353
|
-
];
|
|
354
264
|
/**
|
|
355
265
|
* The command option property parser logic.
|
|
356
266
|
*/
|
|
357
267
|
function OptionsMemberParserLogic(props) {
|
|
358
268
|
const { name, option, isCaseSensitive } = props;
|
|
359
|
-
const equalsRegex = `/^--?(${isCaseSensitive || name.length === 1 ? name : name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}${option.alias && option.alias.length > 0 ? "|" : ""}${option.alias?.map(
|
|
360
|
-
"a",
|
|
361
|
-
"",
|
|
362
|
-
"P\"2!\"/\""
|
|
363
|
-
])).join("|")})=/`;
|
|
269
|
+
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("|")})=/`;
|
|
364
270
|
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
365
271
|
get when() {
|
|
366
272
|
return option.type === "string" || option.type === "number";
|
|
@@ -408,11 +314,7 @@ function OptionsMemberParserLogic(props) {
|
|
|
408
314
|
return (option.type === "string" || option.type === "number") && option.choices && option.choices.length > 0;
|
|
409
315
|
},
|
|
410
316
|
get children() {
|
|
411
|
-
return _alloy_js_core.code` as ${option.choices?.map(
|
|
412
|
-
"choice",
|
|
413
|
-
"",
|
|
414
|
-
"P\"2!\"/\""
|
|
415
|
-
])).join(" | ")} `;
|
|
317
|
+
return _alloy_js_core.code` as ${option.choices?.map((choice) => (0, _stryke_type_checks_is_set_string.isSetString)(choice) ? `"${choice}"` : choice).join(" | ")} `;
|
|
416
318
|
}
|
|
417
319
|
}),
|
|
418
320
|
_alloy_js_core.code`); `
|
|
@@ -447,11 +349,7 @@ function OptionsMemberParserLogic(props) {
|
|
|
447
349
|
return (option.type === "string" || option.type === "number") && option.choices && option.choices.length > 0;
|
|
448
350
|
},
|
|
449
351
|
get children() {
|
|
450
|
-
return _alloy_js_core.code` as ${option.choices?.map(
|
|
451
|
-
"choice",
|
|
452
|
-
"",
|
|
453
|
-
"P\"2!\"/\""
|
|
454
|
-
])).join(" | ")} `;
|
|
352
|
+
return _alloy_js_core.code` as ${option.choices?.map((choice) => (0, _stryke_type_checks_is_set_string.isSetString)(choice) ? `"${choice}"` : choice).join(" | ")} `;
|
|
455
353
|
}
|
|
456
354
|
}),
|
|
457
355
|
_alloy_js_core.code`); `
|
|
@@ -488,11 +386,7 @@ function OptionsMemberParserLogic(props) {
|
|
|
488
386
|
return option.choices && option.choices.length > 0;
|
|
489
387
|
},
|
|
490
388
|
get children() {
|
|
491
|
-
return _alloy_js_core.code` as ${option.choices?.map(
|
|
492
|
-
"choice",
|
|
493
|
-
"",
|
|
494
|
-
"P\"2!\"/\""
|
|
495
|
-
])).join(" | ")}`;
|
|
389
|
+
return _alloy_js_core.code` as ${option.choices?.map((choice) => `"${choice}"`).join(" | ")}`;
|
|
496
390
|
}
|
|
497
391
|
}),
|
|
498
392
|
_alloy_js_core.code`; `
|
|
@@ -561,11 +455,7 @@ function OptionsMemberParserLogic(props) {
|
|
|
561
455
|
return option.choices && option.choices.length > 0;
|
|
562
456
|
},
|
|
563
457
|
get children() {
|
|
564
|
-
return _alloy_js_core.code` as ${option.choices?.map(
|
|
565
|
-
"choice",
|
|
566
|
-
"",
|
|
567
|
-
"P\"2!\"/\""
|
|
568
|
-
])).join(" | ")}`;
|
|
458
|
+
return _alloy_js_core.code` as ${option.choices?.map((choice) => `"${choice}"`).join(" | ")}`;
|
|
569
459
|
}
|
|
570
460
|
}),
|
|
571
461
|
_alloy_js_core.code`; `
|
|
@@ -675,24 +565,6 @@ function OptionsMemberParserLogic(props) {
|
|
|
675
565
|
}
|
|
676
566
|
})];
|
|
677
567
|
}
|
|
678
|
-
OptionsMemberParserLogic.__type = [
|
|
679
|
-
() => __ΩOptionsMemberParserLogicProps,
|
|
680
|
-
"props",
|
|
681
|
-
"OptionsMemberParserLogic",
|
|
682
|
-
"The command option property parser logic.",
|
|
683
|
-
"Pn!2\"\"/#?$"
|
|
684
|
-
];
|
|
685
|
-
const __ΩOptionsMemberParserConditionProps = [
|
|
686
|
-
"name",
|
|
687
|
-
"The option name to generate the parser logic for.",
|
|
688
|
-
"alias",
|
|
689
|
-
"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.",
|
|
690
|
-
"isCaseSensitive",
|
|
691
|
-
true,
|
|
692
|
-
"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.",
|
|
693
|
-
"OptionsMemberParserConditionProps",
|
|
694
|
-
"P&4!?\"&F4#8?$)4%>&?'Mw(y"
|
|
695
|
-
];
|
|
696
568
|
function OptionsMemberParserCondition(props) {
|
|
697
569
|
const { name, alias: aliasProp, isCaseSensitive } = props;
|
|
698
570
|
return [(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`${isCaseSensitive ? "arg.startsWith(\"--" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\").startsWith(\""}${isCaseSensitive ? name : name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}=") || ${isCaseSensitive ? "arg" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"} === "${isCaseSensitive ? name : name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}" || ${isCaseSensitive ? "arg.startsWith(\"-" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\").startsWith(\""}${isCaseSensitive ? name : name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}=") || ${isCaseSensitive ? "arg" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"} === "${isCaseSensitive ? name : name.toLowerCase().replaceAll("-", "").replaceAll("_", "")}"`), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
@@ -702,33 +574,17 @@ function OptionsMemberParserCondition(props) {
|
|
|
702
574
|
get children() {
|
|
703
575
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
704
576
|
each: aliasProp ?? [],
|
|
705
|
-
|
|
706
|
-
return __assignType((alias) => _alloy_js_core.code` || ${isCaseSensitive || alias.length === 1 ? "arg.startsWith(\"--" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\").startsWith(\""}${isCaseSensitive || alias.length === 1 ? alias : alias.toLowerCase().replaceAll("-", "").replaceAll("_", "")}=") || ${isCaseSensitive || alias.length === 1 ? "arg" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"} === "${isCaseSensitive || alias.length === 1 ? alias : alias.toLowerCase().replaceAll("-", "").replaceAll("_", "")}" || ${isCaseSensitive || alias.length === 1 ? "arg.startsWith(\"-" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\").startsWith(\""}${isCaseSensitive || alias.length === 1 ? alias : alias.toLowerCase().replaceAll("-", "").replaceAll("_", "")}=") || ${isCaseSensitive || alias.length === 1 ? "arg" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"} === "${isCaseSensitive || alias.length === 1 ? alias : alias.toLowerCase().replaceAll("-", "").replaceAll("_", "")}"`, [
|
|
707
|
-
"alias",
|
|
708
|
-
"",
|
|
709
|
-
"P\"2!\"/\""
|
|
710
|
-
]);
|
|
711
|
-
}
|
|
577
|
+
children: (alias) => _alloy_js_core.code` || ${isCaseSensitive || alias.length === 1 ? "arg.startsWith(\"--" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\").startsWith(\""}${isCaseSensitive || alias.length === 1 ? alias : alias.toLowerCase().replaceAll("-", "").replaceAll("_", "")}=") || ${isCaseSensitive || alias.length === 1 ? "arg" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"} === "${isCaseSensitive || alias.length === 1 ? alias : alias.toLowerCase().replaceAll("-", "").replaceAll("_", "")}" || ${isCaseSensitive || alias.length === 1 ? "arg.startsWith(\"-" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\").startsWith(\""}${isCaseSensitive || alias.length === 1 ? alias : alias.toLowerCase().replaceAll("-", "").replaceAll("_", "")}=") || ${isCaseSensitive || alias.length === 1 ? "arg" : "arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")"} === "${isCaseSensitive || alias.length === 1 ? alias : alias.toLowerCase().replaceAll("-", "").replaceAll("_", "")}"`
|
|
712
578
|
});
|
|
713
579
|
}
|
|
714
580
|
})];
|
|
715
581
|
}
|
|
716
|
-
OptionsMemberParserCondition.__type = [
|
|
717
|
-
() => __ΩOptionsMemberParserConditionProps,
|
|
718
|
-
"props",
|
|
719
|
-
"OptionsMemberParserCondition",
|
|
720
|
-
"Pn!2\"\"/#"
|
|
721
|
-
];
|
|
722
582
|
function OptionsInterfaceDeclaration(props) {
|
|
723
583
|
const { command } = props;
|
|
724
|
-
const options = (0, _alloy_js_core.computed)(() => require_contexts_options.computedOptions(Object.entries(command.options).map(
|
|
584
|
+
const options = (0, _alloy_js_core.computed)(() => require_contexts_options.computedOptions(Object.entries(command.options).map(([name, option]) => ({
|
|
725
585
|
...option,
|
|
726
586
|
name
|
|
727
|
-
})
|
|
728
|
-
"param0",
|
|
729
|
-
"",
|
|
730
|
-
"P\"2!\"/\""
|
|
731
|
-
]))));
|
|
587
|
+
}))));
|
|
732
588
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
733
589
|
"export": true,
|
|
734
590
|
get name() {
|
|
@@ -741,75 +597,37 @@ function OptionsInterfaceDeclaration(props) {
|
|
|
741
597
|
return Object.values(options.value);
|
|
742
598
|
},
|
|
743
599
|
hardline: true,
|
|
744
|
-
|
|
745
|
-
return __assignType((option) => (0, _alloy_js_core_jsx_runtime.createComponent)(OptionsMember, { option }), [
|
|
746
|
-
"option",
|
|
747
|
-
"",
|
|
748
|
-
"P\"2!\"/\""
|
|
749
|
-
]);
|
|
750
|
-
}
|
|
600
|
+
children: (option) => (0, _alloy_js_core_jsx_runtime.createComponent)(OptionsMember, { option })
|
|
751
601
|
});
|
|
752
602
|
}
|
|
753
603
|
});
|
|
754
604
|
}
|
|
755
|
-
OptionsInterfaceDeclaration.__type = [
|
|
756
|
-
"CommandTree",
|
|
757
|
-
"command",
|
|
758
|
-
"props",
|
|
759
|
-
"OptionsInterfaceDeclaration",
|
|
760
|
-
"PP\"w!4\"M2#\"/$"
|
|
761
|
-
];
|
|
762
|
-
const __ΩOptionsParserLogicProps = [
|
|
763
|
-
"appSpecificEnvPrefix",
|
|
764
|
-
"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`).",
|
|
765
|
-
"isCaseSensitive",
|
|
766
|
-
true,
|
|
767
|
-
"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.",
|
|
768
|
-
"OptionsParserLogicProps",
|
|
769
|
-
"P!&4!?\")4#8>$?%Mw&y"
|
|
770
|
-
];
|
|
771
605
|
/**
|
|
772
606
|
* The command options parser logic.
|
|
773
607
|
*/
|
|
774
608
|
function OptionsParserLogic(props) {
|
|
775
609
|
const { segments = [], options: _options, name: _name, appSpecificEnvPrefix, isCaseSensitive = false } = props;
|
|
776
|
-
const options = (0, _alloy_js_core.computed)(() => require_contexts_options.computedOptions(Object.entries(_options).map(
|
|
610
|
+
const options = (0, _alloy_js_core.computed)(() => require_contexts_options.computedOptions(Object.entries(_options).map(([name, option]) => ({
|
|
777
611
|
...option,
|
|
778
612
|
name
|
|
779
|
-
})
|
|
780
|
-
"param0",
|
|
781
|
-
"",
|
|
782
|
-
"P\"2!\"/\""
|
|
783
|
-
]))));
|
|
613
|
+
}))));
|
|
784
614
|
return [
|
|
785
615
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
786
616
|
"const": true,
|
|
787
617
|
name: "options",
|
|
788
618
|
get initializer() {
|
|
789
619
|
return _alloy_js_core.code` {
|
|
790
|
-
${segments.length > 0 ? "...useGlobalOptions(), " : ""}${Object.entries(options.value).filter(
|
|
791
|
-
"param0",
|
|
792
|
-
"",
|
|
793
|
-
"P\"2!\"/\""
|
|
794
|
-
])).map(__assignType(([name, option]) => {
|
|
620
|
+
${segments.length > 0 ? "...useGlobalOptions(), " : ""}${Object.entries(options.value).filter(([, option]) => option.env || option.default !== void 0 || (option.type === "string" || option.type === "number") && option.variadic).map(([name, option]) => {
|
|
795
621
|
if (option.type === "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}"` : ""}, `;
|
|
796
622
|
else if (option.type === "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}` : ""}, `;
|
|
797
623
|
else if (option.type === "boolean") return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${appSpecificEnvPrefix}_${option.env} ?? ` : ""}${option.default ? "true" : "false"},`;
|
|
798
624
|
return "";
|
|
799
|
-
}
|
|
800
|
-
"param0",
|
|
801
|
-
"",
|
|
802
|
-
"P\"2!\"/\""
|
|
803
|
-
])).join("")}
|
|
625
|
+
}).join("")}
|
|
804
626
|
} as unknown as ${segments.length > 0 ? (0, _stryke_string_format_pascal_case.pascalCase)(_name) : "Global"}Options;`;
|
|
805
627
|
}
|
|
806
628
|
}),
|
|
807
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
808
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`for (let i = 0; i < args.slice(${segments.filter(
|
|
809
|
-
"segment",
|
|
810
|
-
"",
|
|
811
|
-
"P\"2!\"/\""
|
|
812
|
-
])).length}).length; i++) { `),
|
|
629
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
630
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`for (let i = 0; i < args.slice(${segments.filter((segment) => require_context_helpers.isDynamicPathSegment(segment)).length}).length; i++) { `),
|
|
813
631
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
814
632
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
815
633
|
"const": true,
|
|
@@ -827,81 +645,55 @@ function OptionsParserLogic(props) {
|
|
|
827
645
|
return Object.entries(options.value);
|
|
828
646
|
},
|
|
829
647
|
hardline: true,
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
}), [
|
|
874
|
-
"param0",
|
|
875
|
-
"i",
|
|
876
|
-
"",
|
|
877
|
-
"P\"2!\"2\"\"/#"
|
|
878
|
-
]);
|
|
879
|
-
}
|
|
648
|
+
children: ([name, option], i) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
649
|
+
when: i === 0,
|
|
650
|
+
get fallback() {
|
|
651
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
652
|
+
get condition() {
|
|
653
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(OptionsMemberParserCondition, {
|
|
654
|
+
name,
|
|
655
|
+
get alias() {
|
|
656
|
+
return option.alias;
|
|
657
|
+
},
|
|
658
|
+
isCaseSensitive
|
|
659
|
+
})];
|
|
660
|
+
},
|
|
661
|
+
get children() {
|
|
662
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(OptionsMemberParserLogic, {
|
|
663
|
+
name,
|
|
664
|
+
option,
|
|
665
|
+
isCaseSensitive
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
},
|
|
670
|
+
get children() {
|
|
671
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
672
|
+
get condition() {
|
|
673
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(OptionsMemberParserCondition, {
|
|
674
|
+
name,
|
|
675
|
+
get alias() {
|
|
676
|
+
return option.alias;
|
|
677
|
+
},
|
|
678
|
+
isCaseSensitive
|
|
679
|
+
});
|
|
680
|
+
},
|
|
681
|
+
get children() {
|
|
682
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(OptionsMemberParserLogic, {
|
|
683
|
+
name,
|
|
684
|
+
option,
|
|
685
|
+
isCaseSensitive
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
})
|
|
880
691
|
}),
|
|
881
692
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
882
693
|
_alloy_js_core.code` } `,
|
|
883
694
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
884
695
|
];
|
|
885
696
|
}
|
|
886
|
-
OptionsParserLogic.__type = [
|
|
887
|
-
() => __ΩOptionsParserLogicProps,
|
|
888
|
-
"props",
|
|
889
|
-
"OptionsParserLogic",
|
|
890
|
-
"The command options parser logic.",
|
|
891
|
-
"Pn!2\"\"/#?$"
|
|
892
|
-
];
|
|
893
|
-
const __ΩCommandParserLogicProps = [
|
|
894
|
-
"CommandTree",
|
|
895
|
-
"command",
|
|
896
|
-
"The command to generate the parser logic for.",
|
|
897
|
-
"appSpecificEnvPrefix",
|
|
898
|
-
"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`).",
|
|
899
|
-
"isCaseSensitive",
|
|
900
|
-
true,
|
|
901
|
-
"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.",
|
|
902
|
-
"CommandParserLogicProps",
|
|
903
|
-
"P\"w!4\"?#&4$?%)4&8>'?(Mw)y"
|
|
904
|
-
];
|
|
905
697
|
/**
|
|
906
698
|
* The command parser logic, which includes parsing dynamic path segments, positional parameters, and options.
|
|
907
699
|
*/
|
|
@@ -912,7 +704,7 @@ function CommandParserLogic(props) {
|
|
|
912
704
|
command,
|
|
913
705
|
isCaseSensitive
|
|
914
706
|
}),
|
|
915
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
707
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
916
708
|
(0, _alloy_js_core_jsx_runtime.createComponent)(OptionsParserLogic, {
|
|
917
709
|
get name() {
|
|
918
710
|
return command.name;
|
|
@@ -926,22 +718,15 @@ function CommandParserLogic(props) {
|
|
|
926
718
|
appSpecificEnvPrefix,
|
|
927
719
|
isCaseSensitive
|
|
928
720
|
}),
|
|
929
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
721
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
930
722
|
(0, _alloy_js_core_jsx_runtime.createComponent)(ArgumentsParserLogic, {
|
|
931
723
|
command,
|
|
932
724
|
appSpecificEnvPrefix,
|
|
933
725
|
isCaseSensitive
|
|
934
726
|
}),
|
|
935
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
727
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {})
|
|
936
728
|
];
|
|
937
729
|
}
|
|
938
|
-
CommandParserLogic.__type = [
|
|
939
|
-
() => __ΩCommandParserLogicProps,
|
|
940
|
-
"props",
|
|
941
|
-
"CommandParserLogic",
|
|
942
|
-
"The command parser logic, which includes parsing dynamic path segments, positional parameters, and options.",
|
|
943
|
-
"Pn!2\"\"/#?$"
|
|
944
|
-
];
|
|
945
730
|
|
|
946
731
|
//#endregion
|
|
947
732
|
exports.ArgumentsParserLogic = ArgumentsParserLogic;
|
|
@@ -951,11 +736,4 @@ exports.OptionsInterfaceDeclaration = OptionsInterfaceDeclaration;
|
|
|
951
736
|
exports.OptionsMember = OptionsMember;
|
|
952
737
|
exports.OptionsMemberParserCondition = OptionsMemberParserCondition;
|
|
953
738
|
exports.OptionsMemberParserLogic = OptionsMemberParserLogic;
|
|
954
|
-
exports.OptionsParserLogic = OptionsParserLogic;
|
|
955
|
-
exports.__ΩArgumentsParserLogicProps = __ΩArgumentsParserLogicProps;
|
|
956
|
-
exports.__ΩCommandParserLogicProps = __ΩCommandParserLogicProps;
|
|
957
|
-
exports.__ΩDynamicSegmentsParserLogicProps = __ΩDynamicSegmentsParserLogicProps;
|
|
958
|
-
exports.__ΩOptionsMemberParserConditionProps = __ΩOptionsMemberParserConditionProps;
|
|
959
|
-
exports.__ΩOptionsMemberParserLogicProps = __ΩOptionsMemberParserLogicProps;
|
|
960
|
-
exports.__ΩOptionsParserLogicProps = __ΩOptionsParserLogicProps;
|
|
961
|
-
//# sourceMappingURL=options-parser-logic.cjs.map
|
|
739
|
+
exports.OptionsParserLogic = OptionsParserLogic;
|