@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,94 +0,0 @@
1
- import { constantCase } from "@stryke/string-format/constant-case";
2
- import { getUniqueBy } from "@stryke/helpers/get-unique";
3
- import { formatTree } from "@stryke/cli/utils/tree";
4
- import { isFunction } from "@stryke/type-checks/is-function";
5
-
6
- //#region src/helpers/utilities.ts
7
- const __ΩRecord = [
8
- "K",
9
- "T",
10
- "Record",
11
- "l'e#\"Rb!b\"Pde\"!N#!w#y"
12
- ];
13
- function __assignType(fn, args) {
14
- fn.__type = args;
15
- return fn;
16
- }
17
- function innerFormatCommandTree(command) {
18
- return {
19
- name: `${command.name}${command.virtual ? " (virtual)" : ""}`,
20
- children: Object.values(command.children ?? {}).map(innerFormatCommandTree)
21
- };
22
- }
23
- innerFormatCommandTree.__type = [
24
- "CommandTree",
25
- "command",
26
- "innerFormatCommandTree",
27
- "P\"w!2\"!/#"
28
- ];
29
- function formatCommandTree(context) {
30
- return formatTree({
31
- name: context.config.name,
32
- children: Object.values(context.commands ?? {}).map(innerFormatCommandTree)
33
- });
34
- }
35
- formatCommandTree.__type = [
36
- "Context",
37
- "context",
38
- "formatCommandTree",
39
- "P\"w!2\"&/#"
40
- ];
41
- /**
42
- * Retrieves the global command options based on the context configuration.
43
- *
44
- * @param context - The build context.
45
- * @param command - The command for which to retrieve global options.
46
- * @returns A record of global command options.
47
- */
48
- function getGlobalOptions(context, command) {
49
- let options;
50
- if (Array.isArray(context.config.globalOptions)) options = Object.fromEntries(getUniqueBy(context.config.globalOptions, __assignType((item) => item.name, [
51
- "CommandOption",
52
- "item",
53
- "",
54
- "P\"w!2\"\"/#"
55
- ])).map(__assignType((option) => [option.name, option], [
56
- "option",
57
- "",
58
- "P\"2!\"/\""
59
- ])));
60
- else if (isFunction(context.config.globalOptions)) options = Object.fromEntries(getUniqueBy(context.config.globalOptions(context, command), __assignType((item) => item.name, [
61
- "CommandOption",
62
- "item",
63
- "",
64
- "P\"w!2\"\"/#"
65
- ])).map(__assignType((option) => [option.name, option], [
66
- "option",
67
- "",
68
- "P\"2!\"/\""
69
- ])));
70
- else options = {};
71
- return Object.fromEntries(Object.entries(options).map(__assignType(([key, value]) => [key, {
72
- ...value,
73
- env: value.env ?? constantCase(key)
74
- }], [
75
- "param0",
76
- "",
77
- "P\"2!\"/\""
78
- ])));
79
- }
80
- getGlobalOptions.__type = [
81
- "Context",
82
- "context",
83
- "CommandBase",
84
- "command",
85
- () => __ΩRecord,
86
- "CommandOption",
87
- "getGlobalOptions",
88
- "Retrieves the global command options based on the context configuration.",
89
- "P\"w!2\"\"w#2$&\"w&o%#/'?("
90
- ];
91
-
92
- //#endregion
93
- export { formatCommandTree, getGlobalOptions };
94
- //# sourceMappingURL=utilities.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utilities.mjs","names":[],"sources":[],"mappings":""}
@@ -1,71 +0,0 @@
1
-
2
- //#region src/helpers/validations.ts
3
- const __ΩValidationFailure = [
4
- "code",
5
- "details",
6
- "ValidationFailure",
7
- "P&4!&4\"Mw#y"
8
- ];
9
- function validateArguments(command) {
10
- const failures = [];
11
- let sequential = false;
12
- for (const argument of command.args ?? []) if ((argument.type === "string" || argument.type === "number") && argument.variadic) if (!sequential) sequential = true;
13
- else failures.push({
14
- code: "SEQUENTIAL_VARIADIC_ARGUMENTS",
15
- details: `Sequential variadic arguments are not allowed - since the argument preceding ${argument.name} is variadic, it must not also be variadic.`
16
- });
17
- else sequential = false;
18
- return failures;
19
- }
20
- validateArguments.__type = [
21
- "CommandTree",
22
- "command",
23
- () => __ΩValidationFailure,
24
- "validateArguments",
25
- "P\"w!2\"n#F/$"
26
- ];
27
- function validateOptions(command) {
28
- const failures = [];
29
- const optionNames = (Set.Ω = [["&"]], /* @__PURE__ */ new Set());
30
- for (const option of Object.values(command.options ?? {})) {
31
- if (optionNames.has(option.name)) failures.push({
32
- code: "DUPLICATE_OPTION_NAME",
33
- details: `Duplicate option name "${option.name}" found in command.`
34
- });
35
- optionNames.add(option.name);
36
- for (const alias of option.alias) {
37
- if (optionNames.has(alias)) failures.push({
38
- code: "DUPLICATE_OPTION_ALIAS",
39
- details: `Duplicate option name "${alias}" (an alias of "${option.name}") found in command.`
40
- });
41
- optionNames.add(alias);
42
- }
43
- }
44
- return failures;
45
- }
46
- validateOptions.__type = [
47
- "CommandTree",
48
- "command",
49
- () => __ΩValidationFailure,
50
- "validateOptions",
51
- "P\"w!2\"n#F/$"
52
- ];
53
- function validateCommand(command) {
54
- const results = [];
55
- let failures = validateOptions(command);
56
- if (failures.length > 0) results.push(...failures);
57
- failures = validateArguments(command);
58
- if (failures.length > 0) results.push(...failures);
59
- return results;
60
- }
61
- validateCommand.__type = [
62
- "CommandTree",
63
- "command",
64
- () => __ΩValidationFailure,
65
- "validateCommand",
66
- "P\"w!2\"n#F/$"
67
- ];
68
-
69
- //#endregion
70
- exports.validateCommand = validateCommand;
71
- //# sourceMappingURL=validations.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validations.cjs","names":[],"sources":[],"mappings":""}
@@ -1,70 +0,0 @@
1
- //#region src/helpers/validations.ts
2
- const __ΩValidationFailure = [
3
- "code",
4
- "details",
5
- "ValidationFailure",
6
- "P&4!&4\"Mw#y"
7
- ];
8
- function validateArguments(command) {
9
- const failures = [];
10
- let sequential = false;
11
- for (const argument of command.args ?? []) if ((argument.type === "string" || argument.type === "number") && argument.variadic) if (!sequential) sequential = true;
12
- else failures.push({
13
- code: "SEQUENTIAL_VARIADIC_ARGUMENTS",
14
- details: `Sequential variadic arguments are not allowed - since the argument preceding ${argument.name} is variadic, it must not also be variadic.`
15
- });
16
- else sequential = false;
17
- return failures;
18
- }
19
- validateArguments.__type = [
20
- "CommandTree",
21
- "command",
22
- () => __ΩValidationFailure,
23
- "validateArguments",
24
- "P\"w!2\"n#F/$"
25
- ];
26
- function validateOptions(command) {
27
- const failures = [];
28
- const optionNames = (Set.Ω = [["&"]], /* @__PURE__ */ new Set());
29
- for (const option of Object.values(command.options ?? {})) {
30
- if (optionNames.has(option.name)) failures.push({
31
- code: "DUPLICATE_OPTION_NAME",
32
- details: `Duplicate option name "${option.name}" found in command.`
33
- });
34
- optionNames.add(option.name);
35
- for (const alias of option.alias) {
36
- if (optionNames.has(alias)) failures.push({
37
- code: "DUPLICATE_OPTION_ALIAS",
38
- details: `Duplicate option name "${alias}" (an alias of "${option.name}") found in command.`
39
- });
40
- optionNames.add(alias);
41
- }
42
- }
43
- return failures;
44
- }
45
- validateOptions.__type = [
46
- "CommandTree",
47
- "command",
48
- () => __ΩValidationFailure,
49
- "validateOptions",
50
- "P\"w!2\"n#F/$"
51
- ];
52
- function validateCommand(command) {
53
- const results = [];
54
- let failures = validateOptions(command);
55
- if (failures.length > 0) results.push(...failures);
56
- failures = validateArguments(command);
57
- if (failures.length > 0) results.push(...failures);
58
- return results;
59
- }
60
- validateCommand.__type = [
61
- "CommandTree",
62
- "command",
63
- () => __ΩValidationFailure,
64
- "validateCommand",
65
- "P\"w!2\"n#F/$"
66
- ];
67
-
68
- //#endregion
69
- export { validateCommand };
70
- //# sourceMappingURL=validations.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validations.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"package.cjs","names":[],"sources":[],"mappings":""}
package/dist/package.mjs DELETED
@@ -1,6 +0,0 @@
1
- //#region package.json
2
- var version = "0.17.21";
3
-
4
- //#endregion
5
- export { version };
6
- //# sourceMappingURL=package.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"package.mjs","names":[],"sources":[],"mappings":""}
@@ -1,49 +0,0 @@
1
- const require_context_helpers = require('./context-helpers.cjs');
2
- let _stryke_path_join_paths = require("@stryke/path/join-paths");
3
-
4
- //#region src/plugin-utils/compute-bin.ts
5
- function __assignType(fn, args) {
6
- fn.__type = args;
7
- return fn;
8
- }
9
- /**
10
- * Computes the command tree for the root binary command based on the provided context.
11
- *
12
- * @param context - The plugin context containing the necessary information to compute the command tree.
13
- * @returns The computed command tree for the root binary command.
14
- */
15
- function computeBin(context) {
16
- return {
17
- id: "",
18
- name: require_context_helpers.getAppName(context),
19
- title: require_context_helpers.getAppTitle(context),
20
- description: require_context_helpers.getAppDescription(context),
21
- virtual: true,
22
- path: null,
23
- segments: [],
24
- alias: [],
25
- tags: [],
26
- options: Object.fromEntries(context.globalOptions.map(__assignType((option) => [option.name, option], [
27
- "option",
28
- "",
29
- "P\"2!\"/\""
30
- ]))),
31
- args: [],
32
- entry: { file: (0, _stryke_path_join_paths.joinPaths)(context.entryPath, "bin.ts") },
33
- parent: null,
34
- children: context.commands,
35
- docs: context.config.docs?.app
36
- };
37
- }
38
- computeBin.__type = [
39
- "Context",
40
- "context",
41
- "CommandTree",
42
- "computeBin",
43
- "Computes the command tree for the root binary command based on the provided context.",
44
- "P\"w!2\"\"w#/$?%"
45
- ];
46
-
47
- //#endregion
48
- exports.computeBin = computeBin;
49
- //# sourceMappingURL=compute-bin.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compute-bin.cjs","names":[],"sources":[],"mappings":""}
@@ -1,13 +0,0 @@
1
- import { CommandTree } from "../types/command.cjs";
2
- import { Context } from "../types/context.cjs";
3
- //#region src/plugin-utils/compute-bin.d.ts
4
- /**
5
- * Computes the command tree for the root binary command based on the provided context.
6
- *
7
- * @param context - The plugin context containing the necessary information to compute the command tree.
8
- * @returns The computed command tree for the root binary command.
9
- */
10
- declare function computeBin(context: Context): CommandTree;
11
- //#endregion
12
- export { computeBin };
13
- //# sourceMappingURL=compute-bin.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compute-bin.d.cts","names":[],"sources":["../../src/plugin-utils/compute-bin.ts"],"mappings":";;;;;;;AA4BA;;iBAAgB,UAAA,CAAW,OAAA,EAAS,OAAA,GAAU,WAAW"}
@@ -1,13 +0,0 @@
1
- import { CommandTree } from "../types/command.mjs";
2
- import { Context } from "../types/context.mjs";
3
- //#region src/plugin-utils/compute-bin.d.ts
4
- /**
5
- * Computes the command tree for the root binary command based on the provided context.
6
- *
7
- * @param context - The plugin context containing the necessary information to compute the command tree.
8
- * @returns The computed command tree for the root binary command.
9
- */
10
- declare function computeBin(context: Context): CommandTree;
11
- //#endregion
12
- export { computeBin };
13
- //# sourceMappingURL=compute-bin.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compute-bin.d.mts","names":[],"sources":["../../src/plugin-utils/compute-bin.ts"],"mappings":""}
@@ -1,49 +0,0 @@
1
- import { getAppDescription, getAppName, getAppTitle } from "./context-helpers.mjs";
2
- import { joinPaths } from "@stryke/path/join-paths";
3
-
4
- //#region src/plugin-utils/compute-bin.ts
5
- function __assignType(fn, args) {
6
- fn.__type = args;
7
- return fn;
8
- }
9
- /**
10
- * Computes the command tree for the root binary command based on the provided context.
11
- *
12
- * @param context - The plugin context containing the necessary information to compute the command tree.
13
- * @returns The computed command tree for the root binary command.
14
- */
15
- function computeBin(context) {
16
- return {
17
- id: "",
18
- name: getAppName(context),
19
- title: getAppTitle(context),
20
- description: getAppDescription(context),
21
- virtual: true,
22
- path: null,
23
- segments: [],
24
- alias: [],
25
- tags: [],
26
- options: Object.fromEntries(context.globalOptions.map(__assignType((option) => [option.name, option], [
27
- "option",
28
- "",
29
- "P\"2!\"/\""
30
- ]))),
31
- args: [],
32
- entry: { file: joinPaths(context.entryPath, "bin.ts") },
33
- parent: null,
34
- children: context.commands,
35
- docs: context.config.docs?.app
36
- };
37
- }
38
- computeBin.__type = [
39
- "Context",
40
- "context",
41
- "CommandTree",
42
- "computeBin",
43
- "Computes the command tree for the root binary command based on the provided context.",
44
- "P\"w!2\"\"w#/$?%"
45
- ];
46
-
47
- //#endregion
48
- export { computeBin };
49
- //# sourceMappingURL=compute-bin.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compute-bin.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"context-helpers.cjs","names":[],"sources":[],"mappings":""}
@@ -1,106 +0,0 @@
1
- import { Context, UnresolvedContext } from "../types/context.cjs";
2
- //#region src/plugin-utils/context-helpers.d.ts
3
- /**
4
- * Sorts command argument aliases, placing single-character aliases first, followed by multi-character aliases, and then sorting them alphabetically.
5
- *
6
- * @param aliases - An array of argument aliases to sort.
7
- * @returns A new array of sorted aliases.
8
- */
9
- declare function sortArgAliases(aliases: string[]): string[];
10
- /**
11
- * Retrieves the application name from the context and configuration.
12
- *
13
- * @param context - The build context containing workspace and package information.
14
- * @returns The application name in kebab-case format.
15
- * @throws An error if no valid application name is found.
16
- */
17
- declare function getAppName<TContext extends UnresolvedContext | Context>(context: TContext): string;
18
- /**
19
- * Retrieves the application title from the context and configuration.
20
- *
21
- * @param context - The build context containing workspace and package information.
22
- * @param replaceCLI - Whether to replace CLI-related terms in the title with the application name.
23
- * @returns The application title in title-case format.
24
- */
25
- declare function getAppTitle<TContext extends UnresolvedContext | Context>(context: TContext, replaceCLI?: boolean): string;
26
- /**
27
- * Retrieves the application description from the context and configuration.
28
- *
29
- * @param context - The build context containing workspace and package information.
30
- * @returns The application description.
31
- */
32
- declare function getAppDescription<TContext extends UnresolvedContext | Context>(context: TContext): string;
33
- /**
34
- * Retrieves the primary binary name for the application.
35
- *
36
- * @param context - The build context containing workspace and package information.
37
- * @returns The primary binary name as a string.
38
- */
39
- declare function getAppBin<TContext extends UnresolvedContext | Context>(context: TContext): string;
40
- /**
41
- * Determines if a given command path segment is variable (enclosed in square brackets).
42
- *
43
- * @example
44
- * ```typescript
45
- * isDynamicPathSegment("[user]"); // true
46
- * isDynamicPathSegment("user"); // false
47
- * ```
48
- *
49
- * @param path - The command path segment to check.
50
- * @returns True if the path is variable, false otherwise.
51
- */
52
- declare function isDynamicPathSegment(path: string): boolean;
53
- /**
54
- * Extracts the variable name from a command path segment by removing enclosing square brackets.
55
- *
56
- * @example
57
- * ```typescript
58
- * getDynamicPathSegmentName("[user]"); // "user"
59
- * ```
60
- *
61
- * @param path - The command path segment.
62
- * @returns The variable name without square brackets.
63
- */
64
- declare function getDynamicPathSegmentName(path: string): string;
65
- /**
66
- * Determines if a given command path segment is a path segment group (enclosed in parentheses).
67
- *
68
- * @example
69
- * ```typescript
70
- * isPathSegmentGroup("(user)"); // true
71
- * isPathSegmentGroup("[user]"); // false
72
- * isPathSegmentGroup("user"); // false
73
- * ```
74
- *
75
- * @param path - The command path segment to check.
76
- * @returns True if the path is a path segment group, false otherwise.
77
- */
78
- declare function isPathSegmentGroup(path: string): boolean;
79
- /**
80
- * Extracts the group name from a command path segment by removing enclosing parentheses.
81
- *
82
- * @example
83
- * ```typescript
84
- * getPathSegmentGroupName("(admin)"); // "admin"
85
- * getPathSegmentGroupName("((group))"); // "group"
86
- * ```
87
- *
88
- * @param path - The command path segment.
89
- * @returns The group name without parentheses.
90
- */
91
- declare function getPathSegmentGroupName(path: string): string;
92
- /**
93
- * Extracts the variable name from a command path segment by removing enclosing square brackets.
94
- *
95
- * @example
96
- * ```typescript
97
- * getDynamicPathSegmentName("[user]"); // "user"
98
- * ```
99
- *
100
- * @param path - The command path segment.
101
- * @returns The variable name without square brackets.
102
- */
103
- declare function getPathSegmentName(path: string): string;
104
- //#endregion
105
- export { getAppBin, getAppDescription, getAppName, getAppTitle, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases };
106
- //# sourceMappingURL=context-helpers.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context-helpers.d.cts","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"mappings":";;;;;AA8BA;;;iBAAgB,cAAA,CAAe,OAAiB;AAAA;AAkBhD;;;;;;AAlBgD,iBAkBhC,UAAA,kBAA4B,iBAAA,GAAoB,OAAA,EAC9D,OAAA,EAAS,QAAA;;;;;;;;iBA4BK,WAAA,kBAA6B,iBAAA,GAAoB,OAAA,EAC/D,OAAA,EAAS,QAAA,EACT,UAAA;AAFF;;;;;;AAAA,iBAwBgB,iBAAA,kBAAmC,iBAAA,GAAoB,OAAA,EACrE,OAAA,EAAS,QAAA;;;;;;;iBAeK,SAAA,kBAA2B,iBAAA,GAAoB,OAAA,EAC7D,OAAA,EAAS,QAAA;;AAvCS;AAsBpB;;;;;;;;;;iBAoCgB,oBAAA,CAAqB,IAAY;;;;AAnC9B;AAenB;;;;;;;iBAmCgB,yBAAA,CAA0B,IAAY;;;;;;;AAlCnC;AAmBnB;;;;AAAiD;AAejD;iBAiBgB,kBAAA,CAAmB,IAAY;;;AAjBO;AAiBtD;;;;AAA+C;AAgB/C;;;;iBAAgB,uBAAA,CAAwB,IAAY;AAkBpD;;;;AAA+C;;;;;;;AAA/C,iBAAgB,kBAAA,CAAmB,IAAY"}
@@ -1,106 +0,0 @@
1
- import { Context, UnresolvedContext } from "../types/context.mjs";
2
- //#region src/plugin-utils/context-helpers.d.ts
3
- /**
4
- * Sorts command argument aliases, placing single-character aliases first, followed by multi-character aliases, and then sorting them alphabetically.
5
- *
6
- * @param aliases - An array of argument aliases to sort.
7
- * @returns A new array of sorted aliases.
8
- */
9
- declare function sortArgAliases(aliases: string[]): string[];
10
- /**
11
- * Retrieves the application name from the context and configuration.
12
- *
13
- * @param context - The build context containing workspace and package information.
14
- * @returns The application name in kebab-case format.
15
- * @throws An error if no valid application name is found.
16
- */
17
- declare function getAppName<TContext extends UnresolvedContext | Context>(context: TContext): string;
18
- /**
19
- * Retrieves the application title from the context and configuration.
20
- *
21
- * @param context - The build context containing workspace and package information.
22
- * @param replaceCLI - Whether to replace CLI-related terms in the title with the application name.
23
- * @returns The application title in title-case format.
24
- */
25
- declare function getAppTitle<TContext extends UnresolvedContext | Context>(context: TContext, replaceCLI?: boolean): string;
26
- /**
27
- * Retrieves the application description from the context and configuration.
28
- *
29
- * @param context - The build context containing workspace and package information.
30
- * @returns The application description.
31
- */
32
- declare function getAppDescription<TContext extends UnresolvedContext | Context>(context: TContext): string;
33
- /**
34
- * Retrieves the primary binary name for the application.
35
- *
36
- * @param context - The build context containing workspace and package information.
37
- * @returns The primary binary name as a string.
38
- */
39
- declare function getAppBin<TContext extends UnresolvedContext | Context>(context: TContext): string;
40
- /**
41
- * Determines if a given command path segment is variable (enclosed in square brackets).
42
- *
43
- * @example
44
- * ```typescript
45
- * isDynamicPathSegment("[user]"); // true
46
- * isDynamicPathSegment("user"); // false
47
- * ```
48
- *
49
- * @param path - The command path segment to check.
50
- * @returns True if the path is variable, false otherwise.
51
- */
52
- declare function isDynamicPathSegment(path: string): boolean;
53
- /**
54
- * Extracts the variable name from a command path segment by removing enclosing square brackets.
55
- *
56
- * @example
57
- * ```typescript
58
- * getDynamicPathSegmentName("[user]"); // "user"
59
- * ```
60
- *
61
- * @param path - The command path segment.
62
- * @returns The variable name without square brackets.
63
- */
64
- declare function getDynamicPathSegmentName(path: string): string;
65
- /**
66
- * Determines if a given command path segment is a path segment group (enclosed in parentheses).
67
- *
68
- * @example
69
- * ```typescript
70
- * isPathSegmentGroup("(user)"); // true
71
- * isPathSegmentGroup("[user]"); // false
72
- * isPathSegmentGroup("user"); // false
73
- * ```
74
- *
75
- * @param path - The command path segment to check.
76
- * @returns True if the path is a path segment group, false otherwise.
77
- */
78
- declare function isPathSegmentGroup(path: string): boolean;
79
- /**
80
- * Extracts the group name from a command path segment by removing enclosing parentheses.
81
- *
82
- * @example
83
- * ```typescript
84
- * getPathSegmentGroupName("(admin)"); // "admin"
85
- * getPathSegmentGroupName("((group))"); // "group"
86
- * ```
87
- *
88
- * @param path - The command path segment.
89
- * @returns The group name without parentheses.
90
- */
91
- declare function getPathSegmentGroupName(path: string): string;
92
- /**
93
- * Extracts the variable name from a command path segment by removing enclosing square brackets.
94
- *
95
- * @example
96
- * ```typescript
97
- * getDynamicPathSegmentName("[user]"); // "user"
98
- * ```
99
- *
100
- * @param path - The command path segment.
101
- * @returns The variable name without square brackets.
102
- */
103
- declare function getPathSegmentName(path: string): string;
104
- //#endregion
105
- export { getAppBin, getAppDescription, getAppName, getAppTitle, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases };
106
- //# sourceMappingURL=context-helpers.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context-helpers.d.mts","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"context-helpers.mjs","names":[],"sources":[],"mappings":""}