@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,2 +1,70 @@
1
- import{getAppTitle as e}from"../plugin-utils/context-helpers.mjs";import{CommandDocs as t}from"../components/docs.mjs";import"../plugin-utils/index.mjs";import{createComponent as n,memo as r}from"@alloy-js/core/jsx-runtime";import{For as i,Show as a}from"@alloy-js/core/components";import{renderString as o}from"@powerlines/plugin-alloy/render";import{code as s}from"@alloy-js/core";import{Heading as c}from"@alloy-js/markdown";import{Spacing as l}from"@powerlines/plugin-alloy/core/components/spacing";import{defineGenerator as u}from"automd";function d(e,t){return e.__type=t,e}const f=d(f=>u({name:`commands`,async generate(){return{contents:o(f,[n(c,{level:2,children:`Commands`}),n(l,{}),r(()=>s`The following commands are available in the ${e(f,!0)} command-line interface application:`),n(l,{}),n(i,{get each(){return Object.values(f.commands)},doubleHardline:!0,get children(){return d(e=>n(a,{get when(){return!e.isVirtual},get children(){return n(t,{command:e,levelOffset:2})}}),[`child`,``,`P"2!"/"`])}}),n(l,{})])}}}),[`Context`,`context`,``,`P"w!2""/#`]);export{f as commands};
1
+ import { getAppTitle } from "../plugin-utils/context-helpers.mjs";
2
+ import { CommandDocs } from "../components/docs.mjs";
3
+ import "../plugin-utils/index.mjs";
4
+ import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
5
+ import { For, Show, code } from "@alloy-js/core";
6
+ import { renderString } from "@powerlines/plugin-alloy/render";
7
+ import { Heading } from "@alloy-js/markdown";
8
+ import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
9
+ import { defineGenerator } from "automd";
10
+
11
+ //#region src/helpers/automd.tsx
12
+ function __assignType(fn, args) {
13
+ fn.__type = args;
14
+ return fn;
15
+ }
16
+ /**
17
+ * AutoMD generator to generate CLI command documentation
18
+ *
19
+ * @see https://automd.unjs.io/
20
+ *
21
+ * @param context - The generator context.
22
+ * @returns The generated documentation content.
23
+ */
24
+ const commands = __assignType((context) => defineGenerator({
25
+ name: "commands",
26
+ async generate() {
27
+ return { contents: renderString(context, [
28
+ createComponent(Heading, {
29
+ level: 2,
30
+ children: "Commands"
31
+ }),
32
+ createComponent(Spacing, {}),
33
+ memo(() => code`The following commands are available in the ${getAppTitle(context, true)} command-line interface application:`),
34
+ createComponent(Spacing, {}),
35
+ createComponent(For, {
36
+ get each() {
37
+ return Object.values(context.commands);
38
+ },
39
+ doubleHardline: true,
40
+ get children() {
41
+ return __assignType((child) => createComponent(Show, {
42
+ get when() {
43
+ return !child.virtual;
44
+ },
45
+ get children() {
46
+ return createComponent(CommandDocs, {
47
+ command: child,
48
+ levelOffset: 2
49
+ });
50
+ }
51
+ }), [
52
+ "child",
53
+ "",
54
+ "P\"2!\"/\""
55
+ ]);
56
+ }
57
+ }),
58
+ createComponent(Spacing, {})
59
+ ]) };
60
+ }
61
+ }), [
62
+ "Context",
63
+ "context",
64
+ "",
65
+ "P\"w!2\"\"/#"
66
+ ]);
67
+
68
+ //#endregion
69
+ export { commands };
2
70
  //# sourceMappingURL=automd.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"automd.mjs","names":[],"sources":["../../src/helpers/automd.tsx"],"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 { code } from \"@alloy-js/core\";\nimport { For, Show } from \"@alloy-js/core/components\";\nimport { Heading } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { renderString } from \"@powerlines/plugin-alloy/render\";\nimport { defineGenerator } from \"automd\";\nimport { CommandDocs } from \"../components/docs\";\nimport { getAppTitle } from \"../plugin-utils\";\nimport type { Context } from \"../types/context\";\n\n/**\n * AutoMD generator to generate CLI command documentation\n *\n * @see https://automd.unjs.io/\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const commands = (context: Context) =>\n defineGenerator({\n name: \"commands\",\n async generate() {\n return {\n contents: renderString(\n context,\n <>\n <Heading level={2}>Commands</Heading>\n <Spacing />\n {code`The following commands are available in the ${getAppTitle(\n context,\n true\n )} command-line interface application:`}\n <Spacing />\n <For each={Object.values(context.commands)} doubleHardline>\n {child => (\n <Show when={!child.isVirtual}>\n <CommandDocs command={child} levelOffset={2} />\n </Show>\n )}\n </For>\n <Spacing />\n </>\n )\n };\n }\n });\n"],"mappings":"sjBAEE,GAAG,OAAS,IAoCd,MAAW,EAAS,EAAA,GAAA,EAAA,CAClB,KAAE,WACF,MAAI,UAAO,CACT,MAAI,CACF,SAAI,EAAO,EAAA,CAAA,EAAA,EAAA,CACT,MAAG,EACH,SAAK,WACN,CAAC,CAAE,EAAY,EAAA,EAAA,CAAA,CAAA,MAAA,CAAA,+CAAA,EAAA,EAAA,GAAA,CAAA,sCAAA,CAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA,EAAA,CACd,IAAI,MAAM,CACR,OAAI,OAAO,OAAA,EAAA,SAAA,EAEb,eAAe,GACf,IAAI,UAAU,CACZ,OAAO,EAAa,GAAO,EAAmB,EAAA,CAC5C,IAAG,MAAQ,CACT,MAAO,CAAC,EAAM,WAEhB,IAAI,UAAM,CACR,OAAC,EAAA,EAAA,CACD,QAAG,EACJ,YAAS,EACV,CAAA,EAEL,CAAA,CAAA,CAAA,QAAA,GAAA,UAAA,CAAA,EAEH,CAAA,CAAA,EAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"automd.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1,23 @@
1
- require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@stryke/path/join`);function t(t){return(0,e.joinPaths)(t.config.root,`docs`,`generated`)}t.__type=[`Context`,`context`,`getDocsOutputPath`,`Gets the output path for the generated documentation.`,`P"w!2"&/#?$`],exports.getDocsOutputPath=t;
1
+ let _stryke_path_join = require("@stryke/path/join");
2
+
3
+ //#region src/helpers/docs-helpers.ts
4
+ /**
5
+ * Gets the output path for the generated documentation.
6
+ *
7
+ * @param context - The Shell Shock context.
8
+ * @returns The output path for the generated documentation.
9
+ */
10
+ function getDocsOutputPath(context) {
11
+ return (0, _stryke_path_join.joinPaths)(context.config.root, "docs", "generated");
12
+ }
13
+ getDocsOutputPath.__type = [
14
+ "Context",
15
+ "context",
16
+ "getDocsOutputPath",
17
+ "Gets the output path for the generated documentation.",
18
+ "P\"w!2\"&/#?$"
19
+ ];
20
+
21
+ //#endregion
22
+ exports.getDocsOutputPath = getDocsOutputPath;
23
+ //# sourceMappingURL=docs-helpers.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs-helpers.cjs","names":[],"sources":[],"mappings":""}
@@ -1,2 +1,23 @@
1
- import{joinPaths as e}from"@stryke/path/join";function t(t){return e(t.config.root,`docs`,`generated`)}t.__type=[`Context`,`context`,`getDocsOutputPath`,`Gets the output path for the generated documentation.`,`P"w!2"&/#?$`];export{t as getDocsOutputPath};
1
+ import { joinPaths } from "@stryke/path/join";
2
+
3
+ //#region src/helpers/docs-helpers.ts
4
+ /**
5
+ * Gets the output path for the generated documentation.
6
+ *
7
+ * @param context - The Shell Shock context.
8
+ * @returns The output path for the generated documentation.
9
+ */
10
+ function getDocsOutputPath(context) {
11
+ return joinPaths(context.config.root, "docs", "generated");
12
+ }
13
+ getDocsOutputPath.__type = [
14
+ "Context",
15
+ "context",
16
+ "getDocsOutputPath",
17
+ "Gets the output path for the generated documentation.",
18
+ "P\"w!2\"&/#?$"
19
+ ];
20
+
21
+ //#endregion
22
+ export { getDocsOutputPath };
2
23
  //# sourceMappingURL=docs-helpers.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"docs-helpers.mjs","names":[],"sources":["../../src/helpers/docs-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\nimport { joinPaths } from \"@stryke/path/join\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Gets the output path for the generated documentation.\n *\n * @param context - The Shell Shock context.\n * @returns The output path for the generated documentation.\n */\nexport function getDocsOutputPath(context: Context): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":"8CAwBA,SAAU,EAAoB,EAAa,CACzC,OAAE,EAAY,EAAW,OAAK,KAAI,OAAU,YAAa,CAE3D,EAAgB,OAAA,CAAA,UAAkB,UAAgB,oBAAU,wDAAA,cAAA"}
1
+ {"version":3,"file":"docs-helpers.mjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ const require_package = require('../package.cjs');
2
+
3
+ //#region src/helpers/get-framework.ts
4
+ /**
5
+ * Retrieves the framework information for Shell Shock.
6
+ *
7
+ * @returns An object containing the name, version, and organization ID of the Shell Shock framework.
8
+ */
9
+ function getFramework() {
10
+ return {
11
+ name: "shell-shock",
12
+ version: require_package.version,
13
+ orgId: "storm-software"
14
+ };
15
+ }
16
+ getFramework.__type = [
17
+ "getFramework",
18
+ "Retrieves the framework information for Shell Shock.",
19
+ "P!/!?\""
20
+ ];
21
+
22
+ //#endregion
23
+ exports.getFramework = getFramework;
24
+ //# sourceMappingURL=get-framework.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-framework.cjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ import { version } from "../package.mjs";
2
+
3
+ //#region src/helpers/get-framework.ts
4
+ /**
5
+ * Retrieves the framework information for Shell Shock.
6
+ *
7
+ * @returns An object containing the name, version, and organization ID of the Shell Shock framework.
8
+ */
9
+ function getFramework() {
10
+ return {
11
+ name: "shell-shock",
12
+ version,
13
+ orgId: "storm-software"
14
+ };
15
+ }
16
+ getFramework.__type = [
17
+ "getFramework",
18
+ "Retrieves the framework information for Shell Shock.",
19
+ "P!/!?\""
20
+ ];
21
+
22
+ //#endregion
23
+ export { getFramework };
24
+ //# sourceMappingURL=get-framework.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-framework.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1,137 @@
1
- require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../plugin-utils/context-helpers.cjs`);let t=require(`@stryke/path/append`),n=require(`@stryke/path/file-path-fns`),r=require(`@stryke/path/join-paths`),i=require(`@stryke/path/replace`),a=require(`@stryke/path/resolve-parent-path`),o=require(`@stryke/type-checks/is-set-string`),s=require(`powerlines/utils`),c=require(`@stryke/type-checks/is-set-object`),l=require(`@stryke/fs/list-files`),u=require(`@stryke/path/common`),d=require(`node:fs`);function f(e,t){return e.__type=t,e}function p(t,r){return(0,i.replacePath)((0,n.findFilePath)(r),t.commandsPath).split(`/`).filter(f(t=>!!t&&!e.isDynamicPathSegment(t),[`p`,``,`P"2!"/"`])).join(`/`).replaceAll(/^\/+/g,``).replaceAll(/\/+$/g,``).replaceAll(`/`,`-`)}p.__type=[`Context`,`context`,`file`,`resolveCommandId`,`P"w!2"&2#&/$`];function m(t){let r=(0,n.findFilePath)(t),i=(0,n.findFolderName)(t,{requireExtension:!0});for(;e.isDynamicPathSegment(i);)r=(0,a.resolveParentPath)(r),i=(0,n.findFolderName)(r,{requireExtension:!0});return i}m.__type=[`file`,`resolveCommandName`,`Finds the command name from the given file path.`,`P&2!"/"?#`];function h(t,r){return(0,i.replacePath)((0,n.findFilePath)(r),t.commandsPath).replaceAll(/^\/+/g,``).replaceAll(/\/+$/g,``).split(`/`).filter(f(t=>t&&!e.isPathSegmentGroup(t),[`path`,``,`P"2!"/"`])).join(`/`)}h.__type=[`Context`,`context`,`file`,`resolveCommandPath`,`P"w!2"&2#&/$`];function g(t,r){return(0,i.replacePath)((0,n.findFilePath)(r),t.commandsPath).split(`/`).filter(f(t=>!!t&&e.isDynamicPathSegment(t),[`path`,``,`P"2!"/"`])).map(f(t=>e.getDynamicPathSegmentName(t),[`path`,``,`P"2!"/"`]))}g.__type=[`Context`,`context`,`file`,`resolveCommandDynamicPathSegments`,`P"w!2"&2#&F/$`];async function _(e){let i=[];if((0,o.isSetString)(e.config.input)?i=await(0,l.listFiles)((0,t.appendPath)((0,t.appendPath)(e.config.input,e.config.root),e.config.cwd)):(0,s.isTypeDefinition)(e.config.input)?i=await(0,l.listFiles)((0,t.appendPath)((0,t.appendPath)(e.config.input.file,e.config.root),e.config.cwd)):Array.isArray(e.config.input)&&e.config.input.length>0?i=(await Promise.all(e.config.input.map(f(async n=>(0,l.listFiles)((0,t.appendPath)((0,t.appendPath)((0,o.isSetString)(n)?n:n.file,e.config.root),e.config.cwd)),[`input`,``,`P"2!"/"`])))).flat():(0,c.isSetObject)(e.config.input)&&(i=(await Promise.all(Object.values(e.config.input).map(f(async n=>Array.isArray(n)?(await Promise.all(n.map(f(async n=>(0,l.listFiles)((0,t.appendPath)((0,t.appendPath)((0,o.isSetString)(n)?n:n.file,e.config.root),e.config.cwd)),[`i`,``,`P"2!"/"`])))).flat():(0,l.listFiles)((0,t.appendPath)((0,t.appendPath)((0,o.isSetString)(n)?n:n.file,e.config.root),e.config.cwd)),[`input`,``,`P"2!"/"`])))).flat()),i.length>0)return(0,u.commonPath)(i.map(f(e=>(0,n.findFilePath)(e),[`p`,``,`P"2!"/"`])));let a=(0,r.joinPaths)(e.config.root,`src/commands`);return(0,d.existsSync)(a)||(a=(0,r.joinPaths)(e.config.root,`commands`),(0,d.existsSync)(a)||(a=(0,r.joinPaths)(e.config.root,`src`),(0,d.existsSync)(a)||(a=e.config.root))),i=(await Promise.all([(0,l.listFiles)((0,r.joinPaths)((0,t.appendPath)(a,e.config.cwd),`**/command.ts`)),(0,l.listFiles)((0,r.joinPaths)((0,t.appendPath)(a,e.config.cwd),`**/command.tsx`))])).flat(),i.length>0?(0,u.commonPath)(i.map(f(e=>(0,n.findFilePath)(e),[`p`,``,`P"2!"/"`]))):(0,t.appendPath)(a,e.config.cwd)}_.__type=[`Context`,`context`,`findCommandsRoot`,'P"w!2"&`/#'],exports.findCommandsRoot=_,exports.resolveCommandId=p,exports.resolveCommandName=m,exports.resolveCommandPath=h;
1
+ const require_context_helpers = require('../plugin-utils/context-helpers.cjs');
2
+ let _stryke_path_append = require("@stryke/path/append");
3
+ let _stryke_path_join_paths = require("@stryke/path/join-paths");
4
+ let _stryke_path_replace = require("@stryke/path/replace");
5
+ let _stryke_path_resolve_parent_path = require("@stryke/path/resolve-parent-path");
6
+ let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
7
+ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
8
+ let powerlines_utils = require("powerlines/utils");
9
+ let _stryke_fs_list_files = require("@stryke/fs/list-files");
10
+ let _stryke_path_common = require("@stryke/path/common");
11
+ let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
12
+ let node_fs = require("node:fs");
13
+
14
+ //#region src/helpers/paths.ts
15
+ function __assignType(fn, args) {
16
+ fn.__type = args;
17
+ return fn;
18
+ }
19
+ function resolveCommandId(context, file) {
20
+ return (0, _stryke_path_replace.replacePath)((0, _stryke_path_file_path_fns.findFilePath)(file), context.commandsPath).split("/").filter(__assignType((p) => Boolean(p) && !require_context_helpers.isDynamicPathSegment(p), [
21
+ "p",
22
+ "",
23
+ "P\"2!\"/\""
24
+ ])).join("/").replaceAll(/^\/+/g, "").replaceAll(/\/+$/g, "").replaceAll("/", "-");
25
+ }
26
+ resolveCommandId.__type = [
27
+ "Context",
28
+ "context",
29
+ "file",
30
+ "resolveCommandId",
31
+ "P\"w!2\"&2#&/$"
32
+ ];
33
+ /**
34
+ * Finds the command name from the given file path.
35
+ *
36
+ * @param file - The file path to extract the command name from.
37
+ * @returns The command name.
38
+ */
39
+ function resolveCommandName(file) {
40
+ let path = (0, _stryke_path_file_path_fns.findFilePath)(file);
41
+ let name = (0, _stryke_path_file_path_fns.findFolderName)(file, { requireExtension: true });
42
+ while (require_context_helpers.isDynamicPathSegment(name)) {
43
+ path = (0, _stryke_path_resolve_parent_path.resolveParentPath)(path);
44
+ name = (0, _stryke_path_file_path_fns.findFolderName)(path, { requireExtension: true });
45
+ }
46
+ return name;
47
+ }
48
+ resolveCommandName.__type = [
49
+ "file",
50
+ "resolveCommandName",
51
+ "Finds the command name from the given file path.",
52
+ "P&2!\"/\"?#"
53
+ ];
54
+ function resolveCommandPath(context, file) {
55
+ return (0, _stryke_path_replace.replacePath)((0, _stryke_path_file_path_fns.findFilePath)(file), context.commandsPath).replaceAll(/^\/+/g, "").replaceAll(/\/+$/g, "").split("/").filter(__assignType((path) => path && !require_context_helpers.isPathSegmentGroup(path), [
56
+ "path",
57
+ "",
58
+ "P\"2!\"/\""
59
+ ])).join("/");
60
+ }
61
+ resolveCommandPath.__type = [
62
+ "Context",
63
+ "context",
64
+ "file",
65
+ "resolveCommandPath",
66
+ "P\"w!2\"&2#&/$"
67
+ ];
68
+ function resolveCommandDynamicPathSegments(context, file) {
69
+ return (0, _stryke_path_replace.replacePath)((0, _stryke_path_file_path_fns.findFilePath)(file), context.commandsPath).split("/").filter(__assignType((path) => Boolean(path) && require_context_helpers.isDynamicPathSegment(path), [
70
+ "path",
71
+ "",
72
+ "P\"2!\"/\""
73
+ ])).map(__assignType((path) => require_context_helpers.getDynamicPathSegmentName(path), [
74
+ "path",
75
+ "",
76
+ "P\"2!\"/\""
77
+ ]));
78
+ }
79
+ resolveCommandDynamicPathSegments.__type = [
80
+ "Context",
81
+ "context",
82
+ "file",
83
+ "resolveCommandDynamicPathSegments",
84
+ "P\"w!2\"&2#&F/$"
85
+ ];
86
+ async function findCommandsRoot(context) {
87
+ let paths = [];
88
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(context.config.input)) paths = await (0, _stryke_fs_list_files.listFiles)((0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)(context.config.input, context.config.root), context.config.cwd));
89
+ else if ((0, powerlines_utils.isFileReference)(context.config.input)) paths = await (0, _stryke_fs_list_files.listFiles)((0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)(context.config.input.file, context.config.root), context.config.cwd));
90
+ else if (Array.isArray(context.config.input) && context.config.input.length > 0) paths = (await Promise.all(context.config.input.map(__assignType(async (input) => (0, _stryke_fs_list_files.listFiles)((0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)((0, _stryke_type_checks_is_set_string.isSetString)(input) ? input : input.file, context.config.root), context.config.cwd)), [
91
+ "input",
92
+ "",
93
+ "P\"2!\"/\""
94
+ ])))).flat();
95
+ else if ((0, _stryke_type_checks_is_set_object.isSetObject)(context.config.input)) paths = (await Promise.all(Object.values(context.config.input).map(__assignType(async (input) => Array.isArray(input) ? (await Promise.all(input.map(__assignType(async (i) => (0, _stryke_fs_list_files.listFiles)((0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)((0, _stryke_type_checks_is_set_string.isSetString)(i) ? i : i.file, context.config.root), context.config.cwd)), [
96
+ "i",
97
+ "",
98
+ "P\"2!\"/\""
99
+ ])))).flat() : (0, _stryke_fs_list_files.listFiles)((0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)((0, _stryke_type_checks_is_set_string.isSetString)(input) ? input : input.file, context.config.root), context.config.cwd)), [
100
+ "input",
101
+ "",
102
+ "P\"2!\"/\""
103
+ ])))).flat();
104
+ if (paths.length > 0) return (0, _stryke_path_common.commonPath)(paths.map(__assignType((p) => (0, _stryke_path_file_path_fns.findFilePath)(p), [
105
+ "p",
106
+ "",
107
+ "P\"2!\"/\""
108
+ ])));
109
+ let commandsPath = (0, _stryke_path_join_paths.joinPaths)(context.config.root, "src/commands");
110
+ if (!(0, node_fs.existsSync)(commandsPath)) {
111
+ commandsPath = (0, _stryke_path_join_paths.joinPaths)(context.config.root, "commands");
112
+ if (!(0, node_fs.existsSync)(commandsPath)) {
113
+ commandsPath = (0, _stryke_path_join_paths.joinPaths)(context.config.root, "src");
114
+ if (!(0, node_fs.existsSync)(commandsPath)) commandsPath = context.config.root;
115
+ }
116
+ }
117
+ paths = (await Promise.all([(0, _stryke_fs_list_files.listFiles)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(commandsPath, context.config.cwd), "**/command.ts")), (0, _stryke_fs_list_files.listFiles)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(commandsPath, context.config.cwd), "**/command.tsx"))])).flat();
118
+ if (paths.length > 0) return (0, _stryke_path_common.commonPath)(paths.map(__assignType((p) => (0, _stryke_path_file_path_fns.findFilePath)(p), [
119
+ "p",
120
+ "",
121
+ "P\"2!\"/\""
122
+ ])));
123
+ return (0, _stryke_path_append.appendPath)(commandsPath, context.config.cwd);
124
+ }
125
+ findCommandsRoot.__type = [
126
+ "Context",
127
+ "context",
128
+ "findCommandsRoot",
129
+ "P\"w!2\"&`/#"
130
+ ];
131
+
132
+ //#endregion
133
+ exports.findCommandsRoot = findCommandsRoot;
134
+ exports.resolveCommandId = resolveCommandId;
135
+ exports.resolveCommandName = resolveCommandName;
136
+ exports.resolveCommandPath = resolveCommandPath;
137
+ //# sourceMappingURL=paths.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.cjs","names":[],"sources":[],"mappings":""}
@@ -1,2 +1,134 @@
1
- import{getDynamicPathSegmentName as e,isDynamicPathSegment as t,isPathSegmentGroup as n}from"../plugin-utils/context-helpers.mjs";import{appendPath as r}from"@stryke/path/append";import{findFilePath as i,findFolderName as a}from"@stryke/path/file-path-fns";import{joinPaths as o}from"@stryke/path/join-paths";import{replacePath as s}from"@stryke/path/replace";import{resolveParentPath as c}from"@stryke/path/resolve-parent-path";import{isSetString as l}from"@stryke/type-checks/is-set-string";import{isTypeDefinition as u}from"powerlines/utils";import{isSetObject as d}from"@stryke/type-checks/is-set-object";import{listFiles as f}from"@stryke/fs/list-files";import{commonPath as p}from"@stryke/path/common";import{existsSync as m}from"node:fs";function h(e,t){return e.__type=t,e}function g(e,n){return s(i(n),e.commandsPath).split(`/`).filter(h(e=>!!e&&!t(e),[`p`,``,`P"2!"/"`])).join(`/`).replaceAll(/^\/+/g,``).replaceAll(/\/+$/g,``).replaceAll(`/`,`-`)}g.__type=[`Context`,`context`,`file`,`resolveCommandId`,`P"w!2"&2#&/$`];function _(e){let n=i(e),r=a(e,{requireExtension:!0});for(;t(r);)n=c(n),r=a(n,{requireExtension:!0});return r}_.__type=[`file`,`resolveCommandName`,`Finds the command name from the given file path.`,`P&2!"/"?#`];function v(e,t){return s(i(t),e.commandsPath).replaceAll(/^\/+/g,``).replaceAll(/\/+$/g,``).split(`/`).filter(h(e=>e&&!n(e),[`path`,``,`P"2!"/"`])).join(`/`)}v.__type=[`Context`,`context`,`file`,`resolveCommandPath`,`P"w!2"&2#&/$`];function y(n,r){return s(i(r),n.commandsPath).split(`/`).filter(h(e=>!!e&&t(e),[`path`,``,`P"2!"/"`])).map(h(t=>e(t),[`path`,``,`P"2!"/"`]))}y.__type=[`Context`,`context`,`file`,`resolveCommandDynamicPathSegments`,`P"w!2"&2#&F/$`];async function b(e){let t=[];if(l(e.config.input)?t=await f(r(r(e.config.input,e.config.root),e.config.cwd)):u(e.config.input)?t=await f(r(r(e.config.input.file,e.config.root),e.config.cwd)):Array.isArray(e.config.input)&&e.config.input.length>0?t=(await Promise.all(e.config.input.map(h(async t=>f(r(r(l(t)?t:t.file,e.config.root),e.config.cwd)),[`input`,``,`P"2!"/"`])))).flat():d(e.config.input)&&(t=(await Promise.all(Object.values(e.config.input).map(h(async t=>Array.isArray(t)?(await Promise.all(t.map(h(async t=>f(r(r(l(t)?t:t.file,e.config.root),e.config.cwd)),[`i`,``,`P"2!"/"`])))).flat():f(r(r(l(t)?t:t.file,e.config.root),e.config.cwd)),[`input`,``,`P"2!"/"`])))).flat()),t.length>0)return p(t.map(h(e=>i(e),[`p`,``,`P"2!"/"`])));let n=o(e.config.root,`src/commands`);return m(n)||(n=o(e.config.root,`commands`),m(n)||(n=o(e.config.root,`src`),m(n)||(n=e.config.root))),t=(await Promise.all([f(o(r(n,e.config.cwd),`**/command.ts`)),f(o(r(n,e.config.cwd),`**/command.tsx`))])).flat(),t.length>0?p(t.map(h(e=>i(e),[`p`,``,`P"2!"/"`]))):r(n,e.config.cwd)}b.__type=[`Context`,`context`,`findCommandsRoot`,'P"w!2"&`/#'];export{b as findCommandsRoot,g as resolveCommandId,_ as resolveCommandName,v as resolveCommandPath};
1
+ import { getDynamicPathSegmentName, isDynamicPathSegment, isPathSegmentGroup } from "../plugin-utils/context-helpers.mjs";
2
+ import { appendPath } from "@stryke/path/append";
3
+ import { joinPaths } from "@stryke/path/join-paths";
4
+ import { replacePath } from "@stryke/path/replace";
5
+ import { resolveParentPath } from "@stryke/path/resolve-parent-path";
6
+ import { isSetObject } from "@stryke/type-checks/is-set-object";
7
+ import { isSetString } from "@stryke/type-checks/is-set-string";
8
+ import { isFileReference } from "powerlines/utils";
9
+ import { listFiles } from "@stryke/fs/list-files";
10
+ import { commonPath } from "@stryke/path/common";
11
+ import { findFilePath, findFolderName } from "@stryke/path/file-path-fns";
12
+ import { existsSync } from "node:fs";
13
+
14
+ //#region src/helpers/paths.ts
15
+ function __assignType(fn, args) {
16
+ fn.__type = args;
17
+ return fn;
18
+ }
19
+ function resolveCommandId(context, file) {
20
+ return replacePath(findFilePath(file), context.commandsPath).split("/").filter(__assignType((p) => Boolean(p) && !isDynamicPathSegment(p), [
21
+ "p",
22
+ "",
23
+ "P\"2!\"/\""
24
+ ])).join("/").replaceAll(/^\/+/g, "").replaceAll(/\/+$/g, "").replaceAll("/", "-");
25
+ }
26
+ resolveCommandId.__type = [
27
+ "Context",
28
+ "context",
29
+ "file",
30
+ "resolveCommandId",
31
+ "P\"w!2\"&2#&/$"
32
+ ];
33
+ /**
34
+ * Finds the command name from the given file path.
35
+ *
36
+ * @param file - The file path to extract the command name from.
37
+ * @returns The command name.
38
+ */
39
+ function resolveCommandName(file) {
40
+ let path = findFilePath(file);
41
+ let name = findFolderName(file, { requireExtension: true });
42
+ while (isDynamicPathSegment(name)) {
43
+ path = resolveParentPath(path);
44
+ name = findFolderName(path, { requireExtension: true });
45
+ }
46
+ return name;
47
+ }
48
+ resolveCommandName.__type = [
49
+ "file",
50
+ "resolveCommandName",
51
+ "Finds the command name from the given file path.",
52
+ "P&2!\"/\"?#"
53
+ ];
54
+ function resolveCommandPath(context, file) {
55
+ return replacePath(findFilePath(file), context.commandsPath).replaceAll(/^\/+/g, "").replaceAll(/\/+$/g, "").split("/").filter(__assignType((path) => path && !isPathSegmentGroup(path), [
56
+ "path",
57
+ "",
58
+ "P\"2!\"/\""
59
+ ])).join("/");
60
+ }
61
+ resolveCommandPath.__type = [
62
+ "Context",
63
+ "context",
64
+ "file",
65
+ "resolveCommandPath",
66
+ "P\"w!2\"&2#&/$"
67
+ ];
68
+ function resolveCommandDynamicPathSegments(context, file) {
69
+ return replacePath(findFilePath(file), context.commandsPath).split("/").filter(__assignType((path) => Boolean(path) && isDynamicPathSegment(path), [
70
+ "path",
71
+ "",
72
+ "P\"2!\"/\""
73
+ ])).map(__assignType((path) => getDynamicPathSegmentName(path), [
74
+ "path",
75
+ "",
76
+ "P\"2!\"/\""
77
+ ]));
78
+ }
79
+ resolveCommandDynamicPathSegments.__type = [
80
+ "Context",
81
+ "context",
82
+ "file",
83
+ "resolveCommandDynamicPathSegments",
84
+ "P\"w!2\"&2#&F/$"
85
+ ];
86
+ async function findCommandsRoot(context) {
87
+ let paths = [];
88
+ if (isSetString(context.config.input)) paths = await listFiles(appendPath(appendPath(context.config.input, context.config.root), context.config.cwd));
89
+ else if (isFileReference(context.config.input)) paths = await listFiles(appendPath(appendPath(context.config.input.file, context.config.root), context.config.cwd));
90
+ else if (Array.isArray(context.config.input) && context.config.input.length > 0) paths = (await Promise.all(context.config.input.map(__assignType(async (input) => listFiles(appendPath(appendPath(isSetString(input) ? input : input.file, context.config.root), context.config.cwd)), [
91
+ "input",
92
+ "",
93
+ "P\"2!\"/\""
94
+ ])))).flat();
95
+ else if (isSetObject(context.config.input)) paths = (await Promise.all(Object.values(context.config.input).map(__assignType(async (input) => Array.isArray(input) ? (await Promise.all(input.map(__assignType(async (i) => listFiles(appendPath(appendPath(isSetString(i) ? i : i.file, context.config.root), context.config.cwd)), [
96
+ "i",
97
+ "",
98
+ "P\"2!\"/\""
99
+ ])))).flat() : listFiles(appendPath(appendPath(isSetString(input) ? input : input.file, context.config.root), context.config.cwd)), [
100
+ "input",
101
+ "",
102
+ "P\"2!\"/\""
103
+ ])))).flat();
104
+ if (paths.length > 0) return commonPath(paths.map(__assignType((p) => findFilePath(p), [
105
+ "p",
106
+ "",
107
+ "P\"2!\"/\""
108
+ ])));
109
+ let commandsPath = joinPaths(context.config.root, "src/commands");
110
+ if (!existsSync(commandsPath)) {
111
+ commandsPath = joinPaths(context.config.root, "commands");
112
+ if (!existsSync(commandsPath)) {
113
+ commandsPath = joinPaths(context.config.root, "src");
114
+ if (!existsSync(commandsPath)) commandsPath = context.config.root;
115
+ }
116
+ }
117
+ paths = (await Promise.all([listFiles(joinPaths(appendPath(commandsPath, context.config.cwd), "**/command.ts")), listFiles(joinPaths(appendPath(commandsPath, context.config.cwd), "**/command.tsx"))])).flat();
118
+ if (paths.length > 0) return commonPath(paths.map(__assignType((p) => findFilePath(p), [
119
+ "p",
120
+ "",
121
+ "P\"2!\"/\""
122
+ ])));
123
+ return appendPath(commandsPath, context.config.cwd);
124
+ }
125
+ findCommandsRoot.__type = [
126
+ "Context",
127
+ "context",
128
+ "findCommandsRoot",
129
+ "P\"w!2\"&`/#"
130
+ ];
131
+
132
+ //#endregion
133
+ export { findCommandsRoot, resolveCommandId, resolveCommandName, resolveCommandPath };
2
134
  //# sourceMappingURL=paths.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"paths.mjs","names":[],"sources":["../../src/helpers/paths.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 { listFiles } from \"@stryke/fs/list-files\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { commonPath } from \"@stryke/path/common\";\nimport { findFilePath, findFolderName } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { existsSync } from \"node:fs\";\nimport { isTypeDefinition } from \"powerlines/utils\";\nimport {\n getDynamicPathSegmentName,\n isDynamicPathSegment,\n isPathSegmentGroup\n} from \"../plugin-utils/context-helpers\";\nimport type { Context } from \"../types/context\";\n\nexport function resolveCommandId(context: Context, file: string): string {\n return replacePath(findFilePath(file), context.commandsPath)\n .split(\"/\")\n .filter(p => Boolean(p) && !isDynamicPathSegment(p))\n .join(\"/\")\n .replaceAll(/^\\/+/g, \"\")\n .replaceAll(/\\/+$/g, \"\")\n .replaceAll(\"/\", \"-\");\n}\n\n/**\n * Finds the command name from the given file path.\n *\n * @param file - The file path to extract the command name from.\n * @returns The command name.\n */\nexport function resolveCommandName(file: string) {\n let path = findFilePath(file);\n let name = findFolderName(file, {\n requireExtension: true\n });\n\n while (isDynamicPathSegment(name)) {\n path = resolveParentPath(path);\n name = findFolderName(path, {\n requireExtension: true\n });\n }\n\n return name;\n}\n\nexport function resolveCommandPath(context: Context, file: string): string {\n return replacePath(findFilePath(file), context.commandsPath)\n .replaceAll(/^\\/+/g, \"\")\n .replaceAll(/\\/+$/g, \"\")\n .split(\"/\")\n .filter(path => path && !isPathSegmentGroup(path))\n .join(\"/\");\n}\n\nexport function resolveCommandDynamicPathSegments(\n context: Context,\n file: string\n): string[] {\n return replacePath(findFilePath(file), context.commandsPath)\n .split(\"/\")\n .filter(path => Boolean(path) && isDynamicPathSegment(path))\n .map(path => getDynamicPathSegmentName(path));\n}\n\nexport async function findCommandsRoot(context: Context): Promise<string> {\n let paths = [] as string[];\n if (isSetString(context.config.input)) {\n paths = await listFiles(\n appendPath(\n appendPath(context.config.input, context.config.root),\n context.config.cwd\n )\n );\n } else if (isTypeDefinition(context.config.input)) {\n paths = await listFiles(\n appendPath(\n appendPath(context.config.input.file, context.config.root),\n context.config.cwd\n )\n );\n } else if (\n Array.isArray(context.config.input) &&\n context.config.input.length > 0\n ) {\n paths = (\n await Promise.all(\n context.config.input.map(async input =>\n listFiles(\n appendPath(\n appendPath(\n isSetString(input) ? input : input.file,\n context.config.root\n ),\n context.config.cwd\n )\n )\n )\n )\n ).flat();\n } else if (isSetObject(context.config.input)) {\n paths = (\n await Promise.all(\n Object.values(context.config.input).map(async input =>\n Array.isArray(input)\n ? (\n await Promise.all(\n input.map(async i =>\n listFiles(\n appendPath(\n appendPath(\n isSetString(i) ? i : i.file,\n context.config.root\n ),\n context.config.cwd\n )\n )\n )\n )\n ).flat()\n : listFiles(\n appendPath(\n appendPath(\n isSetString(input) ? input : input.file,\n context.config.root\n ),\n context.config.cwd\n )\n )\n )\n )\n ).flat();\n }\n\n if (paths.length > 0) {\n return commonPath(paths.map(p => findFilePath(p)));\n }\n\n let commandsPath = joinPaths(context.config.root, \"src/commands\");\n if (!existsSync(commandsPath)) {\n commandsPath = joinPaths(context.config.root, \"commands\");\n if (!existsSync(commandsPath)) {\n commandsPath = joinPaths(context.config.root, \"src\");\n if (!existsSync(commandsPath)) {\n commandsPath = context.config.root;\n }\n }\n }\n\n paths = (\n await Promise.all([\n listFiles(\n joinPaths(appendPath(commandsPath, context.config.cwd), \"**/command.ts\")\n ),\n listFiles(\n joinPaths(\n appendPath(commandsPath, context.config.cwd),\n \"**/command.tsx\"\n )\n )\n ])\n ).flat();\n if (paths.length > 0) {\n return commonPath(paths.map(p => findFilePath(p)));\n }\n\n return appendPath(commandsPath, context.config.cwd);\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"paths.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1,113 @@
1
- require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@powerlines/plugin-env/helpers`),t=require(`@stryke/path/join-paths`);function n(e,t){return e.__type=t,e}function r(e){return{...e,parent:e.parent?.name?e.parent.name:null,children:Object.fromEntries(Object.entries(e.children||{}).map(n(([e,t])=>[e,r(t)],[`param0`,``,`P"2!"/"`])))}}r.__type=[`CommandTree`,`command`,`SerializedCommandTree`,`serialize`,`P"w!2""w#/$`];function i(e,t=null){let r={...e,parent:t??null,children:{}};return r.children=Object.fromEntries(Object.entries(e.children||{}).map(n(([e,t])=>[e,i(t,r)],[`param0`,``,`P"2!"/"`]))),r}i.__type=[`SerializedCommandTree`,`command`,`CommandTree`,`parent`,()=>null,`deserialize`,`P"w!2"P"w#,J2$>%"w#/&`];function a(e){return(0,t.joinPaths)(e.dataPath,`reflections`,`commands.json`)}a.__type=[`Context`,`context`,`getCommandsPersistencePath`,`Gets the file path for persisting CLI command reflections.`,`P"w!2"&/#?$`];async function o(e){let t=await e.fs.read(a(e));if(!t||!t.length)throw Error(`CLI Command reflection file ${a(e)} is empty`);e.commands=Object.fromEntries(Object.entries(JSON.parse(t)??{}).map(n(([e,t])=>[e,i(t)],[`param0`,``,`P"2!"/"`])))}o.__type=[`Context`,`context`,`readCommandsPersistence`,`Reads the persisted CLI command reflections from the file system and populates the context's commands.`,`P"w!2""/#?$`];async function s(t){let i=a(t);await(0,e.writeEnvTypeReflection)(t,t.env.types.env,`env`),await t.fs.write(i,JSON.stringify(Object.fromEntries(Object.entries(t.commands).map(n(([e,t])=>[e,r(t)],[`param0`,``,`P"2!"/"`]))),null,t.config.mode===`production`?0:2))}s.__type=[`Context`,`context`,`writeCommandsPersistence`,`Writes the current CLI command reflections from the context to the file system for persistence.`,`P"w!2""/#?$`],exports.getCommandsPersistencePath=a,exports.readCommandsPersistence=o,exports.writeCommandsPersistence=s;
1
+ let _stryke_path_join_paths = require("@stryke/path/join-paths");
2
+ let _powerlines_plugin_env_helpers = require("@powerlines/plugin-env/helpers");
3
+
4
+ //#region src/helpers/persistence.ts
5
+ function __assignType(fn, args) {
6
+ fn.__type = args;
7
+ return fn;
8
+ }
9
+ function serialize(command) {
10
+ return {
11
+ ...command,
12
+ parent: command.parent?.name ? command.parent.name : null,
13
+ children: Object.fromEntries(Object.entries(command.children || {}).map(__assignType(([name, child]) => [name, serialize(child)], [
14
+ "param0",
15
+ "",
16
+ "P\"2!\"/\""
17
+ ])))
18
+ };
19
+ }
20
+ serialize.__type = [
21
+ "CommandTree",
22
+ "command",
23
+ "SerializedCommandTree",
24
+ "serialize",
25
+ "P\"w!2\"\"w#/$"
26
+ ];
27
+ function deserialize(command, parent = null) {
28
+ const result = {
29
+ ...command,
30
+ parent: parent ?? null,
31
+ children: {}
32
+ };
33
+ result.children = Object.fromEntries(Object.entries(command.children || {}).map(__assignType(([name, child]) => [name, deserialize(child, result)], [
34
+ "param0",
35
+ "",
36
+ "P\"2!\"/\""
37
+ ])));
38
+ return result;
39
+ }
40
+ deserialize.__type = [
41
+ "SerializedCommandTree",
42
+ "command",
43
+ "CommandTree",
44
+ "parent",
45
+ () => null,
46
+ "deserialize",
47
+ "P\"w!2\"P\"w#,J2$>%\"w#/&"
48
+ ];
49
+ /**
50
+ * Gets the file path for persisting CLI command reflections.
51
+ *
52
+ * @param context - The Shell Shock context.
53
+ * @returns The file path for persisting CLI command reflections.
54
+ */
55
+ function getCommandsPersistencePath(context) {
56
+ return (0, _stryke_path_join_paths.joinPaths)(context.dataPath, "reflections", "commands.json");
57
+ }
58
+ getCommandsPersistencePath.__type = [
59
+ "Context",
60
+ "context",
61
+ "getCommandsPersistencePath",
62
+ "Gets the file path for persisting CLI command reflections.",
63
+ "P\"w!2\"&/#?$"
64
+ ];
65
+ /**
66
+ * Reads the persisted CLI command reflections from the file system and populates the context's commands.
67
+ *
68
+ * @param context - The Shell Shock context.
69
+ * @throws Will throw an error if the reflections file is empty or cannot be read.
70
+ */
71
+ async function readCommandsPersistence(context) {
72
+ const reflections = await context.fs.read(getCommandsPersistencePath(context));
73
+ if (!reflections || !reflections.length) throw new Error(`CLI Command reflection file ${getCommandsPersistencePath(context)} is empty`);
74
+ context.commands = Object.fromEntries(Object.entries(JSON.parse(reflections) ?? {}).map(__assignType(([name, command]) => [name, deserialize(command)], [
75
+ "param0",
76
+ "",
77
+ "P\"2!\"/\""
78
+ ])));
79
+ }
80
+ readCommandsPersistence.__type = [
81
+ "Context",
82
+ "context",
83
+ "readCommandsPersistence",
84
+ "Reads the persisted CLI command reflections from the file system and populates the context's commands.",
85
+ "P\"w!2\"\"/#?$"
86
+ ];
87
+ /**
88
+ * Writes the current CLI command reflections from the context to the file system for persistence.
89
+ *
90
+ * @param context - The Shell Shock context.
91
+ * @returns A promise that resolves when the reflections have been successfully written to the file system.
92
+ * @throws Will throw an error if there is an issue writing the reflections to the file system.
93
+ */
94
+ async function writeCommandsPersistence(context) {
95
+ const filePath = getCommandsPersistencePath(context);
96
+ await (0, _powerlines_plugin_env_helpers.writeEnv)(context);
97
+ await context.fs.write(filePath, JSON.stringify(Object.fromEntries(Object.entries(context.commands).map(__assignType(([name, command]) => [name, serialize(command)], [
98
+ "param0",
99
+ "",
100
+ "P\"2!\"/\""
101
+ ]))), null, context.config.mode === "production" ? 0 : 2));
102
+ }
103
+ writeCommandsPersistence.__type = [
104
+ "Context",
105
+ "context",
106
+ "writeCommandsPersistence",
107
+ "Writes the current CLI command reflections from the context to the file system for persistence.",
108
+ "P\"w!2\"\"/#?$"
109
+ ];
110
+
111
+ //#endregion
112
+ exports.writeCommandsPersistence = writeCommandsPersistence;
113
+ //# sourceMappingURL=persistence.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persistence.cjs","names":[],"sources":[],"mappings":""}