@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.
Files changed (307) hide show
  1. package/README.md +16 -7
  2. package/dist/api.cjs +4 -5
  3. package/dist/api.d.cts +1 -1
  4. package/dist/api.d.mts +1 -1
  5. package/dist/api.mjs +2 -2
  6. package/dist/command-B6KYexlV.d.mts +308 -0
  7. package/dist/command-B6KYexlV.d.mts.map +1 -0
  8. package/dist/command-CtfR7hKM.d.cts +308 -0
  9. package/dist/command-CtfR7hKM.d.cts.map +1 -0
  10. package/dist/components/command-validation-logic.cjs +153 -216
  11. package/dist/components/command-validation-logic.d.cts +2 -1
  12. package/dist/components/command-validation-logic.d.cts.map +1 -1
  13. package/dist/components/command-validation-logic.d.mts +2 -1
  14. package/dist/components/command-validation-logic.mjs +153 -214
  15. package/dist/components/docs.cjs +6 -364
  16. package/dist/components/docs.d.cts +2 -3
  17. package/dist/components/docs.d.cts.map +1 -1
  18. package/dist/components/docs.d.mts +2 -3
  19. package/dist/components/docs.mjs +2 -356
  20. package/dist/components/exec-builtin.cjs +63 -100
  21. package/dist/components/exec-builtin.d.cts +1 -2
  22. package/dist/components/exec-builtin.d.cts.map +1 -1
  23. package/dist/components/exec-builtin.d.mts +1 -2
  24. package/dist/components/exec-builtin.mjs +7 -41
  25. package/dist/components/helpers.cjs +2 -52
  26. package/dist/components/helpers.d.cts +2 -1
  27. package/dist/components/helpers.d.cts.map +1 -1
  28. package/dist/components/helpers.d.mts +2 -1
  29. package/dist/components/helpers.mjs +2 -50
  30. package/dist/components/index.cjs +7 -23
  31. package/dist/components/index.mjs +9 -9
  32. package/dist/components/options-parser-logic.cjs +198 -420
  33. package/dist/components/options-parser-logic.d.cts +2 -5
  34. package/dist/components/options-parser-logic.d.cts.map +1 -1
  35. package/dist/components/options-parser-logic.d.mts +2 -5
  36. package/dist/components/options-parser-logic.mjs +192 -407
  37. package/dist/components/state-builtin.cjs +106 -164
  38. package/dist/components/state-builtin.d.cts +1 -2
  39. package/dist/components/state-builtin.d.cts.map +1 -1
  40. package/dist/components/state-builtin.d.mts +1 -2
  41. package/dist/components/state-builtin.mjs +12 -68
  42. package/dist/components/usage.cjs +4 -48
  43. package/dist/components/usage.d.cts +1 -2
  44. package/dist/components/usage.d.cts.map +1 -1
  45. package/dist/components/usage.d.mts +1 -2
  46. package/dist/components/usage.mjs +4 -46
  47. package/dist/components/utils-builtin.cjs +77 -144
  48. package/dist/components/utils-builtin.d.cts +1 -2
  49. package/dist/components/utils-builtin.d.cts.map +1 -1
  50. package/dist/components/utils-builtin.d.mts +1 -2
  51. package/dist/components/utils-builtin.mjs +9 -74
  52. package/dist/config-BIF9mEz0.d.cts +157 -0
  53. package/dist/config-BIF9mEz0.d.cts.map +1 -0
  54. package/dist/config-CnNYdfsL.d.mts +157 -0
  55. package/dist/config-CnNYdfsL.d.mts.map +1 -0
  56. package/dist/config.cjs +24 -58
  57. package/dist/config.d.cts +1 -2
  58. package/dist/config.d.cts.map +1 -1
  59. package/dist/config.d.mts +1 -2
  60. package/dist/config.mjs +23 -55
  61. package/dist/{plugin-utils/context-helpers.mjs → context-helpers-D3EJxwbq.mjs} +5 -83
  62. package/dist/context-helpers-D3EJxwbq.mjs.map +1 -0
  63. package/dist/{plugin-utils/context-helpers.cjs → context-helpers-_wUuFRB8.cjs} +63 -92
  64. package/dist/contexts/command.cjs +3 -9
  65. package/dist/contexts/command.d.cts +1 -2
  66. package/dist/contexts/command.d.cts.map +1 -1
  67. package/dist/contexts/command.d.mts +1 -2
  68. package/dist/contexts/command.mjs +2 -7
  69. package/dist/contexts/index.cjs +19 -1
  70. package/dist/contexts/index.d.cts +2 -1
  71. package/dist/contexts/index.d.mts +2 -1
  72. package/dist/contexts/index.mjs +2 -1
  73. package/dist/contexts/options.cjs +7 -30
  74. package/dist/contexts/options.d.cts +1 -2
  75. package/dist/contexts/options.d.cts.map +1 -1
  76. package/dist/contexts/options.d.mts +1 -2
  77. package/dist/contexts/options.mjs +7 -27
  78. package/dist/contexts/power-plant.cjs +19 -0
  79. package/dist/contexts/power-plant.d.cts +2 -0
  80. package/dist/contexts/power-plant.d.mts +2 -0
  81. package/dist/contexts/power-plant.mjs +5 -0
  82. package/dist/docs-C6ZvsVMu.cjs +278 -0
  83. package/dist/docs-CGQ2HtEY.mjs +249 -0
  84. package/dist/docs-CGQ2HtEY.mjs.map +1 -0
  85. package/dist/engine.cjs +5 -39
  86. package/dist/engine.d.cts +1 -2
  87. package/dist/engine.d.cts.map +1 -1
  88. package/dist/engine.d.mts +1 -2
  89. package/dist/engine.mjs +4 -37
  90. package/dist/generator.cjs +68 -0
  91. package/dist/generator.d.cts +15 -0
  92. package/dist/generator.d.cts.map +1 -0
  93. package/dist/generator.d.mts +15 -0
  94. package/dist/generator.d.mts.map +1 -0
  95. package/dist/generator.mjs +66 -0
  96. package/dist/generator.mjs.map +1 -0
  97. package/dist/{helpers/get-framework.cjs → get-framework-CxZc2krd.cjs} +7 -8
  98. package/dist/{helpers/get-framework.mjs → get-framework-Dlqz2hVZ.mjs} +3 -8
  99. package/dist/get-framework-Dlqz2hVZ.mjs.map +1 -0
  100. package/dist/helpers/power-plant.cjs +102 -0
  101. package/dist/helpers/power-plant.d.cts +61 -0
  102. package/dist/helpers/power-plant.d.cts.map +1 -0
  103. package/dist/helpers/power-plant.d.mts +61 -0
  104. package/dist/helpers/power-plant.d.mts.map +1 -0
  105. package/dist/helpers/power-plant.mjs +99 -0
  106. package/dist/helpers/power-plant.mjs.map +1 -0
  107. package/dist/index-D4klH_pj.d.mts +2 -0
  108. package/dist/index-DYOBadKY.d.cts +2 -0
  109. package/dist/index.cjs +1 -37
  110. package/dist/index.d.cts +4 -6
  111. package/dist/index.d.cts.map +1 -1
  112. package/dist/index.d.mts +4 -6
  113. package/dist/index.mjs +0 -35
  114. package/dist/package-B7Vu265G.mjs +6 -0
  115. package/dist/package-B7Vu265G.mjs.map +1 -0
  116. package/dist/{package.cjs → package-BLC4qc8t.cjs} +2 -4
  117. package/dist/plugin-B-hM2twc.mjs +1458 -0
  118. package/dist/plugin-B-hM2twc.mjs.map +1 -0
  119. package/dist/plugin-Bhfq0DMC.cjs +1490 -0
  120. package/dist/plugin-utils/index.cjs +359 -26
  121. package/dist/plugin-utils/index.d.cts +273 -9
  122. package/dist/plugin-utils/index.d.cts.map +1 -0
  123. package/dist/plugin-utils/index.d.mts +273 -9
  124. package/dist/plugin-utils/index.d.mts.map +1 -0
  125. package/dist/plugin-utils/index.mjs +346 -10
  126. package/dist/plugin-utils/index.mjs.map +1 -0
  127. package/dist/plugin.cjs +3 -496
  128. package/dist/plugin.d.cts +1 -3
  129. package/dist/plugin.d.cts.map +1 -1
  130. package/dist/plugin.d.mts +1 -3
  131. package/dist/plugin.mjs +2 -491
  132. package/dist/power-plant-LgxcvlMN.d.cts +4 -0
  133. package/dist/power-plant-LgxcvlMN.d.mts +4 -0
  134. package/dist/reflect-CSiffeL9.cjs +27 -0
  135. package/dist/reflect-DXKSFgvS.mjs +23 -0
  136. package/dist/reflect-DXKSFgvS.mjs.map +1 -0
  137. package/dist/schemas/env.cjs +91 -0
  138. package/dist/schemas/env.d.cts +145 -0
  139. package/dist/schemas/env.d.cts.map +1 -0
  140. package/dist/schemas/env.d.mts +145 -0
  141. package/dist/{types → schemas}/env.d.mts.map +1 -1
  142. package/dist/schemas/env.mjs +91 -0
  143. package/dist/schemas/index.cjs +4 -0
  144. package/dist/schemas/index.d.cts +2 -0
  145. package/dist/schemas/index.d.mts +2 -0
  146. package/dist/schemas/index.mjs +3 -0
  147. package/dist/types/command.cjs +0 -402
  148. package/dist/types/command.d.cts +2 -309
  149. package/dist/types/command.d.mts +2 -309
  150. package/dist/types/command.mjs +1 -368
  151. package/dist/types/config.cjs +0 -175
  152. package/dist/types/config.d.cts +2 -126
  153. package/dist/types/config.d.mts +2 -126
  154. package/dist/types/config.mjs +1 -164
  155. package/dist/types/context.cjs +0 -45
  156. package/dist/types/context.d.cts +2 -31
  157. package/dist/types/context.d.mts +2 -31
  158. package/dist/types/context.mjs +1 -41
  159. package/dist/types/index.cjs +3 -53
  160. package/dist/types/index.d.cts +4 -5
  161. package/dist/types/index.d.mts +4 -5
  162. package/dist/types/index.mjs +4 -5
  163. package/package.json +106 -42
  164. package/dist/_virtual/_rolldown/runtime.cjs +0 -29
  165. package/dist/api.cjs.map +0 -1
  166. package/dist/components/command-validation-logic.cjs.map +0 -1
  167. package/dist/components/docs.cjs.map +0 -1
  168. package/dist/components/docs.mjs.map +0 -1
  169. package/dist/components/exec-builtin.cjs.map +0 -1
  170. package/dist/components/helpers.cjs.map +0 -1
  171. package/dist/components/options-parser-logic.cjs.map +0 -1
  172. package/dist/components/state-builtin.cjs.map +0 -1
  173. package/dist/components/usage.cjs.map +0 -1
  174. package/dist/components/utils-builtin.cjs.map +0 -1
  175. package/dist/config.cjs.map +0 -1
  176. package/dist/contexts/command.cjs.map +0 -1
  177. package/dist/contexts/options.cjs.map +0 -1
  178. package/dist/engine.cjs.map +0 -1
  179. package/dist/helpers/automd.cjs +0 -193
  180. package/dist/helpers/automd.cjs.map +0 -1
  181. package/dist/helpers/automd.mjs +0 -190
  182. package/dist/helpers/automd.mjs.map +0 -1
  183. package/dist/helpers/docs-helpers.cjs +0 -24
  184. package/dist/helpers/docs-helpers.cjs.map +0 -1
  185. package/dist/helpers/docs-helpers.mjs +0 -24
  186. package/dist/helpers/docs-helpers.mjs.map +0 -1
  187. package/dist/helpers/get-framework.cjs.map +0 -1
  188. package/dist/helpers/get-framework.mjs.map +0 -1
  189. package/dist/helpers/paths.cjs +0 -137
  190. package/dist/helpers/paths.cjs.map +0 -1
  191. package/dist/helpers/paths.mjs +0 -134
  192. package/dist/helpers/paths.mjs.map +0 -1
  193. package/dist/helpers/persistence.cjs +0 -114
  194. package/dist/helpers/persistence.cjs.map +0 -1
  195. package/dist/helpers/persistence.mjs +0 -113
  196. package/dist/helpers/persistence.mjs.map +0 -1
  197. package/dist/helpers/update-package-json.cjs +0 -65
  198. package/dist/helpers/update-package-json.cjs.map +0 -1
  199. package/dist/helpers/update-package-json.mjs +0 -64
  200. package/dist/helpers/update-package-json.mjs.map +0 -1
  201. package/dist/helpers/utilities.cjs +0 -95
  202. package/dist/helpers/utilities.cjs.map +0 -1
  203. package/dist/helpers/utilities.mjs +0 -94
  204. package/dist/helpers/utilities.mjs.map +0 -1
  205. package/dist/helpers/validations.cjs +0 -71
  206. package/dist/helpers/validations.cjs.map +0 -1
  207. package/dist/helpers/validations.mjs +0 -70
  208. package/dist/helpers/validations.mjs.map +0 -1
  209. package/dist/index.cjs.map +0 -1
  210. package/dist/package.cjs.map +0 -1
  211. package/dist/package.mjs +0 -6
  212. package/dist/package.mjs.map +0 -1
  213. package/dist/plugin-utils/compute-bin.cjs +0 -49
  214. package/dist/plugin-utils/compute-bin.cjs.map +0 -1
  215. package/dist/plugin-utils/compute-bin.d.cts +0 -13
  216. package/dist/plugin-utils/compute-bin.d.cts.map +0 -1
  217. package/dist/plugin-utils/compute-bin.d.mts +0 -13
  218. package/dist/plugin-utils/compute-bin.d.mts.map +0 -1
  219. package/dist/plugin-utils/compute-bin.mjs +0 -49
  220. package/dist/plugin-utils/compute-bin.mjs.map +0 -1
  221. package/dist/plugin-utils/context-helpers.cjs.map +0 -1
  222. package/dist/plugin-utils/context-helpers.d.cts +0 -106
  223. package/dist/plugin-utils/context-helpers.d.cts.map +0 -1
  224. package/dist/plugin-utils/context-helpers.d.mts +0 -106
  225. package/dist/plugin-utils/context-helpers.d.mts.map +0 -1
  226. package/dist/plugin-utils/context-helpers.mjs.map +0 -1
  227. package/dist/plugin-utils/deepkit.cjs +0 -70
  228. package/dist/plugin-utils/deepkit.cjs.map +0 -1
  229. package/dist/plugin-utils/deepkit.d.cts +0 -23
  230. package/dist/plugin-utils/deepkit.d.cts.map +0 -1
  231. package/dist/plugin-utils/deepkit.d.mts +0 -23
  232. package/dist/plugin-utils/deepkit.d.mts.map +0 -1
  233. package/dist/plugin-utils/deepkit.mjs +0 -69
  234. package/dist/plugin-utils/deepkit.mjs.map +0 -1
  235. package/dist/plugin-utils/description-helpers.cjs +0 -112
  236. package/dist/plugin-utils/description-helpers.cjs.map +0 -1
  237. package/dist/plugin-utils/description-helpers.d.cts +0 -44
  238. package/dist/plugin-utils/description-helpers.d.cts.map +0 -1
  239. package/dist/plugin-utils/description-helpers.d.mts +0 -44
  240. package/dist/plugin-utils/description-helpers.d.mts.map +0 -1
  241. package/dist/plugin-utils/description-helpers.mjs +0 -108
  242. package/dist/plugin-utils/description-helpers.mjs.map +0 -1
  243. package/dist/plugin-utils/get-command-tree.cjs +0 -118
  244. package/dist/plugin-utils/get-command-tree.cjs.map +0 -1
  245. package/dist/plugin-utils/get-command-tree.d.cts +0 -36
  246. package/dist/plugin-utils/get-command-tree.d.cts.map +0 -1
  247. package/dist/plugin-utils/get-command-tree.d.mts +0 -36
  248. package/dist/plugin-utils/get-command-tree.d.mts.map +0 -1
  249. package/dist/plugin-utils/get-command-tree.mjs +0 -115
  250. package/dist/plugin-utils/get-command-tree.mjs.map +0 -1
  251. package/dist/plugin-utils/reflect.cjs +0 -54
  252. package/dist/plugin-utils/reflect.cjs.map +0 -1
  253. package/dist/plugin-utils/reflect.d.cts +0 -14
  254. package/dist/plugin-utils/reflect.d.cts.map +0 -1
  255. package/dist/plugin-utils/reflect.d.mts +0 -14
  256. package/dist/plugin-utils/reflect.d.mts.map +0 -1
  257. package/dist/plugin-utils/reflect.mjs +0 -53
  258. package/dist/plugin-utils/reflect.mjs.map +0 -1
  259. package/dist/plugin-utils/traverse-command-tree.cjs +0 -65
  260. package/dist/plugin-utils/traverse-command-tree.cjs.map +0 -1
  261. package/dist/plugin-utils/traverse-command-tree.d.cts +0 -22
  262. package/dist/plugin-utils/traverse-command-tree.d.cts.map +0 -1
  263. package/dist/plugin-utils/traverse-command-tree.d.mts +0 -22
  264. package/dist/plugin-utils/traverse-command-tree.d.mts.map +0 -1
  265. package/dist/plugin-utils/traverse-command-tree.mjs +0 -63
  266. package/dist/plugin-utils/traverse-command-tree.mjs.map +0 -1
  267. package/dist/plugin-utils/type-checks.cjs +0 -222
  268. package/dist/plugin-utils/type-checks.cjs.map +0 -1
  269. package/dist/plugin-utils/type-checks.d.cts +0 -41
  270. package/dist/plugin-utils/type-checks.d.cts.map +0 -1
  271. package/dist/plugin-utils/type-checks.d.mts +0 -41
  272. package/dist/plugin-utils/type-checks.d.mts.map +0 -1
  273. package/dist/plugin-utils/type-checks.mjs +0 -218
  274. package/dist/plugin-utils/type-checks.mjs.map +0 -1
  275. package/dist/plugin.cjs.map +0 -1
  276. package/dist/plugin.mjs.map +0 -1
  277. package/dist/resolver/deepkit.cjs +0 -110
  278. package/dist/resolver/deepkit.cjs.map +0 -1
  279. package/dist/resolver/deepkit.mjs +0 -109
  280. package/dist/resolver/deepkit.mjs.map +0 -1
  281. package/dist/resolver/helpers.cjs +0 -184
  282. package/dist/resolver/helpers.cjs.map +0 -1
  283. package/dist/resolver/helpers.mjs +0 -180
  284. package/dist/resolver/helpers.mjs.map +0 -1
  285. package/dist/resolver/resolve.cjs +0 -473
  286. package/dist/resolver/resolve.cjs.map +0 -1
  287. package/dist/resolver/resolve.mjs +0 -473
  288. package/dist/resolver/resolve.mjs.map +0 -1
  289. package/dist/types/command.cjs.map +0 -1
  290. package/dist/types/command.d.cts.map +0 -1
  291. package/dist/types/command.d.mts.map +0 -1
  292. package/dist/types/command.mjs.map +0 -1
  293. package/dist/types/config.cjs.map +0 -1
  294. package/dist/types/config.d.cts.map +0 -1
  295. package/dist/types/config.d.mts.map +0 -1
  296. package/dist/types/config.mjs.map +0 -1
  297. package/dist/types/context.cjs.map +0 -1
  298. package/dist/types/context.d.cts.map +0 -1
  299. package/dist/types/context.d.mts.map +0 -1
  300. package/dist/types/context.mjs.map +0 -1
  301. package/dist/types/env.cjs +0 -53
  302. package/dist/types/env.cjs.map +0 -1
  303. package/dist/types/env.d.cts +0 -71
  304. package/dist/types/env.d.cts.map +0 -1
  305. package/dist/types/env.d.mts +0 -71
  306. package/dist/types/env.mjs +0 -51
  307. /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 "@powerlines/plugin-alloy/core/components/spacing";
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
- get children() {
37
- return __assignType((option) => [
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 argument.required;
29
+ return option.required;
214
30
  },
215
31
  get children() {
216
32
  return [createComponent(IfStatement, {
217
33
  get condition() {
218
- return code`!${camelCase(argument.name)}`;
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 \\"${argument.name}\\" positional argument");`;
37
+ return code`failures.push("Missing required \\"${option.name}\\" option");`;
222
38
  }
223
39
  }), createComponent(Show, {
224
40
  get when() {
225
- return argument.variadic;
41
+ return option.variadic;
226
42
  },
227
43
  get children() {
228
44
  return createComponent(ElseIfClause, {
229
45
  get condition() {
230
- return code`${camelCase(argument.name)}.length === 0`;
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 \\"${argument.name}\\" array positional argument");`;
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
- }), createComponent(Show, {
55
+ }),
56
+ createComponent(Show, {
240
57
  get when() {
241
- return argument.type === "number";
58
+ return option.type === "number";
242
59
  },
243
60
  get children() {
244
61
  return createComponent(Show, {
245
62
  get when() {
246
- return argument.variadic;
63
+ return option.variadic;
247
64
  },
248
65
  get fallback() {
249
66
  return createComponent(IfStatement, {
250
67
  get condition() {
251
- return code`${camelCase(argument.name)} && Number.isNaN(${camelCase(argument.name)})`;
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 \\"${argument.name}\\" positional argument");`;
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`${camelCase(argument.name)}.some(value => Number.isNaN(value))`;
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 \\"${argument.name}\\" array positional argument");`;
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
- "argument",
272
- "",
273
- "P\"2!\"/\""
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, __ΩCommandValidationLogicProps };
227
+ export { CommandValidationLogic };
289
228
  //# sourceMappingURL=command-validation-logic.mjs.map