@shell-shock/core 0.17.8 → 0.17.10

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 (141) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +29 -1
  2. package/dist/api.cjs +148 -1
  3. package/dist/api.d.cts +6 -6
  4. package/dist/api.d.cts.map +1 -1
  5. package/dist/api.d.mts +6 -6
  6. package/dist/api.d.mts.map +1 -1
  7. package/dist/api.mjs +145 -1
  8. package/dist/api.mjs.map +1 -1
  9. package/dist/components/command-validation-logic.cjs +292 -1
  10. package/dist/components/command-validation-logic.mjs +289 -1
  11. package/dist/components/command-validation-logic.mjs.map +1 -1
  12. package/dist/components/docs.cjs +265 -1
  13. package/dist/components/docs.mjs +256 -1
  14. package/dist/components/docs.mjs.map +1 -1
  15. package/dist/components/exec-builtin.cjs +429 -13
  16. package/dist/components/exec-builtin.mjs +425 -13
  17. package/dist/components/exec-builtin.mjs.map +1 -1
  18. package/dist/components/helpers.cjs +120 -1
  19. package/dist/components/helpers.mjs +112 -1
  20. package/dist/components/helpers.mjs.map +1 -1
  21. package/dist/components/index.cjs +58 -1
  22. package/dist/components/index.mjs +10 -1
  23. package/dist/components/options-parser-logic.cjs +960 -5
  24. package/dist/components/options-parser-logic.d.cts +1 -1
  25. package/dist/components/options-parser-logic.mjs +945 -5
  26. package/dist/components/options-parser-logic.mjs.map +1 -1
  27. package/dist/components/state-builtin.cjs +629 -8
  28. package/dist/components/state-builtin.mjs +622 -8
  29. package/dist/components/state-builtin.mjs.map +1 -1
  30. package/dist/components/usage.cjs +117 -1
  31. package/dist/components/usage.mjs +114 -1
  32. package/dist/components/usage.mjs.map +1 -1
  33. package/dist/components/utils-builtin.cjs +838 -33
  34. package/dist/components/utils-builtin.mjs +828 -33
  35. package/dist/components/utils-builtin.mjs.map +1 -1
  36. package/dist/config.cjs +31 -1
  37. package/dist/config.mjs +29 -1
  38. package/dist/config.mjs.map +1 -1
  39. package/dist/contexts/command.cjs +26 -1
  40. package/dist/contexts/command.mjs +23 -1
  41. package/dist/contexts/command.mjs.map +1 -1
  42. package/dist/contexts/index.cjs +9 -1
  43. package/dist/contexts/index.mjs +4 -1
  44. package/dist/contexts/options.cjs +63 -1
  45. package/dist/contexts/options.mjs +58 -1
  46. package/dist/contexts/options.mjs.map +1 -1
  47. package/dist/helpers/automd.cjs +71 -1
  48. package/dist/helpers/automd.mjs +70 -1
  49. package/dist/helpers/automd.mjs.map +1 -1
  50. package/dist/helpers/docs-helpers.cjs +23 -1
  51. package/dist/helpers/docs-helpers.mjs +22 -1
  52. package/dist/helpers/docs-helpers.mjs.map +1 -1
  53. package/dist/helpers/paths.cjs +137 -1
  54. package/dist/helpers/paths.mjs +133 -1
  55. package/dist/helpers/paths.mjs.map +1 -1
  56. package/dist/helpers/persistence.cjs +115 -1
  57. package/dist/helpers/persistence.mjs +112 -1
  58. package/dist/helpers/persistence.mjs.map +1 -1
  59. package/dist/helpers/update-package-json.cjs +65 -1
  60. package/dist/helpers/update-package-json.mjs +63 -1
  61. package/dist/helpers/update-package-json.mjs.map +1 -1
  62. package/dist/helpers/utilities.cjs +95 -1
  63. package/dist/helpers/utilities.mjs +93 -1
  64. package/dist/helpers/utilities.mjs.map +1 -1
  65. package/dist/helpers/validations.cjs +71 -1
  66. package/dist/helpers/validations.mjs +71 -1
  67. package/dist/helpers/validations.mjs.map +1 -1
  68. package/dist/index.cjs +53 -1
  69. package/dist/index.d.cts +3 -3
  70. package/dist/index.d.mts +3 -3
  71. package/dist/index.mjs +7 -1
  72. package/dist/plugin-utils/compute-bin.cjs +50 -1
  73. package/dist/plugin-utils/compute-bin.mjs +49 -1
  74. package/dist/plugin-utils/compute-bin.mjs.map +1 -1
  75. package/dist/plugin-utils/context-helpers.cjs +231 -1
  76. package/dist/plugin-utils/context-helpers.mjs +221 -1
  77. package/dist/plugin-utils/context-helpers.mjs.map +1 -1
  78. package/dist/plugin-utils/deepkit.cjs +71 -1
  79. package/dist/plugin-utils/deepkit.mjs +69 -1
  80. package/dist/plugin-utils/deepkit.mjs.map +1 -1
  81. package/dist/plugin-utils/description-helpers.cjs +111 -2
  82. package/dist/plugin-utils/description-helpers.mjs +107 -2
  83. package/dist/plugin-utils/description-helpers.mjs.map +1 -1
  84. package/dist/plugin-utils/get-command-tree.cjs +117 -1
  85. package/dist/plugin-utils/get-command-tree.mjs +114 -1
  86. package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
  87. package/dist/plugin-utils/index.cjs +39 -1
  88. package/dist/plugin-utils/index.mjs +10 -1
  89. package/dist/plugin-utils/reflect.cjs +52 -1
  90. package/dist/plugin-utils/reflect.mjs +52 -1
  91. package/dist/plugin-utils/reflect.mjs.map +1 -1
  92. package/dist/plugin-utils/traverse-command-tree.cjs +64 -1
  93. package/dist/plugin-utils/traverse-command-tree.mjs +62 -1
  94. package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
  95. package/dist/plugin-utils/type-checks.cjs +93 -1
  96. package/dist/plugin-utils/type-checks.mjs +88 -1
  97. package/dist/plugin-utils/type-checks.mjs.map +1 -1
  98. package/dist/plugin.cjs +471 -4
  99. package/dist/plugin.d.cts.map +1 -1
  100. package/dist/plugin.d.mts.map +1 -1
  101. package/dist/plugin.mjs +465 -4
  102. package/dist/plugin.mjs.map +1 -1
  103. package/dist/resolver/deepkit.cjs +135 -1
  104. package/dist/resolver/deepkit.mjs +134 -1
  105. package/dist/resolver/deepkit.mjs.map +1 -1
  106. package/dist/resolver/helpers.cjs +173 -1
  107. package/dist/resolver/helpers.mjs +168 -1
  108. package/dist/resolver/helpers.mjs.map +1 -1
  109. package/dist/resolver/module.cjs +145 -1
  110. package/dist/resolver/module.mjs +144 -1
  111. package/dist/resolver/module.mjs.map +1 -1
  112. package/dist/resolver/resolve.cjs +222 -1
  113. package/dist/resolver/resolve.mjs +221 -1
  114. package/dist/resolver/resolve.mjs.map +1 -1
  115. package/dist/types/command.cjs +441 -1
  116. package/dist/types/command.d.cts +1 -1
  117. package/dist/types/command.d.mts +2 -2
  118. package/dist/types/command.mjs +405 -1
  119. package/dist/types/command.mjs.map +1 -1
  120. package/dist/types/config.cjs +134 -1
  121. package/dist/types/config.d.cts +10 -8
  122. package/dist/types/config.d.cts.map +1 -1
  123. package/dist/types/config.d.mts +10 -8
  124. package/dist/types/config.d.mts.map +1 -1
  125. package/dist/types/config.mjs +127 -1
  126. package/dist/types/config.mjs.map +1 -1
  127. package/dist/types/context.cjs +37 -1
  128. package/dist/types/context.mjs +34 -1
  129. package/dist/types/context.mjs.map +1 -1
  130. package/dist/types/env.cjs +52 -1
  131. package/dist/types/env.d.cts +1 -1
  132. package/dist/types/env.d.mts +1 -1
  133. package/dist/types/env.mjs +50 -1
  134. package/dist/types/env.mjs.map +1 -1
  135. package/dist/types/index.cjs +50 -1
  136. package/dist/types/index.d.cts +2 -2
  137. package/dist/types/index.d.mts +2 -2
  138. package/dist/types/index.mjs +6 -1
  139. package/dist/types/options.cjs +12 -1
  140. package/dist/types/options.mjs +10 -1
  141. package/package.json +22 -21
@@ -1,2 +1,115 @@
1
- import{isDynamicPathSegment as e}from"./context-helpers.mjs";import{traverseCommands as t}from"./traverse-command-tree.mjs";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(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(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(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(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`/#?$'];export{i as getCommandList,a as getCommandPaths,o as getCommandSegments,r as getCommandTree};
1
+ import { isDynamicPathSegment } from "./context-helpers.mjs";
2
+ import { traverseCommands } from "./traverse-command-tree.mjs";
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) => !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 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 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 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
+ export { getCommandList, getCommandPaths, getCommandSegments, getCommandTree };
2
115
  //# sourceMappingURL=get-command-tree.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-command-tree.mjs","names":[],"sources":["../../src/plugin-utils/get-command-tree.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 { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { isDynamicPathSegment } from \"./context-helpers\";\nimport { traverseCommands } from \"./traverse-command-tree\";\n\n/**\n * Retrieves a specific command tree based on the provided path.\n *\n * @param context - The build context containing the command definitions.\n * @param path - An array of strings representing the command path.\n * @returns The command tree at the specified path, or null if not found.\n */\nexport function getCommandTree(\n context: Context,\n path = [] as string[]\n): CommandTree | null {\n if (path.length === 0) {\n return null;\n }\n\n let currentTree: CommandTree | null = context.commands[path[0]!] ?? null;\n if (path.length > 1) {\n const segments = path\n .slice(1)\n .filter(segment => !isDynamicPathSegment(segment));\n for (const segment of segments) {\n if (\n currentTree?.children &&\n Object.prototype.hasOwnProperty.call(currentTree.children, segment)\n ) {\n currentTree = currentTree.children[segment] ?? null;\n } else {\n return null;\n }\n }\n }\n\n return currentTree;\n}\n\n/**\n * Retrieves a list of all command trees defined in the context.\n *\n * @param context - The build context containing the command definitions.\n * @returns A promise that resolves to an array of all command trees in the context.\n */\nexport async function getCommandList(context: Context): Promise<CommandTree[]> {\n const commandList: CommandTree[] = [];\n await traverseCommands(context, commandTree => {\n commandList.push(commandTree);\n });\n\n return commandList;\n}\n\n/**\n * Retrieves a list of all command paths defined in the context.\n *\n * @param context - The build context containing the command definitions.\n * @returns A promise that resolves to an array of all command paths in the context.\n */\nexport async function getCommandPaths(context: Context): Promise<string[]> {\n const commandPaths: string[] = [];\n await traverseCommands(context, commandTree => {\n if (commandTree.path) {\n commandPaths.push(commandTree.path);\n }\n });\n\n return commandPaths;\n}\n\n/**\n * Retrieves a list of all command segments defined in the context.\n *\n * @param context - The build context containing the command definitions.\n * @returns A promise that resolves to an array of all command segments in the context.\n */\nexport async function getCommandSegments(\n context: Context\n): Promise<string[][]> {\n const commandSegments: string[][] = [];\n await traverseCommands(context, commandTree => {\n if (commandTree.path) {\n commandSegments.push(commandTree.segments);\n }\n });\n\n return commandSegments;\n}\n"],"mappings":"4HAAA,SAAS,EAAa,EAAI,EAAM,CAE9B,kBAAO,qBAYR,GAAK,EAAA,SAAQ,EAAA,OAAA,kCAId,GAAM,EAAK,OAAG,EAAA,CACd,IAAO,EAAc,EAAG,MAAQ,EAAC,CAAA,OAAM,EAAQ,GAAA,CAAA,EAAA,EAAA,CAAA,CAAA,UAAA,GAAA,UAAA,CAAA,CAAA,CAC/C,IAAS,IAAA,KAAA,EACH,GAAG,GAAA,UAA0B,OAAC,UAAgB,eAAM,KAAA,EAAA,SAAA,EAAA,CAAA,EAAA,EAAA,SAAA,IAAA,UAGvD,OAAY,KAIb,OAAE,EAEJ,EAAe,OAAC,CAAA,UAAc,UAAA,OAAA,cAAA,iBAAA,gEAAA,sBAAA,qBAQ5B,IAAI,EAAa,EAAA,CAIjB,OAHA,MAAI,EAAiB,EAAA,EAAA,GAAA,CACnB,EAAM,KAAW,EAAA,EAChB,CAAC,cAAQ,GAAA,UAAA,CAAA,CAAA,CACP,EAEP,EAAS,OAAA,CAAA,UAAA,UAAA,cAAA,iBAAA,gEAAA,kBAAA,CAOT,eAAM,EAAA,EAAA,CACJ,IAAE,EAAA,EAAA,CAMF,OALA,MAAA,EAAA,EAAA,EAAA,GAAA,SAEA,EAAO,KAAW,EAAA,KAAA,iCAGlB,EAEF,EAAC,OAAA,CAAA,UAAA,UAAA,kBAAA,gEAAA,gBAAA,CAOD,eAAqB,EAAY,EAAA,CAC/B,IAAE,EAAA,EAAA,CAMF,uBAJM,EAAY,MACpB,EAAA,KAAA,EAAA,SAAA,EAEE,CAAA,cAAA,GAAA,UAAA,CAAA,CAAA,CACC,EAEH,EAAmB,OAAK,CAAK,UAAS,UAAW,qBAAuB,mEAAA,iBAAA"}
1
+ {"version":3,"file":"get-command-tree.mjs","names":[],"sources":["../../src/plugin-utils/get-command-tree.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 { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { isDynamicPathSegment } from \"./context-helpers\";\nimport { traverseCommands } from \"./traverse-command-tree\";\n\n/**\n * Retrieves a specific command tree based on the provided path.\n *\n * @param context - The build context containing the command definitions.\n * @param path - An array of strings representing the command path.\n * @returns The command tree at the specified path, or null if not found.\n */\nexport function getCommandTree(\n context: Context,\n path = [] as string[]\n): CommandTree | null {\n if (path.length === 0) {\n return null;\n }\n\n let currentTree: CommandTree | null = context.commands[path[0]!] ?? null;\n if (path.length > 1) {\n const segments = path\n .slice(1)\n .filter(segment => !isDynamicPathSegment(segment));\n for (const segment of segments) {\n if (\n currentTree?.children &&\n Object.prototype.hasOwnProperty.call(currentTree.children, segment)\n ) {\n currentTree = currentTree.children[segment] ?? null;\n } else {\n return null;\n }\n }\n }\n\n return currentTree;\n}\n\n/**\n * Retrieves a list of all command trees defined in the context.\n *\n * @param context - The build context containing the command definitions.\n * @returns A promise that resolves to an array of all command trees in the context.\n */\nexport async function getCommandList(context: Context): Promise<CommandTree[]> {\n const commandList: CommandTree[] = [];\n await traverseCommands(context, commandTree => {\n commandList.push(commandTree);\n });\n\n return commandList;\n}\n\n/**\n * Retrieves a list of all command paths defined in the context.\n *\n * @param context - The build context containing the command definitions.\n * @returns A promise that resolves to an array of all command paths in the context.\n */\nexport async function getCommandPaths(context: Context): Promise<string[]> {\n const commandPaths: string[] = [];\n await traverseCommands(context, commandTree => {\n if (commandTree.path) {\n commandPaths.push(commandTree.path);\n }\n });\n\n return commandPaths;\n}\n\n/**\n * Retrieves a list of all command segments defined in the context.\n *\n * @param context - The build context containing the command definitions.\n * @returns A promise that resolves to an array of all command segments in the context.\n */\nexport async function getCommandSegments(\n context: Context\n): Promise<string[][]> {\n const commandSegments: string[][] = [];\n await traverseCommands(context, commandTree => {\n if (commandTree.path) {\n commandSegments.push(commandTree.segments);\n }\n });\n\n return commandSegments;\n}\n"],"mappings":";;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE9B,QAAO;;;;;;;;;;AAYR,KAAK,KAAA,WAAQ;;AAId,KAAM,KAAK,SAAG,GAAA;EACd,MAAO,WAAc,KAAG,MAAQ,EAAC,CAAA,OAAM,cAAQ,YAAA,CAAA,qBAAA,QAAA,EAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;AAC/C,OAAS,MAAA,WAAA,SACH,KAAG,aAAA,YAA0B,OAAC,UAAgB,eAAM,KAAA,YAAA,UAAA,QAAA;MAGvD,QAAY;;AAIb,QAAE;;AAEJ,eAAe,SAAC;CAAA;CAAc;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;CAQ5B,MAAI,cAAa,EAAA;AACjB,OAAI,iBAAiB,SAAA,cAAA,gBAAA;AACnB,cAAM,KAAW,YAAA;IAChB;EAAC;EAAQ;EAAA;EAAA,CAAA,CAAA;AACZ,QAAK;;AAEP,eAAS,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOT,eAAM,gBAAA,SAAA;CACJ,MAAE,eAAA,EAAA;AACF,OAAA,iBAAA,SAAA,cAAA,gBAAA;uBAEA,cAAO,KAAW,YAAA,KAAA;;;;;;AAGlB,QAAA;;AAEF,gBAAC,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOD,eAAqB,mBAAY,SAAA;CAC/B,MAAE,kBAAA,EAAA;;AAEF,MAAM,YAAY,KACpB,iBAAA,KAAA,YAAA,SAAA;IAEE;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA;AACA,QAAC;;AAEH,mBAAmB,SAAK;CAAK;CAAS;CAAW;CAAuB;CAAA;CAAA"}
@@ -1 +1,39 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./context-helpers.cjs`),t=require(`./reflect.cjs`),n=require(`./compute-bin.cjs`),r=require(`./type-checks.cjs`),i=require(`./deepkit.cjs`),a=require(`./description-helpers.cjs`),o=require(`./traverse-command-tree.cjs`),s=require(`./get-command-tree.cjs`);exports.__ΩFormatDescriptionOptions=a.__ΩFormatDescriptionOptions,exports.__ΩFormatShortDescriptionOptions=a.__ΩFormatShortDescriptionOptions,exports.computeBin=n.computeBin,exports.extractReflectionKind=i.extractReflectionKind,exports.extractType=i.extractType,exports.formatDescription=a.formatDescription,exports.formatShortDescription=a.formatShortDescription,exports.getAppBin=e.getAppBin,exports.getAppDescription=e.getAppDescription,exports.getAppName=e.getAppName,exports.getAppTitle=e.getAppTitle,exports.getCommandList=s.getCommandList,exports.getCommandPaths=s.getCommandPaths,exports.getCommandSegments=s.getCommandSegments,exports.getCommandTree=s.getCommandTree,exports.getDynamicPathSegmentName=e.getDynamicPathSegmentName,exports.getPathSegmentGroupName=e.getPathSegmentGroupName,exports.getPathSegmentName=e.getPathSegmentName,exports.isCommandArgument=r.isCommandArgument,exports.isCommandOption=r.isCommandOption,exports.isCommandParameter=r.isCommandParameter,exports.isCommandParameterConfig=r.isCommandParameterConfig,exports.isCommandParameterKind=r.isCommandParameterKind,exports.isDynamicPathSegment=e.isDynamicPathSegment,exports.isPathSegmentGroup=e.isPathSegmentGroup,exports.sortArgAliases=e.sortArgAliases,exports.sortOptions=t.sortOptions,exports.traverseCommandTree=o.traverseCommandTree,exports.traverseCommands=o.traverseCommands;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_context_helpers = require('./context-helpers.cjs');
3
+ const require_reflect = require('./reflect.cjs');
4
+ const require_compute_bin = require('./compute-bin.cjs');
5
+ const require_type_checks = require('./type-checks.cjs');
6
+ const require_deepkit = require('./deepkit.cjs');
7
+ const require_description_helpers = require('./description-helpers.cjs');
8
+ const require_traverse_command_tree = require('./traverse-command-tree.cjs');
9
+ const require_get_command_tree = require('./get-command-tree.cjs');
10
+
11
+ exports.__ΩFormatDescriptionOptions = require_description_helpers.__ΩFormatDescriptionOptions;
12
+ exports.__ΩFormatShortDescriptionOptions = require_description_helpers.__ΩFormatShortDescriptionOptions;
13
+ exports.computeBin = require_compute_bin.computeBin;
14
+ exports.extractReflectionKind = require_deepkit.extractReflectionKind;
15
+ exports.extractType = require_deepkit.extractType;
16
+ exports.formatDescription = require_description_helpers.formatDescription;
17
+ exports.formatShortDescription = require_description_helpers.formatShortDescription;
18
+ exports.getAppBin = require_context_helpers.getAppBin;
19
+ exports.getAppDescription = require_context_helpers.getAppDescription;
20
+ exports.getAppName = require_context_helpers.getAppName;
21
+ exports.getAppTitle = require_context_helpers.getAppTitle;
22
+ exports.getCommandList = require_get_command_tree.getCommandList;
23
+ exports.getCommandPaths = require_get_command_tree.getCommandPaths;
24
+ exports.getCommandSegments = require_get_command_tree.getCommandSegments;
25
+ exports.getCommandTree = require_get_command_tree.getCommandTree;
26
+ exports.getDynamicPathSegmentName = require_context_helpers.getDynamicPathSegmentName;
27
+ exports.getPathSegmentGroupName = require_context_helpers.getPathSegmentGroupName;
28
+ exports.getPathSegmentName = require_context_helpers.getPathSegmentName;
29
+ exports.isCommandArgument = require_type_checks.isCommandArgument;
30
+ exports.isCommandOption = require_type_checks.isCommandOption;
31
+ exports.isCommandParameter = require_type_checks.isCommandParameter;
32
+ exports.isCommandParameterConfig = require_type_checks.isCommandParameterConfig;
33
+ exports.isCommandParameterKind = require_type_checks.isCommandParameterKind;
34
+ exports.isDynamicPathSegment = require_context_helpers.isDynamicPathSegment;
35
+ exports.isPathSegmentGroup = require_context_helpers.isPathSegmentGroup;
36
+ exports.sortArgAliases = require_context_helpers.sortArgAliases;
37
+ exports.sortOptions = require_reflect.sortOptions;
38
+ exports.traverseCommandTree = require_traverse_command_tree.traverseCommandTree;
39
+ exports.traverseCommands = require_traverse_command_tree.traverseCommands;
@@ -1 +1,10 @@
1
- import{getAppBin as e,getAppDescription as t,getAppName as n,getAppTitle as r,getDynamicPathSegmentName as i,getPathSegmentGroupName as a,getPathSegmentName as o,isDynamicPathSegment as s,isPathSegmentGroup as c,sortArgAliases as l}from"./context-helpers.mjs";import{sortOptions as u}from"./reflect.mjs";import{computeBin as d}from"./compute-bin.mjs";import{isCommandArgument as f,isCommandOption as p,isCommandParameter as m,isCommandParameterConfig as h,isCommandParameterKind as g}from"./type-checks.mjs";import{extractReflectionKind as _,extractType as v}from"./deepkit.mjs";import{__ΩFormatDescriptionOptions as y,__ΩFormatShortDescriptionOptions as b,formatDescription as x,formatShortDescription as S}from"./description-helpers.mjs";import{traverseCommandTree as C,traverseCommands as w}from"./traverse-command-tree.mjs";import{getCommandList as T,getCommandPaths as E,getCommandSegments as D,getCommandTree as O}from"./get-command-tree.mjs";export{y as __ΩFormatDescriptionOptions,b as __ΩFormatShortDescriptionOptions,d as computeBin,_ as extractReflectionKind,v as extractType,x as formatDescription,S as formatShortDescription,e as getAppBin,t as getAppDescription,n as getAppName,r as getAppTitle,T as getCommandList,E as getCommandPaths,D as getCommandSegments,O as getCommandTree,i as getDynamicPathSegmentName,a as getPathSegmentGroupName,o as getPathSegmentName,f as isCommandArgument,p as isCommandOption,m as isCommandParameter,h as isCommandParameterConfig,g as isCommandParameterKind,s as isDynamicPathSegment,c as isPathSegmentGroup,l as sortArgAliases,u as sortOptions,C as traverseCommandTree,w as traverseCommands};
1
+ import { getAppBin, getAppDescription, getAppName, getAppTitle, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases } from "./context-helpers.mjs";
2
+ import { sortOptions } from "./reflect.mjs";
3
+ import { computeBin } from "./compute-bin.mjs";
4
+ import { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind } from "./type-checks.mjs";
5
+ import { extractReflectionKind, extractType } from "./deepkit.mjs";
6
+ import { __ΩFormatDescriptionOptions, __ΩFormatShortDescriptionOptions, formatDescription, formatShortDescription } from "./description-helpers.mjs";
7
+ import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.mjs";
8
+ import { getCommandList, getCommandPaths, getCommandSegments, getCommandTree } from "./get-command-tree.mjs";
9
+
10
+ export { __ΩFormatDescriptionOptions, __ΩFormatShortDescriptionOptions, computeBin, extractReflectionKind, extractType, formatDescription, formatShortDescription, getAppBin, getAppDescription, getAppName, getAppTitle, getCommandList, getCommandPaths, getCommandSegments, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
@@ -1 +1,52 @@
1
- const e=require(`../types/command.cjs`);function t(e,t){return e.__type=t,e}function n(n){return!n||n.length===0?[]:n.filter(t(t=>t.kind!==e.CommandParameterKinds.boolean||t.variadic||!t.isNegativeOf,[`arg`,``,`P"2!"/"`])).sort(t((e,t)=>e.name.localeCompare(t.name),[`a`,`b`,``,`P"2!"2""/#`])).reduce(t((r,i)=>{if(r.push(i),i.kind===e.CommandParameterKinds.boolean){let a=n.find(t(t=>t.kind===e.CommandParameterKinds.boolean&&!t.variadic&&t.isNegativeOf===i.name,[`a`,``,`P"2!"/"`]));a&&r.push(a)}return r},[`ret`,`arg`,``,`P"2!"2""/#`]),[])}n.__type=[`CommandOption`,`options`,`sortOptions`,`Sort command options alphabetically by name, placing boolean options with negatives appropriately.`,`P"w!F2""w!F/#?$`],exports.sortOptions=n;
1
+ const require_types_command = require('../types/command.cjs');
2
+
3
+ //#region src/plugin-utils/reflect.ts
4
+ function __assignType(fn, args) {
5
+ fn.__type = args;
6
+ return fn;
7
+ }
8
+ /**
9
+ * Sort command options alphabetically by name, placing boolean options with negatives appropriately.
10
+ *
11
+ * @param options - The array of command options to sort.
12
+ * @returns A new array of sorted command options.
13
+ */
14
+ function sortOptions(options) {
15
+ if (!options || options.length === 0) return [];
16
+ return options.filter(__assignType((arg) => arg.kind !== require_types_command.CommandParameterKinds.boolean || arg.variadic || !arg.isNegativeOf, [
17
+ "arg",
18
+ "",
19
+ "P\"2!\"/\""
20
+ ])).sort(__assignType((a, b) => a.name.localeCompare(b.name), [
21
+ "a",
22
+ "b",
23
+ "",
24
+ "P\"2!\"2\"\"/#"
25
+ ])).reduce(__assignType((ret, arg) => {
26
+ ret.push(arg);
27
+ if (arg.kind === require_types_command.CommandParameterKinds.boolean) {
28
+ const negativeArg = options.find(__assignType((a) => a.kind === require_types_command.CommandParameterKinds.boolean && !a.variadic && a.isNegativeOf === arg.name, [
29
+ "a",
30
+ "",
31
+ "P\"2!\"/\""
32
+ ]));
33
+ if (negativeArg) ret.push(negativeArg);
34
+ }
35
+ return ret;
36
+ }, [
37
+ "ret",
38
+ "arg",
39
+ "",
40
+ "P\"2!\"2\"\"/#"
41
+ ]), []);
42
+ }
43
+ sortOptions.__type = [
44
+ "CommandOption",
45
+ "options",
46
+ "sortOptions",
47
+ "Sort command options alphabetically by name, placing boolean options with negatives appropriately.",
48
+ "P\"w!F2\"\"w!F/#?$"
49
+ ];
50
+
51
+ //#endregion
52
+ exports.sortOptions = sortOptions;
@@ -1,2 +1,53 @@
1
- import{CommandParameterKinds as e}from"../types/command.mjs";function t(e,t){return e.__type=t,e}function n(n){return!n||n.length===0?[]:n.filter(t(t=>t.kind!==e.boolean||t.variadic||!t.isNegativeOf,[`arg`,``,`P"2!"/"`])).sort(t((e,t)=>e.name.localeCompare(t.name),[`a`,`b`,``,`P"2!"2""/#`])).reduce(t((r,i)=>{if(r.push(i),i.kind===e.boolean){let a=n.find(t(t=>t.kind===e.boolean&&!t.variadic&&t.isNegativeOf===i.name,[`a`,``,`P"2!"/"`]));a&&r.push(a)}return r},[`ret`,`arg`,``,`P"2!"2""/#`]),[])}n.__type=[`CommandOption`,`options`,`sortOptions`,`Sort command options alphabetically by name, placing boolean options with negatives appropriately.`,`P"w!F2""w!F/#?$`];export{n as sortOptions};
1
+ import { CommandParameterKinds } from "../types/command.mjs";
2
+
3
+ //#region src/plugin-utils/reflect.ts
4
+ function __assignType(fn, args) {
5
+ fn.__type = args;
6
+ return fn;
7
+ }
8
+ /**
9
+ * Sort command options alphabetically by name, placing boolean options with negatives appropriately.
10
+ *
11
+ * @param options - The array of command options to sort.
12
+ * @returns A new array of sorted command options.
13
+ */
14
+ function sortOptions(options) {
15
+ if (!options || options.length === 0) return [];
16
+ return options.filter(__assignType((arg) => arg.kind !== CommandParameterKinds.boolean || arg.variadic || !arg.isNegativeOf, [
17
+ "arg",
18
+ "",
19
+ "P\"2!\"/\""
20
+ ])).sort(__assignType((a, b) => a.name.localeCompare(b.name), [
21
+ "a",
22
+ "b",
23
+ "",
24
+ "P\"2!\"2\"\"/#"
25
+ ])).reduce(__assignType((ret, arg) => {
26
+ ret.push(arg);
27
+ if (arg.kind === CommandParameterKinds.boolean) {
28
+ const negativeArg = options.find(__assignType((a) => a.kind === CommandParameterKinds.boolean && !a.variadic && a.isNegativeOf === arg.name, [
29
+ "a",
30
+ "",
31
+ "P\"2!\"/\""
32
+ ]));
33
+ if (negativeArg) ret.push(negativeArg);
34
+ }
35
+ return ret;
36
+ }, [
37
+ "ret",
38
+ "arg",
39
+ "",
40
+ "P\"2!\"2\"\"/#"
41
+ ]), []);
42
+ }
43
+ sortOptions.__type = [
44
+ "CommandOption",
45
+ "options",
46
+ "sortOptions",
47
+ "Sort command options alphabetically by name, placing boolean options with negatives appropriately.",
48
+ "P\"w!F2\"\"w!F/#?$"
49
+ ];
50
+
51
+ //#endregion
52
+ export { sortOptions };
2
53
  //# sourceMappingURL=reflect.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"reflect.mjs","names":[],"sources":["../../src/plugin-utils/reflect.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 { CommandOption } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * Sort command options alphabetically by name, placing boolean options with negatives appropriately.\n *\n * @param options - The array of command options to sort.\n * @returns A new array of sorted command options.\n */\nexport function sortOptions(options: CommandOption[]): CommandOption[] {\n if (!options || options.length === 0) {\n return [];\n }\n\n return options\n .filter(\n arg =>\n arg.kind !== CommandParameterKinds.boolean ||\n arg.variadic ||\n !arg.isNegativeOf\n )\n .sort((a, b) => a.name.localeCompare(b.name))\n .reduce((ret, arg) => {\n ret.push(arg);\n\n if (arg.kind === CommandParameterKinds.boolean) {\n // Add the negative argument if it exists\n const negativeArg = options.find(\n a =>\n a.kind === CommandParameterKinds.boolean &&\n !a.variadic &&\n a.isNegativeOf === arg.name\n );\n if (negativeArg) {\n ret.push(negativeArg);\n }\n }\n\n return ret;\n }, [] as CommandOption[]);\n}\n"],"mappings":"6DAAA,SAAS,EAAa,EAAI,EAAM,CAE9B,kBAAO,EAST,SAAgB,EAAW,EAAQ,OAClC,CAAA,GAAiB,EAAQ,SAAS,EAAA,EAAA,iLAI/B,EAAI,KAAK,EAAI,qBAGX,IAAG,EAAA,EAAwB,KAAM,EAAS,GAAQ,EAAA,OAAA,EAAA,SAAA,CAAA,EAAA,UAAA,EAAA,eAAA,EAAA,KAAA,CAAA,IAAA,GAAA,UAAA,CAAA,CAAA,IAEtD,EAAA,KAAA,EAAA,CAGE,OAAM,GACN,CAAA,MAAS,MAAK,GAAM,aAAU,CAAA,CAAA,EAAQ,CAAA,CAE1C,EAAO,OAAS,CAAA,gBAAqB,UAAa,cAAK,qGAAgB,kBAAA"}
1
+ {"version":3,"file":"reflect.mjs","names":[],"sources":["../../src/plugin-utils/reflect.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 { CommandOption } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * Sort command options alphabetically by name, placing boolean options with negatives appropriately.\n *\n * @param options - The array of command options to sort.\n * @returns A new array of sorted command options.\n */\nexport function sortOptions(options: CommandOption[]): CommandOption[] {\n if (!options || options.length === 0) {\n return [];\n }\n\n return options\n .filter(\n arg =>\n arg.kind !== CommandParameterKinds.boolean ||\n arg.variadic ||\n !arg.isNegativeOf\n )\n .sort((a, b) => a.name.localeCompare(b.name))\n .reduce((ret, arg) => {\n ret.push(arg);\n\n if (arg.kind === CommandParameterKinds.boolean) {\n // Add the negative argument if it exists\n const negativeArg = options.find(\n a =>\n a.kind === CommandParameterKinds.boolean &&\n !a.variadic &&\n a.isNegativeOf === arg.name\n );\n if (negativeArg) {\n ret.push(negativeArg);\n }\n }\n\n return ret;\n }, [] as CommandOption[]);\n}\n"],"mappings":";;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE9B,QAAO;;;;;;;;AAST,SAAgB,YAAW,SAAQ;AAClC,KAAA,CAAA,WAAiB,QAAQ,WAAS;;;;;;;;;;;AAI/B,MAAI,KAAK,IAAI;;GAGX,MAAG,cAAA,QAAwB,KAAM,cAAS,MAAQ,EAAA,SAAA,sBAAA,WAAA,CAAA,EAAA,YAAA,EAAA,iBAAA,IAAA,MAAA;IAAA;IAAA;IAAA;IAAA,CAAA,CAAA;mBAEtD,KAAA,KAAA,YAAA;;AAGE,SAAM;IACN;EAAA;EAAS;EAAK;EAAM;EAAU,CAAA,EAAA,EAAQ,CAAA;;AAE1C,YAAO,SAAS;CAAA;CAAqB;CAAa;CAAK;CAAgB;CAAA"}
@@ -1 +1,64 @@
1
- function e(e,t){return e.__type=t,e}async function t(n,r){n.children&&await Promise.all(Object.values(n.children).map(e(async e=>{await Promise.resolve(r(e)),await t(e,r)},[`childTree`,``,`P"2!"/"`])))}t.__type=[`CommandTree`,`commandTree`,`node`,``,`visitor`,`traverseCommandTree`,`Traverses a command tree and applies a visitor function to each node.`,`P"w!2"P"w!2#!/$2%$\`/&?'`];async function n(n,r){n.commands&&await Promise.all(Object.values(n.commands).map(e(async e=>{await Promise.resolve(r(e)),await t(e,r)},[`childTree`,``,`P"2!"/"`])))}n.__type=[`context`,`CommandTree`,`node`,``,`visitor`,`traverseCommands`,`Traverses all commands in the context and applies a visitor function to each command tree.`,`P"2!P"w"2#!/$2%$\`/&?'`],exports.traverseCommandTree=t,exports.traverseCommands=n;
1
+
2
+ //#region src/plugin-utils/traverse-command-tree.ts
3
+ function __assignType(fn, args) {
4
+ fn.__type = args;
5
+ return fn;
6
+ }
7
+ /**
8
+ * Traverses a command tree and applies a visitor function to each node.
9
+ *
10
+ * @param commandTree - The command tree to traverse.
11
+ * @param visitor - The visitor function to apply to each node.
12
+ */
13
+ async function traverseCommandTree(commandTree, visitor) {
14
+ if (!commandTree.children) return;
15
+ await Promise.all(Object.values(commandTree.children).map(__assignType(async (childTree) => {
16
+ await Promise.resolve(visitor(childTree));
17
+ await traverseCommandTree(childTree, visitor);
18
+ }, [
19
+ "childTree",
20
+ "",
21
+ "P\"2!\"/\""
22
+ ])));
23
+ }
24
+ traverseCommandTree.__type = [
25
+ "CommandTree",
26
+ "commandTree",
27
+ "node",
28
+ "",
29
+ "visitor",
30
+ "traverseCommandTree",
31
+ "Traverses a command tree and applies a visitor function to each node.",
32
+ "P\"w!2\"P\"w!2#!/$2%$`/&?'"
33
+ ];
34
+ /**
35
+ * Traverses all commands in the context and applies a visitor function to each command tree.
36
+ *
37
+ * @param context - The build context containing the command definitions.
38
+ * @param visitor - The visitor function to apply to each command tree.
39
+ */
40
+ async function traverseCommands(context, visitor) {
41
+ if (!context.commands) return;
42
+ await Promise.all(Object.values(context.commands).map(__assignType(async (childTree) => {
43
+ await Promise.resolve(visitor(childTree));
44
+ await traverseCommandTree(childTree, visitor);
45
+ }, [
46
+ "childTree",
47
+ "",
48
+ "P\"2!\"/\""
49
+ ])));
50
+ }
51
+ traverseCommands.__type = [
52
+ "context",
53
+ "CommandTree",
54
+ "node",
55
+ "",
56
+ "visitor",
57
+ "traverseCommands",
58
+ "Traverses all commands in the context and applies a visitor function to each command tree.",
59
+ "P\"2!P\"w\"2#!/$2%$`/&?'"
60
+ ];
61
+
62
+ //#endregion
63
+ exports.traverseCommandTree = traverseCommandTree;
64
+ exports.traverseCommands = traverseCommands;
@@ -1,2 +1,63 @@
1
- function e(e,t){return e.__type=t,e}async function t(n,r){n.children&&await Promise.all(Object.values(n.children).map(e(async e=>{await Promise.resolve(r(e)),await t(e,r)},[`childTree`,``,`P"2!"/"`])))}t.__type=[`CommandTree`,`commandTree`,`node`,``,`visitor`,`traverseCommandTree`,`Traverses a command tree and applies a visitor function to each node.`,`P"w!2"P"w!2#!/$2%$\`/&?'`];async function n(n,r){n.commands&&await Promise.all(Object.values(n.commands).map(e(async e=>{await Promise.resolve(r(e)),await t(e,r)},[`childTree`,``,`P"2!"/"`])))}n.__type=[`context`,`CommandTree`,`node`,``,`visitor`,`traverseCommands`,`Traverses all commands in the context and applies a visitor function to each command tree.`,`P"2!P"w"2#!/$2%$\`/&?'`];export{t as traverseCommandTree,n as traverseCommands};
1
+ //#region src/plugin-utils/traverse-command-tree.ts
2
+ function __assignType(fn, args) {
3
+ fn.__type = args;
4
+ return fn;
5
+ }
6
+ /**
7
+ * Traverses a command tree and applies a visitor function to each node.
8
+ *
9
+ * @param commandTree - The command tree to traverse.
10
+ * @param visitor - The visitor function to apply to each node.
11
+ */
12
+ async function traverseCommandTree(commandTree, visitor) {
13
+ if (!commandTree.children) return;
14
+ await Promise.all(Object.values(commandTree.children).map(__assignType(async (childTree) => {
15
+ await Promise.resolve(visitor(childTree));
16
+ await traverseCommandTree(childTree, visitor);
17
+ }, [
18
+ "childTree",
19
+ "",
20
+ "P\"2!\"/\""
21
+ ])));
22
+ }
23
+ traverseCommandTree.__type = [
24
+ "CommandTree",
25
+ "commandTree",
26
+ "node",
27
+ "",
28
+ "visitor",
29
+ "traverseCommandTree",
30
+ "Traverses a command tree and applies a visitor function to each node.",
31
+ "P\"w!2\"P\"w!2#!/$2%$`/&?'"
32
+ ];
33
+ /**
34
+ * Traverses all commands in the context and applies a visitor function to each command tree.
35
+ *
36
+ * @param context - The build context containing the command definitions.
37
+ * @param visitor - The visitor function to apply to each command tree.
38
+ */
39
+ async function traverseCommands(context, visitor) {
40
+ if (!context.commands) return;
41
+ await Promise.all(Object.values(context.commands).map(__assignType(async (childTree) => {
42
+ await Promise.resolve(visitor(childTree));
43
+ await traverseCommandTree(childTree, visitor);
44
+ }, [
45
+ "childTree",
46
+ "",
47
+ "P\"2!\"/\""
48
+ ])));
49
+ }
50
+ traverseCommands.__type = [
51
+ "context",
52
+ "CommandTree",
53
+ "node",
54
+ "",
55
+ "visitor",
56
+ "traverseCommands",
57
+ "Traverses all commands in the context and applies a visitor function to each command tree.",
58
+ "P\"2!P\"w\"2#!/$2%$`/&?'"
59
+ ];
60
+
61
+ //#endregion
62
+ export { traverseCommandTree, traverseCommands };
2
63
  //# sourceMappingURL=traverse-command-tree.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-command-tree.mjs","names":[],"sources":["../../src/plugin-utils/traverse-command-tree.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 { MaybePromise } from \"@stryke/types/base\";\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Traverses a command tree and applies a visitor function to each node.\n *\n * @param commandTree - The command tree to traverse.\n * @param visitor - The visitor function to apply to each node.\n */\nexport async function traverseCommandTree(\n commandTree: CommandTree,\n visitor: (node: CommandTree) => MaybePromise<void>\n): Promise<void> {\n if (!commandTree.children) {\n return;\n }\n\n await Promise.all(\n Object.values(commandTree.children).map(async childTree => {\n await Promise.resolve(visitor(childTree));\n await traverseCommandTree(childTree, visitor);\n })\n );\n}\n\n/**\n * Traverses all commands in the context and applies a visitor function to each command tree.\n *\n * @param context - The build context containing the command definitions.\n * @param visitor - The visitor function to apply to each command tree.\n */\nexport async function traverseCommands<TContext extends Context>(\n context: TContext,\n visitor: (node: CommandTree) => MaybePromise<void>\n): Promise<void> {\n if (!context.commands) {\n return;\n }\n\n await Promise.all(\n Object.values(context.commands).map(async childTree => {\n await Promise.resolve(visitor(childTree));\n await traverseCommandTree(childTree, visitor);\n })\n );\n}\n"],"mappings":"AAAA,SAAS,EAAa,EAAI,EAAM,CAE9B,kBAAO,EAQT,eAAsB,EAAoB,EAAU,EAAS,CAC5D,EAAkB,UAGlB,MAAK,QAAQ,IAAA,OAAa,OAAO,EAAE,SAAA,CAAA,IAAA,EAAA,KAAA,IAAA,6BAEhC,MAAM,EAAoB,EAAW,EAAQ,gCAGjD,EAAc,OAAc,CAAA,cAAe,cAAQ,OAAA,GAAA,UAAA,sBAAA,wEAAA,2BAAA,CAOnD,eAAoB,EAAY,EAAY,EAAa,CACvD,EAAA,UAGA,MAAA,QAAc,IAAE,OAAA,OAAgB,EAAA,SAAiB,CAAA,IAAA,EAAA,KAAA,IAAA,CAChD,MAAO,QAAO,QAAA,EAAA,EAAA,CAAA,CACb,MAAG,EAAsB,EAAA,EAAA,EACzB,CAAA,YAAM,GAAA,UAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"traverse-command-tree.mjs","names":[],"sources":["../../src/plugin-utils/traverse-command-tree.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 { MaybePromise } from \"@stryke/types/base\";\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Traverses a command tree and applies a visitor function to each node.\n *\n * @param commandTree - The command tree to traverse.\n * @param visitor - The visitor function to apply to each node.\n */\nexport async function traverseCommandTree(\n commandTree: CommandTree,\n visitor: (node: CommandTree) => MaybePromise<void>\n): Promise<void> {\n if (!commandTree.children) {\n return;\n }\n\n await Promise.all(\n Object.values(commandTree.children).map(async childTree => {\n await Promise.resolve(visitor(childTree));\n await traverseCommandTree(childTree, visitor);\n })\n );\n}\n\n/**\n * Traverses all commands in the context and applies a visitor function to each command tree.\n *\n * @param context - The build context containing the command definitions.\n * @param visitor - The visitor function to apply to each command tree.\n */\nexport async function traverseCommands<TContext extends Context>(\n context: TContext,\n visitor: (node: CommandTree) => MaybePromise<void>\n): Promise<void> {\n if (!context.commands) {\n return;\n }\n\n await Promise.all(\n Object.values(context.commands).map(async childTree => {\n await Promise.resolve(visitor(childTree));\n await traverseCommandTree(childTree, visitor);\n })\n );\n}\n"],"mappings":";AAAA,SAAS,aAAa,IAAI,MAAM;;AAE9B,QAAO;;;;;;;;AAQT,eAAsB,oBAAoB,aAAU,SAAS;AAC5D,KAAA,CAAA,YAAkB,SAClB;AAEA,OAAK,QAAQ,IAAA,OAAa,OAAO,YAAE,SAAA,CAAA,IAAA,aAAA,OAAA,cAAA;;AAEhC,QAAM,oBAAoB,WAAW,QAAQ;;;;;;;AAGjD,oBAAc,SAAc;CAAA;CAAe;CAAQ;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOnD,eAAoB,iBAAY,SAAY,SAAa;AACvD,KAAA,CAAA,QAAA,SACF;AAEE,OAAA,QAAc,IAAE,OAAA,OAAgB,QAAA,SAAiB,CAAA,IAAA,aAAA,OAAA,cAAA;AAChD,QAAO,QAAO,QAAA,QAAA,UAAA,CAAA;AACb,QAAG,oBAAsB,WAAA,QAAA;IACzB;EAAA;EAAM;EAAA;EAAA,CAAA,CAAA,CAAA"}
@@ -1 +1,93 @@
1
- require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../types/command.cjs`);let t=require(`@stryke/type-checks/is-set-string`),n=require(`@stryke/type-checks/is-set-object`),r=require(`@stryke/type-checks/is-boolean`);function i(n){return(0,t.isSetString)(n)&&[e.CommandParameterKinds.string,e.CommandParameterKinds.number,e.CommandParameterKinds.boolean].includes(n)}i.__type=[`obj`,`isCommandParameterKind`,`Type guard to check if a value is a valid {@link CommandParameterKind} type.`,`P"2!!/"?#`];function a(e){return(0,n.isSetObject)(e)&&`kind`in e&&i(e.kind)}a.__type=[`obj`,`isCommandParameterConfig`,`Type guard to check if a value is a valid {@link CommandParameterConfig} type.`,`P"2!!/"?#`];function o(e){return a(e)&&`name`in e&&(0,t.isSetString)(e.name)&&`title`in e&&(0,t.isSetString)(e.title)&&`description`in e&&(0,t.isSetString)(e.description)&&`alias`in e&&Array.isArray(e.alias)&&`env`in e&&((0,t.isSetString)(e.env)||e.env===!1)&&`optional`in e&&(0,r.isBoolean)(e.optional)&&`variadic`in e&&(0,r.isBoolean)(e.variadic)}o.__type=[`obj`,`isCommandParameter`,`Type guard to check if a value is a valid {@link CommandParameter} type.`,`P"2!!/"?#`];function s(e){return a(e)&&o(e)&&`default`in e}s.__type=[`obj`,`isCommandOption`,`Type guard to check if a value is a valid {@link CommandOption} type.`,`P"2!!/"?#`];function c(e){return a(e)&&o(e)}c.__type=[`obj`,`isCommandArgument`,`Type guard to check if a value is a valid {@link CommandArgument} type.`,`P"2!!/"?#`],exports.isCommandArgument=c,exports.isCommandOption=s,exports.isCommandParameter=o,exports.isCommandParameterConfig=a,exports.isCommandParameterKind=i;
1
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
+ const require_types_command = require('../types/command.cjs');
3
+ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
4
+ let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
5
+ let _stryke_type_checks_is_boolean = require("@stryke/type-checks/is-boolean");
6
+
7
+ //#region src/plugin-utils/type-checks.ts
8
+ /**
9
+ * Type guard to check if a value is a valid {@link CommandParameterKind} type.
10
+ *
11
+ * @param obj - The value to check.
12
+ * @returns True if the value is a valid {@link CommandParameterKind} type, false otherwise.
13
+ */
14
+ function isCommandParameterKind(obj) {
15
+ return (0, _stryke_type_checks_is_set_string.isSetString)(obj) && [
16
+ require_types_command.CommandParameterKinds.string,
17
+ require_types_command.CommandParameterKinds.number,
18
+ require_types_command.CommandParameterKinds.boolean
19
+ ].includes(obj);
20
+ }
21
+ isCommandParameterKind.__type = [
22
+ "obj",
23
+ "isCommandParameterKind",
24
+ "Type guard to check if a value is a valid {@link CommandParameterKind} type.",
25
+ "P\"2!!/\"?#"
26
+ ];
27
+ /**
28
+ * Type guard to check if a value is a valid {@link CommandParameterConfig} type.
29
+ *
30
+ * @param obj - The value to check.
31
+ * @returns True if the value is a valid {@link CommandParameterConfig} type, false otherwise.
32
+ */
33
+ function isCommandParameterConfig(obj) {
34
+ return (0, _stryke_type_checks_is_set_object.isSetObject)(obj) && "kind" in obj && isCommandParameterKind(obj.kind);
35
+ }
36
+ isCommandParameterConfig.__type = [
37
+ "obj",
38
+ "isCommandParameterConfig",
39
+ "Type guard to check if a value is a valid {@link CommandParameterConfig} type.",
40
+ "P\"2!!/\"?#"
41
+ ];
42
+ /**
43
+ * Type guard to check if a value is a valid {@link CommandParameter} type.
44
+ *
45
+ * @param obj - The value to check.
46
+ * @returns True if the value is a valid {@link CommandParameter} type, false otherwise.
47
+ */
48
+ function isCommandParameter(obj) {
49
+ return isCommandParameterConfig(obj) && "name" in obj && (0, _stryke_type_checks_is_set_string.isSetString)(obj.name) && "title" in obj && (0, _stryke_type_checks_is_set_string.isSetString)(obj.title) && "description" in obj && (0, _stryke_type_checks_is_set_string.isSetString)(obj.description) && "alias" in obj && Array.isArray(obj.alias) && "env" in obj && ((0, _stryke_type_checks_is_set_string.isSetString)(obj.env) || obj.env === false) && "optional" in obj && (0, _stryke_type_checks_is_boolean.isBoolean)(obj.optional) && "variadic" in obj && (0, _stryke_type_checks_is_boolean.isBoolean)(obj.variadic);
50
+ }
51
+ isCommandParameter.__type = [
52
+ "obj",
53
+ "isCommandParameter",
54
+ "Type guard to check if a value is a valid {@link CommandParameter} type.",
55
+ "P\"2!!/\"?#"
56
+ ];
57
+ /**
58
+ * Type guard to check if a value is a valid {@link CommandOption} type.
59
+ *
60
+ * @param obj - The value to check.
61
+ * @returns True if the value is a valid {@link CommandOption} type, false otherwise.
62
+ */
63
+ function isCommandOption(obj) {
64
+ return isCommandParameterConfig(obj) && isCommandParameter(obj) && "default" in obj;
65
+ }
66
+ isCommandOption.__type = [
67
+ "obj",
68
+ "isCommandOption",
69
+ "Type guard to check if a value is a valid {@link CommandOption} type.",
70
+ "P\"2!!/\"?#"
71
+ ];
72
+ /**
73
+ * Type guard to check if a value is a valid {@link CommandArgument} type.
74
+ *
75
+ * @param obj - The value to check.
76
+ * @returns True if the value is a valid {@link CommandArgument} type, false otherwise.
77
+ */
78
+ function isCommandArgument(obj) {
79
+ return isCommandParameterConfig(obj) && isCommandParameter(obj);
80
+ }
81
+ isCommandArgument.__type = [
82
+ "obj",
83
+ "isCommandArgument",
84
+ "Type guard to check if a value is a valid {@link CommandArgument} type.",
85
+ "P\"2!!/\"?#"
86
+ ];
87
+
88
+ //#endregion
89
+ exports.isCommandArgument = isCommandArgument;
90
+ exports.isCommandOption = isCommandOption;
91
+ exports.isCommandParameter = isCommandParameter;
92
+ exports.isCommandParameterConfig = isCommandParameterConfig;
93
+ exports.isCommandParameterKind = isCommandParameterKind;