@shell-shock/core 0.17.7 → 0.17.8

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 (145) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +1 -29
  2. package/dist/api.cjs +1 -95
  3. package/dist/api.d.cts +52 -4
  4. package/dist/api.d.cts.map +1 -1
  5. package/dist/api.d.mts +52 -4
  6. package/dist/api.d.mts.map +1 -1
  7. package/dist/api.mjs +1 -92
  8. package/dist/api.mjs.map +1 -1
  9. package/dist/components/command-validation-logic.cjs +1 -292
  10. package/dist/components/command-validation-logic.mjs +1 -289
  11. package/dist/components/command-validation-logic.mjs.map +1 -1
  12. package/dist/components/docs.cjs +1 -265
  13. package/dist/components/docs.d.cts.map +1 -1
  14. package/dist/components/docs.d.mts.map +1 -1
  15. package/dist/components/docs.mjs +1 -256
  16. package/dist/components/docs.mjs.map +1 -1
  17. package/dist/components/exec-builtin.cjs +13 -429
  18. package/dist/components/exec-builtin.mjs +13 -425
  19. package/dist/components/exec-builtin.mjs.map +1 -1
  20. package/dist/components/helpers.cjs +1 -120
  21. package/dist/components/helpers.mjs +1 -112
  22. package/dist/components/helpers.mjs.map +1 -1
  23. package/dist/components/index.cjs +1 -58
  24. package/dist/components/index.mjs +1 -10
  25. package/dist/components/options-parser-logic.cjs +5 -960
  26. package/dist/components/options-parser-logic.d.cts +1 -1
  27. package/dist/components/options-parser-logic.mjs +5 -945
  28. package/dist/components/options-parser-logic.mjs.map +1 -1
  29. package/dist/components/state-builtin.cjs +8 -629
  30. package/dist/components/state-builtin.d.cts.map +1 -1
  31. package/dist/components/state-builtin.d.mts.map +1 -1
  32. package/dist/components/state-builtin.mjs +8 -622
  33. package/dist/components/state-builtin.mjs.map +1 -1
  34. package/dist/components/usage.cjs +1 -117
  35. package/dist/components/usage.mjs +1 -114
  36. package/dist/components/usage.mjs.map +1 -1
  37. package/dist/components/utils-builtin.cjs +33 -838
  38. package/dist/components/utils-builtin.d.cts.map +1 -1
  39. package/dist/components/utils-builtin.d.mts.map +1 -1
  40. package/dist/components/utils-builtin.mjs +33 -828
  41. package/dist/components/utils-builtin.mjs.map +1 -1
  42. package/dist/config.cjs +1 -31
  43. package/dist/config.mjs +1 -29
  44. package/dist/config.mjs.map +1 -1
  45. package/dist/contexts/command.cjs +1 -26
  46. package/dist/contexts/command.mjs +1 -23
  47. package/dist/contexts/command.mjs.map +1 -1
  48. package/dist/contexts/index.cjs +1 -9
  49. package/dist/contexts/index.mjs +1 -4
  50. package/dist/contexts/options.cjs +1 -63
  51. package/dist/contexts/options.mjs +1 -58
  52. package/dist/contexts/options.mjs.map +1 -1
  53. package/dist/helpers/automd.cjs +1 -71
  54. package/dist/helpers/automd.mjs +1 -70
  55. package/dist/helpers/automd.mjs.map +1 -1
  56. package/dist/helpers/docs-helpers.cjs +1 -23
  57. package/dist/helpers/docs-helpers.mjs +1 -22
  58. package/dist/helpers/docs-helpers.mjs.map +1 -1
  59. package/dist/helpers/paths.cjs +1 -137
  60. package/dist/helpers/paths.mjs +1 -133
  61. package/dist/helpers/paths.mjs.map +1 -1
  62. package/dist/helpers/persistence.cjs +1 -113
  63. package/dist/helpers/persistence.mjs +1 -110
  64. package/dist/helpers/persistence.mjs.map +1 -1
  65. package/dist/helpers/update-package-json.cjs +1 -59
  66. package/dist/helpers/update-package-json.mjs +1 -57
  67. package/dist/helpers/update-package-json.mjs.map +1 -1
  68. package/dist/helpers/utilities.cjs +1 -95
  69. package/dist/helpers/utilities.mjs +1 -93
  70. package/dist/helpers/utilities.mjs.map +1 -1
  71. package/dist/helpers/validations.cjs +1 -71
  72. package/dist/helpers/validations.mjs +1 -71
  73. package/dist/helpers/validations.mjs.map +1 -1
  74. package/dist/index.cjs +1 -52
  75. package/dist/index.d.cts +1 -1
  76. package/dist/index.d.mts +1 -1
  77. package/dist/index.mjs +1 -7
  78. package/dist/plugin-utils/compute-bin.cjs +1 -50
  79. package/dist/plugin-utils/compute-bin.mjs +1 -49
  80. package/dist/plugin-utils/compute-bin.mjs.map +1 -1
  81. package/dist/plugin-utils/context-helpers.cjs +1 -231
  82. package/dist/plugin-utils/context-helpers.mjs +1 -221
  83. package/dist/plugin-utils/context-helpers.mjs.map +1 -1
  84. package/dist/plugin-utils/deepkit.cjs +1 -71
  85. package/dist/plugin-utils/deepkit.mjs +1 -69
  86. package/dist/plugin-utils/deepkit.mjs.map +1 -1
  87. package/dist/plugin-utils/description-helpers.cjs +2 -111
  88. package/dist/plugin-utils/description-helpers.mjs +2 -107
  89. package/dist/plugin-utils/description-helpers.mjs.map +1 -1
  90. package/dist/plugin-utils/get-command-tree.cjs +1 -117
  91. package/dist/plugin-utils/get-command-tree.mjs +1 -114
  92. package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
  93. package/dist/plugin-utils/index.cjs +1 -39
  94. package/dist/plugin-utils/index.mjs +1 -10
  95. package/dist/plugin-utils/reflect.cjs +1 -52
  96. package/dist/plugin-utils/reflect.mjs +1 -52
  97. package/dist/plugin-utils/reflect.mjs.map +1 -1
  98. package/dist/plugin-utils/traverse-command-tree.cjs +1 -64
  99. package/dist/plugin-utils/traverse-command-tree.mjs +1 -62
  100. package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
  101. package/dist/plugin-utils/type-checks.cjs +1 -93
  102. package/dist/plugin-utils/type-checks.mjs +1 -88
  103. package/dist/plugin-utils/type-checks.mjs.map +1 -1
  104. package/dist/plugin.cjs +4 -429
  105. package/dist/plugin.d.cts.map +1 -1
  106. package/dist/plugin.d.mts.map +1 -1
  107. package/dist/plugin.mjs +4 -423
  108. package/dist/plugin.mjs.map +1 -1
  109. package/dist/resolver/deepkit.cjs +1 -135
  110. package/dist/resolver/deepkit.mjs +1 -134
  111. package/dist/resolver/deepkit.mjs.map +1 -1
  112. package/dist/resolver/helpers.cjs +1 -173
  113. package/dist/resolver/helpers.mjs +1 -168
  114. package/dist/resolver/helpers.mjs.map +1 -1
  115. package/dist/resolver/module.cjs +1 -145
  116. package/dist/resolver/module.mjs +1 -144
  117. package/dist/resolver/module.mjs.map +1 -1
  118. package/dist/resolver/resolve.cjs +1 -222
  119. package/dist/resolver/resolve.mjs +1 -221
  120. package/dist/resolver/resolve.mjs.map +1 -1
  121. package/dist/types/command.cjs +1 -441
  122. package/dist/types/command.mjs +1 -405
  123. package/dist/types/command.mjs.map +1 -1
  124. package/dist/types/config.cjs +1 -144
  125. package/dist/types/config.d.cts +3 -2
  126. package/dist/types/config.d.cts.map +1 -1
  127. package/dist/types/config.d.mts +3 -2
  128. package/dist/types/config.d.mts.map +1 -1
  129. package/dist/types/config.mjs +1 -138
  130. package/dist/types/config.mjs.map +1 -1
  131. package/dist/types/context.cjs +1 -37
  132. package/dist/types/context.d.cts +3 -2
  133. package/dist/types/context.d.cts.map +1 -1
  134. package/dist/types/context.d.mts +3 -2
  135. package/dist/types/context.d.mts.map +1 -1
  136. package/dist/types/context.mjs +1 -34
  137. package/dist/types/context.mjs.map +1 -1
  138. package/dist/types/env.cjs +1 -52
  139. package/dist/types/env.mjs +1 -50
  140. package/dist/types/env.mjs.map +1 -1
  141. package/dist/types/index.cjs +1 -49
  142. package/dist/types/index.mjs +1 -6
  143. package/dist/types/options.cjs +1 -12
  144. package/dist/types/options.mjs +1 -10
  145. package/package.json +23 -23
@@ -1,39 +1 @@
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
+ 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,10 +1 @@
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
+ 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,52 +1 @@
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.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.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
+ 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,53 +1,2 @@
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.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.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 };
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};
53
2
  //# 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 => arg.kind !== CommandParameterKinds.boolean || !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.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;;AAE5B,QAAO;;;;;;;;AASX,SAAgB,YAAW,SAAQ;AAClC,KAAO,CAAC,WAAW,QAAO,WAAQ;gBAI1B,OAAO,cAAa,QAAO,IAAI,SAAS,sBAAqB,WAAA,CAAA,IAAA,cAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA;;;;;KAE/D,OAAO,cAAgB,KAAK,QAAI;AAC/B,MAAC,KAAA,IAAA;;GAGD,MAAQ,cAAQ,QAAe,KAAG,cAAc,MAAO,EAAC,SAAQ,sBAAe,WACtF,EAAA,iBAAA,IAAA,MAAA;IAAA;IAAA;IAAA;IAAA,CAAA,CAAA;AACS,OAAA,YACI,KAAI,KAAM,YAAU;;AAG3B,SAAQ;IACX;EAAA;EAAS;EAAA;EAAA;EAAA,CAAA,EAAA,EAAA,CAAA"}
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,64 +1 @@
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
+ 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,63 +1,2 @@
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 };
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};
63
2
  //# 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,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;AAQX,eAAsB,oBAAoB,aAAU,SAAS;AAC5D,KAAA,CAAA,YAAoB,SACb;AAEP,OAAK,QAAQ,IAAA,OAAa,OAAS,YAAA,SAAA,CAAA,IAAA,aAAA,OAAA,cAAA;;AAE5B,QAAM,oBAAoB,WAAW,QAAQ;;;;;;;AAGrD,oBAAc,SAAc;CAAA;CAAe;CAAQ;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOnD,eAAoB,iBAAY,SAAY,SAAa;AACvD,KAAA,CAAA,QAAA,SACK;AAEL,OAAQ,QAAQ,IAAA,OAAW,OAAK,QAAA,SAAiB,CAAA,IAAA,aAAA,OAAA,cAAA;AAChD,QAAQ,QAAM,QAAA,QAAA,UAAA,CAAA;AACV,QAAA,oBAAsB,WAAA,QAAA;IACzB;EAAA;EAAM;EAAA;EAAA,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,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,93 +1 @@
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;
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,89 +1,2 @@
1
- import { CommandParameterKinds } from "../types/command.mjs";
2
- import { isSetString } from "@stryke/type-checks/is-set-string";
3
- import { isSetObject } from "@stryke/type-checks/is-set-object";
4
- import { isBoolean } from "@stryke/type-checks/is-boolean";
5
-
6
- //#region src/plugin-utils/type-checks.ts
7
- /**
8
- * Type guard to check if a value is a valid {@link CommandParameterKind} type.
9
- *
10
- * @param obj - The value to check.
11
- * @returns True if the value is a valid {@link CommandParameterKind} type, false otherwise.
12
- */
13
- function isCommandParameterKind(obj) {
14
- return isSetString(obj) && [
15
- CommandParameterKinds.string,
16
- CommandParameterKinds.number,
17
- CommandParameterKinds.boolean
18
- ].includes(obj);
19
- }
20
- isCommandParameterKind.__type = [
21
- "obj",
22
- "isCommandParameterKind",
23
- "Type guard to check if a value is a valid {@link CommandParameterKind} type.",
24
- "P\"2!!/\"?#"
25
- ];
26
- /**
27
- * Type guard to check if a value is a valid {@link CommandParameterConfig} type.
28
- *
29
- * @param obj - The value to check.
30
- * @returns True if the value is a valid {@link CommandParameterConfig} type, false otherwise.
31
- */
32
- function isCommandParameterConfig(obj) {
33
- return isSetObject(obj) && "kind" in obj && isCommandParameterKind(obj.kind);
34
- }
35
- isCommandParameterConfig.__type = [
36
- "obj",
37
- "isCommandParameterConfig",
38
- "Type guard to check if a value is a valid {@link CommandParameterConfig} type.",
39
- "P\"2!!/\"?#"
40
- ];
41
- /**
42
- * Type guard to check if a value is a valid {@link CommandParameter} type.
43
- *
44
- * @param obj - The value to check.
45
- * @returns True if the value is a valid {@link CommandParameter} type, false otherwise.
46
- */
47
- function isCommandParameter(obj) {
48
- return isCommandParameterConfig(obj) && "name" in obj && isSetString(obj.name) && "title" in obj && isSetString(obj.title) && "description" in obj && isSetString(obj.description) && "alias" in obj && Array.isArray(obj.alias) && "env" in obj && (isSetString(obj.env) || obj.env === false) && "optional" in obj && isBoolean(obj.optional) && "variadic" in obj && isBoolean(obj.variadic);
49
- }
50
- isCommandParameter.__type = [
51
- "obj",
52
- "isCommandParameter",
53
- "Type guard to check if a value is a valid {@link CommandParameter} type.",
54
- "P\"2!!/\"?#"
55
- ];
56
- /**
57
- * Type guard to check if a value is a valid {@link CommandOption} type.
58
- *
59
- * @param obj - The value to check.
60
- * @returns True if the value is a valid {@link CommandOption} type, false otherwise.
61
- */
62
- function isCommandOption(obj) {
63
- return isCommandParameterConfig(obj) && isCommandParameter(obj) && "default" in obj;
64
- }
65
- isCommandOption.__type = [
66
- "obj",
67
- "isCommandOption",
68
- "Type guard to check if a value is a valid {@link CommandOption} type.",
69
- "P\"2!!/\"?#"
70
- ];
71
- /**
72
- * Type guard to check if a value is a valid {@link CommandArgument} type.
73
- *
74
- * @param obj - The value to check.
75
- * @returns True if the value is a valid {@link CommandArgument} type, false otherwise.
76
- */
77
- function isCommandArgument(obj) {
78
- return isCommandParameterConfig(obj) && isCommandParameter(obj);
79
- }
80
- isCommandArgument.__type = [
81
- "obj",
82
- "isCommandArgument",
83
- "Type guard to check if a value is a valid {@link CommandArgument} type.",
84
- "P\"2!!/\"?#"
85
- ];
86
-
87
- //#endregion
88
- export { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind };
1
+ import{CommandParameterKinds as e}from"../types/command.mjs";import{isSetString as t}from"@stryke/type-checks/is-set-string";import{isSetObject as n}from"@stryke/type-checks/is-set-object";import{isBoolean as r}from"@stryke/type-checks/is-boolean";function i(n){return t(n)&&[e.string,e.number,e.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 n(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&&t(e.name)&&`title`in e&&t(e.title)&&`description`in e&&t(e.description)&&`alias`in e&&Array.isArray(e.alias)&&`env`in e&&(t(e.env)||e.env===!1)&&`optional`in e&&r(e.optional)&&`variadic`in e&&r(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!!/"?#`];export{c as isCommandArgument,s as isCommandOption,o as isCommandParameter,a as isCommandParameterConfig,i as isCommandParameterKind};
89
2
  //# sourceMappingURL=type-checks.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-checks.mjs","names":[],"sources":["../../src/plugin-utils/type-checks.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 { isBoolean } from \"@stryke/type-checks/is-boolean\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandParameter,\n CommandParameterConfig,\n CommandParameterKind\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameterKind} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameterKind} type, false otherwise.\n */\nexport function isCommandParameterKind(obj: any): obj is CommandParameterKind {\n return (\n isSetString(obj) &&\n [\n CommandParameterKinds.string,\n CommandParameterKinds.number,\n CommandParameterKinds.boolean\n ].includes(obj as CommandParameterKind)\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameterConfig} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameterConfig} type, false otherwise.\n */\nexport function isCommandParameterConfig(\n obj: any\n): obj is CommandParameterConfig {\n return isSetObject(obj) && \"kind\" in obj && isCommandParameterKind(obj.kind);\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameter} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameter} type, false otherwise.\n */\nexport function isCommandParameter(obj: any): obj is CommandParameter {\n return (\n isCommandParameterConfig(obj) &&\n \"name\" in obj &&\n isSetString(obj.name) &&\n \"title\" in obj &&\n isSetString(obj.title) &&\n \"description\" in obj &&\n isSetString(obj.description) &&\n \"alias\" in obj &&\n Array.isArray(obj.alias) &&\n \"env\" in obj &&\n (isSetString(obj.env) || obj.env === false) &&\n \"optional\" in obj &&\n isBoolean(obj.optional) &&\n \"variadic\" in obj &&\n isBoolean(obj.variadic)\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandOption} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandOption} type, false otherwise.\n */\nexport function isCommandOption(obj: any): obj is CommandOption {\n return (\n isCommandParameterConfig(obj) && isCommandParameter(obj) && \"default\" in obj\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandArgument} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandArgument} type, false otherwise.\n */\nexport function isCommandArgument(obj: any): obj is CommandArgument {\n return isCommandParameterConfig(obj) && isCommandParameter(obj);\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,SAAgB,uBAAS,KAAA;AACzB,QAAS,YAAA,IAAA;EAEP,sBAAA;EACM,sBAA0B;EACjC,sBAAA;EACQ,CAAC,SAAS,IAAC;;AAEpB,uBAAE,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOF,SAAM,yBAAsB,KAAA;AACxB,QAAE,YAAgB,IAAA,IAAA,UAAA,OAAoB,uBAAA,IAAA,KAAA;;AAE1C,yBAAA,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOA,SAAE,mBAAA,KAAA;AACF,QAAO,yBAAS,IAAwB,IACjC,UAAA,OACA,YAAG,IAAA,KAAA,IACF,WAAC,OACT,YAAA,IAAA,MAAA,4BAEE,YAAA,IAAA,YAAA,IACM,WAAS,OAChB,MAAA,QAAA,IAAA,MAAA,IACG,SAAY,QACZ,YAAgB,IAAI,IAAK,IAAI,IAAE,QAAQ,UACzC,cAAA,OACK,UAAS,IAAA,SAAA,IACR,cAAC,OACL,UAAA,IAAA,SAAyB;;AAE7B,mBAAmB,SAAQ;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAO3B,SAAgB,gBAAE,KAAA;AACd,QAAC,yBAAgC,IAAI,IAAA,mBAAQ,IAAA,IAAA,aAAA;;AAEjD,gBAAc,SAAI;CAAQ;CAAG;CAAA;CAAA;CAAA;;;;;;;AAO7B,SAAgB,kBAAkB,KAAK;AACtC,QAAA,yBAAA,IAAA,IAAA,mBAAA,IAAA;;AAED,kBAAiB,SAAO;CAAA;CAAW;CAAa;CAAoC;CAAA"}
1
+ {"version":3,"file":"type-checks.mjs","names":[],"sources":["../../src/plugin-utils/type-checks.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 { isBoolean } from \"@stryke/type-checks/is-boolean\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandParameter,\n CommandParameterConfig,\n CommandParameterKind\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameterKind} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameterKind} type, false otherwise.\n */\nexport function isCommandParameterKind(obj: any): obj is CommandParameterKind {\n return (\n isSetString(obj) &&\n [\n CommandParameterKinds.string,\n CommandParameterKinds.number,\n CommandParameterKinds.boolean\n ].includes(obj as CommandParameterKind)\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameterConfig} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameterConfig} type, false otherwise.\n */\nexport function isCommandParameterConfig(\n obj: any\n): obj is CommandParameterConfig {\n return isSetObject(obj) && \"kind\" in obj && isCommandParameterKind(obj.kind);\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameter} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameter} type, false otherwise.\n */\nexport function isCommandParameter(obj: any): obj is CommandParameter {\n return (\n isCommandParameterConfig(obj) &&\n \"name\" in obj &&\n isSetString(obj.name) &&\n \"title\" in obj &&\n isSetString(obj.title) &&\n \"description\" in obj &&\n isSetString(obj.description) &&\n \"alias\" in obj &&\n Array.isArray(obj.alias) &&\n \"env\" in obj &&\n (isSetString(obj.env) || obj.env === false) &&\n \"optional\" in obj &&\n isBoolean(obj.optional) &&\n \"variadic\" in obj &&\n isBoolean(obj.variadic)\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandOption} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandOption} type, false otherwise.\n */\nexport function isCommandOption(obj: any): obj is CommandOption {\n return (\n isCommandParameterConfig(obj) && isCommandParameter(obj) && \"default\" in obj\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandArgument} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandArgument} type, false otherwise.\n */\nexport function isCommandArgument(obj: any): obj is CommandArgument {\n return isCommandParameterConfig(obj) && isCommandParameter(obj);\n}\n"],"mappings":"wPA2BA,SAAgB,EAAS,EAAA,CACzB,OAAS,EAAA,EAAA,EAAA,CAAqB,EAAkB,OAAQ,EAAA,OAAA,EAAA,QAAA,CAAA,SAAA,EAAA,CAExD,EAAE,OAAA,CAAA,MAAA,yBAAA,+EAAA,YAAA,CAOF,SAAS,EAAA,EAAA,CACP,OAAE,EAAiB,EAAC,EAAA,SAAA,GAAA,EAAA,EAAA,KAAA,CAEtB,EAAM,OAA4B,CAAA,MAAA,2BAAA,iFAAA,YAAA,CAOlC,SAAE,EAAA,EAAA,CACA,OAAM,EAA0B,EAAI,EAAC,SAAa,GAAA,EAAA,EAAuB,KAAK,EAAA,UAAA,GAAA,EAAA,EAAA,MAAA,EAAA,gBAAA,GAAA,EAAA,EAAA,YAAA,EAAA,UAAA,GAAA,MAAA,QAAA,EAAA,MAAA,EAAA,QAAA,IAAA,EAAA,EAAA,IAAA,EAAA,EAAA,MAAA,KAAA,aAAA,GAAA,EAAA,EAAA,SAAA,EAAA,aAAA,GAAA,EAAA,EAAA,SAAA,CAEhF,EAAmB,OAAS,CAAC,MAAK,qBAAA,2EAAA,YAAA,CAOlC,SAAA,EAAA,EAAA,kCAGA,EAAgB,OAAS,CAAC,MAAO,kBAAmB,wEAAsB,YAAA,CAO1E,SAAI,EAA8B,EAAC,CACjC,OAAO,EAAU,EAAA,EAAA,EAAA,EAAA,CAEnB,EAAkB,OAAE,CAAA,MAAA,oBAAA,0EAAA,YAAA"}