@shell-shock/core 0.17.22 → 0.17.24

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 (306) hide show
  1. package/dist/api.cjs +4 -5
  2. package/dist/api.d.cts +1 -1
  3. package/dist/api.d.mts +1 -1
  4. package/dist/api.mjs +2 -2
  5. package/dist/command-B6KYexlV.d.mts +308 -0
  6. package/dist/command-B6KYexlV.d.mts.map +1 -0
  7. package/dist/command-CtfR7hKM.d.cts +308 -0
  8. package/dist/command-CtfR7hKM.d.cts.map +1 -0
  9. package/dist/components/command-validation-logic.cjs +153 -216
  10. package/dist/components/command-validation-logic.d.cts +2 -1
  11. package/dist/components/command-validation-logic.d.cts.map +1 -1
  12. package/dist/components/command-validation-logic.d.mts +2 -1
  13. package/dist/components/command-validation-logic.mjs +153 -214
  14. package/dist/components/docs.cjs +6 -364
  15. package/dist/components/docs.d.cts +2 -3
  16. package/dist/components/docs.d.cts.map +1 -1
  17. package/dist/components/docs.d.mts +2 -3
  18. package/dist/components/docs.mjs +2 -356
  19. package/dist/components/exec-builtin.cjs +63 -100
  20. package/dist/components/exec-builtin.d.cts +1 -2
  21. package/dist/components/exec-builtin.d.cts.map +1 -1
  22. package/dist/components/exec-builtin.d.mts +1 -2
  23. package/dist/components/exec-builtin.mjs +7 -41
  24. package/dist/components/helpers.cjs +2 -52
  25. package/dist/components/helpers.d.cts +2 -1
  26. package/dist/components/helpers.d.cts.map +1 -1
  27. package/dist/components/helpers.d.mts +2 -1
  28. package/dist/components/helpers.mjs +2 -50
  29. package/dist/components/index.cjs +7 -23
  30. package/dist/components/index.mjs +9 -9
  31. package/dist/components/options-parser-logic.cjs +198 -420
  32. package/dist/components/options-parser-logic.d.cts +2 -5
  33. package/dist/components/options-parser-logic.d.cts.map +1 -1
  34. package/dist/components/options-parser-logic.d.mts +2 -5
  35. package/dist/components/options-parser-logic.mjs +192 -407
  36. package/dist/components/state-builtin.cjs +106 -164
  37. package/dist/components/state-builtin.d.cts +1 -2
  38. package/dist/components/state-builtin.d.cts.map +1 -1
  39. package/dist/components/state-builtin.d.mts +1 -2
  40. package/dist/components/state-builtin.mjs +12 -68
  41. package/dist/components/usage.cjs +4 -48
  42. package/dist/components/usage.d.cts +1 -2
  43. package/dist/components/usage.d.cts.map +1 -1
  44. package/dist/components/usage.d.mts +1 -2
  45. package/dist/components/usage.mjs +4 -46
  46. package/dist/components/utils-builtin.cjs +77 -144
  47. package/dist/components/utils-builtin.d.cts +1 -2
  48. package/dist/components/utils-builtin.d.cts.map +1 -1
  49. package/dist/components/utils-builtin.d.mts +1 -2
  50. package/dist/components/utils-builtin.mjs +9 -74
  51. package/dist/config-BIF9mEz0.d.cts +157 -0
  52. package/dist/config-BIF9mEz0.d.cts.map +1 -0
  53. package/dist/config-CnNYdfsL.d.mts +157 -0
  54. package/dist/config-CnNYdfsL.d.mts.map +1 -0
  55. package/dist/config.cjs +24 -58
  56. package/dist/config.d.cts +1 -2
  57. package/dist/config.d.cts.map +1 -1
  58. package/dist/config.d.mts +1 -2
  59. package/dist/config.mjs +23 -55
  60. package/dist/{plugin-utils/context-helpers.mjs → context-helpers-D3EJxwbq.mjs} +5 -83
  61. package/dist/context-helpers-D3EJxwbq.mjs.map +1 -0
  62. package/dist/{plugin-utils/context-helpers.cjs → context-helpers-_wUuFRB8.cjs} +63 -92
  63. package/dist/contexts/command.cjs +3 -9
  64. package/dist/contexts/command.d.cts +1 -2
  65. package/dist/contexts/command.d.cts.map +1 -1
  66. package/dist/contexts/command.d.mts +1 -2
  67. package/dist/contexts/command.mjs +2 -7
  68. package/dist/contexts/index.cjs +19 -1
  69. package/dist/contexts/index.d.cts +2 -1
  70. package/dist/contexts/index.d.mts +2 -1
  71. package/dist/contexts/index.mjs +2 -1
  72. package/dist/contexts/options.cjs +7 -30
  73. package/dist/contexts/options.d.cts +1 -2
  74. package/dist/contexts/options.d.cts.map +1 -1
  75. package/dist/contexts/options.d.mts +1 -2
  76. package/dist/contexts/options.mjs +7 -27
  77. package/dist/contexts/power-plant.cjs +19 -0
  78. package/dist/contexts/power-plant.d.cts +2 -0
  79. package/dist/contexts/power-plant.d.mts +2 -0
  80. package/dist/contexts/power-plant.mjs +5 -0
  81. package/dist/docs-C6ZvsVMu.cjs +278 -0
  82. package/dist/docs-CGQ2HtEY.mjs +249 -0
  83. package/dist/docs-CGQ2HtEY.mjs.map +1 -0
  84. package/dist/engine.cjs +5 -39
  85. package/dist/engine.d.cts +1 -2
  86. package/dist/engine.d.cts.map +1 -1
  87. package/dist/engine.d.mts +1 -2
  88. package/dist/engine.mjs +4 -37
  89. package/dist/generator.cjs +68 -0
  90. package/dist/generator.d.cts +15 -0
  91. package/dist/generator.d.cts.map +1 -0
  92. package/dist/generator.d.mts +15 -0
  93. package/dist/generator.d.mts.map +1 -0
  94. package/dist/generator.mjs +66 -0
  95. package/dist/generator.mjs.map +1 -0
  96. package/dist/{helpers/get-framework.mjs → get-framework-Bde25gcE.mjs} +3 -8
  97. package/dist/get-framework-Bde25gcE.mjs.map +1 -0
  98. package/dist/{helpers/get-framework.cjs → get-framework-KhAcbWmi.cjs} +7 -8
  99. package/dist/helpers/power-plant.cjs +102 -0
  100. package/dist/helpers/power-plant.d.cts +61 -0
  101. package/dist/helpers/power-plant.d.cts.map +1 -0
  102. package/dist/helpers/power-plant.d.mts +61 -0
  103. package/dist/helpers/power-plant.d.mts.map +1 -0
  104. package/dist/helpers/power-plant.mjs +99 -0
  105. package/dist/helpers/power-plant.mjs.map +1 -0
  106. package/dist/index-D4klH_pj.d.mts +2 -0
  107. package/dist/index-DYOBadKY.d.cts +2 -0
  108. package/dist/index.cjs +1 -37
  109. package/dist/index.d.cts +4 -6
  110. package/dist/index.d.cts.map +1 -1
  111. package/dist/index.d.mts +4 -6
  112. package/dist/index.mjs +0 -35
  113. package/dist/package-BEuyOlNO.mjs +6 -0
  114. package/dist/package-BEuyOlNO.mjs.map +1 -0
  115. package/dist/{package.cjs → package-Bzt7_95T.cjs} +2 -4
  116. package/dist/plugin-DZxQWd06.cjs +1490 -0
  117. package/dist/plugin-Dz1jMeMo.mjs +1458 -0
  118. package/dist/plugin-Dz1jMeMo.mjs.map +1 -0
  119. package/dist/plugin-utils/index.cjs +359 -26
  120. package/dist/plugin-utils/index.d.cts +273 -9
  121. package/dist/plugin-utils/index.d.cts.map +1 -0
  122. package/dist/plugin-utils/index.d.mts +273 -9
  123. package/dist/plugin-utils/index.d.mts.map +1 -0
  124. package/dist/plugin-utils/index.mjs +346 -10
  125. package/dist/plugin-utils/index.mjs.map +1 -0
  126. package/dist/plugin.cjs +3 -496
  127. package/dist/plugin.d.cts +1 -3
  128. package/dist/plugin.d.cts.map +1 -1
  129. package/dist/plugin.d.mts +1 -3
  130. package/dist/plugin.mjs +2 -491
  131. package/dist/power-plant-LgxcvlMN.d.cts +4 -0
  132. package/dist/power-plant-LgxcvlMN.d.mts +4 -0
  133. package/dist/reflect-CSiffeL9.cjs +27 -0
  134. package/dist/reflect-DXKSFgvS.mjs +23 -0
  135. package/dist/reflect-DXKSFgvS.mjs.map +1 -0
  136. package/dist/schemas/env.cjs +91 -0
  137. package/dist/schemas/env.d.cts +145 -0
  138. package/dist/schemas/env.d.cts.map +1 -0
  139. package/dist/schemas/env.d.mts +145 -0
  140. package/dist/{types → schemas}/env.d.mts.map +1 -1
  141. package/dist/schemas/env.mjs +91 -0
  142. package/dist/schemas/index.cjs +4 -0
  143. package/dist/schemas/index.d.cts +2 -0
  144. package/dist/schemas/index.d.mts +2 -0
  145. package/dist/schemas/index.mjs +3 -0
  146. package/dist/types/command.cjs +0 -402
  147. package/dist/types/command.d.cts +2 -309
  148. package/dist/types/command.d.mts +2 -309
  149. package/dist/types/command.mjs +1 -368
  150. package/dist/types/config.cjs +0 -175
  151. package/dist/types/config.d.cts +2 -126
  152. package/dist/types/config.d.mts +2 -126
  153. package/dist/types/config.mjs +1 -164
  154. package/dist/types/context.cjs +0 -45
  155. package/dist/types/context.d.cts +2 -31
  156. package/dist/types/context.d.mts +2 -31
  157. package/dist/types/context.mjs +1 -41
  158. package/dist/types/index.cjs +3 -53
  159. package/dist/types/index.d.cts +4 -5
  160. package/dist/types/index.d.mts +4 -5
  161. package/dist/types/index.mjs +4 -5
  162. package/package.json +106 -42
  163. package/dist/_virtual/_rolldown/runtime.cjs +0 -29
  164. package/dist/api.cjs.map +0 -1
  165. package/dist/components/command-validation-logic.cjs.map +0 -1
  166. package/dist/components/docs.cjs.map +0 -1
  167. package/dist/components/docs.mjs.map +0 -1
  168. package/dist/components/exec-builtin.cjs.map +0 -1
  169. package/dist/components/helpers.cjs.map +0 -1
  170. package/dist/components/options-parser-logic.cjs.map +0 -1
  171. package/dist/components/state-builtin.cjs.map +0 -1
  172. package/dist/components/usage.cjs.map +0 -1
  173. package/dist/components/utils-builtin.cjs.map +0 -1
  174. package/dist/config.cjs.map +0 -1
  175. package/dist/contexts/command.cjs.map +0 -1
  176. package/dist/contexts/options.cjs.map +0 -1
  177. package/dist/engine.cjs.map +0 -1
  178. package/dist/helpers/automd.cjs +0 -193
  179. package/dist/helpers/automd.cjs.map +0 -1
  180. package/dist/helpers/automd.mjs +0 -190
  181. package/dist/helpers/automd.mjs.map +0 -1
  182. package/dist/helpers/docs-helpers.cjs +0 -24
  183. package/dist/helpers/docs-helpers.cjs.map +0 -1
  184. package/dist/helpers/docs-helpers.mjs +0 -24
  185. package/dist/helpers/docs-helpers.mjs.map +0 -1
  186. package/dist/helpers/get-framework.cjs.map +0 -1
  187. package/dist/helpers/get-framework.mjs.map +0 -1
  188. package/dist/helpers/paths.cjs +0 -137
  189. package/dist/helpers/paths.cjs.map +0 -1
  190. package/dist/helpers/paths.mjs +0 -134
  191. package/dist/helpers/paths.mjs.map +0 -1
  192. package/dist/helpers/persistence.cjs +0 -114
  193. package/dist/helpers/persistence.cjs.map +0 -1
  194. package/dist/helpers/persistence.mjs +0 -113
  195. package/dist/helpers/persistence.mjs.map +0 -1
  196. package/dist/helpers/update-package-json.cjs +0 -65
  197. package/dist/helpers/update-package-json.cjs.map +0 -1
  198. package/dist/helpers/update-package-json.mjs +0 -64
  199. package/dist/helpers/update-package-json.mjs.map +0 -1
  200. package/dist/helpers/utilities.cjs +0 -95
  201. package/dist/helpers/utilities.cjs.map +0 -1
  202. package/dist/helpers/utilities.mjs +0 -94
  203. package/dist/helpers/utilities.mjs.map +0 -1
  204. package/dist/helpers/validations.cjs +0 -71
  205. package/dist/helpers/validations.cjs.map +0 -1
  206. package/dist/helpers/validations.mjs +0 -70
  207. package/dist/helpers/validations.mjs.map +0 -1
  208. package/dist/index.cjs.map +0 -1
  209. package/dist/package.cjs.map +0 -1
  210. package/dist/package.mjs +0 -6
  211. package/dist/package.mjs.map +0 -1
  212. package/dist/plugin-utils/compute-bin.cjs +0 -49
  213. package/dist/plugin-utils/compute-bin.cjs.map +0 -1
  214. package/dist/plugin-utils/compute-bin.d.cts +0 -13
  215. package/dist/plugin-utils/compute-bin.d.cts.map +0 -1
  216. package/dist/plugin-utils/compute-bin.d.mts +0 -13
  217. package/dist/plugin-utils/compute-bin.d.mts.map +0 -1
  218. package/dist/plugin-utils/compute-bin.mjs +0 -49
  219. package/dist/plugin-utils/compute-bin.mjs.map +0 -1
  220. package/dist/plugin-utils/context-helpers.cjs.map +0 -1
  221. package/dist/plugin-utils/context-helpers.d.cts +0 -106
  222. package/dist/plugin-utils/context-helpers.d.cts.map +0 -1
  223. package/dist/plugin-utils/context-helpers.d.mts +0 -106
  224. package/dist/plugin-utils/context-helpers.d.mts.map +0 -1
  225. package/dist/plugin-utils/context-helpers.mjs.map +0 -1
  226. package/dist/plugin-utils/deepkit.cjs +0 -70
  227. package/dist/plugin-utils/deepkit.cjs.map +0 -1
  228. package/dist/plugin-utils/deepkit.d.cts +0 -23
  229. package/dist/plugin-utils/deepkit.d.cts.map +0 -1
  230. package/dist/plugin-utils/deepkit.d.mts +0 -23
  231. package/dist/plugin-utils/deepkit.d.mts.map +0 -1
  232. package/dist/plugin-utils/deepkit.mjs +0 -69
  233. package/dist/plugin-utils/deepkit.mjs.map +0 -1
  234. package/dist/plugin-utils/description-helpers.cjs +0 -112
  235. package/dist/plugin-utils/description-helpers.cjs.map +0 -1
  236. package/dist/plugin-utils/description-helpers.d.cts +0 -44
  237. package/dist/plugin-utils/description-helpers.d.cts.map +0 -1
  238. package/dist/plugin-utils/description-helpers.d.mts +0 -44
  239. package/dist/plugin-utils/description-helpers.d.mts.map +0 -1
  240. package/dist/plugin-utils/description-helpers.mjs +0 -108
  241. package/dist/plugin-utils/description-helpers.mjs.map +0 -1
  242. package/dist/plugin-utils/get-command-tree.cjs +0 -118
  243. package/dist/plugin-utils/get-command-tree.cjs.map +0 -1
  244. package/dist/plugin-utils/get-command-tree.d.cts +0 -36
  245. package/dist/plugin-utils/get-command-tree.d.cts.map +0 -1
  246. package/dist/plugin-utils/get-command-tree.d.mts +0 -36
  247. package/dist/plugin-utils/get-command-tree.d.mts.map +0 -1
  248. package/dist/plugin-utils/get-command-tree.mjs +0 -115
  249. package/dist/plugin-utils/get-command-tree.mjs.map +0 -1
  250. package/dist/plugin-utils/reflect.cjs +0 -54
  251. package/dist/plugin-utils/reflect.cjs.map +0 -1
  252. package/dist/plugin-utils/reflect.d.cts +0 -14
  253. package/dist/plugin-utils/reflect.d.cts.map +0 -1
  254. package/dist/plugin-utils/reflect.d.mts +0 -14
  255. package/dist/plugin-utils/reflect.d.mts.map +0 -1
  256. package/dist/plugin-utils/reflect.mjs +0 -53
  257. package/dist/plugin-utils/reflect.mjs.map +0 -1
  258. package/dist/plugin-utils/traverse-command-tree.cjs +0 -65
  259. package/dist/plugin-utils/traverse-command-tree.cjs.map +0 -1
  260. package/dist/plugin-utils/traverse-command-tree.d.cts +0 -22
  261. package/dist/plugin-utils/traverse-command-tree.d.cts.map +0 -1
  262. package/dist/plugin-utils/traverse-command-tree.d.mts +0 -22
  263. package/dist/plugin-utils/traverse-command-tree.d.mts.map +0 -1
  264. package/dist/plugin-utils/traverse-command-tree.mjs +0 -63
  265. package/dist/plugin-utils/traverse-command-tree.mjs.map +0 -1
  266. package/dist/plugin-utils/type-checks.cjs +0 -222
  267. package/dist/plugin-utils/type-checks.cjs.map +0 -1
  268. package/dist/plugin-utils/type-checks.d.cts +0 -41
  269. package/dist/plugin-utils/type-checks.d.cts.map +0 -1
  270. package/dist/plugin-utils/type-checks.d.mts +0 -41
  271. package/dist/plugin-utils/type-checks.d.mts.map +0 -1
  272. package/dist/plugin-utils/type-checks.mjs +0 -218
  273. package/dist/plugin-utils/type-checks.mjs.map +0 -1
  274. package/dist/plugin.cjs.map +0 -1
  275. package/dist/plugin.mjs.map +0 -1
  276. package/dist/resolver/deepkit.cjs +0 -110
  277. package/dist/resolver/deepkit.cjs.map +0 -1
  278. package/dist/resolver/deepkit.mjs +0 -109
  279. package/dist/resolver/deepkit.mjs.map +0 -1
  280. package/dist/resolver/helpers.cjs +0 -184
  281. package/dist/resolver/helpers.cjs.map +0 -1
  282. package/dist/resolver/helpers.mjs +0 -180
  283. package/dist/resolver/helpers.mjs.map +0 -1
  284. package/dist/resolver/resolve.cjs +0 -473
  285. package/dist/resolver/resolve.cjs.map +0 -1
  286. package/dist/resolver/resolve.mjs +0 -473
  287. package/dist/resolver/resolve.mjs.map +0 -1
  288. package/dist/types/command.cjs.map +0 -1
  289. package/dist/types/command.d.cts.map +0 -1
  290. package/dist/types/command.d.mts.map +0 -1
  291. package/dist/types/command.mjs.map +0 -1
  292. package/dist/types/config.cjs.map +0 -1
  293. package/dist/types/config.d.cts.map +0 -1
  294. package/dist/types/config.d.mts.map +0 -1
  295. package/dist/types/config.mjs.map +0 -1
  296. package/dist/types/context.cjs.map +0 -1
  297. package/dist/types/context.d.cts.map +0 -1
  298. package/dist/types/context.d.mts.map +0 -1
  299. package/dist/types/context.mjs.map +0 -1
  300. package/dist/types/env.cjs +0 -53
  301. package/dist/types/env.cjs.map +0 -1
  302. package/dist/types/env.d.cts +0 -71
  303. package/dist/types/env.d.cts.map +0 -1
  304. package/dist/types/env.d.mts +0 -71
  305. package/dist/types/env.mjs +0 -51
  306. /package/dist/{types → schemas}/env.mjs.map +0 -0
@@ -1,473 +0,0 @@
1
- const require_context_helpers = require('../plugin-utils/context-helpers.cjs');
2
- const require_utilities = require('../helpers/utilities.cjs');
3
- const require_helpers = require('./helpers.cjs');
4
- const require_deepkit = require('./deepkit.cjs');
5
- let _powerlines_schema = require("@powerlines/schema");
6
- let _stryke_convert_to_array = require("@stryke/convert/to-array");
7
- let _stryke_path_replace = require("@stryke/path/replace");
8
- let _stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
9
- let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
10
- let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
11
- let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
12
- let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
13
- let _stryke_type_checks_is_boolean = require("@stryke/type-checks/is-boolean");
14
- let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
15
- let _stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
16
- let _powerlines_deepkit_esbuild_plugin = require("@powerlines/deepkit/esbuild-plugin");
17
- let _stryke_json = require("@stryke/json");
18
-
19
- //#region src/resolver/resolve.ts
20
- const __ΩRecord = [
21
- "K",
22
- "T",
23
- "Record",
24
- "l'e#\"Rb!b\"Pde\"!N#!w#y"
25
- ];
26
- function __assignType(fn, args) {
27
- fn.__type = args;
28
- return fn;
29
- }
30
- function isFiniteNumber(value) {
31
- return typeof value === "number" && Number.isFinite(value);
32
- }
33
- isFiniteNumber.__type = [
34
- "value",
35
- "isFiniteNumber",
36
- "P#2!!/\""
37
- ];
38
- function asRecord(value) {
39
- return (0, _stryke_type_checks_is_set_object.isSetObject)(value) ? value : {};
40
- }
41
- asRecord.__type = [
42
- "value",
43
- () => __ΩRecord,
44
- "asRecord",
45
- "P#2!&#o\"#/#"
46
- ];
47
- function toAliasList(value) {
48
- if (Array.isArray(value)) return (0, _stryke_helpers_get_unique.getUnique)(value.filter(_stryke_type_checks_is_set_string.isSetString));
49
- return (0, _stryke_type_checks_is_set_string.isSetString)(value) ? [value] : [];
50
- }
51
- toAliasList.__type = [
52
- "value",
53
- "toAliasList",
54
- "P#2!&F/\""
55
- ];
56
- function inferParameterType(input) {
57
- const schemaType = input.type;
58
- if (Array.isArray(schemaType)) {
59
- const first = schemaType.find(__assignType((type) => type !== "null", [
60
- "type",
61
- "",
62
- "P\"2!\"/\""
63
- ]));
64
- if (first === "integer" || first === "number") return "number";
65
- if (first === "boolean") return "boolean";
66
- if (first === "array") {
67
- const nestedType = asRecord(input.items).type;
68
- if (nestedType === "integer" || nestedType === "number") return "number";
69
- if (nestedType === "boolean") return "boolean";
70
- return "string";
71
- }
72
- return "string";
73
- }
74
- if (schemaType === "integer" || schemaType === "number") return "number";
75
- if (schemaType === "boolean") return "boolean";
76
- if (schemaType === "array") {
77
- const nestedType = asRecord(input.items).type;
78
- if (nestedType === "integer" || nestedType === "number") return "number";
79
- if (nestedType === "boolean") return "boolean";
80
- return "string";
81
- }
82
- if (Array.isArray(input.enum) && input.enum.length > 0) {
83
- const first = input.enum.find(__assignType((value) => value !== null, [
84
- "value",
85
- "",
86
- "P\"2!\"/\""
87
- ]));
88
- if (isFiniteNumber(first)) return "number";
89
- if ((0, _stryke_type_checks_is_boolean.isBoolean)(first)) return "boolean";
90
- }
91
- if (isFiniteNumber(input.default)) return "number";
92
- if ((0, _stryke_type_checks_is_boolean.isBoolean)(input.default)) return "boolean";
93
- return "string";
94
- }
95
- inferParameterType.__type = [
96
- () => __ΩRecord,
97
- "input",
98
- "CommandOption",
99
- "type",
100
- "inferParameterType",
101
- "P&#o!#2\"\"w#.$f/%"
102
- ];
103
- function inferVariadic(input) {
104
- if ((0, _stryke_type_checks_is_boolean.isBoolean)(input.variadic)) return input.variadic;
105
- return input.type === "array";
106
- }
107
- inferVariadic.__type = [
108
- () => __ΩRecord,
109
- "input",
110
- "inferVariadic",
111
- "P&#o!#2\")/#"
112
- ];
113
- function normalizeDefault(input, type, variadic) {
114
- const defaultValue = input.default;
115
- if (defaultValue === void 0) return;
116
- if (type === "boolean") {
117
- if (variadic) {
118
- if (Array.isArray(defaultValue)) return defaultValue.filter(_stryke_type_checks_is_boolean.isBoolean);
119
- return (0, _stryke_type_checks_is_boolean.isBoolean)(defaultValue) ? [defaultValue] : void 0;
120
- }
121
- if (Array.isArray(defaultValue)) return defaultValue.find(_stryke_type_checks_is_boolean.isBoolean);
122
- return (0, _stryke_type_checks_is_boolean.isBoolean)(defaultValue) ? defaultValue : void 0;
123
- }
124
- if (type === "number") {
125
- if (variadic) {
126
- if (Array.isArray(defaultValue)) return defaultValue.map(__assignType((item) => typeof item === "bigint" ? Number(item) : item, [
127
- "item",
128
- "",
129
- "P\"2!\"/\""
130
- ])).filter(isFiniteNumber);
131
- const normalized = typeof defaultValue === "bigint" ? Number(defaultValue) : defaultValue;
132
- return isFiniteNumber(normalized) ? [normalized] : void 0;
133
- }
134
- if (Array.isArray(defaultValue)) return defaultValue.map(__assignType((item) => typeof item === "bigint" ? Number(item) : item, [
135
- "item",
136
- "",
137
- "P\"2!\"/\""
138
- ])).find(isFiniteNumber);
139
- const normalized = typeof defaultValue === "bigint" ? Number(defaultValue) : defaultValue;
140
- return isFiniteNumber(normalized) ? normalized : void 0;
141
- }
142
- if (variadic) {
143
- if (Array.isArray(defaultValue)) return defaultValue.filter(_stryke_type_checks_is_set_string.isSetString);
144
- return (0, _stryke_type_checks_is_set_string.isSetString)(defaultValue) ? [defaultValue] : void 0;
145
- }
146
- if (Array.isArray(defaultValue)) return defaultValue.find(_stryke_type_checks_is_set_string.isSetString);
147
- return (0, _stryke_type_checks_is_set_string.isSetString)(defaultValue) ? defaultValue : void 0;
148
- }
149
- normalizeDefault.__type = [
150
- () => __ΩRecord,
151
- "input",
152
- "CommandOption",
153
- "type",
154
- "type",
155
- "variadic",
156
- "normalizeDefault",
157
- "P&#o!#2\"\"w#.$f2%)2&\"/'"
158
- ];
159
- function normalizeStringChoices(input) {
160
- const source = Array.isArray(input.choices) ? input.choices : input.enum;
161
- if (!Array.isArray(source)) return;
162
- return source.filter(_stryke_type_checks_is_set_string.isSetString);
163
- }
164
- normalizeStringChoices.__type = [
165
- () => __ΩRecord,
166
- "input",
167
- "normalizeStringChoices",
168
- "P&#o!#2\"\"/#"
169
- ];
170
- function normalizeNumberChoices(input) {
171
- const source = Array.isArray(input.choices) ? input.choices : input.enum;
172
- if (!Array.isArray(source)) return;
173
- return source.map(__assignType((item) => typeof item === "bigint" ? Number(item) : item, [
174
- "item",
175
- "",
176
- "P\"2!\"/\""
177
- ])).filter(isFiniteNumber);
178
- }
179
- normalizeNumberChoices.__type = [
180
- () => __ΩRecord,
181
- "input",
182
- "normalizeNumberChoices",
183
- "P&#o!#2\"\"/#"
184
- ];
185
- function resolveCommandParameter(schema, defaults) {
186
- const input = asRecord(schema);
187
- const type = inferParameterType(input);
188
- const variadic = inferVariadic(input);
189
- const defaultValue = normalizeDefault(input, type, variadic);
190
- const required = (0, _stryke_type_checks_is_boolean.isBoolean)(input.required) ? input.required : defaultValue === void 0 ? defaults.fallbackRequired : false;
191
- const env = (0, _stryke_type_checks_is_set_string.isSetString)(input.env) ? input.env : false;
192
- const result = {
193
- name: (0, _stryke_type_checks_is_set_string.isSetString)(input.name) ? input.name : "",
194
- type,
195
- title: (0, _stryke_type_checks_is_set_string.isSetString)(input.title) ? input.title : "",
196
- description: (0, _stryke_type_checks_is_set_string.isSetString)(input.description) ? input.description : "",
197
- alias: toAliasList(input.alias),
198
- default: defaultValue,
199
- env,
200
- required,
201
- variadic
202
- };
203
- if (type === "string") {
204
- const stringChoices = normalizeStringChoices(input);
205
- if (Array.isArray(stringChoices)) result.choices = stringChoices;
206
- if ((0, _stryke_type_checks_is_set_string.isSetString)(input.format)) result.format = input.format;
207
- }
208
- if (type === "number") {
209
- const numberChoices = normalizeNumberChoices(input);
210
- if (Array.isArray(numberChoices)) result.choices = numberChoices;
211
- }
212
- if (defaults.includeBooleanOptionFields && type === "boolean" && !variadic) {
213
- const optionResult = result;
214
- if ((0, _stryke_type_checks_is_set_string.isSetString)(input.isNegativeOf)) optionResult.isNegativeOf = input.isNegativeOf;
215
- if ((0, _stryke_type_checks_is_boolean.isBoolean)(input.skipAddingNegative)) optionResult.skipAddingNegative = input.skipAddingNegative;
216
- }
217
- return result;
218
- }
219
- resolveCommandParameter.__type = [
220
- "schema",
221
- "fallbackRequired",
222
- "includeBooleanOptionFields",
223
- "defaults",
224
- "CommandOption",
225
- "CommandArgument",
226
- "resolveCommandParameter",
227
- "P#2!P)4\")4#M2$P\"w%\"w&J/'"
228
- ];
229
- async function preprocess(input) {
230
- const { context, command, parent } = input;
231
- const title = command.title || `${parent?.title ? `${parent.virtual ? parent.title.replace(/(?:c|C)ommands?$/, "").trim() : parent.title} - ` : ""}${(0, _stryke_string_format_title_case.titleCase)(command.name)}${command.virtual ? " Commands" : ""}`;
232
- const result = {
233
- input,
234
- output: {
235
- alias: [],
236
- icon: parent?.icon,
237
- tags: parent?.tags ?? [],
238
- ...command,
239
- title,
240
- options: parent === null ? require_utilities.getGlobalOptions(context, command) : {},
241
- args: [],
242
- parent: parent ?? null,
243
- children: {}
244
- }
245
- };
246
- if (!command.virtual) {
247
- if (!command.entry.input?.file || !context.fs.existsSync(command.entry.input.file)) throw new Error(`${!command.entry.input?.file ? "Missing" : "Non-existent"} command entry file for "${command.name}"`);
248
- context.debug(`Adding reflection for CLI command: ${command.id} (file: ${(0, _stryke_path_replace.replacePath)(command.entry.input.file, context.config.cwd)})`);
249
- result.module = await (_powerlines_schema.resolveModule.Ω = [["CommandModule", "\"w!"]], (0, _powerlines_schema.resolveModule)(context, command.entry.input, {
250
- name: `${command.title || (0, _stryke_string_format_title_case.titleCase)(command.name)} Command Bundler`,
251
- plugins: [(0, _powerlines_deepkit_esbuild_plugin.esbuildPlugin)(context, {
252
- reflection: "default",
253
- level: "all"
254
- })],
255
- resolve: { skipNodeModulesBundle: true }
256
- }));
257
- }
258
- if (!command.virtual) {
259
- if (!result.module?.default) throw new Error(`The command entry file "${input.command.entry.input?.file || input.command.path}" does not include a handler function as its default export - this is required for command resolution and execution.`);
260
- const type = (0, _powerlines_deepkit_vendor_type.reflect)(result.module.default);
261
- if (type.kind !== _powerlines_deepkit_vendor_type.ReflectionKind.function) throw new Error(`The command entry file "${input.command.entry.input?.file || input.command.path}" does not have a valid function as its default export - this is required for command resolution and execution.`);
262
- result.reflection = new _powerlines_deepkit_vendor_type.ReflectionFunction(type);
263
- }
264
- return result;
265
- }
266
- preprocess.__type = [
267
- "ResolverInput",
268
- "input",
269
- "ResolverContext",
270
- "preprocess",
271
- "P\"w!2\"\"w#`/$"
272
- ];
273
- async function postprocess(ctx) {
274
- ctx.output.options = require_helpers.applyOptionsDefaults(ctx);
275
- ctx.output.args = require_helpers.applyArgsDefaults(ctx);
276
- ctx.output.args.forEach(__assignType((arg, index) => {
277
- const found = ctx.output.args.findIndex(__assignType((a) => a.name === arg.name, [
278
- "a",
279
- "",
280
- "P\"2!\"/\""
281
- ]));
282
- if (found !== -1 && found !== index || ctx.output.segments.some(__assignType((segment) => require_context_helpers.isDynamicPathSegment(segment) && require_context_helpers.getDynamicPathSegmentName(segment) === arg.name, [
283
- "segment",
284
- "",
285
- "P\"2!\"/\""
286
- ]))) {
287
- arg.name += `_${ctx.output.segments.filter(__assignType((segment) => require_context_helpers.isDynamicPathSegment(segment) && require_context_helpers.getDynamicPathSegmentName(segment).replace(/_\d+$/, "") === arg.name, [
288
- "segment",
289
- "",
290
- "P\"2!\"/\""
291
- ])).length + ctx.output.args.filter(__assignType((a) => a.name.replace(/_\d+$/, "") === arg.name, [
292
- "a",
293
- "",
294
- "P\"2!\"/\""
295
- ])).length}`;
296
- arg.env = arg.name ? arg.env || arg.env === false ? arg.env : ctx.input.context.config.autoAssignEnv ? (0, _stryke_string_format_constant_case.constantCase)(arg.name) : false : false;
297
- }
298
- }, [
299
- "arg",
300
- "index",
301
- "",
302
- "P\"2!\"2\"\"/#"
303
- ]));
304
- require_helpers.applyDefaults(ctx);
305
- if (ctx.input.context.env) {
306
- if ((0, _stryke_type_checks_is_set_object.isSetObject)(ctx.output.options)) Object.values(ctx.output.options).filter(__assignType((option) => Boolean(option.env), [
307
- "option",
308
- "",
309
- "P\"2!\"/\""
310
- ])).forEach(__assignType((option) => {
311
- (0, _powerlines_schema.addProperty)(ctx.input.context.env.config.schema, option.env, {
312
- ...option,
313
- name: option.env,
314
- alias: option.alias.filter(__assignType((alias) => alias.length > 1, [
315
- "alias",
316
- "",
317
- "P\"2!\"/\""
318
- ])).map(__assignType((alias) => (0, _stryke_string_format_constant_case.constantCase)(alias), [
319
- "alias",
320
- "",
321
- "P\"2!\"/\""
322
- ]))
323
- });
324
- }, [
325
- "option",
326
- "",
327
- "P\"2!\"/\""
328
- ]));
329
- ctx.output.args.filter(__assignType((arg) => Boolean(arg.env), [
330
- "arg",
331
- "",
332
- "P\"2!\"/\""
333
- ])).forEach(__assignType((arg) => (0, _powerlines_schema.addProperty)(ctx.input.context.env.config.schema, arg.env, {
334
- ...arg,
335
- name: arg.env,
336
- alias: arg.alias.filter(__assignType((alias) => alias.length > 1, [
337
- "alias",
338
- "",
339
- "P\"2!\"/\""
340
- ])).map(__assignType((alias) => (0, _stryke_string_format_constant_case.constantCase)(alias), [
341
- "alias",
342
- "",
343
- "P\"2!\"/\""
344
- ]))
345
- }), [
346
- "arg",
347
- "",
348
- "P\"2!\"/\""
349
- ]));
350
- }
351
- await Promise.all(ctx.input.context.inputs.filter(__assignType((input) => input.segments.filter(__assignType((segment) => !require_context_helpers.isDynamicPathSegment(segment), [
352
- "segment",
353
- "",
354
- "P\"2!\"/\""
355
- ])).length === ctx.input.command.segments.filter(__assignType((segment) => !require_context_helpers.isDynamicPathSegment(segment), [
356
- "segment",
357
- "",
358
- "P\"2!\"/\""
359
- ])).length + 1 && input.segments.slice(0, ctx.input.command.segments.length).every(__assignType((value, index) => value === ctx.input.command.segments[index], [
360
- "value",
361
- "index",
362
- "",
363
- "P\"2!\"2\"\"/#"
364
- ])), [
365
- "input",
366
- "",
367
- "P\"2!\"/\""
368
- ])).map(__assignType(async (input) => {
369
- ctx.output.children[input.name] = await (resolve.Ω = [[
370
- () => ctx,
371
- "ResolverContext",
372
- "Pi!\"w\"q\"!j"
373
- ]], resolve({
374
- context: ctx.input.context,
375
- command: input,
376
- parent: ctx.output
377
- }));
378
- }, [
379
- "input",
380
- "",
381
- "P\"2!\"/\""
382
- ])));
383
- return ctx.output;
384
- }
385
- postprocess.__type = [
386
- "ResolverContext",
387
- "ctx",
388
- "CommandTree",
389
- "postprocess",
390
- "P\"w!2\"\"w#`/$"
391
- ];
392
- /**
393
- * Resolves a command tree from the given resolver input.
394
- *
395
- * @param input - The resolver input containing the context, command, and optional parent command tree.
396
- * @returns A promise that resolves to the resolved command tree.
397
- */
398
- async function resolve(input) {
399
- const ctx = await (preprocess.Ω = [[
400
- () => input,
401
- "ResolverInput",
402
- "Pi!\"w\"q\"!j"
403
- ]], preprocess(input));
404
- if (!ctx.output.virtual) {
405
- if (!ctx.module) throw new Error(`Command module at path "${ctx.input.command.path}" is undefined or null. Please ensure the module exports a valid command.`);
406
- else if (!(0, _stryke_type_checks_is_set_object.isSetObject)(ctx.module)) throw new TypeError(`Command module at path "${ctx.input.command.path}" is not an object. Please ensure the module exports a valid command.`);
407
- else if (!("default" in ctx.module)) throw new Error(`Command module at path "${ctx.input.command.path}" does not appear to be valid. Please ensure the module's default export is a valid command handler function.`);
408
- const metadata = ctx.module.metadata ?? {};
409
- if ((0, _stryke_type_checks_is_set_string.isSetString)(metadata.title)) ctx.output.title = metadata.title;
410
- if ((0, _stryke_type_checks_is_set_string.isSetString)(metadata.description)) ctx.output.description = metadata.description;
411
- if ((0, _stryke_type_checks_is_set_string.isSetString)(metadata.alias) || Array.isArray(metadata.alias) && metadata.alias.length > 0) ctx.output.alias = (0, _stryke_convert_to_array.toArray)(metadata.alias);
412
- if ((0, _stryke_type_checks_is_set_string.isSetString)(metadata.icon)) ctx.output.icon = metadata.icon;
413
- if ((0, _stryke_type_checks_is_set_string.isSetString)(metadata.tags)) ctx.output.tags = (0, _stryke_helpers_get_unique.getUnique)(ctx.output.tags.concat((0, _stryke_convert_to_array.toArray)(metadata.tags)));
414
- ctx.output.description ??= ctx.input.command.description || (0, _stryke_type_checks_is_function.isFunction)(ctx.reflection?.getDescription) ? ctx.reflection?.getDescription() : ctx.reflection?.description;
415
- if (ctx.module.options) {
416
- const options = await (0, _powerlines_schema.extract)(ctx.input.context, ctx.module.options);
417
- if (!(0, _stryke_type_checks_is_set_object.isSetObject)(options) || !(0, _stryke_json.isJsonSchemaObjectType)(options.schema)) throw new TypeError(`Command options for command at path "${ctx.input.command.path}" must resolve to an object.`);
418
- ctx.output.options = (0, _powerlines_schema.getPropertiesList)(options).reduce(__assignType((ret, property) => {
419
- ret[property.name] = resolveCommandParameter(property, {
420
- fallbackRequired: false,
421
- includeBooleanOptionFields: true
422
- });
423
- return ret;
424
- }, [
425
- "ret",
426
- "property",
427
- "",
428
- "P\"2!\"2\"\"/#"
429
- ]), {});
430
- }
431
- if (ctx.module.args) {
432
- const args = await (0, _powerlines_schema.extract)(ctx.input.context, ctx.module.args);
433
- if ((0, _stryke_type_checks_is_set_object.isSetObject)(args)) {
434
- if (!(0, _stryke_json.isJsonSchemaTupleType)(args.schema) && !(0, _powerlines_schema.isJsonSchemaArray)(args.schema)) throw new TypeError(`Command arguments for command at path "${ctx.input.command.path}" must resolve to a tuple${args?.schema?.type ? `, instead received ${JSON.stringify(args.schema.type)}` : ""}.`);
435
- if (Array.isArray(args.schema.items)) ctx.output.args = args.schema.items.map(__assignType((item) => resolveCommandParameter(item, {
436
- fallbackRequired: true,
437
- includeBooleanOptionFields: false
438
- }), [
439
- "item",
440
- "",
441
- "P\"2!\"/\""
442
- ]));
443
- }
444
- }
445
- const parameters = ctx.reflection?.getParameters() ?? [];
446
- if (parameters.length > 0) {
447
- const hasOptions = parameters[0] && (parameters[0].type.kind === _powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral || parameters[0].type.kind === _powerlines_deepkit_vendor_type.ReflectionKind.class);
448
- if (hasOptions && !ctx.module.options) {
449
- const optionsReflection = _powerlines_deepkit_vendor_type.ReflectionClass.from(parameters[0]?.type);
450
- for (const property of optionsReflection.getProperties()) ctx.output.options[property.getNameAsString()] = require_deepkit.resolveCommandOption(ctx, property);
451
- }
452
- if (!ctx.module.args) ctx.output.args = (hasOptions ? parameters.slice(1) : parameters).map(__assignType((arg, index) => require_deepkit.resolveCommandArgument(ctx, index, arg), [
453
- "arg",
454
- "index",
455
- "",
456
- "P\"2!\"2\"\"/#"
457
- ]));
458
- }
459
- } else require_helpers.resolveVirtualCommand(ctx);
460
- return postprocess(ctx);
461
- }
462
- resolve.__type = [
463
- "ResolverInput",
464
- "input",
465
- "CommandTree",
466
- "resolve",
467
- "Resolves a command tree from the given resolver input.",
468
- "P\"w!2\"\"w#`/$?%"
469
- ];
470
-
471
- //#endregion
472
- exports.resolve = resolve;
473
- //# sourceMappingURL=resolve.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve.cjs","names":[],"sources":[],"mappings":""}