@shell-shock/core 0.17.8 → 0.17.11

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 (272) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +29 -1
  2. package/dist/api.cjs +36 -1
  3. package/dist/api.cjs.map +1 -0
  4. package/dist/api.d.cts +2 -77
  5. package/dist/api.d.cts.map +1 -1
  6. package/dist/api.d.mts +2 -76
  7. package/dist/api.d.mts.map +1 -1
  8. package/dist/api.mjs +35 -1
  9. package/dist/api.mjs.map +1 -1
  10. package/dist/components/command-validation-logic.cjs +291 -1
  11. package/dist/components/command-validation-logic.cjs.map +1 -0
  12. package/dist/components/command-validation-logic.d.cts +1 -3
  13. package/dist/components/command-validation-logic.d.cts.map +1 -1
  14. package/dist/components/command-validation-logic.d.mts +1 -3
  15. package/dist/components/command-validation-logic.d.mts.map +1 -1
  16. package/dist/components/command-validation-logic.mjs +288 -1
  17. package/dist/components/command-validation-logic.mjs.map +1 -1
  18. package/dist/components/docs.cjs +265 -1
  19. package/dist/components/docs.cjs.map +1 -0
  20. package/dist/components/docs.d.cts +4 -5
  21. package/dist/components/docs.d.cts.map +1 -1
  22. package/dist/components/docs.d.mts +4 -5
  23. package/dist/components/docs.d.mts.map +1 -1
  24. package/dist/components/docs.mjs +256 -1
  25. package/dist/components/docs.mjs.map +1 -1
  26. package/dist/components/exec-builtin.cjs +429 -15
  27. package/dist/components/exec-builtin.cjs.map +1 -0
  28. package/dist/components/exec-builtin.d.cts +1 -2
  29. package/dist/components/exec-builtin.d.cts.map +1 -1
  30. package/dist/components/exec-builtin.d.mts +1 -2
  31. package/dist/components/exec-builtin.d.mts.map +1 -1
  32. package/dist/components/exec-builtin.mjs +424 -15
  33. package/dist/components/exec-builtin.mjs.map +1 -1
  34. package/dist/components/helpers.cjs +119 -1
  35. package/dist/components/helpers.cjs.map +1 -0
  36. package/dist/components/helpers.d.cts +6 -8
  37. package/dist/components/helpers.d.cts.map +1 -1
  38. package/dist/components/helpers.d.mts +6 -8
  39. package/dist/components/helpers.d.mts.map +1 -1
  40. package/dist/components/helpers.mjs +111 -1
  41. package/dist/components/helpers.mjs.map +1 -1
  42. package/dist/components/index.cjs +58 -1
  43. package/dist/components/index.mjs +10 -1
  44. package/dist/components/options-parser-logic.cjs +959 -5
  45. package/dist/components/options-parser-logic.cjs.map +1 -0
  46. package/dist/components/options-parser-logic.d.cts +8 -9
  47. package/dist/components/options-parser-logic.d.cts.map +1 -1
  48. package/dist/components/options-parser-logic.d.mts +8 -9
  49. package/dist/components/options-parser-logic.d.mts.map +1 -1
  50. package/dist/components/options-parser-logic.mjs +944 -5
  51. package/dist/components/options-parser-logic.mjs.map +1 -1
  52. package/dist/components/state-builtin.cjs +630 -8
  53. package/dist/components/state-builtin.cjs.map +1 -0
  54. package/dist/components/state-builtin.d.cts +4 -5
  55. package/dist/components/state-builtin.d.cts.map +1 -1
  56. package/dist/components/state-builtin.d.mts +4 -5
  57. package/dist/components/state-builtin.d.mts.map +1 -1
  58. package/dist/components/state-builtin.mjs +622 -8
  59. package/dist/components/state-builtin.mjs.map +1 -1
  60. package/dist/components/usage.cjs +116 -1
  61. package/dist/components/usage.cjs.map +1 -0
  62. package/dist/components/usage.d.cts +1 -2
  63. package/dist/components/usage.d.cts.map +1 -1
  64. package/dist/components/usage.d.mts +1 -2
  65. package/dist/components/usage.d.mts.map +1 -1
  66. package/dist/components/usage.mjs +113 -1
  67. package/dist/components/usage.mjs.map +1 -1
  68. package/dist/components/utils-builtin.cjs +839 -33
  69. package/dist/components/utils-builtin.cjs.map +1 -0
  70. package/dist/components/utils-builtin.d.cts +7 -8
  71. package/dist/components/utils-builtin.d.cts.map +1 -1
  72. package/dist/components/utils-builtin.d.mts +7 -8
  73. package/dist/components/utils-builtin.d.mts.map +1 -1
  74. package/dist/components/utils-builtin.mjs +828 -33
  75. package/dist/components/utils-builtin.mjs.map +1 -1
  76. package/dist/config.cjs +65 -1
  77. package/dist/config.cjs.map +1 -0
  78. package/dist/config.d.cts +29 -8
  79. package/dist/config.d.cts.map +1 -1
  80. package/dist/config.d.mts +29 -8
  81. package/dist/config.d.mts.map +1 -1
  82. package/dist/config.mjs +62 -1
  83. package/dist/config.mjs.map +1 -1
  84. package/dist/contexts/command.cjs +26 -1
  85. package/dist/contexts/command.cjs.map +1 -0
  86. package/dist/contexts/command.d.cts.map +1 -1
  87. package/dist/contexts/command.d.mts.map +1 -1
  88. package/dist/contexts/command.mjs +23 -1
  89. package/dist/contexts/command.mjs.map +1 -1
  90. package/dist/contexts/index.cjs +9 -1
  91. package/dist/contexts/index.mjs +4 -1
  92. package/dist/contexts/options.cjs +63 -1
  93. package/dist/contexts/options.cjs.map +1 -0
  94. package/dist/contexts/options.d.cts.map +1 -1
  95. package/dist/contexts/options.d.mts.map +1 -1
  96. package/dist/contexts/options.mjs +57 -1
  97. package/dist/contexts/options.mjs.map +1 -1
  98. package/dist/engine.cjs +138 -0
  99. package/dist/engine.cjs.map +1 -0
  100. package/dist/engine.d.cts +79 -0
  101. package/dist/engine.d.cts.map +1 -0
  102. package/dist/engine.d.mts +79 -0
  103. package/dist/engine.d.mts.map +1 -0
  104. package/dist/engine.mjs +136 -0
  105. package/dist/engine.mjs.map +1 -0
  106. package/dist/helpers/automd.cjs +70 -1
  107. package/dist/helpers/automd.cjs.map +1 -0
  108. package/dist/helpers/automd.mjs +69 -1
  109. package/dist/helpers/automd.mjs.map +1 -1
  110. package/dist/helpers/docs-helpers.cjs +23 -1
  111. package/dist/helpers/docs-helpers.cjs.map +1 -0
  112. package/dist/helpers/docs-helpers.mjs +22 -1
  113. package/dist/helpers/docs-helpers.mjs.map +1 -1
  114. package/dist/helpers/get-framework.cjs +24 -0
  115. package/dist/helpers/get-framework.cjs.map +1 -0
  116. package/dist/helpers/get-framework.mjs +24 -0
  117. package/dist/helpers/get-framework.mjs.map +1 -0
  118. package/dist/helpers/paths.cjs +137 -1
  119. package/dist/helpers/paths.cjs.map +1 -0
  120. package/dist/helpers/paths.mjs +133 -1
  121. package/dist/helpers/paths.mjs.map +1 -1
  122. package/dist/helpers/persistence.cjs +113 -1
  123. package/dist/helpers/persistence.cjs.map +1 -0
  124. package/dist/helpers/persistence.mjs +112 -1
  125. package/dist/helpers/persistence.mjs.map +1 -1
  126. package/dist/helpers/update-package-json.cjs +65 -1
  127. package/dist/helpers/update-package-json.cjs.map +1 -0
  128. package/dist/helpers/update-package-json.mjs +63 -1
  129. package/dist/helpers/update-package-json.mjs.map +1 -1
  130. package/dist/helpers/utilities.cjs +95 -1
  131. package/dist/helpers/utilities.cjs.map +1 -0
  132. package/dist/helpers/utilities.mjs +93 -1
  133. package/dist/helpers/utilities.mjs.map +1 -1
  134. package/dist/helpers/validations.cjs +71 -1
  135. package/dist/helpers/validations.cjs.map +1 -0
  136. package/dist/helpers/validations.mjs +69 -1
  137. package/dist/helpers/validations.mjs.map +1 -1
  138. package/dist/index.cjs +123 -1
  139. package/dist/index.cjs.map +1 -0
  140. package/dist/index.d.cts +80 -5
  141. package/dist/index.d.cts.map +1 -0
  142. package/dist/index.d.mts +80 -5
  143. package/dist/index.d.mts.map +1 -0
  144. package/dist/index.mjs +119 -1
  145. package/dist/index.mjs.map +1 -0
  146. package/dist/package.cjs +12 -0
  147. package/dist/package.cjs.map +1 -0
  148. package/dist/package.mjs +6 -0
  149. package/dist/package.mjs.map +1 -0
  150. package/dist/plugin-utils/compute-bin.cjs +48 -1
  151. package/dist/plugin-utils/compute-bin.cjs.map +1 -0
  152. package/dist/plugin-utils/compute-bin.d.cts +2 -2
  153. package/dist/plugin-utils/compute-bin.d.cts.map +1 -1
  154. package/dist/plugin-utils/compute-bin.d.mts +2 -2
  155. package/dist/plugin-utils/compute-bin.d.mts.map +1 -1
  156. package/dist/plugin-utils/compute-bin.mjs +47 -1
  157. package/dist/plugin-utils/compute-bin.mjs.map +1 -1
  158. package/dist/plugin-utils/context-helpers.cjs +224 -1
  159. package/dist/plugin-utils/context-helpers.cjs.map +1 -0
  160. package/dist/plugin-utils/context-helpers.d.cts +4 -4
  161. package/dist/plugin-utils/context-helpers.d.cts.map +1 -1
  162. package/dist/plugin-utils/context-helpers.d.mts +4 -4
  163. package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
  164. package/dist/plugin-utils/context-helpers.mjs +214 -1
  165. package/dist/plugin-utils/context-helpers.mjs.map +1 -1
  166. package/dist/plugin-utils/deepkit.cjs +70 -1
  167. package/dist/plugin-utils/deepkit.cjs.map +1 -0
  168. package/dist/plugin-utils/deepkit.d.cts +5 -5
  169. package/dist/plugin-utils/deepkit.d.cts.map +1 -1
  170. package/dist/plugin-utils/deepkit.d.mts +5 -5
  171. package/dist/plugin-utils/deepkit.d.mts.map +1 -1
  172. package/dist/plugin-utils/deepkit.mjs +68 -1
  173. package/dist/plugin-utils/deepkit.mjs.map +1 -1
  174. package/dist/plugin-utils/description-helpers.cjs +112 -2
  175. package/dist/plugin-utils/description-helpers.cjs.map +1 -0
  176. package/dist/plugin-utils/description-helpers.d.cts.map +1 -1
  177. package/dist/plugin-utils/description-helpers.d.mts.map +1 -1
  178. package/dist/plugin-utils/description-helpers.mjs +107 -2
  179. package/dist/plugin-utils/description-helpers.mjs.map +1 -1
  180. package/dist/plugin-utils/get-command-tree.cjs +118 -1
  181. package/dist/plugin-utils/get-command-tree.cjs.map +1 -0
  182. package/dist/plugin-utils/get-command-tree.d.cts.map +1 -1
  183. package/dist/plugin-utils/get-command-tree.d.mts.map +1 -1
  184. package/dist/plugin-utils/get-command-tree.mjs +114 -1
  185. package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
  186. package/dist/plugin-utils/index.cjs +39 -1
  187. package/dist/plugin-utils/index.d.cts +2 -2
  188. package/dist/plugin-utils/index.d.mts +2 -2
  189. package/dist/plugin-utils/index.mjs +10 -1
  190. package/dist/plugin-utils/reflect.cjs +52 -1
  191. package/dist/plugin-utils/reflect.cjs.map +1 -0
  192. package/dist/plugin-utils/reflect.d.cts.map +1 -1
  193. package/dist/plugin-utils/reflect.d.mts.map +1 -1
  194. package/dist/plugin-utils/reflect.mjs +50 -1
  195. package/dist/plugin-utils/reflect.mjs.map +1 -1
  196. package/dist/plugin-utils/traverse-command-tree.cjs +65 -1
  197. package/dist/plugin-utils/traverse-command-tree.cjs.map +1 -0
  198. package/dist/plugin-utils/traverse-command-tree.d.cts.map +1 -1
  199. package/dist/plugin-utils/traverse-command-tree.d.mts.map +1 -1
  200. package/dist/plugin-utils/traverse-command-tree.mjs +62 -1
  201. package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
  202. package/dist/plugin-utils/type-checks.cjs +222 -1
  203. package/dist/plugin-utils/type-checks.cjs.map +1 -0
  204. package/dist/plugin-utils/type-checks.d.cts +5 -5
  205. package/dist/plugin-utils/type-checks.d.cts.map +1 -1
  206. package/dist/plugin-utils/type-checks.d.mts +5 -5
  207. package/dist/plugin-utils/type-checks.d.mts.map +1 -1
  208. package/dist/plugin-utils/type-checks.mjs +217 -1
  209. package/dist/plugin-utils/type-checks.mjs.map +1 -1
  210. package/dist/plugin.cjs +495 -4
  211. package/dist/plugin.cjs.map +1 -0
  212. package/dist/plugin.d.cts.map +1 -1
  213. package/dist/plugin.d.mts.map +1 -1
  214. package/dist/plugin.mjs +488 -4
  215. package/dist/plugin.mjs.map +1 -1
  216. package/dist/resolver/helpers.cjs +182 -1
  217. package/dist/resolver/helpers.cjs.map +1 -0
  218. package/dist/resolver/helpers.mjs +178 -1
  219. package/dist/resolver/helpers.mjs.map +1 -1
  220. package/dist/resolver/resolve.cjs +479 -1
  221. package/dist/resolver/resolve.cjs.map +1 -0
  222. package/dist/resolver/resolve.mjs +478 -1
  223. package/dist/resolver/resolve.mjs.map +1 -1
  224. package/dist/types/command.cjs +402 -1
  225. package/dist/types/command.cjs.map +1 -0
  226. package/dist/types/command.d.cts +61 -119
  227. package/dist/types/command.d.cts.map +1 -1
  228. package/dist/types/command.d.mts +61 -119
  229. package/dist/types/command.d.mts.map +1 -1
  230. package/dist/types/command.mjs +367 -1
  231. package/dist/types/command.mjs.map +1 -1
  232. package/dist/types/config.cjs +175 -1
  233. package/dist/types/config.cjs.map +1 -0
  234. package/dist/types/config.d.cts +19 -12
  235. package/dist/types/config.d.cts.map +1 -1
  236. package/dist/types/config.d.mts +19 -12
  237. package/dist/types/config.d.mts.map +1 -1
  238. package/dist/types/config.mjs +163 -1
  239. package/dist/types/config.mjs.map +1 -1
  240. package/dist/types/context.cjs +45 -1
  241. package/dist/types/context.cjs.map +1 -0
  242. package/dist/types/context.d.cts +3 -2
  243. package/dist/types/context.d.cts.map +1 -1
  244. package/dist/types/context.d.mts +3 -2
  245. package/dist/types/context.d.mts.map +1 -1
  246. package/dist/types/context.mjs +40 -1
  247. package/dist/types/context.mjs.map +1 -1
  248. package/dist/types/env.cjs +53 -1
  249. package/dist/types/env.cjs.map +1 -0
  250. package/dist/types/env.d.cts +1 -1
  251. package/dist/types/env.d.cts.map +1 -1
  252. package/dist/types/env.d.mts +1 -1
  253. package/dist/types/env.d.mts.map +1 -1
  254. package/dist/types/env.mjs +50 -1
  255. package/dist/types/env.mjs.map +1 -1
  256. package/dist/types/index.cjs +53 -1
  257. package/dist/types/index.d.cts +4 -4
  258. package/dist/types/index.d.mts +4 -4
  259. package/dist/types/index.mjs +6 -1
  260. package/dist/types/options.cjs +13 -1
  261. package/dist/types/options.cjs.map +1 -0
  262. package/dist/types/options.d.cts.map +1 -1
  263. package/dist/types/options.d.mts.map +1 -1
  264. package/dist/types/options.mjs +10 -1
  265. package/dist/types/options.mjs.map +1 -1
  266. package/package.json +43 -34
  267. package/dist/resolver/deepkit.cjs +0 -1
  268. package/dist/resolver/deepkit.mjs +0 -2
  269. package/dist/resolver/deepkit.mjs.map +0 -1
  270. package/dist/resolver/module.cjs +0 -1
  271. package/dist/resolver/module.mjs +0 -2
  272. package/dist/resolver/module.mjs.map +0 -1
@@ -1,23 +1,23 @@
1
- import { BaseCommandParameter, CommandParameterKind } from "../types/command.cjs";
1
+ import { BaseCommandParameter, CommandParameterType } from "../types/command.cjs";
2
2
  import { ReflectionKind, Type } from "@powerlines/deepkit/vendor/type";
3
3
 
4
4
  //#region src/plugin-utils/deepkit.d.ts
5
5
  /**
6
- * Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
6
+ * Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterType}.
7
7
  *
8
8
  * @param command - The command parameter or kind to extract the reflection kind from.
9
9
  * @param checkVariadic - Whether to check for variadic parameters (arrays).
10
10
  * @returns The extracted {@link ReflectionKind}.
11
11
  */
12
- declare function extractReflectionKind(command: BaseCommandParameter | CommandParameterKind, checkVariadic?: boolean): ReflectionKind;
12
+ declare function extractReflectionKind(command: BaseCommandParameter | CommandParameterType, checkVariadic?: boolean): ReflectionKind;
13
13
  /**
14
- * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
14
+ * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterType}.
15
15
  *
16
16
  * @param command - The command parameter or kind to extract the type from.
17
17
  * @param checkVariadic - Whether to check for variadic parameters (arrays).
18
18
  * @returns The extracted {@link Type}.
19
19
  */
20
- declare function extractType(command: BaseCommandParameter | CommandParameterKind, checkVariadic?: boolean): Type;
20
+ declare function extractType(command: BaseCommandParameter | CommandParameterType, checkVariadic?: boolean): Type;
21
21
  //#endregion
22
22
  export { extractReflectionKind, extractType };
23
23
  //# sourceMappingURL=deepkit.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deepkit.d.cts","names":[],"sources":["../../src/plugin-utils/deepkit.ts"],"mappings":";;;;;AAoCA;;;;;;iBAAgB,qBAAA,CACd,OAAA,EAAS,oBAAA,GAAuB,oBAAA,EAChC,aAAA,aACC,cAAA;;;;;;;;iBAqCa,WAAA,CACd,OAAA,EAAS,oBAAA,GAAuB,oBAAA,EAChC,aAAA,aACC,IAAA"}
1
+ {"version":3,"file":"deepkit.d.cts","names":[],"sources":["../../src/plugin-utils/deepkit.ts"],"mappings":";;;;;AAmCA;;;;;;iBAAgB,qBAAA,CACd,OAAA,EAAS,oBAAA,GAAuB,oBAAA,EAChC,aAAA,aACC,cAAA;;;;;;;;iBAgCa,WAAA,CACd,OAAA,EAAS,oBAAA,GAAuB,oBAAA,EAChC,aAAA,aACC,IAAA"}
@@ -1,23 +1,23 @@
1
- import { BaseCommandParameter, CommandParameterKind } from "../types/command.mjs";
1
+ import { BaseCommandParameter, CommandParameterType } from "../types/command.mjs";
2
2
  import { ReflectionKind, Type } from "@powerlines/deepkit/vendor/type";
3
3
 
4
4
  //#region src/plugin-utils/deepkit.d.ts
5
5
  /**
6
- * Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
6
+ * Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterType}.
7
7
  *
8
8
  * @param command - The command parameter or kind to extract the reflection kind from.
9
9
  * @param checkVariadic - Whether to check for variadic parameters (arrays).
10
10
  * @returns The extracted {@link ReflectionKind}.
11
11
  */
12
- declare function extractReflectionKind(command: BaseCommandParameter | CommandParameterKind, checkVariadic?: boolean): ReflectionKind;
12
+ declare function extractReflectionKind(command: BaseCommandParameter | CommandParameterType, checkVariadic?: boolean): ReflectionKind;
13
13
  /**
14
- * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
14
+ * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterType}.
15
15
  *
16
16
  * @param command - The command parameter or kind to extract the type from.
17
17
  * @param checkVariadic - Whether to check for variadic parameters (arrays).
18
18
  * @returns The extracted {@link Type}.
19
19
  */
20
- declare function extractType(command: BaseCommandParameter | CommandParameterKind, checkVariadic?: boolean): Type;
20
+ declare function extractType(command: BaseCommandParameter | CommandParameterType, checkVariadic?: boolean): Type;
21
21
  //#endregion
22
22
  export { extractReflectionKind, extractType };
23
23
  //# sourceMappingURL=deepkit.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deepkit.d.mts","names":[],"sources":["../../src/plugin-utils/deepkit.ts"],"mappings":";;;;;AAoCA;;;;;;iBAAgB,qBAAA,CACd,OAAA,EAAS,oBAAA,GAAuB,oBAAA,EAChC,aAAA,aACC,cAAA;;;;;;;;iBAqCa,WAAA,CACd,OAAA,EAAS,oBAAA,GAAuB,oBAAA,EAChC,aAAA,aACC,IAAA"}
1
+ {"version":3,"file":"deepkit.d.mts","names":[],"sources":["../../src/plugin-utils/deepkit.ts"],"mappings":""}
@@ -1,2 +1,69 @@
1
- import{CommandParameterKinds as e}from"../types/command.mjs";import{isCommandParameterKind as t}from"./type-checks.mjs";import{ReflectionKind as n}from"@powerlines/deepkit/vendor/type";import{isSetObject as r}from"@stryke/type-checks/is-set-object";function i(i,a=!0){return t(i)&&i===e.string||r(i)&&i.kind===e.string?a&&i.variadic?n.array:n.string:t(i)&&i===e.number||r(i)&&i.kind===e.number?a&&i.variadic?n.array:n.number:t(i)&&i===e.boolean||r(i)&&i.kind===e.boolean?n.boolean:n.string}i.__type=[`BaseCommandParameter`,`CommandParameterKind`,`command`,`checkVariadic`,`extractReflectionKind`,`Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.`,`PP"w!"w"J2#"2$!/%?&`];function a(e,o=!0){let s=i(e,o);return s===n.string?{kind:n.string}:s===n.number?{kind:n.number}:s===n.boolean?{kind:n.boolean}:s===n.array?t(e)?{kind:n.array,type:a({kind:e},!1)}:r(e)?{kind:n.array,type:a({...e,kind:e.kind},!1)}:{kind:n.array,type:{kind:n.string}}:{kind:n.string}}a.__type=[`BaseCommandParameter`,`CommandParameterKind`,`command`,`checkVariadic`,`extractType`,`Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.`,`PP"w!"w"J2#"2$!/%?&`];export{i as extractReflectionKind,a as extractType};
1
+ import { isCommandParameterType } from "./type-checks.mjs";
2
+ import { isSetObject } from "@stryke/type-checks/is-set-object";
3
+ import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
4
+
5
+ //#region src/plugin-utils/deepkit.ts
6
+ /**
7
+ * Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterType}.
8
+ *
9
+ * @param command - The command parameter or kind to extract the reflection kind from.
10
+ * @param checkVariadic - Whether to check for variadic parameters (arrays).
11
+ * @returns The extracted {@link ReflectionKind}.
12
+ */
13
+ function extractReflectionKind(command, checkVariadic = true) {
14
+ if (isCommandParameterType(command) && command === "string" || isSetObject(command) && command.type === "string") return checkVariadic && command.variadic ? ReflectionKind.array : ReflectionKind.string;
15
+ else if (isCommandParameterType(command) && command === "number" || isSetObject(command) && command.type === "number") return checkVariadic && command.variadic ? ReflectionKind.array : ReflectionKind.number;
16
+ else if (isCommandParameterType(command) && command === "boolean" || isSetObject(command) && command.type === "boolean") return ReflectionKind.boolean;
17
+ else return ReflectionKind.string;
18
+ }
19
+ extractReflectionKind.__type = [
20
+ "BaseCommandParameter",
21
+ "CommandParameterType",
22
+ "command",
23
+ "checkVariadic",
24
+ "extractReflectionKind",
25
+ "Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterType}.",
26
+ "PP\"w!\"w\"J2#\"2$!/%?&"
27
+ ];
28
+ /**
29
+ * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterType}.
30
+ *
31
+ * @param command - The command parameter or kind to extract the type from.
32
+ * @param checkVariadic - Whether to check for variadic parameters (arrays).
33
+ * @returns The extracted {@link Type}.
34
+ */
35
+ function extractType(command, checkVariadic = true) {
36
+ const reflectionKind = extractReflectionKind(command, checkVariadic);
37
+ if (reflectionKind === ReflectionKind.string) return { kind: ReflectionKind.string };
38
+ else if (reflectionKind === ReflectionKind.number) return { kind: ReflectionKind.number };
39
+ else if (reflectionKind === ReflectionKind.boolean) return { kind: ReflectionKind.boolean };
40
+ else if (reflectionKind === ReflectionKind.array) if (isCommandParameterType(command)) return {
41
+ kind: ReflectionKind.array,
42
+ type: extractType({ type: command }, false)
43
+ };
44
+ else if (isSetObject(command)) return {
45
+ kind: ReflectionKind.array,
46
+ type: extractType({
47
+ ...command,
48
+ type: command.type
49
+ }, false)
50
+ };
51
+ else return {
52
+ kind: ReflectionKind.array,
53
+ type: { kind: ReflectionKind.string }
54
+ };
55
+ else return { kind: ReflectionKind.string };
56
+ }
57
+ extractType.__type = [
58
+ "BaseCommandParameter",
59
+ "CommandParameterType",
60
+ "command",
61
+ "checkVariadic",
62
+ "extractType",
63
+ "Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterType}.",
64
+ "PP\"w!\"w\"J2#\"2$!/%?&"
65
+ ];
66
+
67
+ //#endregion
68
+ export { extractReflectionKind, extractType };
2
69
  //# sourceMappingURL=deepkit.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"deepkit.mjs","names":[],"sources":["../../src/plugin-utils/deepkit.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Type } from \"@powerlines/deepkit/vendor/type\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type {\n BaseCommandParameter,\n CommandParameterKind,\n StringCommandParameter\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\nimport { isCommandParameterKind } from \"./type-checks\";\n\n/**\n * Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.\n *\n * @param command - The command parameter or kind to extract the reflection kind from.\n * @param checkVariadic - Whether to check for variadic parameters (arrays).\n * @returns The extracted {@link ReflectionKind}.\n */\nexport function extractReflectionKind(\n command: BaseCommandParameter | CommandParameterKind,\n checkVariadic = true\n): ReflectionKind {\n if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.string) ||\n (isSetObject(command as BaseCommandParameter) &&\n (command as BaseCommandParameter).kind === CommandParameterKinds.string)\n ) {\n return checkVariadic && (command as StringCommandParameter).variadic\n ? ReflectionKind.array\n : ReflectionKind.string;\n } else if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.number) ||\n (isSetObject(command as BaseCommandParameter) &&\n (command as BaseCommandParameter).kind === CommandParameterKinds.number)\n ) {\n return checkVariadic && (command as any).variadic\n ? ReflectionKind.array\n : ReflectionKind.number;\n } else if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.boolean) ||\n (isSetObject(command) && command.kind === CommandParameterKinds.boolean)\n ) {\n return ReflectionKind.boolean;\n } else {\n return ReflectionKind.string;\n }\n}\n\n/**\n * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.\n *\n * @param command - The command parameter or kind to extract the type from.\n * @param checkVariadic - Whether to check for variadic parameters (arrays).\n * @returns The extracted {@link Type}.\n */\nexport function extractType(\n command: BaseCommandParameter | CommandParameterKind,\n checkVariadic = true\n): Type {\n const reflectionKind = extractReflectionKind(command, checkVariadic);\n if (reflectionKind === ReflectionKind.string) {\n return { kind: ReflectionKind.string };\n } else if (reflectionKind === ReflectionKind.number) {\n return { kind: ReflectionKind.number };\n } else if (reflectionKind === ReflectionKind.boolean) {\n return { kind: ReflectionKind.boolean };\n } else if (reflectionKind === ReflectionKind.array) {\n if (isCommandParameterKind(command)) {\n return {\n kind: ReflectionKind.array,\n type: extractType(\n {\n kind: command\n } as BaseCommandParameter,\n false\n )\n };\n } else if (isSetObject(command)) {\n return {\n kind: ReflectionKind.array,\n type: extractType(\n {\n ...command,\n kind: command.kind\n } as BaseCommandParameter,\n false\n )\n };\n } else {\n return {\n kind: ReflectionKind.array,\n type: { kind: ReflectionKind.string }\n };\n }\n } else {\n return { kind: ReflectionKind.string };\n }\n}\n"],"mappings":"4QAoCA,OAPE,EAAA,EAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,EAAA,OAAA,EAAA,OACS,GAAU,EAAe,SAAU,EAAK,MAAA,EAAgC,OAClF,EAAA,EAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,EAAA,OAAA,EAAA,OACS,GAAc,EAAQ,SAAa,EAAgB,MAAI,EAAoB,OAC3E,EAA0B,EAAO,EAAI,IAAS,EAAmB,SAAA,EAAA,EAAA,EAAA,EAAA,OAAA,EAAA,QAChE,EAAe,QAEnB,EAAS,OAGhB,EAAkB,OAAA,CAAA,uBAAA,uBAAA,UAAA,gBAAA,wBAAA,yGAAA,sBAAA,CAQlB,SAAQ,EAAe,EAAA,EAAA,GAAA,CACrB,IAAM,EAAe,EAAM,EAAA,EAAA,CAsCzB,OArCA,IAAQ,EAAA,OACP,CACC,KAAA,EAAY,OACb,CACE,IAAW,EAA6B,OAC3C,CACA,KAAO,EAAgB,OACtB,CACG,IAAqB,EAAA,QAClB,CACN,KAAA,EAAsB,QACtB,CACA,IAAwB,EAAiB,MAC1C,EAAA,EAAA,CACO,CACH,KAAC,EAAA,MACL,KAAO,EAAe,CACxB,KAAA,EACF,CAAA,GAAA,EAEE,EAAA,EAAA,CACW,CACZ,KAAA,EAAA,MACG,KAAM,EAAc,CACd,GAAA,EACN,KAAY,EAAA,KACd,CAAA,GAAA,CACK,CAEL,CACM,KAAA,EAAA,MACA,KAAA,CACF,KAAA,EAAmB,OACrB,CACA,CAGO,CACP,KAAQ,EAAe,OACvB,CAGJ,EAAY,OAAE,CAAA,uBAAW,uBAAA,UAAA,gBAAA,cAAA,+FAAA,sBAAA"}
1
+ {"version":3,"file":"deepkit.mjs","names":[],"sources":[],"mappings":""}
@@ -1,2 +1,112 @@
1
- const e=[`replaceNewlines`,!0,`If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.`,`collapseWhitespace`,`If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.`,`FormatDescriptionOptions`,`P)4!8>"?#)4$8>"?%Mw&y`];function t(e,t={}){let n=e.trim();return t.replaceNewlines&&(n=n.replace(/\s*\n\s*/g,` `)),t.collapseWhitespace&&(n=n.replace(/\s{2,}/g,` `)),n.trim()}t.__type=[`description`,()=>e,`options`,()=>({}),`formatDescriptionWhitespace`,`Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.`,`P&2!n"2#>$&/%?&`];function n(e){return e.replaceAll(`'`,`\\'`).replaceAll(`"`,`\\"`).replaceAll("`","\\`").replace(/\$\{/g,"\\${")}n.__type=[`description`,`formatDescriptionEscapes`,`Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.`,`P&2!&/"?#`];function r(e,r={}){return n(t(e,r))}r.__type=[`description`,()=>e,`options`,()=>({}),`formatDescription`,`Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.`,`P&2!n"2#>$&/%?&`];const i=[()=>e,`length`,62,`The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.`,`FormatShortDescriptionOptions`,`Pn!'4"8>#?$Mw%y`];function a(e,r={}){let i=r.length??62,a=t(e,r),o=((a.indexOf(`
2
- `)<i-3||a.search(/[.!?\n]\s*\S/)>i-3?a.match(/^.*[.!?\n]\s?\S/)?.[0]?.trim()?.slice(0,-1)?.trim():void 0)||a).trim();return o.trim().length>i&&(o=`${o.substring(0,Math.max(0,i-3)).trim()}...`),n(o)}a.__type=[`description`,()=>i,`options`,()=>({}),`formatShortDescription`,`Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.`,`P&2!n"2#>$&/%?&`],exports.__ΩFormatDescriptionOptions=e,exports.__ΩFormatShortDescriptionOptions=i,exports.formatDescription=r,exports.formatShortDescription=a;
1
+
2
+ //#region src/plugin-utils/description-helpers.ts
3
+ const __ΩFormatDescriptionOptions = [
4
+ "replaceNewlines",
5
+ true,
6
+ "If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.",
7
+ "collapseWhitespace",
8
+ "If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.",
9
+ "FormatDescriptionOptions",
10
+ "P)4!8>\"?#)4$8>\"?%Mw&y"
11
+ ];
12
+ /**
13
+ * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
14
+ *
15
+ * @remarks
16
+ * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
17
+ *
18
+ * @param description - The full description string.
19
+ * @returns The formatted description string.
20
+ */
21
+ function formatDescriptionWhitespace(description, options = {}) {
22
+ let formattedDescription = description.trim();
23
+ if (options.replaceNewlines) formattedDescription = formattedDescription.replace(/\s*\n\s*/g, " ");
24
+ if (options.collapseWhitespace) formattedDescription = formattedDescription.replace(/\s{2,}/g, " ");
25
+ return formattedDescription.trim();
26
+ }
27
+ formatDescriptionWhitespace.__type = [
28
+ "description",
29
+ () => __ΩFormatDescriptionOptions,
30
+ "options",
31
+ () => ({}),
32
+ "formatDescriptionWhitespace",
33
+ "Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.",
34
+ "P&2!n\"2#>$&/%?&"
35
+ ];
36
+ /**
37
+ * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
38
+ *
39
+ * @remarks
40
+ * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
41
+ *
42
+ * @param description - The full description string.
43
+ * @returns The formatted description string.
44
+ */
45
+ function formatDescriptionEscapes(description) {
46
+ return description.replaceAll("'", "\\'").replaceAll("\"", "\\\"").replaceAll("`", "\\`").replace(/\$\{/g, "\\${");
47
+ }
48
+ formatDescriptionEscapes.__type = [
49
+ "description",
50
+ "formatDescriptionEscapes",
51
+ "Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.",
52
+ "P&2!&/\"?#"
53
+ ];
54
+ /**
55
+ * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
56
+ *
57
+ * @remarks
58
+ * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
59
+ *
60
+ * @param description - The full description string.
61
+ * @returns The formatted description string.
62
+ */
63
+ function formatDescription(description, options = {}) {
64
+ return formatDescriptionEscapes(formatDescriptionWhitespace(description, options));
65
+ }
66
+ formatDescription.__type = [
67
+ "description",
68
+ () => __ΩFormatDescriptionOptions,
69
+ "options",
70
+ () => ({}),
71
+ "formatDescription",
72
+ "Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.",
73
+ "P&2!n\"2#>$&/%?&"
74
+ ];
75
+ const __ΩFormatShortDescriptionOptions = [
76
+ () => __ΩFormatDescriptionOptions,
77
+ "length",
78
+ 62,
79
+ "The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.",
80
+ "FormatShortDescriptionOptions",
81
+ "Pn!'4\"8>#?$Mw%y"
82
+ ];
83
+ /**
84
+ * Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.
85
+ *
86
+ * @param description - The full description string.
87
+ * @param options - Options for formatting the short description, including the maximum length.
88
+ * @returns The extracted short description.
89
+ */
90
+ function formatShortDescription(description, options = {}) {
91
+ const length = options.length ?? 62;
92
+ const formattedDescription = formatDescriptionWhitespace(description, options);
93
+ let result = ((formattedDescription.indexOf("\n") < length - 3 || formattedDescription.search(/[.!?\n]\s*\S/) > length - 3 ? formattedDescription.match(/^.*[.!?\n]\s?\S/)?.[0]?.trim()?.slice(0, -1)?.trim() : void 0) || formattedDescription).trim();
94
+ if (result.trim().length > length) result = `${result.substring(0, Math.max(0, length - 3)).trim()}...`;
95
+ return formatDescriptionEscapes(result);
96
+ }
97
+ formatShortDescription.__type = [
98
+ "description",
99
+ () => __ΩFormatShortDescriptionOptions,
100
+ "options",
101
+ () => ({}),
102
+ "formatShortDescription",
103
+ "Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.",
104
+ "P&2!n\"2#>$&/%?&"
105
+ ];
106
+
107
+ //#endregion
108
+ exports.__ΩFormatDescriptionOptions = __ΩFormatDescriptionOptions;
109
+ exports.__ΩFormatShortDescriptionOptions = __ΩFormatShortDescriptionOptions;
110
+ exports.formatDescription = formatDescription;
111
+ exports.formatShortDescription = formatShortDescription;
112
+ //# sourceMappingURL=description-helpers.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"description-helpers.cjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"description-helpers.d.cts","names":[],"sources":["../../src/plugin-utils/description-helpers.ts"],"mappings":";UAkBiB,wBAAA;EAAA;;;;;EAMf,eAAA;EA4D+B;;;;;EArD/B,kBAAA;AAAA;;AA8DF;;;;;AAgBA;;;iBAzBgB,iBAAA,CACd,WAAA,UACA,OAAA,GAAS,wBAAA;AAAA,UAOM,6BAAA,SAAsC,wBAAA;EAkB5C;;;;;EAZT,MAAA;AAAA;;;;;;;;iBAUc,sBAAA,CACd,WAAA,UACA,OAAA,GAAS,6BAAA"}
1
+ {"version":3,"file":"description-helpers.d.cts","names":[],"sources":["../../src/plugin-utils/description-helpers.ts"],"mappings":";UAkBiB,wBAAA;EAAA;;;;AAaG;EAPlB,eAAA;EA4D+B;;;;;EArD/B,kBAAkB;AAAA;AAuDoB;AAOxC;;;;AAMQ;AAUR;;;AAvBwC,iBAFxB,iBAAA,CACd,WAAA,UACA,OAAA,GAAS,wBAA6B;AAAA,UAOvB,6BAAA,SAAsC,wBAAwB;EAkBpE;;;AAAkC;;EAZ3C,MAAM;AAAA;;;;;;;;iBAUQ,sBAAA,CACd,WAAA,UACA,OAAA,GAAS,6BAAkC"}
@@ -1 +1 @@
1
- {"version":3,"file":"description-helpers.d.mts","names":[],"sources":["../../src/plugin-utils/description-helpers.ts"],"mappings":";UAkBiB,wBAAA;EAAA;;;;;EAMf,eAAA;EA4D+B;;;;;EArD/B,kBAAA;AAAA;;AA8DF;;;;;AAgBA;;;iBAzBgB,iBAAA,CACd,WAAA,UACA,OAAA,GAAS,wBAAA;AAAA,UAOM,6BAAA,SAAsC,wBAAA;EAkB5C;;;;;EAZT,MAAA;AAAA;;;;;;;;iBAUc,sBAAA,CACd,WAAA,UACA,OAAA,GAAS,6BAAA"}
1
+ {"version":3,"file":"description-helpers.d.mts","names":[],"sources":["../../src/plugin-utils/description-helpers.ts"],"mappings":""}
@@ -1,3 +1,108 @@
1
- const e=[`replaceNewlines`,!0,`If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.`,`collapseWhitespace`,`If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.`,`FormatDescriptionOptions`,`P)4!8>"?#)4$8>"?%Mw&y`];function t(e,t={}){let n=e.trim();return t.replaceNewlines&&(n=n.replace(/\s*\n\s*/g,` `)),t.collapseWhitespace&&(n=n.replace(/\s{2,}/g,` `)),n.trim()}t.__type=[`description`,()=>e,`options`,()=>({}),`formatDescriptionWhitespace`,`Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.`,`P&2!n"2#>$&/%?&`];function n(e){return e.replaceAll(`'`,`\\'`).replaceAll(`"`,`\\"`).replaceAll("`","\\`").replace(/\$\{/g,"\\${")}n.__type=[`description`,`formatDescriptionEscapes`,`Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.`,`P&2!&/"?#`];function r(e,r={}){return n(t(e,r))}r.__type=[`description`,()=>e,`options`,()=>({}),`formatDescription`,`Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.`,`P&2!n"2#>$&/%?&`];const i=[()=>e,`length`,62,`The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.`,`FormatShortDescriptionOptions`,`Pn!'4"8>#?$Mw%y`];function a(e,r={}){let i=r.length??62,a=t(e,r),o=((a.indexOf(`
2
- `)<i-3||a.search(/[.!?\n]\s*\S/)>i-3?a.match(/^.*[.!?\n]\s?\S/)?.[0]?.trim()?.slice(0,-1)?.trim():void 0)||a).trim();return o.trim().length>i&&(o=`${o.substring(0,Math.max(0,i-3)).trim()}...`),n(o)}a.__type=[`description`,()=>i,`options`,()=>({}),`formatShortDescription`,`Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.`,`P&2!n"2#>$&/%?&`];export{e as __ΩFormatDescriptionOptions,i as __ΩFormatShortDescriptionOptions,r as formatDescription,a as formatShortDescription};
1
+ //#region src/plugin-utils/description-helpers.ts
2
+ const __ΩFormatDescriptionOptions = [
3
+ "replaceNewlines",
4
+ true,
5
+ "If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.",
6
+ "collapseWhitespace",
7
+ "If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.",
8
+ "FormatDescriptionOptions",
9
+ "P)4!8>\"?#)4$8>\"?%Mw&y"
10
+ ];
11
+ /**
12
+ * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
13
+ *
14
+ * @remarks
15
+ * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
16
+ *
17
+ * @param description - The full description string.
18
+ * @returns The formatted description string.
19
+ */
20
+ function formatDescriptionWhitespace(description, options = {}) {
21
+ let formattedDescription = description.trim();
22
+ if (options.replaceNewlines) formattedDescription = formattedDescription.replace(/\s*\n\s*/g, " ");
23
+ if (options.collapseWhitespace) formattedDescription = formattedDescription.replace(/\s{2,}/g, " ");
24
+ return formattedDescription.trim();
25
+ }
26
+ formatDescriptionWhitespace.__type = [
27
+ "description",
28
+ () => __ΩFormatDescriptionOptions,
29
+ "options",
30
+ () => ({}),
31
+ "formatDescriptionWhitespace",
32
+ "Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.",
33
+ "P&2!n\"2#>$&/%?&"
34
+ ];
35
+ /**
36
+ * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
37
+ *
38
+ * @remarks
39
+ * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
40
+ *
41
+ * @param description - The full description string.
42
+ * @returns The formatted description string.
43
+ */
44
+ function formatDescriptionEscapes(description) {
45
+ return description.replaceAll("'", "\\'").replaceAll("\"", "\\\"").replaceAll("`", "\\`").replace(/\$\{/g, "\\${");
46
+ }
47
+ formatDescriptionEscapes.__type = [
48
+ "description",
49
+ "formatDescriptionEscapes",
50
+ "Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.",
51
+ "P&2!&/\"?#"
52
+ ];
53
+ /**
54
+ * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
55
+ *
56
+ * @remarks
57
+ * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
58
+ *
59
+ * @param description - The full description string.
60
+ * @returns The formatted description string.
61
+ */
62
+ function formatDescription(description, options = {}) {
63
+ return formatDescriptionEscapes(formatDescriptionWhitespace(description, options));
64
+ }
65
+ formatDescription.__type = [
66
+ "description",
67
+ () => __ΩFormatDescriptionOptions,
68
+ "options",
69
+ () => ({}),
70
+ "formatDescription",
71
+ "Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.",
72
+ "P&2!n\"2#>$&/%?&"
73
+ ];
74
+ const __ΩFormatShortDescriptionOptions = [
75
+ () => __ΩFormatDescriptionOptions,
76
+ "length",
77
+ 62,
78
+ "The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.",
79
+ "FormatShortDescriptionOptions",
80
+ "Pn!'4\"8>#?$Mw%y"
81
+ ];
82
+ /**
83
+ * Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.
84
+ *
85
+ * @param description - The full description string.
86
+ * @param options - Options for formatting the short description, including the maximum length.
87
+ * @returns The extracted short description.
88
+ */
89
+ function formatShortDescription(description, options = {}) {
90
+ const length = options.length ?? 62;
91
+ const formattedDescription = formatDescriptionWhitespace(description, options);
92
+ let result = ((formattedDescription.indexOf("\n") < length - 3 || formattedDescription.search(/[.!?\n]\s*\S/) > length - 3 ? formattedDescription.match(/^.*[.!?\n]\s?\S/)?.[0]?.trim()?.slice(0, -1)?.trim() : void 0) || formattedDescription).trim();
93
+ if (result.trim().length > length) result = `${result.substring(0, Math.max(0, length - 3)).trim()}...`;
94
+ return formatDescriptionEscapes(result);
95
+ }
96
+ formatShortDescription.__type = [
97
+ "description",
98
+ () => __ΩFormatShortDescriptionOptions,
99
+ "options",
100
+ () => ({}),
101
+ "formatShortDescription",
102
+ "Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.",
103
+ "P&2!n\"2#>$&/%?&"
104
+ ];
105
+
106
+ //#endregion
107
+ export { __ΩFormatDescriptionOptions, __ΩFormatShortDescriptionOptions, formatDescription, formatShortDescription };
3
108
  //# sourceMappingURL=description-helpers.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"description-helpers.mjs","names":[],"sources":["../../src/plugin-utils/description-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport interface FormatDescriptionOptions {\n /**\n * If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.\n *\n * @defaultValue false\n */\n replaceNewlines?: boolean;\n\n /**\n * If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.\n *\n * @defaultValue false\n */\n collapseWhitespace?: boolean;\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionWhitespace(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n let formattedDescription = description.trim();\n if (options.replaceNewlines) {\n formattedDescription = formattedDescription.replace(/\\s*\\n\\s*/g, \" \");\n }\n if (options.collapseWhitespace) {\n formattedDescription = formattedDescription.replace(/\\s{2,}/g, \" \");\n }\n\n return formattedDescription.trim();\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionEscapes(description: string): string {\n return description\n .replaceAll(\"'\", \"\\\\'\")\n .replaceAll('\"', '\\\\\"')\n .replaceAll(\"`\", \"\\\\`\")\n .replace(/\\$\\{/g, \"\\\\${\");\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nexport function formatDescription(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n return formatDescriptionEscapes(\n formatDescriptionWhitespace(description, options)\n );\n}\n\nexport interface FormatShortDescriptionOptions extends FormatDescriptionOptions {\n /**\n * The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.\n *\n * @defaultValue 62\n */\n length?: number;\n}\n\n/**\n * Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.\n *\n * @param description - The full description string.\n * @param options - Options for formatting the short description, including the maximum length.\n * @returns The extracted short description.\n */\nexport function formatShortDescription(\n description: string,\n options: FormatShortDescriptionOptions = {}\n): string {\n const length = options.length ?? 62;\n const formattedDescription = formatDescriptionWhitespace(\n description,\n options\n );\n\n const firstSentenceMatch =\n formattedDescription.indexOf(\"\\n\") < length - 3 ||\n formattedDescription.search(/[.!?\\n]\\s*\\S/) > length - 3\n ? formattedDescription\n .match(/^.*[.!?\\n]\\s?\\S/)?.[0]\n ?.trim()\n ?.slice(0, -1)\n ?.trim()\n : undefined;\n\n let result = (firstSentenceMatch || formattedDescription).trim();\n if (result.trim().length > length) {\n result = `${result.substring(0, Math.max(0, length - 3)).trim()}...`;\n }\n\n return formatDescriptionEscapes(result);\n}\n"],"mappings":"sgBA4BA,SAAG,EAAA,EAAA,EAAA,EAAA,CAAA,CACD,IAAI,EAAa,EAAA,MAAA,CAOlB,OANG,EAAA,kBACF,EAAqB,EAAO,QAAA,YAAA,IAAA,yBAG5B,EAAA,EAAA,QAAA,UAAA,IAAA,EAED,EAAA,MAAA,CAED,EAAsB,OAAc,CAAA,kBAAiB,EAAgC,eAAqB,EAAE,EAAC,8BAAa,kMAAA,kBAAA,CAU1H,SAAM,EAAyB,EAAA,CAC7B,OAAE,EAAA,WAAuB,IAAA,MAAA,CAAA,WAA4B,IAAK,MAAM,CAAC,WAAM,IAAA,MAAA,CAAA,QAAA,QAAA,OAAA,CAEzE,EAAc,OAAoB,CAAA,cAAA,2BAAA,kMAAA,YAAA,CAUlC,SAAI,EAAA,EAAA,EAAA,EAAA,CAAA,CACF,OAAM,EAAuB,EAA8B,EAAS,EAAU,CAAI,CAEpF,EAAU,OAAiB,CAAC,kBAAiB,EAAM,eAAA,EAAA,EAAA,oBAAA,kMAAA,kBAAA,CACnD,MAAI,EAAkC,KAAM,EAAA,SAAA,GAAA,gHAAA,gCAAA,kBAAA,oBAU1C,IAAA,EAAA,EAAA,QAAA,GACC,EAA4B,EAAyB,EAAU,EAAc,CAE5E,IADH,EAAA,QAAA;EAAA,CAAA,EAAA,GAAA,EAAA,OAAA,eAAA,CAAA,EAAA,EAAA,EAAA,MAAA,kBAAA,GAAA,IAAA,MAAA,EAAA,MAAA,EAAA,GAAA,EAAA,MAAA,CAAA,IAAA,KACG,GAAA,MAAA,CAIF,OAHC,EAAQ,MAAO,CAAA,OAAI,IACrB,EAAA,GAAA,EAAA,UAAA,EAAA,KAAA,IAAA,EAAA,EAAA,EAAA,CAAA,CAAA,MAAA,CAAA,MAEG,EAAsB,EAAY,CAEtC,EAAgB,OAAA,CAAiB,kBAAA,EAAA,eAAA,EAAA,EAAA,yBAAA,+JAAA,kBAAA"}
1
+ {"version":3,"file":"description-helpers.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1,118 @@
1
- const e=require(`./context-helpers.cjs`),t=require(`./traverse-command-tree.cjs`);function n(e,t){return e.__type=t,e}function r(t,r=[]){if(r.length===0)return null;let i=t.commands[r[0]]??null;if(r.length>1){let t=r.slice(1).filter(n(t=>!e.isDynamicPathSegment(t),[`segment`,``,`P"2!"/"`]));for(let e of t)if(i?.children&&Object.prototype.hasOwnProperty.call(i.children,e))i=i.children[e]??null;else return null}return i}r.__type=[`Context`,`context`,`path`,`CommandTree`,`getCommandTree`,`Retrieves a specific command tree based on the provided path.`,`P"w!2""2#P"w$,J/%?&`];async function i(e){let r=[];return await t.traverseCommands(e,n(e=>{r.push(e)},[`commandTree`,``,`P"2!"/"`])),r}i.__type=[`Context`,`context`,`CommandTree`,`getCommandList`,`Retrieves a list of all command trees defined in the context.`,'P"w!2""w#F`/$?%'];async function a(e){let r=[];return await t.traverseCommands(e,n(e=>{e.path&&r.push(e.path)},[`commandTree`,``,`P"2!"/"`])),r}a.__type=[`Context`,`context`,`getCommandPaths`,`Retrieves a list of all command paths defined in the context.`,'P"w!2"&F`/#?$'];async function o(e){let r=[];return await t.traverseCommands(e,n(e=>{e.path&&r.push(e.segments)},[`commandTree`,``,`P"2!"/"`])),r}o.__type=[`Context`,`context`,`getCommandSegments`,`Retrieves a list of all command segments defined in the context.`,'P"w!2"&FF`/#?$'],exports.getCommandList=i,exports.getCommandPaths=a,exports.getCommandSegments=o,exports.getCommandTree=r;
1
+ const require_context_helpers = require('./context-helpers.cjs');
2
+ const require_traverse_command_tree = require('./traverse-command-tree.cjs');
3
+
4
+ //#region src/plugin-utils/get-command-tree.ts
5
+ function __assignType(fn, args) {
6
+ fn.__type = args;
7
+ return fn;
8
+ }
9
+ /**
10
+ * Retrieves a specific command tree based on the provided path.
11
+ *
12
+ * @param context - The build context containing the command definitions.
13
+ * @param path - An array of strings representing the command path.
14
+ * @returns The command tree at the specified path, or null if not found.
15
+ */
16
+ function getCommandTree(context, path = []) {
17
+ if (path.length === 0) return null;
18
+ let currentTree = context.commands[path[0]] ?? null;
19
+ if (path.length > 1) {
20
+ const segments = path.slice(1).filter(__assignType((segment) => !require_context_helpers.isDynamicPathSegment(segment), [
21
+ "segment",
22
+ "",
23
+ "P\"2!\"/\""
24
+ ]));
25
+ for (const segment of segments) if (currentTree?.children && Object.prototype.hasOwnProperty.call(currentTree.children, segment)) currentTree = currentTree.children[segment] ?? null;
26
+ else return null;
27
+ }
28
+ return currentTree;
29
+ }
30
+ getCommandTree.__type = [
31
+ "Context",
32
+ "context",
33
+ "path",
34
+ "CommandTree",
35
+ "getCommandTree",
36
+ "Retrieves a specific command tree based on the provided path.",
37
+ "P\"w!2\"\"2#P\"w$,J/%?&"
38
+ ];
39
+ /**
40
+ * Retrieves a list of all command trees defined in the context.
41
+ *
42
+ * @param context - The build context containing the command definitions.
43
+ * @returns A promise that resolves to an array of all command trees in the context.
44
+ */
45
+ async function getCommandList(context) {
46
+ const commandList = [];
47
+ await require_traverse_command_tree.traverseCommands(context, __assignType((commandTree) => {
48
+ commandList.push(commandTree);
49
+ }, [
50
+ "commandTree",
51
+ "",
52
+ "P\"2!\"/\""
53
+ ]));
54
+ return commandList;
55
+ }
56
+ getCommandList.__type = [
57
+ "Context",
58
+ "context",
59
+ "CommandTree",
60
+ "getCommandList",
61
+ "Retrieves a list of all command trees defined in the context.",
62
+ "P\"w!2\"\"w#F`/$?%"
63
+ ];
64
+ /**
65
+ * Retrieves a list of all command paths defined in the context.
66
+ *
67
+ * @param context - The build context containing the command definitions.
68
+ * @returns A promise that resolves to an array of all command paths in the context.
69
+ */
70
+ async function getCommandPaths(context) {
71
+ const commandPaths = [];
72
+ await require_traverse_command_tree.traverseCommands(context, __assignType((commandTree) => {
73
+ if (commandTree.path) commandPaths.push(commandTree.path);
74
+ }, [
75
+ "commandTree",
76
+ "",
77
+ "P\"2!\"/\""
78
+ ]));
79
+ return commandPaths;
80
+ }
81
+ getCommandPaths.__type = [
82
+ "Context",
83
+ "context",
84
+ "getCommandPaths",
85
+ "Retrieves a list of all command paths defined in the context.",
86
+ "P\"w!2\"&F`/#?$"
87
+ ];
88
+ /**
89
+ * Retrieves a list of all command segments defined in the context.
90
+ *
91
+ * @param context - The build context containing the command definitions.
92
+ * @returns A promise that resolves to an array of all command segments in the context.
93
+ */
94
+ async function getCommandSegments(context) {
95
+ const commandSegments = [];
96
+ await require_traverse_command_tree.traverseCommands(context, __assignType((commandTree) => {
97
+ if (commandTree.path) commandSegments.push(commandTree.segments);
98
+ }, [
99
+ "commandTree",
100
+ "",
101
+ "P\"2!\"/\""
102
+ ]));
103
+ return commandSegments;
104
+ }
105
+ getCommandSegments.__type = [
106
+ "Context",
107
+ "context",
108
+ "getCommandSegments",
109
+ "Retrieves a list of all command segments defined in the context.",
110
+ "P\"w!2\"&FF`/#?$"
111
+ ];
112
+
113
+ //#endregion
114
+ exports.getCommandList = getCommandList;
115
+ exports.getCommandPaths = getCommandPaths;
116
+ exports.getCommandSegments = getCommandSegments;
117
+ exports.getCommandTree = getCommandTree;
118
+ //# sourceMappingURL=get-command-tree.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-command-tree.cjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"get-command-tree.d.cts","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"mappings":";;;;;;AA8BA;;;;;iBAAgB,cAAA,CACd,OAAA,EAAS,OAAA,EACT,IAAA,cACC,WAAA;;;;;AA+BH;;iBAAsB,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,OAAA,CAAQ,WAAA;;;;;;;iBAe1C,eAAA,CAAgB,OAAA,EAAS,OAAA,GAAU,OAAA;;;;;AAAzD;;iBAiBsB,kBAAA,CACpB,OAAA,EAAS,OAAA,GACR,OAAA"}
1
+ {"version":3,"file":"get-command-tree.d.cts","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"mappings":";;;;;;AA8BA;;;;;iBAAgB,cAAA,CACd,OAAA,EAAS,OAAA,EACT,IAAA,cACC,WAAW;;;;AAAA;AA+Bd;;iBAAsB,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,OAAA,CAAQ,WAAA;;;;;;;iBAe1C,eAAA,CAAgB,OAAA,EAAS,OAAA,GAAU,OAAO;;;;AAfW;AAe3E;;iBAiBsB,kBAAA,CACpB,OAAA,EAAS,OAAA,GACR,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-command-tree.d.mts","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"mappings":";;;;;;AA8BA;;;;;iBAAgB,cAAA,CACd,OAAA,EAAS,OAAA,EACT,IAAA,cACC,WAAA;;;;;AA+BH;;iBAAsB,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,OAAA,CAAQ,WAAA;;;;;;;iBAe1C,eAAA,CAAgB,OAAA,EAAS,OAAA,GAAU,OAAA;;;;;AAAzD;;iBAiBsB,kBAAA,CACpB,OAAA,EAAS,OAAA,GACR,OAAA"}
1
+ {"version":3,"file":"get-command-tree.d.mts","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"mappings":""}