@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,21 +1,11 @@
|
|
|
1
1
|
import { createComponent, createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { For, Show, code } from "@alloy-js/core";
|
|
3
3
|
import { camelCase } from "@stryke/string-format/camel-case";
|
|
4
|
-
import { Spacing } from "@
|
|
4
|
+
import { Spacing } from "@power-plant/alloy-js/core/components/spacing";
|
|
5
5
|
import { list } from "@stryke/string-format/list";
|
|
6
6
|
import { ElseIfClause, IfStatement, VarDeclaration } from "@alloy-js/typescript";
|
|
7
7
|
|
|
8
8
|
//#region src/components/command-validation-logic.tsx
|
|
9
|
-
function __assignType(fn, args) {
|
|
10
|
-
fn.__type = args;
|
|
11
|
-
return fn;
|
|
12
|
-
}
|
|
13
|
-
const __ΩCommandValidationLogicProps = [
|
|
14
|
-
"CommandTree",
|
|
15
|
-
"command",
|
|
16
|
-
"CommandValidationLogicProps",
|
|
17
|
-
"P\"w!4\"Mw#y"
|
|
18
|
-
];
|
|
19
9
|
/**
|
|
20
10
|
* A component that generates command validation logic for required options and arguments.
|
|
21
11
|
*/
|
|
@@ -33,257 +23,206 @@ function CommandValidationLogic(props) {
|
|
|
33
23
|
return Object.values(command.options ?? {});
|
|
34
24
|
},
|
|
35
25
|
doubleHardline: true,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
createComponent(Show, {
|
|
39
|
-
get when() {
|
|
40
|
-
return option.required;
|
|
41
|
-
},
|
|
42
|
-
get children() {
|
|
43
|
-
return [createComponent(IfStatement, {
|
|
44
|
-
get condition() {
|
|
45
|
-
return code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}`;
|
|
46
|
-
},
|
|
47
|
-
get children() {
|
|
48
|
-
return code`failures.push("Missing required \\"${option.name}\\" option");`;
|
|
49
|
-
}
|
|
50
|
-
}), createComponent(Show, {
|
|
51
|
-
get when() {
|
|
52
|
-
return option.variadic;
|
|
53
|
-
},
|
|
54
|
-
get children() {
|
|
55
|
-
return createComponent(ElseIfClause, {
|
|
56
|
-
get condition() {
|
|
57
|
-
return code`options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}.length === 0`;
|
|
58
|
-
},
|
|
59
|
-
get children() {
|
|
60
|
-
return code`failures.push("No values were provided to the required \\"${option.name}\\" array option");`;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
})];
|
|
65
|
-
}
|
|
66
|
-
}),
|
|
67
|
-
createComponent(Show, {
|
|
68
|
-
get when() {
|
|
69
|
-
return option.type === "number";
|
|
70
|
-
},
|
|
71
|
-
get children() {
|
|
72
|
-
return createComponent(Show, {
|
|
73
|
-
get when() {
|
|
74
|
-
return option.variadic;
|
|
75
|
-
},
|
|
76
|
-
get fallback() {
|
|
77
|
-
return createComponent(IfStatement, {
|
|
78
|
-
get condition() {
|
|
79
|
-
return code`options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} && Number.isNaN(options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`})`;
|
|
80
|
-
},
|
|
81
|
-
get children() {
|
|
82
|
-
return code`failures.push("Invalid numeric value provided for the \\"${option.name}\\" option");`;
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
|
-
get children() {
|
|
87
|
-
return createComponent(IfStatement, {
|
|
88
|
-
get condition() {
|
|
89
|
-
return code`options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}.some(value => Number.isNaN(value))`;
|
|
90
|
-
},
|
|
91
|
-
get children() {
|
|
92
|
-
return code`failures.push("Invalid numeric value provided in the \\"${option.name}\\" array option");`;
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}),
|
|
99
|
-
createComponent(Show, {
|
|
100
|
-
get when() {
|
|
101
|
-
return (option.type === "string" || option.type === "number") && option.choices && option.choices.length > 0;
|
|
102
|
-
},
|
|
103
|
-
get children() {
|
|
104
|
-
return createComponent(Show, {
|
|
105
|
-
get when() {
|
|
106
|
-
return !option.variadic;
|
|
107
|
-
},
|
|
108
|
-
get fallback() {
|
|
109
|
-
return createComponent(Show, {
|
|
110
|
-
get when() {
|
|
111
|
-
return option.required;
|
|
112
|
-
},
|
|
113
|
-
get fallback() {
|
|
114
|
-
return createComponent(IfStatement, {
|
|
115
|
-
get condition() {
|
|
116
|
-
return code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}.every(value => [${option.choices?.map(__assignType((choice) => option.type === "string" ? `"${choice}"` : choice, [
|
|
117
|
-
"choice",
|
|
118
|
-
"",
|
|
119
|
-
"P\"2!\"/\""
|
|
120
|
-
])).join(", ")}].includes(value))`;
|
|
121
|
-
},
|
|
122
|
-
get children() {
|
|
123
|
-
return code`failures.push(\`Invalid value provided for the \\"${option.name}\\" option - valid values include: ${list(option?.choices?.map(__assignType((choice) => String(choice), [
|
|
124
|
-
"choice",
|
|
125
|
-
"",
|
|
126
|
-
"P\"2!\"/\""
|
|
127
|
-
])) ?? [])}; provided: \${options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}}\`);`;
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
},
|
|
131
|
-
get children() {
|
|
132
|
-
return createComponent(ElseIfClause, {
|
|
133
|
-
get condition() {
|
|
134
|
-
return code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}.every(value => [${option.choices?.map(__assignType((choice) => option.type === "string" ? `"${choice}"` : choice, [
|
|
135
|
-
"choice",
|
|
136
|
-
"",
|
|
137
|
-
"P\"2!\"/\""
|
|
138
|
-
])).join(", ")}].includes(value))`;
|
|
139
|
-
},
|
|
140
|
-
get children() {
|
|
141
|
-
return code`failures.push(\`Invalid value provided for the \\"${option.name}\\" option - valid values include: ${list(option?.choices?.map(__assignType((choice) => String(choice), [
|
|
142
|
-
"choice",
|
|
143
|
-
"",
|
|
144
|
-
"P\"2!\"/\""
|
|
145
|
-
])) ?? [])}; provided: \${options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}}\`);`;
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
},
|
|
151
|
-
get children() {
|
|
152
|
-
return createComponent(Show, {
|
|
153
|
-
get when() {
|
|
154
|
-
return option.required;
|
|
155
|
-
},
|
|
156
|
-
get fallback() {
|
|
157
|
-
return createComponent(IfStatement, {
|
|
158
|
-
get condition() {
|
|
159
|
-
return code`![${option.choices?.map(__assignType((choice) => option.type === "string" ? `"${choice}"` : choice, [
|
|
160
|
-
"choice",
|
|
161
|
-
"",
|
|
162
|
-
"P\"2!\"/\""
|
|
163
|
-
])).join(", ")}].includes(options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`})`;
|
|
164
|
-
},
|
|
165
|
-
get children() {
|
|
166
|
-
return code`failures.push(\`Invalid value provided for the \\"${option.name}\\" option - valid values include: ${list(option?.choices?.map(__assignType((choice) => String(choice), [
|
|
167
|
-
"choice",
|
|
168
|
-
"",
|
|
169
|
-
"P\"2!\"/\""
|
|
170
|
-
])) ?? [])}; provided: \${options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}}\`);`;
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
},
|
|
174
|
-
get children() {
|
|
175
|
-
return createComponent(ElseIfClause, {
|
|
176
|
-
get condition() {
|
|
177
|
-
return code`![${option.choices?.map(__assignType((choice) => option.type === "string" ? `"${choice}"` : choice, [
|
|
178
|
-
"choice",
|
|
179
|
-
"",
|
|
180
|
-
"P\"2!\"/\""
|
|
181
|
-
])).join(", ")}].includes(options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`})`;
|
|
182
|
-
},
|
|
183
|
-
get children() {
|
|
184
|
-
return code`failures.push(\`Invalid value provided for the \\"${option.name}\\" option - valid values include: ${list(option?.choices?.map(__assignType((choice) => String(choice), [
|
|
185
|
-
"choice",
|
|
186
|
-
"",
|
|
187
|
-
"P\"2!\"/\""
|
|
188
|
-
])) ?? [])}; provided: \${options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}}\`);`;
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
})
|
|
197
|
-
], [
|
|
198
|
-
"option",
|
|
199
|
-
"",
|
|
200
|
-
"P\"2!\"/\""
|
|
201
|
-
]);
|
|
202
|
-
}
|
|
203
|
-
}),
|
|
204
|
-
createComponent(Spacing, {}),
|
|
205
|
-
createComponent(For, {
|
|
206
|
-
get each() {
|
|
207
|
-
return command.args;
|
|
208
|
-
},
|
|
209
|
-
doubleHardline: true,
|
|
210
|
-
get children() {
|
|
211
|
-
return __assignType((argument) => [createComponent(Show, {
|
|
26
|
+
children: (option) => [
|
|
27
|
+
createComponent(Show, {
|
|
212
28
|
get when() {
|
|
213
|
-
return
|
|
29
|
+
return option.required;
|
|
214
30
|
},
|
|
215
31
|
get children() {
|
|
216
32
|
return [createComponent(IfStatement, {
|
|
217
33
|
get condition() {
|
|
218
|
-
return code
|
|
34
|
+
return code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}`;
|
|
219
35
|
},
|
|
220
36
|
get children() {
|
|
221
|
-
return code`failures.push("Missing required \\"${
|
|
37
|
+
return code`failures.push("Missing required \\"${option.name}\\" option");`;
|
|
222
38
|
}
|
|
223
39
|
}), createComponent(Show, {
|
|
224
40
|
get when() {
|
|
225
|
-
return
|
|
41
|
+
return option.variadic;
|
|
226
42
|
},
|
|
227
43
|
get children() {
|
|
228
44
|
return createComponent(ElseIfClause, {
|
|
229
45
|
get condition() {
|
|
230
|
-
return code
|
|
46
|
+
return code`options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}.length === 0`;
|
|
231
47
|
},
|
|
232
48
|
get children() {
|
|
233
|
-
return code`failures.push("No values were provided to the required \\"${
|
|
49
|
+
return code`failures.push("No values were provided to the required \\"${option.name}\\" array option");`;
|
|
234
50
|
}
|
|
235
51
|
});
|
|
236
52
|
}
|
|
237
53
|
})];
|
|
238
54
|
}
|
|
239
|
-
}),
|
|
55
|
+
}),
|
|
56
|
+
createComponent(Show, {
|
|
240
57
|
get when() {
|
|
241
|
-
return
|
|
58
|
+
return option.type === "number";
|
|
242
59
|
},
|
|
243
60
|
get children() {
|
|
244
61
|
return createComponent(Show, {
|
|
245
62
|
get when() {
|
|
246
|
-
return
|
|
63
|
+
return option.variadic;
|
|
247
64
|
},
|
|
248
65
|
get fallback() {
|
|
249
66
|
return createComponent(IfStatement, {
|
|
250
67
|
get condition() {
|
|
251
|
-
return code
|
|
68
|
+
return code`options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} && Number.isNaN(options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`})`;
|
|
252
69
|
},
|
|
253
70
|
get children() {
|
|
254
|
-
return code`failures.push("Invalid numeric value provided for the \\"${
|
|
71
|
+
return code`failures.push("Invalid numeric value provided for the \\"${option.name}\\" option");`;
|
|
255
72
|
}
|
|
256
73
|
});
|
|
257
74
|
},
|
|
258
75
|
get children() {
|
|
259
76
|
return createComponent(IfStatement, {
|
|
260
77
|
get condition() {
|
|
261
|
-
return code
|
|
78
|
+
return code`options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}.some(value => Number.isNaN(value))`;
|
|
262
79
|
},
|
|
263
80
|
get children() {
|
|
264
|
-
return code`failures.push("Invalid numeric value provided in the \\"${
|
|
81
|
+
return code`failures.push("Invalid numeric value provided in the \\"${option.name}\\" array option");`;
|
|
265
82
|
}
|
|
266
83
|
});
|
|
267
84
|
}
|
|
268
85
|
});
|
|
269
86
|
}
|
|
270
|
-
})
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
87
|
+
}),
|
|
88
|
+
createComponent(Show, {
|
|
89
|
+
get when() {
|
|
90
|
+
return (option.type === "string" || option.type === "number") && option.choices && option.choices.length > 0;
|
|
91
|
+
},
|
|
92
|
+
get children() {
|
|
93
|
+
return createComponent(Show, {
|
|
94
|
+
get when() {
|
|
95
|
+
return !option.variadic;
|
|
96
|
+
},
|
|
97
|
+
get fallback() {
|
|
98
|
+
return createComponent(Show, {
|
|
99
|
+
get when() {
|
|
100
|
+
return option.required;
|
|
101
|
+
},
|
|
102
|
+
get fallback() {
|
|
103
|
+
return createComponent(IfStatement, {
|
|
104
|
+
get condition() {
|
|
105
|
+
return code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}.every(value => [${option.choices?.map((choice) => option.type === "string" ? `"${choice}"` : choice).join(", ")}].includes(value))`;
|
|
106
|
+
},
|
|
107
|
+
get children() {
|
|
108
|
+
return code`failures.push(\`Invalid value provided for the \\"${option.name}\\" option - valid values include: ${list(option?.choices?.map((choice) => String(choice)) ?? [])}; provided: \${options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}}\`);`;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
get children() {
|
|
113
|
+
return createComponent(ElseIfClause, {
|
|
114
|
+
get condition() {
|
|
115
|
+
return code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}.every(value => [${option.choices?.map((choice) => option.type === "string" ? `"${choice}"` : choice).join(", ")}].includes(value))`;
|
|
116
|
+
},
|
|
117
|
+
get children() {
|
|
118
|
+
return code`failures.push(\`Invalid value provided for the \\"${option.name}\\" option - valid values include: ${list(option?.choices?.map((choice) => String(choice)) ?? [])}; provided: \${options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}}\`);`;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
get children() {
|
|
125
|
+
return createComponent(Show, {
|
|
126
|
+
get when() {
|
|
127
|
+
return option.required;
|
|
128
|
+
},
|
|
129
|
+
get fallback() {
|
|
130
|
+
return createComponent(IfStatement, {
|
|
131
|
+
get condition() {
|
|
132
|
+
return code`![${option.choices?.map((choice) => option.type === "string" ? `"${choice}"` : choice).join(", ")}].includes(options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`})`;
|
|
133
|
+
},
|
|
134
|
+
get children() {
|
|
135
|
+
return code`failures.push(\`Invalid value provided for the \\"${option.name}\\" option - valid values include: ${list(option?.choices?.map((choice) => String(choice)) ?? [])}; provided: \${options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}}\`);`;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
get children() {
|
|
140
|
+
return createComponent(ElseIfClause, {
|
|
141
|
+
get condition() {
|
|
142
|
+
return code`![${option.choices?.map((choice) => option.type === "string" ? `"${choice}"` : choice).join(", ")}].includes(options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`})`;
|
|
143
|
+
},
|
|
144
|
+
get children() {
|
|
145
|
+
return code`failures.push(\`Invalid value provided for the \\"${option.name}\\" option - valid values include: ${list(option?.choices?.map((choice) => String(choice)) ?? [])}; provided: \${options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}}\`);`;
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
})
|
|
154
|
+
]
|
|
155
|
+
}),
|
|
156
|
+
createComponent(Spacing, {}),
|
|
157
|
+
createComponent(For, {
|
|
158
|
+
get each() {
|
|
159
|
+
return command.args;
|
|
160
|
+
},
|
|
161
|
+
doubleHardline: true,
|
|
162
|
+
children: (argument) => [createComponent(Show, {
|
|
163
|
+
get when() {
|
|
164
|
+
return argument.required;
|
|
165
|
+
},
|
|
166
|
+
get children() {
|
|
167
|
+
return [createComponent(IfStatement, {
|
|
168
|
+
get condition() {
|
|
169
|
+
return code`!${camelCase(argument.name)}`;
|
|
170
|
+
},
|
|
171
|
+
get children() {
|
|
172
|
+
return code`failures.push("Missing required \\"${argument.name}\\" positional argument");`;
|
|
173
|
+
}
|
|
174
|
+
}), createComponent(Show, {
|
|
175
|
+
get when() {
|
|
176
|
+
return argument.variadic;
|
|
177
|
+
},
|
|
178
|
+
get children() {
|
|
179
|
+
return createComponent(ElseIfClause, {
|
|
180
|
+
get condition() {
|
|
181
|
+
return code`${camelCase(argument.name)}.length === 0`;
|
|
182
|
+
},
|
|
183
|
+
get children() {
|
|
184
|
+
return code`failures.push("No values were provided to the required \\"${argument.name}\\" array positional argument");`;
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
})];
|
|
189
|
+
}
|
|
190
|
+
}), createComponent(Show, {
|
|
191
|
+
get when() {
|
|
192
|
+
return argument.type === "number";
|
|
193
|
+
},
|
|
194
|
+
get children() {
|
|
195
|
+
return createComponent(Show, {
|
|
196
|
+
get when() {
|
|
197
|
+
return argument.variadic;
|
|
198
|
+
},
|
|
199
|
+
get fallback() {
|
|
200
|
+
return createComponent(IfStatement, {
|
|
201
|
+
get condition() {
|
|
202
|
+
return code`${camelCase(argument.name)} && Number.isNaN(${camelCase(argument.name)})`;
|
|
203
|
+
},
|
|
204
|
+
get children() {
|
|
205
|
+
return code`failures.push("Invalid numeric value provided for the \\"${argument.name}\\" positional argument");`;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
},
|
|
209
|
+
get children() {
|
|
210
|
+
return createComponent(IfStatement, {
|
|
211
|
+
get condition() {
|
|
212
|
+
return code`${camelCase(argument.name)}.some(value => Number.isNaN(value))`;
|
|
213
|
+
},
|
|
214
|
+
get children() {
|
|
215
|
+
return code`failures.push("Invalid numeric value provided in the \\"${argument.name}\\" array positional argument");`;
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
})]
|
|
276
222
|
})
|
|
277
223
|
];
|
|
278
224
|
}
|
|
279
|
-
CommandValidationLogic.__type = [
|
|
280
|
-
() => __ΩCommandValidationLogicProps,
|
|
281
|
-
"props",
|
|
282
|
-
"CommandValidationLogic",
|
|
283
|
-
"A component that generates command validation logic for required options and arguments.",
|
|
284
|
-
"Pn!2\"\"/#?$"
|
|
285
|
-
];
|
|
286
225
|
|
|
287
226
|
//#endregion
|
|
288
|
-
export { CommandValidationLogic
|
|
227
|
+
export { CommandValidationLogic };
|
|
289
228
|
//# sourceMappingURL=command-validation-logic.mjs.map
|