@shell-shock/core 0.17.8 → 0.17.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +29 -1
  2. package/dist/api.cjs +148 -1
  3. package/dist/api.d.cts +6 -6
  4. package/dist/api.d.cts.map +1 -1
  5. package/dist/api.d.mts +6 -6
  6. package/dist/api.d.mts.map +1 -1
  7. package/dist/api.mjs +145 -1
  8. package/dist/api.mjs.map +1 -1
  9. package/dist/components/command-validation-logic.cjs +292 -1
  10. package/dist/components/command-validation-logic.mjs +289 -1
  11. package/dist/components/command-validation-logic.mjs.map +1 -1
  12. package/dist/components/docs.cjs +265 -1
  13. package/dist/components/docs.mjs +256 -1
  14. package/dist/components/docs.mjs.map +1 -1
  15. package/dist/components/exec-builtin.cjs +429 -13
  16. package/dist/components/exec-builtin.mjs +425 -13
  17. package/dist/components/exec-builtin.mjs.map +1 -1
  18. package/dist/components/helpers.cjs +120 -1
  19. package/dist/components/helpers.mjs +112 -1
  20. package/dist/components/helpers.mjs.map +1 -1
  21. package/dist/components/index.cjs +58 -1
  22. package/dist/components/index.mjs +10 -1
  23. package/dist/components/options-parser-logic.cjs +960 -5
  24. package/dist/components/options-parser-logic.d.cts +1 -1
  25. package/dist/components/options-parser-logic.mjs +945 -5
  26. package/dist/components/options-parser-logic.mjs.map +1 -1
  27. package/dist/components/state-builtin.cjs +629 -8
  28. package/dist/components/state-builtin.mjs +622 -8
  29. package/dist/components/state-builtin.mjs.map +1 -1
  30. package/dist/components/usage.cjs +117 -1
  31. package/dist/components/usage.mjs +114 -1
  32. package/dist/components/usage.mjs.map +1 -1
  33. package/dist/components/utils-builtin.cjs +838 -33
  34. package/dist/components/utils-builtin.mjs +828 -33
  35. package/dist/components/utils-builtin.mjs.map +1 -1
  36. package/dist/config.cjs +31 -1
  37. package/dist/config.mjs +29 -1
  38. package/dist/config.mjs.map +1 -1
  39. package/dist/contexts/command.cjs +26 -1
  40. package/dist/contexts/command.mjs +23 -1
  41. package/dist/contexts/command.mjs.map +1 -1
  42. package/dist/contexts/index.cjs +9 -1
  43. package/dist/contexts/index.mjs +4 -1
  44. package/dist/contexts/options.cjs +63 -1
  45. package/dist/contexts/options.mjs +58 -1
  46. package/dist/contexts/options.mjs.map +1 -1
  47. package/dist/helpers/automd.cjs +71 -1
  48. package/dist/helpers/automd.mjs +70 -1
  49. package/dist/helpers/automd.mjs.map +1 -1
  50. package/dist/helpers/docs-helpers.cjs +23 -1
  51. package/dist/helpers/docs-helpers.mjs +22 -1
  52. package/dist/helpers/docs-helpers.mjs.map +1 -1
  53. package/dist/helpers/paths.cjs +137 -1
  54. package/dist/helpers/paths.mjs +133 -1
  55. package/dist/helpers/paths.mjs.map +1 -1
  56. package/dist/helpers/persistence.cjs +115 -1
  57. package/dist/helpers/persistence.mjs +112 -1
  58. package/dist/helpers/persistence.mjs.map +1 -1
  59. package/dist/helpers/update-package-json.cjs +65 -1
  60. package/dist/helpers/update-package-json.mjs +63 -1
  61. package/dist/helpers/update-package-json.mjs.map +1 -1
  62. package/dist/helpers/utilities.cjs +95 -1
  63. package/dist/helpers/utilities.mjs +93 -1
  64. package/dist/helpers/utilities.mjs.map +1 -1
  65. package/dist/helpers/validations.cjs +71 -1
  66. package/dist/helpers/validations.mjs +71 -1
  67. package/dist/helpers/validations.mjs.map +1 -1
  68. package/dist/index.cjs +53 -1
  69. package/dist/index.d.cts +3 -3
  70. package/dist/index.d.mts +3 -3
  71. package/dist/index.mjs +7 -1
  72. package/dist/plugin-utils/compute-bin.cjs +50 -1
  73. package/dist/plugin-utils/compute-bin.mjs +49 -1
  74. package/dist/plugin-utils/compute-bin.mjs.map +1 -1
  75. package/dist/plugin-utils/context-helpers.cjs +231 -1
  76. package/dist/plugin-utils/context-helpers.mjs +221 -1
  77. package/dist/plugin-utils/context-helpers.mjs.map +1 -1
  78. package/dist/plugin-utils/deepkit.cjs +71 -1
  79. package/dist/plugin-utils/deepkit.mjs +69 -1
  80. package/dist/plugin-utils/deepkit.mjs.map +1 -1
  81. package/dist/plugin-utils/description-helpers.cjs +111 -2
  82. package/dist/plugin-utils/description-helpers.mjs +107 -2
  83. package/dist/plugin-utils/description-helpers.mjs.map +1 -1
  84. package/dist/plugin-utils/get-command-tree.cjs +117 -1
  85. package/dist/plugin-utils/get-command-tree.mjs +114 -1
  86. package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
  87. package/dist/plugin-utils/index.cjs +39 -1
  88. package/dist/plugin-utils/index.mjs +10 -1
  89. package/dist/plugin-utils/reflect.cjs +52 -1
  90. package/dist/plugin-utils/reflect.mjs +52 -1
  91. package/dist/plugin-utils/reflect.mjs.map +1 -1
  92. package/dist/plugin-utils/traverse-command-tree.cjs +64 -1
  93. package/dist/plugin-utils/traverse-command-tree.mjs +62 -1
  94. package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
  95. package/dist/plugin-utils/type-checks.cjs +93 -1
  96. package/dist/plugin-utils/type-checks.mjs +88 -1
  97. package/dist/plugin-utils/type-checks.mjs.map +1 -1
  98. package/dist/plugin.cjs +471 -4
  99. package/dist/plugin.d.cts.map +1 -1
  100. package/dist/plugin.d.mts.map +1 -1
  101. package/dist/plugin.mjs +465 -4
  102. package/dist/plugin.mjs.map +1 -1
  103. package/dist/resolver/deepkit.cjs +135 -1
  104. package/dist/resolver/deepkit.mjs +134 -1
  105. package/dist/resolver/deepkit.mjs.map +1 -1
  106. package/dist/resolver/helpers.cjs +173 -1
  107. package/dist/resolver/helpers.mjs +168 -1
  108. package/dist/resolver/helpers.mjs.map +1 -1
  109. package/dist/resolver/module.cjs +145 -1
  110. package/dist/resolver/module.mjs +144 -1
  111. package/dist/resolver/module.mjs.map +1 -1
  112. package/dist/resolver/resolve.cjs +222 -1
  113. package/dist/resolver/resolve.mjs +221 -1
  114. package/dist/resolver/resolve.mjs.map +1 -1
  115. package/dist/types/command.cjs +441 -1
  116. package/dist/types/command.d.cts +1 -1
  117. package/dist/types/command.d.mts +2 -2
  118. package/dist/types/command.mjs +405 -1
  119. package/dist/types/command.mjs.map +1 -1
  120. package/dist/types/config.cjs +134 -1
  121. package/dist/types/config.d.cts +10 -8
  122. package/dist/types/config.d.cts.map +1 -1
  123. package/dist/types/config.d.mts +10 -8
  124. package/dist/types/config.d.mts.map +1 -1
  125. package/dist/types/config.mjs +127 -1
  126. package/dist/types/config.mjs.map +1 -1
  127. package/dist/types/context.cjs +37 -1
  128. package/dist/types/context.mjs +34 -1
  129. package/dist/types/context.mjs.map +1 -1
  130. package/dist/types/env.cjs +52 -1
  131. package/dist/types/env.d.cts +1 -1
  132. package/dist/types/env.d.mts +1 -1
  133. package/dist/types/env.mjs +50 -1
  134. package/dist/types/env.mjs.map +1 -1
  135. package/dist/types/index.cjs +50 -1
  136. package/dist/types/index.d.cts +2 -2
  137. package/dist/types/index.d.mts +2 -2
  138. package/dist/types/index.mjs +6 -1
  139. package/dist/types/options.cjs +12 -1
  140. package/dist/types/options.mjs +10 -1
  141. package/package.json +22 -21
@@ -1 +1,63 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../types/command.cjs`);let n=require(`@stryke/string-format/camel-case`),r=require(`@stryke/type-checks/is-set-string`),i=require(`defu`);i=e.__toESM(i,1);let a=require(`@alloy-js/core`);function o(e,t){return e.__type=t,e}const s=(a.createNamedContext.Ω=[[`&F`]],(0,a.createNamedContext)(`ExistingOptions`,[]));function c(){return a.useContext.Ω=[[`&F`]],(0,a.useContext)(s)}c.__type=[`useExistingOptions`,`Hook to access the ExistingOptions context.`,`P"/!?"`];function l(e){return e.reduce(o((e,a)=>(e[(0,n.camelCase)(a.name)]??=(0,i.default)({name:(0,n.camelCase)(a.name)},e[a.name]??{},a),a.kind===t.CommandParameterKinds.boolean&&!a.variadic&&a.isNegativeOf&&(e[(0,n.camelCase)(a.isNegativeOf)]=(0,i.default)({name:(0,n.camelCase)(a.isNegativeOf)},e[a.isNegativeOf]??{},{...a,env:(0,r.isSetString)(a.env)?`NO_${a.env}`:!1,description:`${a.description.replace(/\.+$/,``)}. This property is the negative form of ${a.name}.`,isNegativeOf:(0,n.camelCase)(a.name),default:!a.default})),e),[`ret`,`option`,``,`P"2!"2""/#`]),{})}l.__type=[`CommandOption`,`options`,`computedOptions`,`P"w!F2""/#`],exports.ExistingOptionsContext=s,exports.computedOptions=l,exports.useExistingOptions=c;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_types_command = require('../types/command.cjs');
4
+ let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
5
+ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
6
+ let defu = require("defu");
7
+ defu = require_runtime.__toESM(defu, 1);
8
+ let _alloy_js_core = require("@alloy-js/core");
9
+
10
+ //#region src/contexts/options.ts
11
+ function __assignType(fn, args) {
12
+ fn.__type = args;
13
+ return fn;
14
+ }
15
+ /**
16
+ * The reflection parameter context used in template rendering.
17
+ */
18
+ const ExistingOptionsContext = (_alloy_js_core.createNamedContext.Ω = [["&F"]], (0, _alloy_js_core.createNamedContext)("ExistingOptions", []));
19
+ /**
20
+ * Hook to access the ExistingOptions context.
21
+ *
22
+ * @remarks
23
+ * This context provides a list of option names that already exist on the interface definition.
24
+ *
25
+ * @returns A reactive version of the current reflection.
26
+ */
27
+ function useExistingOptions() {
28
+ return _alloy_js_core.useContext.Ω = [["&F"]], (0, _alloy_js_core.useContext)(ExistingOptionsContext);
29
+ }
30
+ useExistingOptions.__type = [
31
+ "useExistingOptions",
32
+ "Hook to access the ExistingOptions context.",
33
+ "P\"/!?\""
34
+ ];
35
+ function computedOptions(options) {
36
+ return options.reduce(__assignType((ret, option) => {
37
+ ret[(0, _stryke_string_format_camel_case.camelCase)(option.name)] ??= (0, defu.default)({ name: (0, _stryke_string_format_camel_case.camelCase)(option.name) }, ret[option.name] ?? {}, option);
38
+ if (option.kind === require_types_command.CommandParameterKinds.boolean && !option.variadic && option.isNegativeOf) ret[(0, _stryke_string_format_camel_case.camelCase)(option.isNegativeOf)] = (0, defu.default)({ name: (0, _stryke_string_format_camel_case.camelCase)(option.isNegativeOf) }, ret[option.isNegativeOf] ?? {}, {
39
+ ...option,
40
+ env: (0, _stryke_type_checks_is_set_string.isSetString)(option.env) ? `NO_${option.env}` : false,
41
+ description: `${option.description.replace(/\.+$/, "")}. This property is the negative form of ${option.name}.`,
42
+ isNegativeOf: (0, _stryke_string_format_camel_case.camelCase)(option.name),
43
+ default: !option.default
44
+ });
45
+ return ret;
46
+ }, [
47
+ "ret",
48
+ "option",
49
+ "",
50
+ "P\"2!\"2\"\"/#"
51
+ ]), {});
52
+ }
53
+ computedOptions.__type = [
54
+ "CommandOption",
55
+ "options",
56
+ "computedOptions",
57
+ "P\"w!F2\"\"/#"
58
+ ];
59
+
60
+ //#endregion
61
+ exports.ExistingOptionsContext = ExistingOptionsContext;
62
+ exports.computedOptions = computedOptions;
63
+ exports.useExistingOptions = useExistingOptions;
@@ -1,2 +1,59 @@
1
- import{CommandParameterKinds as e}from"../types/command.mjs";import{camelCase as t}from"@stryke/string-format/camel-case";import{isSetString as n}from"@stryke/type-checks/is-set-string";import r from"defu";import{createNamedContext as i,useContext as a}from"@alloy-js/core";function o(e,t){return e.__type=t,e}const s=(i.Ω=[[`&F`]],i(`ExistingOptions`,[]));function c(){return a.Ω=[[`&F`]],a(s)}c.__type=[`useExistingOptions`,`Hook to access the ExistingOptions context.`,`P"/!?"`];function l(i){return i.reduce(o((i,a)=>(i[t(a.name)]??=r({name:t(a.name)},i[a.name]??{},a),a.kind===e.boolean&&!a.variadic&&a.isNegativeOf&&(i[t(a.isNegativeOf)]=r({name:t(a.isNegativeOf)},i[a.isNegativeOf]??{},{...a,env:n(a.env)?`NO_${a.env}`:!1,description:`${a.description.replace(/\.+$/,``)}. This property is the negative form of ${a.name}.`,isNegativeOf:t(a.name),default:!a.default})),i),[`ret`,`option`,``,`P"2!"2""/#`]),{})}l.__type=[`CommandOption`,`options`,`computedOptions`,`P"w!F2""/#`];export{s as ExistingOptionsContext,l as computedOptions,c as useExistingOptions};
1
+ import { CommandParameterKinds } from "../types/command.mjs";
2
+ import { camelCase } from "@stryke/string-format/camel-case";
3
+ import { isSetString } from "@stryke/type-checks/is-set-string";
4
+ import defu$1 from "defu";
5
+ import { createNamedContext, useContext } from "@alloy-js/core";
6
+
7
+ //#region src/contexts/options.ts
8
+ function __assignType(fn, args) {
9
+ fn.__type = args;
10
+ return fn;
11
+ }
12
+ /**
13
+ * The reflection parameter context used in template rendering.
14
+ */
15
+ const ExistingOptionsContext = (createNamedContext.Ω = [["&F"]], createNamedContext("ExistingOptions", []));
16
+ /**
17
+ * Hook to access the ExistingOptions context.
18
+ *
19
+ * @remarks
20
+ * This context provides a list of option names that already exist on the interface definition.
21
+ *
22
+ * @returns A reactive version of the current reflection.
23
+ */
24
+ function useExistingOptions() {
25
+ return useContext.Ω = [["&F"]], useContext(ExistingOptionsContext);
26
+ }
27
+ useExistingOptions.__type = [
28
+ "useExistingOptions",
29
+ "Hook to access the ExistingOptions context.",
30
+ "P\"/!?\""
31
+ ];
32
+ function computedOptions(options) {
33
+ return options.reduce(__assignType((ret, option) => {
34
+ ret[camelCase(option.name)] ??= defu$1({ name: camelCase(option.name) }, ret[option.name] ?? {}, option);
35
+ if (option.kind === CommandParameterKinds.boolean && !option.variadic && option.isNegativeOf) ret[camelCase(option.isNegativeOf)] = defu$1({ name: camelCase(option.isNegativeOf) }, ret[option.isNegativeOf] ?? {}, {
36
+ ...option,
37
+ env: isSetString(option.env) ? `NO_${option.env}` : false,
38
+ description: `${option.description.replace(/\.+$/, "")}. This property is the negative form of ${option.name}.`,
39
+ isNegativeOf: camelCase(option.name),
40
+ default: !option.default
41
+ });
42
+ return ret;
43
+ }, [
44
+ "ret",
45
+ "option",
46
+ "",
47
+ "P\"2!\"2\"\"/#"
48
+ ]), {});
49
+ }
50
+ computedOptions.__type = [
51
+ "CommandOption",
52
+ "options",
53
+ "computedOptions",
54
+ "P\"w!F2\"\"/#"
55
+ ];
56
+
57
+ //#endregion
58
+ export { ExistingOptionsContext, computedOptions, useExistingOptions };
2
59
  //# sourceMappingURL=options.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"options.mjs","names":[],"sources":["../../src/contexts/options.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 { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport type { BooleanCommandOption, CommandOption } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ExistingOptionsContext: ComponentContext<string[]> =\n createNamedContext<string[]>(\"ExistingOptions\", []);\n\n/**\n * Hook to access the ExistingOptions context.\n *\n * @remarks\n * This context provides a list of option names that already exist on the interface definition.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useExistingOptions() {\n return useContext<string[]>(ExistingOptionsContext)!;\n}\n\nexport function computedOptions(options: CommandOption[]) {\n return options.reduce(\n (ret, option) => {\n ret[camelCase(option.name)] ??= defu(\n {\n name: camelCase(option.name)\n },\n ret[option.name] ?? {},\n option\n );\n\n if (\n option.kind === CommandParameterKinds.boolean &&\n !option.variadic &&\n option.isNegativeOf\n ) {\n ret[camelCase(option.isNegativeOf)] = defu(\n {\n name: camelCase(option.isNegativeOf)\n },\n ret[option.isNegativeOf] ?? {},\n {\n ...option,\n env: isSetString(option.env) ? `NO_${option.env}` : false,\n description: `${option.description.replace(\n /\\.+$/,\n \"\"\n )}. This property is the negative form of ${option.name}.`,\n isNegativeOf: camelCase(option.name),\n default: !option.default\n }\n ) as BooleanCommandOption;\n }\n\n return ret;\n },\n {} as Record<string, CommandOption>\n );\n}\n"],"mappings":"kRAAA,SAAS,EAAa,EAAI,EAAM,CAE9B,kBAAO,EAUT,MAAa,GAAsB,EAAkB,EAAA,CAAA,CAAA,KAAA,CAAA,CAAA,EAAA,kBAAA,EAAA,CAAA,EASrD,SAAS,GAA4B,CACrC,MAAO,GAAW,EAAK,CAAA,CAAA,KAAA,CAAA,CAAA,EAAA,EAAA,CAEvB,EAAS,OAAA,CAAA,qBAAuC,8CAAQ,SAAA,eAEtD,OAAA,EAAA,OAAA,GAAA,EAAA,KACC,EAAI,EAAW,EAAA,KAAU,IAAQ,EAAK,CACvC,KAAA,EAAA,EAAA,KAAA,CACF,CAAO,EAAA,EAAM,OAAA,EAAA,CAAA,EAAwB,CACnC,EAAA,OAAmB,EAAW,SAAqB,CAAA,EAAA,UAAA,EAAA,eAAA,EAAA,EAAA,EAAA,aAAA,EAAA,EAAA,CAEnD,KAAA,EAAA,EAAA,aAAA,CACK,CAAC,EAAG,EAAO,eAAmB,EAAC,CAAA,CACrC,GAAA,EACG,IAAA,EAAA,EAAA,IAAA,CAAA,MAAA,EAAA,MAAA,GACI,YAAQ,GAAQ,EAAO,YAAW,QAAM,OAAK,GAAQ,CAAA,0CAAiC,EAAA,KAAA,GAC7F,aAAA,EAAA,EAAA,KAAA,CACG,QAAU,CAAA,EAAS,QACrB,CAAA,EAEO,GACT,CAAA,MAAA,SAAA,GAAA,aAAA,CAAA,CAAA,EAAA,CAAA,CAEA,EAAgB,OAAA,CAAA,gBAAyB,UAAa,kBAAI,aAAA"}
1
+ {"version":3,"file":"options.mjs","names":[],"sources":["../../src/contexts/options.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 { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport type { BooleanCommandOption, CommandOption } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ExistingOptionsContext: ComponentContext<string[]> =\n createNamedContext<string[]>(\"ExistingOptions\", []);\n\n/**\n * Hook to access the ExistingOptions context.\n *\n * @remarks\n * This context provides a list of option names that already exist on the interface definition.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useExistingOptions() {\n return useContext<string[]>(ExistingOptionsContext)!;\n}\n\nexport function computedOptions(options: CommandOption[]) {\n return options.reduce(\n (ret, option) => {\n ret[camelCase(option.name)] ??= defu(\n {\n name: camelCase(option.name)\n },\n ret[option.name] ?? {},\n option\n );\n\n if (\n option.kind === CommandParameterKinds.boolean &&\n !option.variadic &&\n option.isNegativeOf\n ) {\n ret[camelCase(option.isNegativeOf)] = defu(\n {\n name: camelCase(option.isNegativeOf)\n },\n ret[option.isNegativeOf] ?? {},\n {\n ...option,\n env: isSetString(option.env) ? `NO_${option.env}` : false,\n description: `${option.description.replace(\n /\\.+$/,\n \"\"\n )}. This property is the negative form of ${option.name}.`,\n isNegativeOf: camelCase(option.name),\n default: !option.default\n }\n ) as BooleanCommandOption;\n }\n\n return ret;\n },\n {} as Record<string, CommandOption>\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE9B,QAAO;;;;;AAUT,MAAa,0BAAsB,mBAAkB,IAAA,CAAA,CAAA,KAAA,CAAA,EAAA,mBAAA,mBAAA,EAAA,CAAA;;;;;;;;;AASrD,SAAS,qBAA4B;AACrC,QAAO,WAAW,IAAK,CAAA,CAAA,KAAA,CAAA,EAAA,WAAA,uBAAA;;AAEvB,mBAAS,SAAA;CAAA;CAAuC;CAAQ;CAAA;;AAEtD,QAAA,QAAA,OAAA,cAAA,KAAA,WAAA;AACC,MAAI,UAAW,OAAA,KAAU,MAAQ,OAAK,EACvC,MAAA,UAAA,OAAA,KAAA,EACF,EAAO,IAAA,OAAM,SAAA,EAAA,EAAA,OAAwB;AACnC,MAAA,OAAA,SAAmB,sBAAW,WAAqB,CAAA,OAAA,YAAA,OAAA,6DAEnD,MAAA,UAAA,OAAA,aAAA,EACK,EAAC,IAAG,OAAO,iBAAmB,EAAC,EAAA;GACrC,GAAA;GACG,KAAA,YAAA,OAAA,IAAA,GAAA,MAAA,OAAA,QAAA;GACI,aAAQ,GAAQ,OAAO,YAAW,QAAM,QAAK,GAAQ,CAAA,0CAAiC,OAAA,KAAA;GAC7F,cAAA,UAAA,OAAA,KAAA;GACG,SAAU,CAAA,OAAS;GACrB,CAAA;AAEA,SAAO;IACT;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,EAAA,EAAA,CAAA;;AAEA,gBAAgB,SAAA;CAAA;CAAyB;CAAa;CAAI;CAAA"}
@@ -1 +1,71 @@
1
- require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../plugin-utils/context-helpers.cjs`),t=require(`../components/docs.cjs`);require(`../plugin-utils/index.cjs`);let n=require(`@alloy-js/core/jsx-runtime`),r=require(`@alloy-js/core/components`),i=require(`@powerlines/plugin-alloy/render`),a=require(`@alloy-js/core`),o=require(`@alloy-js/markdown`),s=require(`@powerlines/plugin-alloy/core/components/spacing`),c=require(`automd`);function l(e,t){return e.__type=t,e}const u=l(u=>(0,c.defineGenerator)({name:`commands`,async generate(){return{contents:(0,i.renderString)(u,[(0,n.createComponent)(o.Heading,{level:2,children:`Commands`}),(0,n.createComponent)(s.Spacing,{}),(0,n.memo)(()=>a.code`The following commands are available in the ${e.getAppTitle(u,!0)} command-line interface application:`),(0,n.createComponent)(s.Spacing,{}),(0,n.createComponent)(r.For,{get each(){return Object.values(u.commands)},doubleHardline:!0,get children(){return l(e=>(0,n.createComponent)(r.Show,{get when(){return!e.isVirtual},get children(){return(0,n.createComponent)(t.CommandDocs,{command:e,levelOffset:2})}}),[`child`,``,`P"2!"/"`])}}),(0,n.createComponent)(s.Spacing,{})])}}}),[`Context`,`context`,``,`P"w!2""/#`]);exports.commands=u;
1
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
+ const require_context_helpers = require('../plugin-utils/context-helpers.cjs');
3
+ const require_components_docs = require('../components/docs.cjs');
4
+ require('../plugin-utils/index.cjs');
5
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
+ let _alloy_js_core_components = require("@alloy-js/core/components");
7
+ let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
8
+ let _alloy_js_core = require("@alloy-js/core");
9
+ let _alloy_js_markdown = require("@alloy-js/markdown");
10
+ let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
11
+ let automd = require("automd");
12
+
13
+ //#region src/helpers/automd.tsx
14
+ function __assignType(fn, args) {
15
+ fn.__type = args;
16
+ return fn;
17
+ }
18
+ /**
19
+ * AutoMD generator to generate CLI command documentation
20
+ *
21
+ * @see https://automd.unjs.io/
22
+ *
23
+ * @param context - The generator context.
24
+ * @returns The generated documentation content.
25
+ */
26
+ const commands = __assignType((context) => (0, automd.defineGenerator)({
27
+ name: "commands",
28
+ async generate() {
29
+ return { contents: (0, _powerlines_plugin_alloy_render.renderString)(context, [
30
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_markdown.Heading, {
31
+ level: 2,
32
+ children: "Commands"
33
+ }),
34
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
35
+ (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`The following commands are available in the ${require_context_helpers.getAppTitle(context, true)} command-line interface application:`),
36
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
37
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core_components.For, {
38
+ get each() {
39
+ return Object.values(context.commands);
40
+ },
41
+ doubleHardline: true,
42
+ get children() {
43
+ return __assignType((child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core_components.Show, {
44
+ get when() {
45
+ return !child.isVirtual;
46
+ },
47
+ get children() {
48
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_docs.CommandDocs, {
49
+ command: child,
50
+ levelOffset: 2
51
+ });
52
+ }
53
+ }), [
54
+ "child",
55
+ "",
56
+ "P\"2!\"/\""
57
+ ]);
58
+ }
59
+ }),
60
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
61
+ ]) };
62
+ }
63
+ }), [
64
+ "Context",
65
+ "context",
66
+ "",
67
+ "P\"w!2\"\"/#"
68
+ ]);
69
+
70
+ //#endregion
71
+ exports.commands = commands;
@@ -1,2 +1,71 @@
1
- import{getAppTitle as e}from"../plugin-utils/context-helpers.mjs";import{CommandDocs as t}from"../components/docs.mjs";import"../plugin-utils/index.mjs";import{createComponent as n,memo as r}from"@alloy-js/core/jsx-runtime";import{For as i,Show as a}from"@alloy-js/core/components";import{renderString as o}from"@powerlines/plugin-alloy/render";import{code as s}from"@alloy-js/core";import{Heading as c}from"@alloy-js/markdown";import{Spacing as l}from"@powerlines/plugin-alloy/core/components/spacing";import{defineGenerator as u}from"automd";function d(e,t){return e.__type=t,e}const f=d(f=>u({name:`commands`,async generate(){return{contents:o(f,[n(c,{level:2,children:`Commands`}),n(l,{}),r(()=>s`The following commands are available in the ${e(f,!0)} command-line interface application:`),n(l,{}),n(i,{get each(){return Object.values(f.commands)},doubleHardline:!0,get children(){return d(e=>n(a,{get when(){return!e.isVirtual},get children(){return n(t,{command:e,levelOffset:2})}}),[`child`,``,`P"2!"/"`])}}),n(l,{})])}}}),[`Context`,`context`,``,`P"w!2""/#`]);export{f as commands};
1
+ import { getAppTitle } from "../plugin-utils/context-helpers.mjs";
2
+ import { CommandDocs } from "../components/docs.mjs";
3
+ import "../plugin-utils/index.mjs";
4
+ import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
5
+ import { For, Show } from "@alloy-js/core/components";
6
+ import { renderString } from "@powerlines/plugin-alloy/render";
7
+ import { code } from "@alloy-js/core";
8
+ import { Heading } from "@alloy-js/markdown";
9
+ import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
10
+ import { defineGenerator } from "automd";
11
+
12
+ //#region src/helpers/automd.tsx
13
+ function __assignType(fn, args) {
14
+ fn.__type = args;
15
+ return fn;
16
+ }
17
+ /**
18
+ * AutoMD generator to generate CLI command documentation
19
+ *
20
+ * @see https://automd.unjs.io/
21
+ *
22
+ * @param context - The generator context.
23
+ * @returns The generated documentation content.
24
+ */
25
+ const commands = __assignType((context) => defineGenerator({
26
+ name: "commands",
27
+ async generate() {
28
+ return { contents: renderString(context, [
29
+ createComponent(Heading, {
30
+ level: 2,
31
+ children: "Commands"
32
+ }),
33
+ createComponent(Spacing, {}),
34
+ memo(() => code`The following commands are available in the ${getAppTitle(context, true)} command-line interface application:`),
35
+ createComponent(Spacing, {}),
36
+ createComponent(For, {
37
+ get each() {
38
+ return Object.values(context.commands);
39
+ },
40
+ doubleHardline: true,
41
+ get children() {
42
+ return __assignType((child) => createComponent(Show, {
43
+ get when() {
44
+ return !child.isVirtual;
45
+ },
46
+ get children() {
47
+ return createComponent(CommandDocs, {
48
+ command: child,
49
+ levelOffset: 2
50
+ });
51
+ }
52
+ }), [
53
+ "child",
54
+ "",
55
+ "P\"2!\"/\""
56
+ ]);
57
+ }
58
+ }),
59
+ createComponent(Spacing, {})
60
+ ]) };
61
+ }
62
+ }), [
63
+ "Context",
64
+ "context",
65
+ "",
66
+ "P\"w!2\"\"/#"
67
+ ]);
68
+
69
+ //#endregion
70
+ export { commands };
2
71
  //# sourceMappingURL=automd.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"automd.mjs","names":[],"sources":["../../src/helpers/automd.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code } from \"@alloy-js/core\";\nimport { For, Show } from \"@alloy-js/core/components\";\nimport { Heading } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { renderString } from \"@powerlines/plugin-alloy/render\";\nimport { defineGenerator } from \"automd\";\nimport { CommandDocs } from \"../components/docs\";\nimport { getAppTitle } from \"../plugin-utils\";\nimport type { Context } from \"../types/context\";\n\n/**\n * AutoMD generator to generate CLI command documentation\n *\n * @see https://automd.unjs.io/\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const commands = (context: Context) =>\n defineGenerator({\n name: \"commands\",\n async generate() {\n return {\n contents: renderString(\n context,\n <>\n <Heading level={2}>Commands</Heading>\n <Spacing />\n {code`The following commands are available in the ${getAppTitle(\n context,\n true\n )} command-line interface application:`}\n <Spacing />\n <For each={Object.values(context.commands)} doubleHardline>\n {child => (\n <Show when={!child.isVirtual}>\n <CommandDocs command={child} levelOffset={2} />\n </Show>\n )}\n </For>\n <Spacing />\n </>\n )\n };\n }\n });\n"],"mappings":"sjBAEE,GAAG,OAAS,IAoCd,MAAW,EAAS,EAAA,GAAA,EAAA,CAClB,KAAE,WACF,MAAI,UAAO,CACT,MAAI,CACF,SAAI,EAAO,EAAA,CAAA,EAAA,EAAA,CACT,MAAG,EACH,SAAK,WACN,CAAC,CAAE,EAAY,EAAA,EAAA,CAAA,CAAA,MAAA,CAAA,+CAAA,EAAA,EAAA,GAAA,CAAA,sCAAA,CAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA,EAAA,CACd,IAAI,MAAM,CACR,OAAI,OAAO,OAAA,EAAA,SAAA,EAEb,eAAe,GACf,IAAI,UAAU,CACZ,OAAO,EAAa,GAAO,EAAmB,EAAA,CAC5C,IAAG,MAAQ,CACT,MAAO,CAAC,EAAM,WAEhB,IAAI,UAAM,CACR,OAAC,EAAA,EAAA,CACD,QAAG,EACJ,YAAS,EACV,CAAA,EAEL,CAAA,CAAA,CAAA,QAAA,GAAA,UAAA,CAAA,EAEH,CAAA,CAAA,EAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"automd.mjs","names":[],"sources":["../../src/helpers/automd.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code } from \"@alloy-js/core\";\nimport { For, Show } from \"@alloy-js/core/components\";\nimport { Heading } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { renderString } from \"@powerlines/plugin-alloy/render\";\nimport { defineGenerator } from \"automd\";\nimport { CommandDocs } from \"../components/docs\";\nimport { getAppTitle } from \"../plugin-utils\";\nimport type { Context } from \"../types/context\";\n\n/**\n * AutoMD generator to generate CLI command documentation\n *\n * @see https://automd.unjs.io/\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const commands = (context: Context) =>\n defineGenerator({\n name: \"commands\",\n async generate() {\n return {\n contents: renderString(\n context,\n <>\n <Heading level={2}>Commands</Heading>\n <Spacing />\n {code`The following commands are available in the ${getAppTitle(\n context,\n true\n )} command-line interface application:`}\n <Spacing />\n <For each={Object.values(context.commands)} doubleHardline>\n {child => (\n <Show when={!child.isVirtual}>\n <CommandDocs command={child} levelOffset={2} />\n </Show>\n )}\n </For>\n <Spacing />\n </>\n )\n };\n }\n });\n"],"mappings":";;;;;;;;;;;;;AAEE,IAAG,SAAS;;;;;;;;;;;AAoCd,MAAW,WAAS,cAAA,YAAA,gBAAA;CAClB,MAAE;CACF,MAAI,WAAO;AACT,SAAI,EACF,UAAI,aAAO,SAAA;GAAA,gBAAA,SAAA;IACT,OAAG;IACH,UAAK;IACN,CAAC;GAAE,gBAAY,SAAA,EAAA,CAAA;GAAA,WAAA,IAAA,+CAAA,YAAA,SAAA,KAAA,CAAA,sCAAA;GAAA,gBAAA,SAAA,EAAA,CAAA;GAAA,gBAAA,KAAA;IACd,IAAI,OAAM;AACR,YAAI,OAAO,OAAA,QAAA,SAAA;;IAEb,gBAAe;IACf,IAAI,WAAU;AACZ,YAAO,cAAa,UAAO,gBAAmB,MAAA;MAC5C,IAAG,OAAQ;AACT,cAAO,CAAC,MAAM;;MAEhB,IAAI,WAAM;AACR,cAAC,gBAAA,aAAA;QACD,SAAG;QACJ,aAAS;QACV,CAAA;;MAEL,CAAA,EAAA;MAAA;MAAA;MAAA;MAAA,CAAA;;IAEH,CAAA;GAAA,gBAAA,SAAA,EAAA,CAAA;GAAA,CAAA"}
@@ -1 +1,23 @@
1
- require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@stryke/path/join`);function t(t){return(0,e.joinPaths)(t.config.root,`docs`,`generated`)}t.__type=[`Context`,`context`,`getDocsOutputPath`,`Gets the output path for the generated documentation.`,`P"w!2"&/#?$`],exports.getDocsOutputPath=t;
1
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
+ let _stryke_path_join = require("@stryke/path/join");
3
+
4
+ //#region src/helpers/docs-helpers.ts
5
+ /**
6
+ * Gets the output path for the generated documentation.
7
+ *
8
+ * @param context - The Shell Shock context.
9
+ * @returns The output path for the generated documentation.
10
+ */
11
+ function getDocsOutputPath(context) {
12
+ return (0, _stryke_path_join.joinPaths)(context.config.root, "docs", "generated");
13
+ }
14
+ getDocsOutputPath.__type = [
15
+ "Context",
16
+ "context",
17
+ "getDocsOutputPath",
18
+ "Gets the output path for the generated documentation.",
19
+ "P\"w!2\"&/#?$"
20
+ ];
21
+
22
+ //#endregion
23
+ exports.getDocsOutputPath = getDocsOutputPath;
@@ -1,2 +1,23 @@
1
- import{joinPaths as e}from"@stryke/path/join";function t(t){return e(t.config.root,`docs`,`generated`)}t.__type=[`Context`,`context`,`getDocsOutputPath`,`Gets the output path for the generated documentation.`,`P"w!2"&/#?$`];export{t as getDocsOutputPath};
1
+ import { joinPaths } from "@stryke/path/join";
2
+
3
+ //#region src/helpers/docs-helpers.ts
4
+ /**
5
+ * Gets the output path for the generated documentation.
6
+ *
7
+ * @param context - The Shell Shock context.
8
+ * @returns The output path for the generated documentation.
9
+ */
10
+ function getDocsOutputPath(context) {
11
+ return joinPaths(context.config.root, "docs", "generated");
12
+ }
13
+ getDocsOutputPath.__type = [
14
+ "Context",
15
+ "context",
16
+ "getDocsOutputPath",
17
+ "Gets the output path for the generated documentation.",
18
+ "P\"w!2\"&/#?$"
19
+ ];
20
+
21
+ //#endregion
22
+ export { getDocsOutputPath };
2
23
  //# sourceMappingURL=docs-helpers.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"docs-helpers.mjs","names":[],"sources":["../../src/helpers/docs-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Gets the output path for the generated documentation.\n *\n * @param context - The Shell Shock context.\n * @returns The output path for the generated documentation.\n */\nexport function getDocsOutputPath(context: Context): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":"8CAwBA,SAAU,EAAoB,EAAa,CACzC,OAAE,EAAY,EAAW,OAAK,KAAI,OAAU,YAAa,CAE3D,EAAgB,OAAA,CAAA,UAAkB,UAAgB,oBAAU,wDAAA,cAAA"}
1
+ {"version":3,"file":"docs-helpers.mjs","names":[],"sources":["../../src/helpers/docs-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Gets the output path for the generated documentation.\n *\n * @param context - The Shell Shock context.\n * @returns The output path for the generated documentation.\n */\nexport function getDocsOutputPath(context: Context): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;AAwBA,SAAU,kBAAoB,SAAa;AACzC,QAAE,UAAY,QAAW,OAAK,MAAI,QAAU,YAAa;;AAE3D,kBAAgB,SAAA;CAAA;CAAkB;CAAgB;CAAU;CAAA;CAAA"}
@@ -1 +1,137 @@
1
- require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../plugin-utils/context-helpers.cjs`);let t=require(`@stryke/path/append`),n=require(`@stryke/path/file-path-fns`),r=require(`@stryke/path/join-paths`),i=require(`@stryke/path/replace`),a=require(`@stryke/path/resolve-parent-path`),o=require(`@stryke/type-checks/is-set-string`),s=require(`powerlines/utils`),c=require(`@stryke/type-checks/is-set-object`),l=require(`@stryke/fs/list-files`),u=require(`@stryke/path/common`),d=require(`node:fs`);function f(e,t){return e.__type=t,e}function p(t,r){return(0,i.replacePath)((0,n.findFilePath)(r),t.commandsPath).split(`/`).filter(f(t=>!!t&&!e.isDynamicPathSegment(t),[`p`,``,`P"2!"/"`])).join(`/`).replaceAll(/^\/+/g,``).replaceAll(/\/+$/g,``).replaceAll(`/`,`-`)}p.__type=[`Context`,`context`,`file`,`resolveCommandId`,`P"w!2"&2#&/$`];function m(t){let r=(0,n.findFilePath)(t),i=(0,n.findFolderName)(t,{requireExtension:!0});for(;e.isDynamicPathSegment(i);)r=(0,a.resolveParentPath)(r),i=(0,n.findFolderName)(r,{requireExtension:!0});return i}m.__type=[`file`,`resolveCommandName`,`Finds the command name from the given file path.`,`P&2!"/"?#`];function h(t,r){return(0,i.replacePath)((0,n.findFilePath)(r),t.commandsPath).replaceAll(/^\/+/g,``).replaceAll(/\/+$/g,``).split(`/`).filter(f(t=>t&&!e.isPathSegmentGroup(t),[`path`,``,`P"2!"/"`])).join(`/`)}h.__type=[`Context`,`context`,`file`,`resolveCommandPath`,`P"w!2"&2#&/$`];function g(t,r){return(0,i.replacePath)((0,n.findFilePath)(r),t.commandsPath).split(`/`).filter(f(t=>!!t&&e.isDynamicPathSegment(t),[`path`,``,`P"2!"/"`])).map(f(t=>e.getDynamicPathSegmentName(t),[`path`,``,`P"2!"/"`]))}g.__type=[`Context`,`context`,`file`,`resolveCommandDynamicPathSegments`,`P"w!2"&2#&F/$`];async function _(e){let i=[];if((0,o.isSetString)(e.config.input)?i=await(0,l.listFiles)((0,t.appendPath)((0,t.appendPath)(e.config.input,e.config.root),e.config.cwd)):(0,s.isTypeDefinition)(e.config.input)?i=await(0,l.listFiles)((0,t.appendPath)((0,t.appendPath)(e.config.input.file,e.config.root),e.config.cwd)):Array.isArray(e.config.input)&&e.config.input.length>0?i=(await Promise.all(e.config.input.map(f(async n=>(0,l.listFiles)((0,t.appendPath)((0,t.appendPath)((0,o.isSetString)(n)?n:n.file,e.config.root),e.config.cwd)),[`input`,``,`P"2!"/"`])))).flat():(0,c.isSetObject)(e.config.input)&&(i=(await Promise.all(Object.values(e.config.input).map(f(async n=>Array.isArray(n)?(await Promise.all(n.map(f(async n=>(0,l.listFiles)((0,t.appendPath)((0,t.appendPath)((0,o.isSetString)(n)?n:n.file,e.config.root),e.config.cwd)),[`i`,``,`P"2!"/"`])))).flat():(0,l.listFiles)((0,t.appendPath)((0,t.appendPath)((0,o.isSetString)(n)?n:n.file,e.config.root),e.config.cwd)),[`input`,``,`P"2!"/"`])))).flat()),i.length>0)return(0,u.commonPath)(i.map(f(e=>(0,n.findFilePath)(e),[`p`,``,`P"2!"/"`])));let a=(0,r.joinPaths)(e.config.root,`src/commands`);return(0,d.existsSync)(a)||(a=(0,r.joinPaths)(e.config.root,`commands`),(0,d.existsSync)(a)||(a=(0,r.joinPaths)(e.config.root,`src`),(0,d.existsSync)(a)||(a=e.config.root))),i=(await Promise.all([(0,l.listFiles)((0,r.joinPaths)((0,t.appendPath)(a,e.config.cwd),`**/command.ts`)),(0,l.listFiles)((0,r.joinPaths)((0,t.appendPath)(a,e.config.cwd),`**/command.tsx`))])).flat(),i.length>0?(0,u.commonPath)(i.map(f(e=>(0,n.findFilePath)(e),[`p`,``,`P"2!"/"`]))):(0,t.appendPath)(a,e.config.cwd)}_.__type=[`Context`,`context`,`findCommandsRoot`,'P"w!2"&`/#'],exports.findCommandsRoot=_,exports.resolveCommandId=p,exports.resolveCommandName=m,exports.resolveCommandPath=h;
1
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
+ const require_context_helpers = require('../plugin-utils/context-helpers.cjs');
3
+ let _stryke_path_append = require("@stryke/path/append");
4
+ let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
5
+ let _stryke_path_join_paths = require("@stryke/path/join-paths");
6
+ let _stryke_path_replace = require("@stryke/path/replace");
7
+ let _stryke_path_resolve_parent_path = require("@stryke/path/resolve-parent-path");
8
+ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
9
+ let powerlines_utils = require("powerlines/utils");
10
+ let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
11
+ let _stryke_fs_list_files = require("@stryke/fs/list-files");
12
+ let _stryke_path_common = require("@stryke/path/common");
13
+ let node_fs = require("node:fs");
14
+
15
+ //#region src/helpers/paths.ts
16
+ function __assignType(fn, args) {
17
+ fn.__type = args;
18
+ return fn;
19
+ }
20
+ function resolveCommandId(context, file) {
21
+ return (0, _stryke_path_replace.replacePath)((0, _stryke_path_file_path_fns.findFilePath)(file), context.commandsPath).split("/").filter(__assignType((p) => Boolean(p) && !require_context_helpers.isDynamicPathSegment(p), [
22
+ "p",
23
+ "",
24
+ "P\"2!\"/\""
25
+ ])).join("/").replaceAll(/^\/+/g, "").replaceAll(/\/+$/g, "").replaceAll("/", "-");
26
+ }
27
+ resolveCommandId.__type = [
28
+ "Context",
29
+ "context",
30
+ "file",
31
+ "resolveCommandId",
32
+ "P\"w!2\"&2#&/$"
33
+ ];
34
+ /**
35
+ * Finds the command name from the given file path.
36
+ *
37
+ * @param file - The file path to extract the command name from.
38
+ * @returns The command name.
39
+ */
40
+ function resolveCommandName(file) {
41
+ let path = (0, _stryke_path_file_path_fns.findFilePath)(file);
42
+ let name = (0, _stryke_path_file_path_fns.findFolderName)(file, { requireExtension: true });
43
+ while (require_context_helpers.isDynamicPathSegment(name)) {
44
+ path = (0, _stryke_path_resolve_parent_path.resolveParentPath)(path);
45
+ name = (0, _stryke_path_file_path_fns.findFolderName)(path, { requireExtension: true });
46
+ }
47
+ return name;
48
+ }
49
+ resolveCommandName.__type = [
50
+ "file",
51
+ "resolveCommandName",
52
+ "Finds the command name from the given file path.",
53
+ "P&2!\"/\"?#"
54
+ ];
55
+ function resolveCommandPath(context, file) {
56
+ return (0, _stryke_path_replace.replacePath)((0, _stryke_path_file_path_fns.findFilePath)(file), context.commandsPath).replaceAll(/^\/+/g, "").replaceAll(/\/+$/g, "").split("/").filter(__assignType((path) => path && !require_context_helpers.isPathSegmentGroup(path), [
57
+ "path",
58
+ "",
59
+ "P\"2!\"/\""
60
+ ])).join("/");
61
+ }
62
+ resolveCommandPath.__type = [
63
+ "Context",
64
+ "context",
65
+ "file",
66
+ "resolveCommandPath",
67
+ "P\"w!2\"&2#&/$"
68
+ ];
69
+ function resolveCommandDynamicPathSegments(context, file) {
70
+ return (0, _stryke_path_replace.replacePath)((0, _stryke_path_file_path_fns.findFilePath)(file), context.commandsPath).split("/").filter(__assignType((path) => Boolean(path) && require_context_helpers.isDynamicPathSegment(path), [
71
+ "path",
72
+ "",
73
+ "P\"2!\"/\""
74
+ ])).map(__assignType((path) => require_context_helpers.getDynamicPathSegmentName(path), [
75
+ "path",
76
+ "",
77
+ "P\"2!\"/\""
78
+ ]));
79
+ }
80
+ resolveCommandDynamicPathSegments.__type = [
81
+ "Context",
82
+ "context",
83
+ "file",
84
+ "resolveCommandDynamicPathSegments",
85
+ "P\"w!2\"&2#&F/$"
86
+ ];
87
+ async function findCommandsRoot(context) {
88
+ let paths = [];
89
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(context.config.input)) paths = await (0, _stryke_fs_list_files.listFiles)((0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)(context.config.input, context.config.root), context.config.cwd));
90
+ else if ((0, powerlines_utils.isTypeDefinition)(context.config.input)) paths = await (0, _stryke_fs_list_files.listFiles)((0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)(context.config.input.file, context.config.root), context.config.cwd));
91
+ else if (Array.isArray(context.config.input) && context.config.input.length > 0) paths = (await Promise.all(context.config.input.map(__assignType(async (input) => (0, _stryke_fs_list_files.listFiles)((0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)((0, _stryke_type_checks_is_set_string.isSetString)(input) ? input : input.file, context.config.root), context.config.cwd)), [
92
+ "input",
93
+ "",
94
+ "P\"2!\"/\""
95
+ ])))).flat();
96
+ else if ((0, _stryke_type_checks_is_set_object.isSetObject)(context.config.input)) paths = (await Promise.all(Object.values(context.config.input).map(__assignType(async (input) => Array.isArray(input) ? (await Promise.all(input.map(__assignType(async (i) => (0, _stryke_fs_list_files.listFiles)((0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)((0, _stryke_type_checks_is_set_string.isSetString)(i) ? i : i.file, context.config.root), context.config.cwd)), [
97
+ "i",
98
+ "",
99
+ "P\"2!\"/\""
100
+ ])))).flat() : (0, _stryke_fs_list_files.listFiles)((0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)((0, _stryke_type_checks_is_set_string.isSetString)(input) ? input : input.file, context.config.root), context.config.cwd)), [
101
+ "input",
102
+ "",
103
+ "P\"2!\"/\""
104
+ ])))).flat();
105
+ if (paths.length > 0) return (0, _stryke_path_common.commonPath)(paths.map(__assignType((p) => (0, _stryke_path_file_path_fns.findFilePath)(p), [
106
+ "p",
107
+ "",
108
+ "P\"2!\"/\""
109
+ ])));
110
+ let commandsPath = (0, _stryke_path_join_paths.joinPaths)(context.config.root, "src/commands");
111
+ if (!(0, node_fs.existsSync)(commandsPath)) {
112
+ commandsPath = (0, _stryke_path_join_paths.joinPaths)(context.config.root, "commands");
113
+ if (!(0, node_fs.existsSync)(commandsPath)) {
114
+ commandsPath = (0, _stryke_path_join_paths.joinPaths)(context.config.root, "src");
115
+ if (!(0, node_fs.existsSync)(commandsPath)) commandsPath = context.config.root;
116
+ }
117
+ }
118
+ paths = (await Promise.all([(0, _stryke_fs_list_files.listFiles)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(commandsPath, context.config.cwd), "**/command.ts")), (0, _stryke_fs_list_files.listFiles)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(commandsPath, context.config.cwd), "**/command.tsx"))])).flat();
119
+ if (paths.length > 0) return (0, _stryke_path_common.commonPath)(paths.map(__assignType((p) => (0, _stryke_path_file_path_fns.findFilePath)(p), [
120
+ "p",
121
+ "",
122
+ "P\"2!\"/\""
123
+ ])));
124
+ return (0, _stryke_path_append.appendPath)(commandsPath, context.config.cwd);
125
+ }
126
+ findCommandsRoot.__type = [
127
+ "Context",
128
+ "context",
129
+ "findCommandsRoot",
130
+ "P\"w!2\"&`/#"
131
+ ];
132
+
133
+ //#endregion
134
+ exports.findCommandsRoot = findCommandsRoot;
135
+ exports.resolveCommandId = resolveCommandId;
136
+ exports.resolveCommandName = resolveCommandName;
137
+ exports.resolveCommandPath = resolveCommandPath;