@shell-shock/core 0.2.0 → 0.3.0

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 (154) hide show
  1. package/README.md +221 -0
  2. package/dist/_virtual/rolldown_runtime.cjs +29 -1
  3. package/dist/api.cjs +57 -1
  4. package/dist/api.cjs.map +1 -0
  5. package/dist/api.d.cts +9 -1
  6. package/dist/api.d.cts.map +1 -0
  7. package/dist/api.d.mts +9 -1
  8. package/dist/api.d.mts.map +1 -0
  9. package/dist/api.mjs +55 -1
  10. package/dist/api.mjs.map +1 -0
  11. package/dist/components/docs.cjs +105 -0
  12. package/dist/components/docs.cjs.map +1 -0
  13. package/dist/components/docs.d.cts +56 -0
  14. package/dist/components/docs.d.cts.map +1 -0
  15. package/dist/components/docs.d.mts +56 -0
  16. package/dist/components/docs.d.mts.map +1 -0
  17. package/dist/components/docs.mjs +102 -0
  18. package/dist/components/docs.mjs.map +1 -0
  19. package/dist/components/index.cjs +5 -0
  20. package/dist/components/index.d.cts +2 -0
  21. package/dist/components/index.d.mts +2 -0
  22. package/dist/components/index.mjs +3 -0
  23. package/dist/config.cjs +18 -1
  24. package/dist/config.cjs.map +1 -0
  25. package/dist/config.d.cts +2 -1
  26. package/dist/config.d.cts.map +1 -0
  27. package/dist/config.d.mts +2 -1
  28. package/dist/config.d.mts.map +1 -0
  29. package/dist/config.mjs +17 -1
  30. package/dist/config.mjs.map +1 -0
  31. package/dist/contexts/command.cjs +21 -0
  32. package/dist/contexts/command.cjs.map +1 -0
  33. package/dist/contexts/command.d.cts +18 -0
  34. package/dist/contexts/command.d.cts.map +1 -0
  35. package/dist/contexts/command.d.mts +18 -0
  36. package/dist/contexts/command.d.mts.map +1 -0
  37. package/dist/contexts/command.mjs +19 -0
  38. package/dist/contexts/command.mjs.map +1 -0
  39. package/dist/contexts/index.cjs +4 -0
  40. package/dist/contexts/index.d.cts +2 -0
  41. package/dist/contexts/index.d.mts +2 -0
  42. package/dist/contexts/index.mjs +3 -0
  43. package/dist/helpers/docs-helpers.cjs +17 -0
  44. package/dist/helpers/docs-helpers.cjs.map +1 -0
  45. package/dist/helpers/docs-helpers.mjs +16 -0
  46. package/dist/helpers/docs-helpers.mjs.map +1 -0
  47. package/dist/helpers/persistence.cjs +50 -1
  48. package/dist/helpers/persistence.cjs.map +1 -0
  49. package/dist/helpers/persistence.mjs +47 -1
  50. package/dist/helpers/persistence.mjs.map +1 -0
  51. package/dist/helpers/resolve-command.cjs +177 -1
  52. package/dist/helpers/resolve-command.cjs.map +1 -0
  53. package/dist/helpers/resolve-command.mjs +172 -1
  54. package/dist/helpers/resolve-command.mjs.map +1 -0
  55. package/dist/helpers/update-package-json.cjs +36 -1
  56. package/dist/helpers/update-package-json.cjs.map +1 -0
  57. package/dist/helpers/update-package-json.mjs +34 -1
  58. package/dist/helpers/update-package-json.mjs.map +1 -0
  59. package/dist/helpers/utilities.cjs +41 -1
  60. package/dist/helpers/utilities.cjs.map +1 -0
  61. package/dist/helpers/utilities.mjs +39 -1
  62. package/dist/helpers/utilities.mjs.map +1 -0
  63. package/dist/helpers/validations.cjs +97 -0
  64. package/dist/helpers/validations.cjs.map +1 -0
  65. package/dist/helpers/validations.mjs +97 -0
  66. package/dist/helpers/validations.mjs.map +1 -0
  67. package/dist/index.cjs +16 -1
  68. package/dist/index.cjs.map +1 -0
  69. package/dist/index.d.cts +7 -18
  70. package/dist/index.d.mts +6 -18
  71. package/dist/index.mjs +10 -1
  72. package/dist/index.mjs.map +1 -0
  73. package/dist/plugin-utils/context-helpers.cjs +86 -0
  74. package/dist/plugin-utils/context-helpers.cjs.map +1 -0
  75. package/dist/plugin-utils/context-helpers.d.cts +58 -0
  76. package/dist/plugin-utils/context-helpers.d.cts.map +1 -0
  77. package/dist/plugin-utils/context-helpers.d.mts +58 -0
  78. package/dist/plugin-utils/context-helpers.d.mts.map +1 -0
  79. package/dist/plugin-utils/context-helpers.mjs +79 -0
  80. package/dist/plugin-utils/context-helpers.mjs.map +1 -0
  81. package/dist/plugin-utils/get-command-tree.cjs +24 -0
  82. package/dist/plugin-utils/get-command-tree.cjs.map +1 -0
  83. package/dist/plugin-utils/get-command-tree.d.cts +16 -0
  84. package/dist/plugin-utils/get-command-tree.d.cts.map +1 -0
  85. package/dist/plugin-utils/get-command-tree.d.mts +16 -0
  86. package/dist/plugin-utils/get-command-tree.d.mts.map +1 -0
  87. package/dist/plugin-utils/get-command-tree.mjs +24 -0
  88. package/dist/plugin-utils/get-command-tree.mjs.map +1 -0
  89. package/dist/plugin-utils/index.cjs +16 -0
  90. package/dist/plugin-utils/index.d.cts +5 -0
  91. package/dist/plugin-utils/index.d.mts +5 -0
  92. package/dist/plugin-utils/index.mjs +6 -0
  93. package/dist/plugin-utils/reflect.cjs +25 -0
  94. package/dist/plugin-utils/reflect.cjs.map +1 -0
  95. package/dist/plugin-utils/reflect.d.cts +14 -0
  96. package/dist/plugin-utils/reflect.d.cts.map +1 -0
  97. package/dist/plugin-utils/reflect.d.mts +14 -0
  98. package/dist/plugin-utils/reflect.d.mts.map +1 -0
  99. package/dist/plugin-utils/reflect.mjs +24 -0
  100. package/dist/plugin-utils/reflect.mjs.map +1 -0
  101. package/dist/plugin-utils/traverse-command-tree.cjs +33 -0
  102. package/dist/plugin-utils/traverse-command-tree.cjs.map +1 -0
  103. package/dist/plugin-utils/traverse-command-tree.d.cts +23 -0
  104. package/dist/plugin-utils/traverse-command-tree.d.cts.map +1 -0
  105. package/dist/plugin-utils/traverse-command-tree.d.mts +23 -0
  106. package/dist/plugin-utils/traverse-command-tree.d.mts.map +1 -0
  107. package/dist/plugin-utils/traverse-command-tree.mjs +31 -0
  108. package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -0
  109. package/dist/plugin.cjs +267 -0
  110. package/dist/plugin.cjs.map +1 -0
  111. package/dist/plugin.d.cts +13 -0
  112. package/dist/plugin.d.cts.map +1 -0
  113. package/dist/plugin.d.mts +13 -0
  114. package/dist/plugin.d.mts.map +1 -0
  115. package/dist/plugin.mjs +261 -0
  116. package/dist/plugin.mjs.map +1 -0
  117. package/dist/types/command.d.cts +13 -4
  118. package/dist/types/command.d.cts.map +1 -0
  119. package/dist/types/command.d.mts +13 -4
  120. package/dist/types/command.d.mts.map +1 -0
  121. package/dist/types/command.mjs +1 -1
  122. package/dist/types/config.d.cts +71 -23
  123. package/dist/types/config.d.cts.map +1 -0
  124. package/dist/types/config.d.mts +71 -23
  125. package/dist/types/config.d.mts.map +1 -0
  126. package/dist/types/config.mjs +1 -1
  127. package/dist/types/context.d.cts +7 -3
  128. package/dist/types/context.d.cts.map +1 -0
  129. package/dist/types/context.d.mts +7 -3
  130. package/dist/types/context.d.mts.map +1 -0
  131. package/dist/types/context.mjs +1 -1
  132. package/dist/types/index.d.cts +4 -4
  133. package/dist/types/index.d.mts +4 -4
  134. package/dist/types/index.mjs +1 -1
  135. package/dist/types/internal.cjs +0 -0
  136. package/dist/types/internal.d.cts +24 -0
  137. package/dist/types/internal.d.cts.map +1 -0
  138. package/dist/types/internal.d.mts +24 -0
  139. package/dist/types/internal.d.mts.map +1 -0
  140. package/dist/types/internal.mjs +1 -0
  141. package/dist/types/options.d.cts +2 -1
  142. package/dist/types/options.d.cts.map +1 -0
  143. package/dist/types/options.d.mts +2 -1
  144. package/dist/types/options.d.mts.map +1 -0
  145. package/dist/types/options.mjs +1 -1
  146. package/package.json +230 -55
  147. package/dist/helpers/get-default-options.cjs +0 -1
  148. package/dist/helpers/get-default-options.d.cts +0 -15
  149. package/dist/helpers/get-default-options.d.mts +0 -15
  150. package/dist/helpers/get-default-options.mjs +0 -1
  151. package/dist/powerlines.cjs +0 -3
  152. package/dist/powerlines.d.cts +0 -12
  153. package/dist/powerlines.d.mts +0 -12
  154. package/dist/powerlines.mjs +0 -3
@@ -0,0 +1,58 @@
1
+ import { Context, UnresolvedContext } from "../types/context.cjs";
2
+ import "../types/index.cjs";
3
+
4
+ //#region src/plugin-utils/context-helpers.d.ts
5
+
6
+ /**
7
+ * Sorts command argument aliases, placing single-character aliases first, followed by multi-character aliases, and then sorting them alphabetically.
8
+ *
9
+ * @param aliases - An array of argument aliases to sort.
10
+ * @returns A new array of sorted aliases.
11
+ */
12
+ declare function sortArgAliases(aliases: string[]): string[];
13
+ /**
14
+ * Retrieves the application name from the context and configuration.
15
+ *
16
+ * @param context - The build context containing workspace and package information.
17
+ * @returns The application name in kebab-case format.
18
+ * @throws An error if no valid application name is found.
19
+ */
20
+ declare function getAppName(context: UnresolvedContext | Context): string;
21
+ /**
22
+ * Retrieves the application title from the context and configuration.
23
+ *
24
+ * @param context - The build context containing workspace and package information.
25
+ * @returns The application title in title-case format.
26
+ */
27
+ declare function getAppTitle(context: UnresolvedContext | Context): string;
28
+ /**
29
+ * Retrieves the application description from the context and configuration.
30
+ *
31
+ * @param context - The build context containing workspace and package information.
32
+ * @returns The application description.
33
+ */
34
+ declare function getAppDescription(context: UnresolvedContext | Context): string;
35
+ /**
36
+ * Retrieves the primary binary name for the application.
37
+ *
38
+ * @param context - The build context containing workspace and package information.
39
+ * @returns The primary binary name as a string.
40
+ */
41
+ declare function getAppBin(context: Context): string;
42
+ /**
43
+ * Determines if a given command path segment is variable (enclosed in square brackets).
44
+ *
45
+ * @param path - The command path segment to check.
46
+ * @returns True if the path is variable, false otherwise.
47
+ */
48
+ declare function isVariableCommandPath(path: string): boolean;
49
+ /**
50
+ * Extracts the variable name from a command path segment by removing enclosing square brackets.
51
+ *
52
+ * @param path - The command path segment.
53
+ * @returns The variable name without square brackets.
54
+ */
55
+ declare function getVariableCommandPathName(path: string): string;
56
+ //#endregion
57
+ export { getAppBin, getAppDescription, getAppName, getAppTitle, getVariableCommandPathName, isVariableCommandPath, sortArgAliases };
58
+ //# sourceMappingURL=context-helpers.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-helpers.d.cts","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA8BA;AAkBA;AA0BA;AAUgB,iBAtDA,cAAA,CAuDL,OAAA,EAAA,MAAA,EAAoB,CAAA,EAAA,MAAO,EAAA;AAetC;AAYA;AAUA;;;;;iBA1EgB,UAAA,UAAoB,oBAAoB;;;;;;;iBA0BxC,WAAA,UAAqB,oBAAoB;;;;;;;iBAUzC,iBAAA,UACL,oBAAoB;;;;;;;iBAef,SAAA,UAAmB;;;;;;;iBAYnB,qBAAA;;;;;;;iBAUA,0BAAA"}
@@ -0,0 +1,58 @@
1
+ import { Context, UnresolvedContext } from "../types/context.mjs";
2
+ import "../types/index.mjs";
3
+
4
+ //#region src/plugin-utils/context-helpers.d.ts
5
+
6
+ /**
7
+ * Sorts command argument aliases, placing single-character aliases first, followed by multi-character aliases, and then sorting them alphabetically.
8
+ *
9
+ * @param aliases - An array of argument aliases to sort.
10
+ * @returns A new array of sorted aliases.
11
+ */
12
+ declare function sortArgAliases(aliases: string[]): string[];
13
+ /**
14
+ * Retrieves the application name from the context and configuration.
15
+ *
16
+ * @param context - The build context containing workspace and package information.
17
+ * @returns The application name in kebab-case format.
18
+ * @throws An error if no valid application name is found.
19
+ */
20
+ declare function getAppName(context: UnresolvedContext | Context): string;
21
+ /**
22
+ * Retrieves the application title from the context and configuration.
23
+ *
24
+ * @param context - The build context containing workspace and package information.
25
+ * @returns The application title in title-case format.
26
+ */
27
+ declare function getAppTitle(context: UnresolvedContext | Context): string;
28
+ /**
29
+ * Retrieves the application description from the context and configuration.
30
+ *
31
+ * @param context - The build context containing workspace and package information.
32
+ * @returns The application description.
33
+ */
34
+ declare function getAppDescription(context: UnresolvedContext | Context): string;
35
+ /**
36
+ * Retrieves the primary binary name for the application.
37
+ *
38
+ * @param context - The build context containing workspace and package information.
39
+ * @returns The primary binary name as a string.
40
+ */
41
+ declare function getAppBin(context: Context): string;
42
+ /**
43
+ * Determines if a given command path segment is variable (enclosed in square brackets).
44
+ *
45
+ * @param path - The command path segment to check.
46
+ * @returns True if the path is variable, false otherwise.
47
+ */
48
+ declare function isVariableCommandPath(path: string): boolean;
49
+ /**
50
+ * Extracts the variable name from a command path segment by removing enclosing square brackets.
51
+ *
52
+ * @param path - The command path segment.
53
+ * @returns The variable name without square brackets.
54
+ */
55
+ declare function getVariableCommandPathName(path: string): string;
56
+ //#endregion
57
+ export { getAppBin, getAppDescription, getAppName, getAppTitle, getVariableCommandPathName, isVariableCommandPath, sortArgAliases };
58
+ //# sourceMappingURL=context-helpers.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-helpers.d.mts","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA8BA;AAkBA;AA0BA;AAUgB,iBAtDA,cAAA,CAuDL,OAAA,EAAA,MAAA,EAAoB,CAAA,EAAA,MAAO,EAAA;AAetC;AAYA;AAUA;;;;;iBA1EgB,UAAA,UAAoB,oBAAoB;;;;;;;iBA0BxC,WAAA,UAAqB,oBAAoB;;;;;;;iBAUzC,iBAAA,UACL,oBAAoB;;;;;;;iBAef,SAAA,UAAmB;;;;;;;iBAYnB,qBAAA;;;;;;;iBAUA,0BAAA"}
@@ -0,0 +1,79 @@
1
+ import { kebabCase } from "@stryke/string-format/kebab-case";
2
+ import { isSetObject } from "@stryke/type-checks/is-set-object";
3
+ import { isSetString } from "@stryke/type-checks/is-set-string";
4
+ import { titleCase } from "@stryke/string-format/title-case";
5
+
6
+ //#region src/plugin-utils/context-helpers.ts
7
+ /**
8
+ * Sorts command argument aliases, placing single-character aliases first, followed by multi-character aliases, and then sorting them alphabetically.
9
+ *
10
+ * @param aliases - An array of argument aliases to sort.
11
+ * @returns A new array of sorted aliases.
12
+ */
13
+ function sortArgAliases(aliases) {
14
+ if (aliases.length === 0) return [];
15
+ const result = aliases.filter((alias) => alias.length === 1);
16
+ result.push(...aliases.filter((alias) => alias.length > 1));
17
+ return result.sort((a, b) => a.localeCompare(b));
18
+ }
19
+ /**
20
+ * Retrieves the application name from the context and configuration.
21
+ *
22
+ * @param context - The build context containing workspace and package information.
23
+ * @returns The application name in kebab-case format.
24
+ * @throws An error if no valid application name is found.
25
+ */
26
+ function getAppName(context) {
27
+ const result = context.config.name || (isSetString(context.config.bin) || Array.isArray(context.config.bin) && context.config.bin.length > 0 && isSetString(context.config.bin[0]) ? isSetString(context.config.bin) ? context.config.bin : context.config.bin[0] : context.packageJson?.name);
28
+ if (!isSetString(result)) throw new Error("No application name found. Please provide a 'bin' option in the configuration or ensure the package.json has a valid 'name' field.");
29
+ return kebabCase(result);
30
+ }
31
+ /**
32
+ * Retrieves the application title from the context and configuration.
33
+ *
34
+ * @param context - The build context containing workspace and package information.
35
+ * @returns The application title in title-case format.
36
+ */
37
+ function getAppTitle(context) {
38
+ return titleCase(context.config.name || getAppName(context));
39
+ }
40
+ /**
41
+ * Retrieves the application description from the context and configuration.
42
+ *
43
+ * @param context - The build context containing workspace and package information.
44
+ * @returns The application description.
45
+ */
46
+ function getAppDescription(context) {
47
+ return context.config.description || context.packageJson?.description || `The ${getAppTitle(context)} command-line interface application.`;
48
+ }
49
+ /**
50
+ * Retrieves the primary binary name for the application.
51
+ *
52
+ * @param context - The build context containing workspace and package information.
53
+ * @returns The primary binary name as a string.
54
+ */
55
+ function getAppBin(context) {
56
+ return isSetObject(context.config.bin) ? Object.keys(context.config.bin)[0] : kebabCase(getAppName(context));
57
+ }
58
+ /**
59
+ * Determines if a given command path segment is variable (enclosed in square brackets).
60
+ *
61
+ * @param path - The command path segment to check.
62
+ * @returns True if the path is variable, false otherwise.
63
+ */
64
+ function isVariableCommandPath(path) {
65
+ return path.startsWith("[") && path.endsWith("]");
66
+ }
67
+ /**
68
+ * Extracts the variable name from a command path segment by removing enclosing square brackets.
69
+ *
70
+ * @param path - The command path segment.
71
+ * @returns The variable name without square brackets.
72
+ */
73
+ function getVariableCommandPathName(path) {
74
+ return path.replaceAll(/^\[+/g, "").replaceAll(/\]+$/g, "");
75
+ }
76
+
77
+ //#endregion
78
+ export { getAppBin, getAppDescription, getAppName, getAppTitle, getVariableCommandPathName, isVariableCommandPath, sortArgAliases };
79
+ //# sourceMappingURL=context-helpers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-helpers.mjs","names":["kebabCase","titleCase","isSetObject","isSetString","sortArgAliases","aliases","length","result","filter","alias","push","sort","a","b","localeCompare","getAppName","context","config","name","bin","Array","isArray","packageJson","Error","getAppTitle","getAppDescription","description","getAppBin","Object","keys","isVariableCommandPath","path","startsWith","endsWith","getVariableCommandPathName","replaceAll"],"sources":["../../src/plugin-utils/context-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 { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type { Context, UnresolvedContext } from \"../types\";\n\n/**\n * Sorts command argument aliases, placing single-character aliases first, followed by multi-character aliases, and then sorting them alphabetically.\n *\n * @param aliases - An array of argument aliases to sort.\n * @returns A new array of sorted aliases.\n */\nexport function sortArgAliases(aliases: string[]): string[] {\n if (aliases.length === 0) {\n return [];\n }\n\n const result = aliases.filter(alias => alias.length === 1);\n result.push(...aliases.filter(alias => alias.length > 1));\n\n return result.sort((a, b) => a.localeCompare(b));\n}\n\n/**\n * Retrieves the application name from the context and configuration.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The application name in kebab-case format.\n * @throws An error if no valid application name is found.\n */\nexport function getAppName(context: UnresolvedContext | Context): string {\n const result =\n context.config.name ||\n (isSetString(context.config.bin) ||\n (Array.isArray(context.config.bin) &&\n context.config.bin.length > 0 &&\n isSetString(context.config.bin[0]))\n ? isSetString(context.config.bin)\n ? context.config.bin\n : context.config.bin[0]\n : context.packageJson?.name);\n if (!isSetString(result)) {\n throw new Error(\n \"No application name found. Please provide a 'bin' option in the configuration or ensure the package.json has a valid 'name' field.\"\n );\n }\n\n return kebabCase(result);\n}\n\n/**\n * Retrieves the application title from the context and configuration.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The application title in title-case format.\n */\nexport function getAppTitle(context: UnresolvedContext | Context): string {\n return titleCase(context.config.name || getAppName(context));\n}\n\n/**\n * Retrieves the application description from the context and configuration.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The application description.\n */\nexport function getAppDescription(\n context: UnresolvedContext | Context\n): string {\n return (\n context.config.description ||\n context.packageJson?.description ||\n `The ${getAppTitle(context)} command-line interface application.`\n );\n}\n\n/**\n * Retrieves the primary binary name for the application.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The primary binary name as a string.\n */\nexport function getAppBin(context: Context): string {\n return isSetObject(context.config.bin)\n ? Object.keys(context.config.bin)[0]!\n : kebabCase(getAppName(context));\n}\n\n/**\n * Determines if a given command path segment is variable (enclosed in square brackets).\n *\n * @param path - The command path segment to check.\n * @returns True if the path is variable, false otherwise.\n */\nexport function isVariableCommandPath(path: string): boolean {\n return path.startsWith(\"[\") && path.endsWith(\"]\");\n}\n\n/**\n * Extracts the variable name from a command path segment by removing enclosing square brackets.\n *\n * @param path - The command path segment.\n * @returns The variable name without square brackets.\n */\nexport function getVariableCommandPathName(path: string): string {\n return path.replaceAll(/^\\[+/g, \"\").replaceAll(/\\]+$/g, \"\");\n}\n"],"mappings":";;;;;;;;;;;;AA8BA,SAAgBI,eAAeC,SAA6B;AAC1D,KAAIA,QAAQC,WAAW,EACrB,QAAO,EAAE;CAGX,MAAMC,SAASF,QAAQG,QAAOC,UAASA,MAAMH,WAAW,EAAE;AAC1DC,QAAOG,KAAK,GAAGL,QAAQG,QAAOC,UAASA,MAAMH,SAAS,EAAE,CAAC;AAEzD,QAAOC,OAAOI,MAAMC,GAAGC,MAAMD,EAAEE,cAAcD,EAAE,CAAC;;;;;;;;;AAUlD,SAAgBE,WAAWC,SAA8C;CACvE,MAAMT,SACJS,QAAQC,OAAOC,SACdf,YAAYa,QAAQC,OAAOE,IAAI,IAC/BC,MAAMC,QAAQL,QAAQC,OAAOE,IAAI,IAChCH,QAAQC,OAAOE,IAAIb,SAAS,KAC5BH,YAAYa,QAAQC,OAAOE,IAAI,GAAI,GACjChB,YAAYa,QAAQC,OAAOE,IAAI,GAC7BH,QAAQC,OAAOE,MACfH,QAAQC,OAAOE,IAAI,KACrBH,QAAQM,aAAaJ;AAC3B,KAAI,CAACf,YAAYI,OAAO,CACtB,OAAM,IAAIgB,MACR,qIACD;AAGH,QAAOvB,UAAUO,OAAO;;;;;;;;AAS1B,SAAgBiB,YAAYR,SAA8C;AACxE,QAAOf,UAAUe,QAAQC,OAAOC,QAAQH,WAAWC,QAAQ,CAAC;;;;;;;;AAS9D,SAAgBS,kBACdT,SACQ;AACR,QACEA,QAAQC,OAAOS,eACfV,QAAQM,aAAaI,eACrB,OAAOF,YAAYR,QAAQ,CAAA;;;;;;;;AAU/B,SAAgBW,UAAUX,SAA0B;AAClD,QAAOd,YAAYc,QAAQC,OAAOE,IAAI,GAClCS,OAAOC,KAAKb,QAAQC,OAAOE,IAAI,CAAC,KAChCnB,UAAUe,WAAWC,QAAQ,CAAC;;;;;;;;AASpC,SAAgBc,sBAAsBC,MAAuB;AAC3D,QAAOA,KAAKC,WAAW,IAAI,IAAID,KAAKE,SAAS,IAAI;;;;;;;;AASnD,SAAgBC,2BAA2BH,MAAsB;AAC/D,QAAOA,KAAKI,WAAW,SAAS,GAAG,CAACA,WAAW,SAAS,GAAG"}
@@ -0,0 +1,24 @@
1
+ const require_plugin_utils_context_helpers = require('./context-helpers.cjs');
2
+
3
+ //#region src/plugin-utils/get-command-tree.ts
4
+ /**
5
+ * Retrieves a specific command tree based on the provided path.
6
+ *
7
+ * @param context - The build context containing the command definitions.
8
+ * @param path - An array of strings representing the command path.
9
+ * @returns The command tree at the specified path, or null if not found.
10
+ */
11
+ function getCommandTree(context, path = []) {
12
+ if (path.length === 0) return null;
13
+ let currentTree = context.commands[path[0]] ?? null;
14
+ if (path.length > 1) {
15
+ const segments = path.slice(1).filter((segment) => !require_plugin_utils_context_helpers.isVariableCommandPath(segment));
16
+ for (const segment of segments) if (currentTree?.children && Object.prototype.hasOwnProperty.call(currentTree.children, segment)) currentTree = currentTree.children[segment] ?? null;
17
+ else return null;
18
+ }
19
+ return currentTree;
20
+ }
21
+
22
+ //#endregion
23
+ exports.getCommandTree = getCommandTree;
24
+ //# sourceMappingURL=get-command-tree.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-command-tree.cjs","names":["isVariableCommandPath","getCommandTree","context","path","length","currentTree","commands","segments","slice","filter","segment","children","Object","prototype","hasOwnProperty","call"],"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 { isVariableCommandPath } from \"./context-helpers\";\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 => !isVariableCommandPath(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"],"mappings":";;;;;;;;;;AA6BA,SAAgBC,eACdC,SACAC,OAAO,EAAc,EACD;AACpB,KAAIA,KAAKC,WAAW,EAClB,QAAO;CAGT,IAAIC,cAAkCH,QAAQI,SAASH,KAAK,OAAQ;AACpE,KAAIA,KAAKC,SAAS,GAAG;EACnB,MAAMG,WAAWJ,KACdK,MAAM,EAAE,CACRC,QAAOC,YAAW,CAACV,2DAAsBU,QAAQ,CAAC;AACrD,OAAK,MAAMA,WAAWH,SACpB,KACEF,aAAaM,YACbC,OAAOC,UAAUC,eAAeC,KAAKV,YAAYM,UAAUD,QAAQ,CAEnEL,eAAcA,YAAYM,SAASD,YAAY;MAE/C,QAAO;;AAKb,QAAOL"}
@@ -0,0 +1,16 @@
1
+ import { CommandTree } from "../types/command.cjs";
2
+ import { Context } from "../types/context.cjs";
3
+
4
+ //#region src/plugin-utils/get-command-tree.d.ts
5
+
6
+ /**
7
+ * Retrieves a specific command tree based on the provided path.
8
+ *
9
+ * @param context - The build context containing the command definitions.
10
+ * @param path - An array of strings representing the command path.
11
+ * @returns The command tree at the specified path, or null if not found.
12
+ */
13
+ declare function getCommandTree(context: Context, path?: string[]): CommandTree | null;
14
+ //#endregion
15
+ export { getCommandTree };
16
+ //# sourceMappingURL=get-command-tree.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-command-tree.d.cts","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"sourcesContent":[],"mappings":";;;;;;;AA6BA;;;;;iBAAgB,cAAA,UACL,2BAER"}
@@ -0,0 +1,16 @@
1
+ import { CommandTree } from "../types/command.mjs";
2
+ import { Context } from "../types/context.mjs";
3
+
4
+ //#region src/plugin-utils/get-command-tree.d.ts
5
+
6
+ /**
7
+ * Retrieves a specific command tree based on the provided path.
8
+ *
9
+ * @param context - The build context containing the command definitions.
10
+ * @param path - An array of strings representing the command path.
11
+ * @returns The command tree at the specified path, or null if not found.
12
+ */
13
+ declare function getCommandTree(context: Context, path?: string[]): CommandTree | null;
14
+ //#endregion
15
+ export { getCommandTree };
16
+ //# sourceMappingURL=get-command-tree.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-command-tree.d.mts","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"sourcesContent":[],"mappings":";;;;;;;AA6BA;;;;;iBAAgB,cAAA,UACL,2BAER"}
@@ -0,0 +1,24 @@
1
+ import { isVariableCommandPath } from "./context-helpers.mjs";
2
+
3
+ //#region src/plugin-utils/get-command-tree.ts
4
+ /**
5
+ * Retrieves a specific command tree based on the provided path.
6
+ *
7
+ * @param context - The build context containing the command definitions.
8
+ * @param path - An array of strings representing the command path.
9
+ * @returns The command tree at the specified path, or null if not found.
10
+ */
11
+ function getCommandTree(context, path = []) {
12
+ if (path.length === 0) return null;
13
+ let currentTree = context.commands[path[0]] ?? null;
14
+ if (path.length > 1) {
15
+ const segments = path.slice(1).filter((segment) => !isVariableCommandPath(segment));
16
+ for (const segment of segments) if (currentTree?.children && Object.prototype.hasOwnProperty.call(currentTree.children, segment)) currentTree = currentTree.children[segment] ?? null;
17
+ else return null;
18
+ }
19
+ return currentTree;
20
+ }
21
+
22
+ //#endregion
23
+ export { getCommandTree };
24
+ //# sourceMappingURL=get-command-tree.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-command-tree.mjs","names":["isVariableCommandPath","getCommandTree","context","path","length","currentTree","commands","segments","slice","filter","segment","children","Object","prototype","hasOwnProperty","call"],"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 { isVariableCommandPath } from \"./context-helpers\";\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 => !isVariableCommandPath(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"],"mappings":";;;;;;;;;;AA6BA,SAAgBC,eACdC,SACAC,OAAO,EAAc,EACD;AACpB,KAAIA,KAAKC,WAAW,EAClB,QAAO;CAGT,IAAIC,cAAkCH,QAAQI,SAASH,KAAK,OAAQ;AACpE,KAAIA,KAAKC,SAAS,GAAG;EACnB,MAAMG,WAAWJ,KACdK,MAAM,EAAE,CACRC,QAAOC,YAAW,CAACV,sBAAsBU,QAAQ,CAAC;AACrD,OAAK,MAAMA,WAAWH,SACpB,KACEF,aAAaM,YACbC,OAAOC,UAAUC,eAAeC,KAAKV,YAAYM,UAAUD,QAAQ,CAEnEL,eAAcA,YAAYM,SAASD,YAAY;MAE/C,QAAO;;AAKb,QAAOL"}
@@ -0,0 +1,16 @@
1
+ const require_plugin_utils_context_helpers = require('./context-helpers.cjs');
2
+ const require_plugin_utils_reflect = require('./reflect.cjs');
3
+ const require_plugin_utils_get_command_tree = require('./get-command-tree.cjs');
4
+ const require_plugin_utils_traverse_command_tree = require('./traverse-command-tree.cjs');
5
+
6
+ exports.getAppBin = require_plugin_utils_context_helpers.getAppBin;
7
+ exports.getAppDescription = require_plugin_utils_context_helpers.getAppDescription;
8
+ exports.getAppName = require_plugin_utils_context_helpers.getAppName;
9
+ exports.getAppTitle = require_plugin_utils_context_helpers.getAppTitle;
10
+ exports.getCommandTree = require_plugin_utils_get_command_tree.getCommandTree;
11
+ exports.getVariableCommandPathName = require_plugin_utils_context_helpers.getVariableCommandPathName;
12
+ exports.isVariableCommandPath = require_plugin_utils_context_helpers.isVariableCommandPath;
13
+ exports.sortArgAliases = require_plugin_utils_context_helpers.sortArgAliases;
14
+ exports.sortOptions = require_plugin_utils_reflect.sortOptions;
15
+ exports.traverseCommandTree = require_plugin_utils_traverse_command_tree.traverseCommandTree;
16
+ exports.traverseCommands = require_plugin_utils_traverse_command_tree.traverseCommands;
@@ -0,0 +1,5 @@
1
+ import { getAppBin, getAppDescription, getAppName, getAppTitle, getVariableCommandPathName, isVariableCommandPath, sortArgAliases } from "./context-helpers.cjs";
2
+ import { getCommandTree } from "./get-command-tree.cjs";
3
+ import { sortOptions } from "./reflect.cjs";
4
+ import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.cjs";
5
+ export { getAppBin, getAppDescription, getAppName, getAppTitle, getCommandTree, getVariableCommandPathName, isVariableCommandPath, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
@@ -0,0 +1,5 @@
1
+ import { getAppBin, getAppDescription, getAppName, getAppTitle, getVariableCommandPathName, isVariableCommandPath, sortArgAliases } from "./context-helpers.mjs";
2
+ import { getCommandTree } from "./get-command-tree.mjs";
3
+ import { sortOptions } from "./reflect.mjs";
4
+ import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.mjs";
5
+ export { getAppBin, getAppDescription, getAppName, getAppTitle, getCommandTree, getVariableCommandPathName, isVariableCommandPath, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
@@ -0,0 +1,6 @@
1
+ import { getAppBin, getAppDescription, getAppName, getAppTitle, getVariableCommandPathName, isVariableCommandPath, sortArgAliases } from "./context-helpers.mjs";
2
+ import { sortOptions } from "./reflect.mjs";
3
+ import { getCommandTree } from "./get-command-tree.mjs";
4
+ import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.mjs";
5
+
6
+ export { getAppBin, getAppDescription, getAppName, getAppTitle, getCommandTree, getVariableCommandPathName, isVariableCommandPath, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
@@ -0,0 +1,25 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
3
+
4
+ //#region src/plugin-utils/reflect.ts
5
+ /**
6
+ * Sort command options alphabetically by name, placing boolean options with negatives appropriately.
7
+ *
8
+ * @param options - The array of command options to sort.
9
+ * @returns A new array of sorted command options.
10
+ */
11
+ function sortOptions(options) {
12
+ if (!options || options.length === 0) return [];
13
+ return options.filter((arg) => arg.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.boolean || !arg.isNegativeOf).sort((a, b) => a.name.localeCompare(b.name)).reduce((ret, arg) => {
14
+ ret.push(arg);
15
+ if (arg.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean) {
16
+ const negativeArg = options.find((a) => a.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean && a.isNegativeOf === arg.name);
17
+ if (negativeArg) ret.push(negativeArg);
18
+ }
19
+ return ret;
20
+ }, []);
21
+ }
22
+
23
+ //#endregion
24
+ exports.sortOptions = sortOptions;
25
+ //# sourceMappingURL=reflect.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflect.cjs","names":["ReflectionKind","sortOptions","options","length","filter","arg","kind","boolean","isNegativeOf","sort","a","b","name","localeCompare","reduce","ret","push","negativeArg","find"],"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 { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport type { CommandOption } 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(arg => arg.kind !== ReflectionKind.boolean || !arg.isNegativeOf)\n .sort((a, b) => a.name.localeCompare(b.name))\n .reduce((ret, arg) => {\n ret.push(arg);\n\n if (arg.kind === ReflectionKind.boolean) {\n // Add the negative argument if it exists\n const negativeArg = options.find(\n a => a.kind === ReflectionKind.boolean && a.isNegativeOf === arg.name\n );\n if (negativeArg) {\n ret.push(negativeArg);\n }\n }\n\n return ret;\n }, [] as CommandOption[]);\n}\n"],"mappings":";;;;;;;;;;AA2BA,SAAgBC,YAAYC,SAA2C;AACrE,KAAI,CAACA,WAAWA,QAAQC,WAAW,EACjC,QAAO,EAAE;AAGX,QAAOD,QACJE,QAAOC,QAAOA,IAAIC,SAASN,gDAAeO,WAAW,CAACF,IAAIG,aAAa,CACvEC,MAAMC,GAAGC,MAAMD,EAAEE,KAAKC,cAAcF,EAAEC,KAAK,CAAC,CAC5CE,QAAQC,KAAKV,QAAQ;AACpBU,MAAIC,KAAKX,IAAI;AAEb,MAAIA,IAAIC,SAASN,gDAAeO,SAAS;GAEvC,MAAMU,cAAcf,QAAQgB,MAC1BR,MAAKA,EAAEJ,SAASN,gDAAeO,WAAWG,EAAEF,iBAAiBH,IAAIO,KAClE;AACD,OAAIK,YACFF,KAAIC,KAAKC,YAAY;;AAIzB,SAAOF;IACN,EAAqB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { CommandOption } from "../types/command.cjs";
2
+
3
+ //#region src/plugin-utils/reflect.d.ts
4
+
5
+ /**
6
+ * Sort command options alphabetically by name, placing boolean options with negatives appropriately.
7
+ *
8
+ * @param options - The array of command options to sort.
9
+ * @returns A new array of sorted command options.
10
+ */
11
+ declare function sortOptions(options: CommandOption[]): CommandOption[];
12
+ //#endregion
13
+ export { sortOptions };
14
+ //# sourceMappingURL=reflect.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflect.d.cts","names":[],"sources":["../../src/plugin-utils/reflect.ts"],"sourcesContent":[],"mappings":";;;;;;AA2BA;;;;iBAAgB,WAAA,UAAqB,kBAAkB"}
@@ -0,0 +1,14 @@
1
+ import { CommandOption } from "../types/command.mjs";
2
+
3
+ //#region src/plugin-utils/reflect.d.ts
4
+
5
+ /**
6
+ * Sort command options alphabetically by name, placing boolean options with negatives appropriately.
7
+ *
8
+ * @param options - The array of command options to sort.
9
+ * @returns A new array of sorted command options.
10
+ */
11
+ declare function sortOptions(options: CommandOption[]): CommandOption[];
12
+ //#endregion
13
+ export { sortOptions };
14
+ //# sourceMappingURL=reflect.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflect.d.mts","names":[],"sources":["../../src/plugin-utils/reflect.ts"],"sourcesContent":[],"mappings":";;;;;;AA2BA;;;;iBAAgB,WAAA,UAAqB,kBAAkB"}
@@ -0,0 +1,24 @@
1
+ import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
2
+
3
+ //#region src/plugin-utils/reflect.ts
4
+ /**
5
+ * Sort command options alphabetically by name, placing boolean options with negatives appropriately.
6
+ *
7
+ * @param options - The array of command options to sort.
8
+ * @returns A new array of sorted command options.
9
+ */
10
+ function sortOptions(options) {
11
+ if (!options || options.length === 0) return [];
12
+ return options.filter((arg) => arg.kind !== ReflectionKind.boolean || !arg.isNegativeOf).sort((a, b) => a.name.localeCompare(b.name)).reduce((ret, arg) => {
13
+ ret.push(arg);
14
+ if (arg.kind === ReflectionKind.boolean) {
15
+ const negativeArg = options.find((a) => a.kind === ReflectionKind.boolean && a.isNegativeOf === arg.name);
16
+ if (negativeArg) ret.push(negativeArg);
17
+ }
18
+ return ret;
19
+ }, []);
20
+ }
21
+
22
+ //#endregion
23
+ export { sortOptions };
24
+ //# sourceMappingURL=reflect.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflect.mjs","names":["ReflectionKind","sortOptions","options","length","filter","arg","kind","boolean","isNegativeOf","sort","a","b","name","localeCompare","reduce","ret","push","negativeArg","find"],"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 { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport type { CommandOption } 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(arg => arg.kind !== ReflectionKind.boolean || !arg.isNegativeOf)\n .sort((a, b) => a.name.localeCompare(b.name))\n .reduce((ret, arg) => {\n ret.push(arg);\n\n if (arg.kind === ReflectionKind.boolean) {\n // Add the negative argument if it exists\n const negativeArg = options.find(\n a => a.kind === ReflectionKind.boolean && a.isNegativeOf === arg.name\n );\n if (negativeArg) {\n ret.push(negativeArg);\n }\n }\n\n return ret;\n }, [] as CommandOption[]);\n}\n"],"mappings":";;;;;;;;;AA2BA,SAAgBC,YAAYC,SAA2C;AACrE,KAAI,CAACA,WAAWA,QAAQC,WAAW,EACjC,QAAO,EAAE;AAGX,QAAOD,QACJE,QAAOC,QAAOA,IAAIC,SAASN,eAAeO,WAAW,CAACF,IAAIG,aAAa,CACvEC,MAAMC,GAAGC,MAAMD,EAAEE,KAAKC,cAAcF,EAAEC,KAAK,CAAC,CAC5CE,QAAQC,KAAKV,QAAQ;AACpBU,MAAIC,KAAKX,IAAI;AAEb,MAAIA,IAAIC,SAASN,eAAeO,SAAS;GAEvC,MAAMU,cAAcf,QAAQgB,MAC1BR,MAAKA,EAAEJ,SAASN,eAAeO,WAAWG,EAAEF,iBAAiBH,IAAIO,KAClE;AACD,OAAIK,YACFF,KAAIC,KAAKC,YAAY;;AAIzB,SAAOF;IACN,EAAqB,CAAC"}
@@ -0,0 +1,33 @@
1
+
2
+ //#region src/plugin-utils/traverse-command-tree.ts
3
+ /**
4
+ * Traverses a command tree and applies a visitor function to each node.
5
+ *
6
+ * @param commandTree - The command tree to traverse.
7
+ * @param visitor - The visitor function to apply to each node.
8
+ */
9
+ async function traverseCommandTree(commandTree, visitor) {
10
+ if (!commandTree.children) return;
11
+ await Promise.all(Object.values(commandTree.children).map(async (childTree) => {
12
+ await Promise.resolve(visitor(childTree));
13
+ await traverseCommandTree(childTree, visitor);
14
+ }));
15
+ }
16
+ /**
17
+ * Traverses all commands in the context and applies a visitor function to each command tree.
18
+ *
19
+ * @param context - The build context containing the command definitions.
20
+ * @param visitor - The visitor function to apply to each command tree.
21
+ */
22
+ async function traverseCommands(context, visitor) {
23
+ if (!context.commands) return;
24
+ await Promise.all(Object.values(context.commands).map(async (childTree) => {
25
+ await Promise.resolve(visitor(childTree));
26
+ await traverseCommandTree(childTree, visitor);
27
+ }));
28
+ }
29
+
30
+ //#endregion
31
+ exports.traverseCommandTree = traverseCommandTree;
32
+ exports.traverseCommands = traverseCommands;
33
+ //# sourceMappingURL=traverse-command-tree.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traverse-command-tree.cjs","names":["traverseCommandTree","commandTree","visitor","children","Promise","all","Object","values","map","childTree","resolve","traverseCommands","context","commands"],"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":";;;;;;;;AA4BA,eAAsBA,oBACpBC,aACAC,SACe;AACf,KAAI,CAACD,YAAYE,SACf;AAGF,OAAMC,QAAQC,IACZC,OAAOC,OAAON,YAAYE,SAAS,CAACK,IAAI,OAAMC,cAAa;AACzD,QAAML,QAAQM,QAAQR,QAAQO,UAAU,CAAC;AACzC,QAAMT,oBAAoBS,WAAWP,QAAQ;GAEjD,CAAC;;;;;;;;AASH,eAAsBS,iBACpBC,SACAV,SACe;AACf,KAAI,CAACU,QAAQC,SACX;AAGF,OAAMT,QAAQC,IACZC,OAAOC,OAAOK,QAAQC,SAAS,CAACL,IAAI,OAAMC,cAAa;AACrD,QAAML,QAAQM,QAAQR,QAAQO,UAAU,CAAC;AACzC,QAAMT,oBAAoBS,WAAWP,QAAQ;GAEjD,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { CommandTree } from "../types/command.cjs";
2
+ import { Context } from "../types/context.cjs";
3
+ import { MaybePromise } from "@stryke/types/base";
4
+
5
+ //#region src/plugin-utils/traverse-command-tree.d.ts
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
+ declare function traverseCommandTree(commandTree: CommandTree, visitor: (node: CommandTree) => MaybePromise<void>): Promise<void>;
14
+ /**
15
+ * Traverses all commands in the context and applies a visitor function to each command tree.
16
+ *
17
+ * @param context - The build context containing the command definitions.
18
+ * @param visitor - The visitor function to apply to each command tree.
19
+ */
20
+ declare function traverseCommands<TContext extends Context>(context: TContext, visitor: (node: CommandTree) => MaybePromise<void>): Promise<void>;
21
+ //#endregion
22
+ export { traverseCommandTree, traverseCommands };
23
+ //# sourceMappingURL=traverse-command-tree.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traverse-command-tree.d.cts","names":[],"sources":["../../src/plugin-utils/traverse-command-tree.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA4BA;;;;AAGG,iBAHmB,mBAAA,CAGnB,WAAA,EAFY,WAEZ,EAAA,OAAA,EAAA,CAAA,IAAA,EADe,WACf,EAAA,GAD+B,YAC/B,CAAA,IAAA,CAAA,CAAA,EAAA,OAAA,CAAA,IAAA,CAAA;;AAmBH;;;;;AAGG,iBAHmB,gBAGnB,CAAA,iBAHqD,OAGrD,CAAA,CAAA,OAAA,EAFQ,QAER,EAAA,OAAA,EAAA,CAAA,IAAA,EADe,WACf,EAAA,GAD+B,YAC/B,CAAA,IAAA,CAAA,CAAA,EAAA,OAAA,CAAA,IAAA,CAAA"}
@@ -0,0 +1,23 @@
1
+ import { CommandTree } from "../types/command.mjs";
2
+ import { Context } from "../types/context.mjs";
3
+ import { MaybePromise } from "@stryke/types/base";
4
+
5
+ //#region src/plugin-utils/traverse-command-tree.d.ts
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
+ declare function traverseCommandTree(commandTree: CommandTree, visitor: (node: CommandTree) => MaybePromise<void>): Promise<void>;
14
+ /**
15
+ * Traverses all commands in the context and applies a visitor function to each command tree.
16
+ *
17
+ * @param context - The build context containing the command definitions.
18
+ * @param visitor - The visitor function to apply to each command tree.
19
+ */
20
+ declare function traverseCommands<TContext extends Context>(context: TContext, visitor: (node: CommandTree) => MaybePromise<void>): Promise<void>;
21
+ //#endregion
22
+ export { traverseCommandTree, traverseCommands };
23
+ //# sourceMappingURL=traverse-command-tree.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traverse-command-tree.d.mts","names":[],"sources":["../../src/plugin-utils/traverse-command-tree.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA4BA;;;;AAGG,iBAHmB,mBAAA,CAGnB,WAAA,EAFY,WAEZ,EAAA,OAAA,EAAA,CAAA,IAAA,EADe,WACf,EAAA,GAD+B,YAC/B,CAAA,IAAA,CAAA,CAAA,EAAA,OAAA,CAAA,IAAA,CAAA;;AAmBH;;;;;AAGG,iBAHmB,gBAGnB,CAAA,iBAHqD,OAGrD,CAAA,CAAA,OAAA,EAFQ,QAER,EAAA,OAAA,EAAA,CAAA,IAAA,EADe,WACf,EAAA,GAD+B,YAC/B,CAAA,IAAA,CAAA,CAAA,EAAA,OAAA,CAAA,IAAA,CAAA"}
@@ -0,0 +1,31 @@
1
+ //#region src/plugin-utils/traverse-command-tree.ts
2
+ /**
3
+ * Traverses a command tree and applies a visitor function to each node.
4
+ *
5
+ * @param commandTree - The command tree to traverse.
6
+ * @param visitor - The visitor function to apply to each node.
7
+ */
8
+ async function traverseCommandTree(commandTree, visitor) {
9
+ if (!commandTree.children) return;
10
+ await Promise.all(Object.values(commandTree.children).map(async (childTree) => {
11
+ await Promise.resolve(visitor(childTree));
12
+ await traverseCommandTree(childTree, visitor);
13
+ }));
14
+ }
15
+ /**
16
+ * Traverses all commands in the context and applies a visitor function to each command tree.
17
+ *
18
+ * @param context - The build context containing the command definitions.
19
+ * @param visitor - The visitor function to apply to each command tree.
20
+ */
21
+ async function traverseCommands(context, visitor) {
22
+ if (!context.commands) return;
23
+ await Promise.all(Object.values(context.commands).map(async (childTree) => {
24
+ await Promise.resolve(visitor(childTree));
25
+ await traverseCommandTree(childTree, visitor);
26
+ }));
27
+ }
28
+
29
+ //#endregion
30
+ export { traverseCommandTree, traverseCommands };
31
+ //# sourceMappingURL=traverse-command-tree.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traverse-command-tree.mjs","names":["traverseCommandTree","commandTree","visitor","children","Promise","all","Object","values","map","childTree","resolve","traverseCommands","context","commands"],"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":";;;;;;;AA4BA,eAAsBA,oBACpBC,aACAC,SACe;AACf,KAAI,CAACD,YAAYE,SACf;AAGF,OAAMC,QAAQC,IACZC,OAAOC,OAAON,YAAYE,SAAS,CAACK,IAAI,OAAMC,cAAa;AACzD,QAAML,QAAQM,QAAQR,QAAQO,UAAU,CAAC;AACzC,QAAMT,oBAAoBS,WAAWP,QAAQ;GAEjD,CAAC;;;;;;;;AASH,eAAsBS,iBACpBC,SACAV,SACe;AACf,KAAI,CAACU,QAAQC,SACX;AAGF,OAAMT,QAAQC,IACZC,OAAOC,OAAOK,QAAQC,SAAS,CAACL,IAAI,OAAMC,cAAa;AACrD,QAAML,QAAQM,QAAQR,QAAQO,UAAU,CAAC;AACzC,QAAMT,oBAAoBS,WAAWP,QAAQ;GAEjD,CAAC"}