@shell-shock/core 0.2.0 → 0.2.1

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 (50) hide show
  1. package/README.md +221 -0
  2. package/dist/_virtual/rolldown_runtime.cjs +29 -1
  3. package/dist/api.cjs +45 -1
  4. package/dist/api.mjs +44 -1
  5. package/dist/components/index.cjs +7 -0
  6. package/dist/components/index.d.cts +2 -0
  7. package/dist/components/index.d.mts +2 -0
  8. package/dist/components/index.mjs +3 -0
  9. package/dist/components/utils-builtin.cjs +453 -0
  10. package/dist/components/utils-builtin.d.cts +27 -0
  11. package/dist/components/utils-builtin.d.mts +27 -0
  12. package/dist/components/utils-builtin.mjs +447 -0
  13. package/dist/config.cjs +17 -1
  14. package/dist/config.mjs +16 -1
  15. package/dist/helpers/persistence.cjs +49 -1
  16. package/dist/helpers/persistence.mjs +46 -1
  17. package/dist/helpers/resolve-command.cjs +92 -1
  18. package/dist/helpers/resolve-command.mjs +88 -1
  19. package/dist/helpers/update-package-json.cjs +28 -1
  20. package/dist/helpers/update-package-json.mjs +27 -1
  21. package/dist/helpers/utilities.cjs +41 -1
  22. package/dist/helpers/utilities.mjs +38 -1
  23. package/dist/index.cjs +24 -1
  24. package/dist/index.d.cts +2 -2
  25. package/dist/index.d.mts +1 -2
  26. package/dist/index.mjs +19 -1
  27. package/dist/plugin-utils/get-command-tree.cjs +22 -0
  28. package/dist/plugin-utils/get-command-tree.d.cts +15 -0
  29. package/dist/plugin-utils/get-command-tree.d.mts +15 -0
  30. package/dist/plugin-utils/get-command-tree.mjs +21 -0
  31. package/dist/plugin-utils/index.cjs +3 -0
  32. package/dist/plugin-utils/index.d.cts +2 -0
  33. package/dist/plugin-utils/index.d.mts +2 -0
  34. package/dist/plugin-utils/index.mjs +3 -0
  35. package/dist/powerlines.cjs +172 -3
  36. package/dist/powerlines.mjs +168 -3
  37. package/dist/types/command.mjs +1 -1
  38. package/dist/types/config.d.cts +4 -19
  39. package/dist/types/config.d.mts +4 -19
  40. package/dist/types/config.mjs +1 -1
  41. package/dist/types/context.d.cts +2 -1
  42. package/dist/types/context.d.mts +2 -1
  43. package/dist/types/context.mjs +1 -1
  44. package/dist/types/index.mjs +1 -1
  45. package/dist/types/options.mjs +1 -1
  46. package/package.json +75 -15
  47. package/dist/helpers/get-default-options.cjs +0 -1
  48. package/dist/helpers/get-default-options.d.cts +0 -15
  49. package/dist/helpers/get-default-options.d.mts +0 -15
  50. package/dist/helpers/get-default-options.mjs +0 -1
@@ -1 +1,92 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`./get-default-options.cjs`);let n=require(`@stryke/path/append`),r=require(`@stryke/path/file-path-fns`),i=require(`@stryke/path/replace`),a=require(`@stryke/path/resolve-parent-path`),o=require(`@stryke/string-format/title-case`),s=require(`@stryke/type-checks/is-set-object`),c=require(`@powerlines/deepkit/vendor/type`),l=require(`@powerlines/deepkit/reflect-type`),u=require(`@stryke/path/common`),d=require(`@stryke/path/normalize`),f=require(`@stryke/type-checks/is-set-string`);function p(e,t){return(0,i.replacePath)((0,r.findFilePath)(t),e.commandsPath).replaceAll(/^\/+/g,``).replaceAll(/\/+$/g,``)}function m(e){return(0,f.isSetString)(e.config.entry)?(0,n.appendPath)((0,n.appendPath)((0,d.stripStars)(e.config.entry),e.config.projectRoot),e.workspaceConfig.workspaceRoot):(0,s.isSetObject)(e.config.entry)&&`file`in e.config.entry?(0,n.appendPath)((0,n.appendPath)((0,d.stripStars)(e.config.entry.file),e.config.projectRoot),e.workspaceConfig.workspaceRoot):Array.isArray(e.config.entry)&&e.config.entry.length>0?(0,u.commonPath)(e.config.entry.map(t=>(0,n.appendPath)((0,n.appendPath)((0,d.stripStars)((0,f.isSetString)(t)?t:t.file),e.config.projectRoot),e.workspaceConfig.workspaceRoot))):(0,n.appendPath)(e.config.sourceRoot||e.config.projectRoot,e.workspaceConfig.workspaceRoot)}function h(e){let t=(0,r.findFolderName)(e),n=1;for(;t.startsWith(`[`)&&t.endsWith(`]`);)t=(0,r.findFolderName)((0,a.resolveParentPath)(e,n++));return t}async function g(e,n,r){let i=n.title||`${r?.title?`${r.title} - `:``}${(0,o.titleCase)(n.name)}`,a={...n,title:i,description:n.description||`The ${i} ${r?`sub-`:``}command.`,options:Object.fromEntries(t.getDefaultOptions(e,n).map(e=>[e.name,e])),params:[],parent:r??null,children:{}};if(n.isVirtual)e.trace(`Adding reflection for virtual command: ${n.id}`);else{if(!n.entry.input?.file||!e.fs.existsSync(n.entry.input.file))throw Error(`${n.entry.input?.file?`Non-existent`:`Missing`} command entry file for "${n.name}"`);e.trace(`Adding reflection for user-defined command: ${n.id} (file: ${n.entry.input.file})`);let t=await(0,l.reflectType)(e,n.entry.input);if(t.kind!==c.ReflectionKind.function)throw Error(`The command entry file "${n.entry.input.file}" does not export a valid function.`);if(t.parameters.length>0&&t.parameters[0]){let e=t.parameters[0];if(e.type.kind===c.ReflectionKind.objectLiteral||e.type.kind===c.ReflectionKind.class){let t=c.ReflectionClass.from(e.type);for(let e of t.getProperties()){let t=e.getType();if(a.options[e.getNameAsString()]={name:e.getNameAsString(),alias:e.getTags().alias??[],title:e.getTags().title||(0,o.titleCase)(e.getNameAsString()),description:e.getDescription(),kind:t.kind,optional:e.isOptional(),default:e.getDefaultValue(),variadic:!1},a.options[e.getNameAsString()].description??=`The ${a.options[e.getNameAsString()].title} option.`,t.kind===c.ReflectionKind.array)if(t.type.kind===c.ReflectionKind.string||t.type.kind===c.ReflectionKind.number)a.options[e.getNameAsString()].variadic=!0,a.options[e.getNameAsString()].kind=t.type.kind;else throw Error(`Unsupported array type for option "${e.getNameAsString()}" in command "${n.name}". Only string[] and number[] are supported.`);else if(t.kind!==c.ReflectionKind.boolean&&t.kind!==c.ReflectionKind.string&&t.kind!==c.ReflectionKind.number)throw Error(`Unsupported type for option "${e.getNameAsString()}" in command "${n.name}". Only string, number, boolean, string[] and number[] are supported, received ${(0,c.stringifyType)(t).trim().replaceAll(` | `,`, or `)}.`)}}}}for(let t of e.inputs.filter(e=>e.path.length===n.path.length+1&&e.path.slice(0,n.path.length).every((e,t)=>e===n.path[t])))a.children[t.name]=await g(e,t,a);return a}exports.findCommandName=h,exports.findCommandsRoot=m,exports.reflectCommandTree=g,exports.resolveCommandPath=p;
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
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_replace = require("@stryke/path/replace");
6
+ let __stryke_path_resolve_parent_path = require("@stryke/path/resolve-parent-path");
7
+ let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
8
+ let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
9
+ let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
10
+ let __powerlines_deepkit_reflect_type = require("@powerlines/deepkit/reflect-type");
11
+ let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
12
+ let __stryke_path_common = require("@stryke/path/common");
13
+ let __stryke_path_normalize = require("@stryke/path/normalize");
14
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
15
+
16
+ //#region src/helpers/resolve-command.ts
17
+ function resolveCommandPath(context, file) {
18
+ return (0, __stryke_path_replace.replacePath)((0, __stryke_path_file_path_fns.findFilePath)(file), context.commandsPath).replaceAll(/^\/+/g, "").replaceAll(/\/+$/g, "");
19
+ }
20
+ function findCommandsRoot(context) {
21
+ if ((0, __stryke_type_checks_is_set_string.isSetString)(context.config.entry)) return (0, __stryke_path_append.appendPath)((0, __stryke_path_append.appendPath)((0, __stryke_path_normalize.stripStars)(context.config.entry), context.config.projectRoot), context.workspaceConfig.workspaceRoot);
22
+ else if ((0, __stryke_type_checks_is_set_object.isSetObject)(context.config.entry) && "file" in context.config.entry) return (0, __stryke_path_append.appendPath)((0, __stryke_path_append.appendPath)((0, __stryke_path_normalize.stripStars)(context.config.entry.file), context.config.projectRoot), context.workspaceConfig.workspaceRoot);
23
+ else if (Array.isArray(context.config.entry) && context.config.entry.length > 0) return (0, __stryke_path_common.commonPath)(context.config.entry.map((entry) => (0, __stryke_path_append.appendPath)((0, __stryke_path_append.appendPath)((0, __stryke_path_normalize.stripStars)((0, __stryke_type_checks_is_set_string.isSetString)(entry) ? entry : entry.file), context.config.projectRoot), context.workspaceConfig.workspaceRoot)));
24
+ return (0, __stryke_path_append.appendPath)(context.config.sourceRoot || context.config.projectRoot, context.workspaceConfig.workspaceRoot);
25
+ }
26
+ /**
27
+ * Finds the command name from the given file path.
28
+ *
29
+ * @param file - The file path to extract the command name from.
30
+ * @returns The command name.
31
+ */
32
+ function findCommandName(file) {
33
+ let name = (0, __stryke_path_file_path_fns.findFolderName)(file);
34
+ let count = 1;
35
+ while (name.startsWith("[") && name.endsWith("]")) name = (0, __stryke_path_file_path_fns.findFolderName)((0, __stryke_path_resolve_parent_path.resolveParentPath)(file, count++));
36
+ return name;
37
+ }
38
+ async function reflectCommandTree(context, command, parent) {
39
+ const title = command.title || `${parent?.title ? `${parent.title} - ` : ""}${(0, __stryke_string_format_title_case.titleCase)(command.name)}`;
40
+ const commandTree = {
41
+ ...command,
42
+ title,
43
+ description: command.description || `The ${title} ${parent ? "sub-" : ""}command.`,
44
+ options: {},
45
+ params: [],
46
+ parent: parent ?? null,
47
+ children: {}
48
+ };
49
+ if (context.config.defaultOptions === false) commandTree.options = {};
50
+ else if (Array.isArray(context.config.defaultOptions)) commandTree.options = Object.fromEntries((0, __stryke_helpers_get_unique.getUniqueBy)(context.config.defaultOptions, (item) => item.name).map((option) => [option.name, option]));
51
+ else if ((0, __stryke_type_checks_is_function.isFunction)(context.config.defaultOptions)) commandTree.options = Object.fromEntries((0, __stryke_helpers_get_unique.getUniqueBy)(context.config.defaultOptions(context, command), (item) => item.name).map((option) => [option.name, option]));
52
+ if (command.isVirtual) context.trace(`Adding reflection for virtual command: ${command.id}`);
53
+ else {
54
+ if (!command.entry.input?.file || !context.fs.existsSync(command.entry.input.file)) throw new Error(`${!command.entry.input?.file ? "Missing" : "Non-existent"} command entry file for "${command.name}"`);
55
+ context.trace(`Adding reflection for user-defined command: ${command.id} (file: ${command.entry.input.file})`);
56
+ const type = await (0, __powerlines_deepkit_reflect_type.reflectType)(context, command.entry.input);
57
+ if (type.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.function) throw new Error(`The command entry file "${command.entry.input.file}" does not export a valid function.`);
58
+ if (type.parameters.length > 0 && type.parameters[0]) {
59
+ const firstParam = type.parameters[0];
60
+ if (firstParam.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral || firstParam.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.class) {
61
+ const optionsReflection = __powerlines_deepkit_vendor_type.ReflectionClass.from(firstParam.type);
62
+ for (const propertyReflection of optionsReflection.getProperties()) {
63
+ const propertyType = propertyReflection.getType();
64
+ commandTree.options[propertyReflection.getNameAsString()] = {
65
+ name: propertyReflection.getNameAsString(),
66
+ alias: propertyReflection.getTags().alias ?? [],
67
+ title: propertyReflection.getTags().title || (0, __stryke_string_format_title_case.titleCase)(propertyReflection.getNameAsString()),
68
+ description: propertyReflection.getDescription(),
69
+ kind: propertyType.kind,
70
+ optional: propertyReflection.isOptional(),
71
+ default: propertyReflection.getDefaultValue(),
72
+ variadic: false
73
+ };
74
+ commandTree.options[propertyReflection.getNameAsString()].description ??= `The ${commandTree.options[propertyReflection.getNameAsString()].title} option.`;
75
+ if (propertyType.kind === __powerlines_deepkit_vendor_type.ReflectionKind.array) if (propertyType.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || propertyType.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) {
76
+ commandTree.options[propertyReflection.getNameAsString()].variadic = true;
77
+ commandTree.options[propertyReflection.getNameAsString()].kind = propertyType.type.kind;
78
+ } else throw new Error(`Unsupported array type for option "${propertyReflection.getNameAsString()}" in command "${command.name}". Only string[] and number[] are supported.`);
79
+ else if (propertyType.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.boolean && propertyType.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.string && propertyType.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.number) throw new Error(`Unsupported type for option "${propertyReflection.getNameAsString()}" in command "${command.name}". Only string, number, boolean, string[] and number[] are supported, received ${(0, __powerlines_deepkit_vendor_type.stringifyType)(propertyType).trim().replaceAll(" | ", ", or ")}.`);
80
+ }
81
+ }
82
+ }
83
+ }
84
+ for (const input of context.inputs.filter((input$1) => input$1.path.length === command.path.length + 1 && input$1.path.slice(0, command.path.length).every((value, index) => value === command.path[index]))) commandTree.children[input.name] = await reflectCommandTree(context, input, commandTree);
85
+ return commandTree;
86
+ }
87
+
88
+ //#endregion
89
+ exports.findCommandName = findCommandName;
90
+ exports.findCommandsRoot = findCommandsRoot;
91
+ exports.reflectCommandTree = reflectCommandTree;
92
+ exports.resolveCommandPath = resolveCommandPath;
@@ -1 +1,88 @@
1
- import{getDefaultOptions as e}from"./get-default-options.mjs";import{appendPath as t}from"@stryke/path/append";import{findFilePath as n,findFolderName as r}from"@stryke/path/file-path-fns";import{replacePath as i}from"@stryke/path/replace";import{resolveParentPath as a}from"@stryke/path/resolve-parent-path";import{titleCase as o}from"@stryke/string-format/title-case";import{isSetObject as s}from"@stryke/type-checks/is-set-object";import{ReflectionClass as c,ReflectionKind as l,stringifyType as u}from"@powerlines/deepkit/vendor/type";import{reflectType as d}from"@powerlines/deepkit/reflect-type";import{commonPath as f}from"@stryke/path/common";import{stripStars as p}from"@stryke/path/normalize";import{isSetString as m}from"@stryke/type-checks/is-set-string";function h(e,t){return i(n(t),e.commandsPath).replaceAll(/^\/+/g,``).replaceAll(/\/+$/g,``)}function g(e){return m(e.config.entry)?t(t(p(e.config.entry),e.config.projectRoot),e.workspaceConfig.workspaceRoot):s(e.config.entry)&&`file`in e.config.entry?t(t(p(e.config.entry.file),e.config.projectRoot),e.workspaceConfig.workspaceRoot):Array.isArray(e.config.entry)&&e.config.entry.length>0?f(e.config.entry.map(n=>t(t(p(m(n)?n:n.file),e.config.projectRoot),e.workspaceConfig.workspaceRoot))):t(e.config.sourceRoot||e.config.projectRoot,e.workspaceConfig.workspaceRoot)}function _(e){let t=r(e),n=1;for(;t.startsWith(`[`)&&t.endsWith(`]`);)t=r(a(e,n++));return t}async function v(t,n,r){let i=n.title||`${r?.title?`${r.title} - `:``}${o(n.name)}`,a={...n,title:i,description:n.description||`The ${i} ${r?`sub-`:``}command.`,options:Object.fromEntries(e(t,n).map(e=>[e.name,e])),params:[],parent:r??null,children:{}};if(n.isVirtual)t.trace(`Adding reflection for virtual command: ${n.id}`);else{if(!n.entry.input?.file||!t.fs.existsSync(n.entry.input.file))throw Error(`${n.entry.input?.file?`Non-existent`:`Missing`} command entry file for "${n.name}"`);t.trace(`Adding reflection for user-defined command: ${n.id} (file: ${n.entry.input.file})`);let e=await d(t,n.entry.input);if(e.kind!==l.function)throw Error(`The command entry file "${n.entry.input.file}" does not export a valid function.`);if(e.parameters.length>0&&e.parameters[0]){let t=e.parameters[0];if(t.type.kind===l.objectLiteral||t.type.kind===l.class){let e=c.from(t.type);for(let t of e.getProperties()){let e=t.getType();if(a.options[t.getNameAsString()]={name:t.getNameAsString(),alias:t.getTags().alias??[],title:t.getTags().title||o(t.getNameAsString()),description:t.getDescription(),kind:e.kind,optional:t.isOptional(),default:t.getDefaultValue(),variadic:!1},a.options[t.getNameAsString()].description??=`The ${a.options[t.getNameAsString()].title} option.`,e.kind===l.array)if(e.type.kind===l.string||e.type.kind===l.number)a.options[t.getNameAsString()].variadic=!0,a.options[t.getNameAsString()].kind=e.type.kind;else throw Error(`Unsupported array type for option "${t.getNameAsString()}" in command "${n.name}". Only string[] and number[] are supported.`);else if(e.kind!==l.boolean&&e.kind!==l.string&&e.kind!==l.number)throw Error(`Unsupported type for option "${t.getNameAsString()}" in command "${n.name}". Only string, number, boolean, string[] and number[] are supported, received ${u(e).trim().replaceAll(` | `,`, or `)}.`)}}}}for(let e of t.inputs.filter(e=>e.path.length===n.path.length+1&&e.path.slice(0,n.path.length).every((e,t)=>e===n.path[t])))a.children[e.name]=await v(t,e,a);return a}export{_ as findCommandName,g as findCommandsRoot,v as reflectCommandTree,h as resolveCommandPath};
1
+ import { getUniqueBy } from "@stryke/helpers/get-unique";
2
+ import { appendPath } from "@stryke/path/append";
3
+ import { findFilePath, findFolderName } from "@stryke/path/file-path-fns";
4
+ import { replacePath } from "@stryke/path/replace";
5
+ import { resolveParentPath } from "@stryke/path/resolve-parent-path";
6
+ import { titleCase } from "@stryke/string-format/title-case";
7
+ import { isFunction } from "@stryke/type-checks/is-function";
8
+ import { isSetObject } from "@stryke/type-checks/is-set-object";
9
+ import { reflectType } from "@powerlines/deepkit/reflect-type";
10
+ import { ReflectionClass, ReflectionKind, stringifyType } from "@powerlines/deepkit/vendor/type";
11
+ import { commonPath } from "@stryke/path/common";
12
+ import { stripStars } from "@stryke/path/normalize";
13
+ import { isSetString } from "@stryke/type-checks/is-set-string";
14
+
15
+ //#region src/helpers/resolve-command.ts
16
+ function resolveCommandPath(context, file) {
17
+ return replacePath(findFilePath(file), context.commandsPath).replaceAll(/^\/+/g, "").replaceAll(/\/+$/g, "");
18
+ }
19
+ function findCommandsRoot(context) {
20
+ if (isSetString(context.config.entry)) return appendPath(appendPath(stripStars(context.config.entry), context.config.projectRoot), context.workspaceConfig.workspaceRoot);
21
+ else if (isSetObject(context.config.entry) && "file" in context.config.entry) return appendPath(appendPath(stripStars(context.config.entry.file), context.config.projectRoot), context.workspaceConfig.workspaceRoot);
22
+ else if (Array.isArray(context.config.entry) && context.config.entry.length > 0) return commonPath(context.config.entry.map((entry) => appendPath(appendPath(stripStars(isSetString(entry) ? entry : entry.file), context.config.projectRoot), context.workspaceConfig.workspaceRoot)));
23
+ return appendPath(context.config.sourceRoot || context.config.projectRoot, context.workspaceConfig.workspaceRoot);
24
+ }
25
+ /**
26
+ * Finds the command name from the given file path.
27
+ *
28
+ * @param file - The file path to extract the command name from.
29
+ * @returns The command name.
30
+ */
31
+ function findCommandName(file) {
32
+ let name = findFolderName(file);
33
+ let count = 1;
34
+ while (name.startsWith("[") && name.endsWith("]")) name = findFolderName(resolveParentPath(file, count++));
35
+ return name;
36
+ }
37
+ async function reflectCommandTree(context, command, parent) {
38
+ const title = command.title || `${parent?.title ? `${parent.title} - ` : ""}${titleCase(command.name)}`;
39
+ const commandTree = {
40
+ ...command,
41
+ title,
42
+ description: command.description || `The ${title} ${parent ? "sub-" : ""}command.`,
43
+ options: {},
44
+ params: [],
45
+ parent: parent ?? null,
46
+ children: {}
47
+ };
48
+ if (context.config.defaultOptions === false) commandTree.options = {};
49
+ else if (Array.isArray(context.config.defaultOptions)) commandTree.options = Object.fromEntries(getUniqueBy(context.config.defaultOptions, (item) => item.name).map((option) => [option.name, option]));
50
+ else if (isFunction(context.config.defaultOptions)) commandTree.options = Object.fromEntries(getUniqueBy(context.config.defaultOptions(context, command), (item) => item.name).map((option) => [option.name, option]));
51
+ if (command.isVirtual) context.trace(`Adding reflection for virtual command: ${command.id}`);
52
+ else {
53
+ if (!command.entry.input?.file || !context.fs.existsSync(command.entry.input.file)) throw new Error(`${!command.entry.input?.file ? "Missing" : "Non-existent"} command entry file for "${command.name}"`);
54
+ context.trace(`Adding reflection for user-defined command: ${command.id} (file: ${command.entry.input.file})`);
55
+ const type = await reflectType(context, command.entry.input);
56
+ if (type.kind !== ReflectionKind.function) throw new Error(`The command entry file "${command.entry.input.file}" does not export a valid function.`);
57
+ if (type.parameters.length > 0 && type.parameters[0]) {
58
+ const firstParam = type.parameters[0];
59
+ if (firstParam.type.kind === ReflectionKind.objectLiteral || firstParam.type.kind === ReflectionKind.class) {
60
+ const optionsReflection = ReflectionClass.from(firstParam.type);
61
+ for (const propertyReflection of optionsReflection.getProperties()) {
62
+ const propertyType = propertyReflection.getType();
63
+ commandTree.options[propertyReflection.getNameAsString()] = {
64
+ name: propertyReflection.getNameAsString(),
65
+ alias: propertyReflection.getTags().alias ?? [],
66
+ title: propertyReflection.getTags().title || titleCase(propertyReflection.getNameAsString()),
67
+ description: propertyReflection.getDescription(),
68
+ kind: propertyType.kind,
69
+ optional: propertyReflection.isOptional(),
70
+ default: propertyReflection.getDefaultValue(),
71
+ variadic: false
72
+ };
73
+ commandTree.options[propertyReflection.getNameAsString()].description ??= `The ${commandTree.options[propertyReflection.getNameAsString()].title} option.`;
74
+ if (propertyType.kind === ReflectionKind.array) if (propertyType.type.kind === ReflectionKind.string || propertyType.type.kind === ReflectionKind.number) {
75
+ commandTree.options[propertyReflection.getNameAsString()].variadic = true;
76
+ commandTree.options[propertyReflection.getNameAsString()].kind = propertyType.type.kind;
77
+ } else throw new Error(`Unsupported array type for option "${propertyReflection.getNameAsString()}" in command "${command.name}". Only string[] and number[] are supported.`);
78
+ else if (propertyType.kind !== ReflectionKind.boolean && propertyType.kind !== ReflectionKind.string && propertyType.kind !== ReflectionKind.number) throw new Error(`Unsupported type for option "${propertyReflection.getNameAsString()}" in command "${command.name}". Only string, number, boolean, string[] and number[] are supported, received ${stringifyType(propertyType).trim().replaceAll(" | ", ", or ")}.`);
79
+ }
80
+ }
81
+ }
82
+ }
83
+ for (const input of context.inputs.filter((input$1) => input$1.path.length === command.path.length + 1 && input$1.path.slice(0, command.path.length).every((value, index) => value === command.path[index]))) commandTree.children[input.name] = await reflectCommandTree(context, input, commandTree);
84
+ return commandTree;
85
+ }
86
+
87
+ //#endregion
88
+ export { findCommandName, findCommandsRoot, reflectCommandTree, resolveCommandPath };
@@ -1 +1,28 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/join-paths`),n=require(`@stryke/path/replace`),r=require(`@stryke/type-checks/is-set-object`),i=require(`@stryke/convert/to-array`),a=require(`@stryke/helpers/get-unique`),o=require(`@stryke/json/storm-json`),s=require(`@stryke/string-format/kebab-case`);function c(e,t){return`./bin/${(0,s.kebabCase)((0,n.replaceExtension)(e))}.${t===`cjs`||Array.isArray(t)&&t.includes(`cjs`)?`cjs`:`mjs`}`}async function l(e){let n=(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`package.json`);if(e.config.bin&&Array.isArray(e.config.bin)&&e.config.bin.length>0?(e.packageJson.bin=Object.fromEntries((0,a.getUnique)((0,i.toArray)(e.config.bin)).map(t=>[t,c(t,e.config.output.format)])),await e.fs.write(n,o.StormJSON.stringify(e.packageJson))):!(0,r.isSetObject)(e.packageJson.bin)&&(e.config.name||e.packageJson.name)&&(e.packageJson.bin={[e.config.name||e.packageJson.name]:c(e.config.name||e.packageJson.name,e.config.output.format)},await e.fs.write(n,o.StormJSON.stringify(e.packageJson))),!(0,r.isSetObject)(e.packageJson.bin))throw Error("Unable to determine the CLI binary name. Please specify the `bin` option in your Shell Shock configuration or ensure that the `name` field is set in your package.json.");e.config.bin=Object.keys(e.packageJson.bin)}exports.updatePackageJsonBinary=l;
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
3
+ let __stryke_path_join_paths = require("@stryke/path/join-paths");
4
+ let __stryke_path_replace = require("@stryke/path/replace");
5
+ let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
6
+ let __stryke_convert_to_array = require("@stryke/convert/to-array");
7
+ let __stryke_json_storm_json = require("@stryke/json/storm-json");
8
+ let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
9
+
10
+ //#region src/helpers/update-package-json.ts
11
+ function formatBinaryPath(name, format) {
12
+ return `./bin/${(0, __stryke_string_format_kebab_case.kebabCase)((0, __stryke_path_replace.replaceExtension)(name))}.${format === "cjs" || Array.isArray(format) && format.includes("cjs") ? "cjs" : "mjs"}`;
13
+ }
14
+ async function updatePackageJsonBinary(context) {
15
+ const packageJsonPath = (0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, "package.json");
16
+ if (context.config.bin && Array.isArray(context.config.bin) && context.config.bin.length > 0) {
17
+ context.packageJson.bin = Object.fromEntries((0, __stryke_helpers_get_unique.getUnique)((0, __stryke_convert_to_array.toArray)(context.config.bin)).map((bin) => [bin, formatBinaryPath(bin, context.config.output.format)]));
18
+ await context.fs.write(packageJsonPath, __stryke_json_storm_json.StormJSON.stringify(context.packageJson));
19
+ } else if (!(0, __stryke_type_checks_is_set_object.isSetObject)(context.packageJson.bin) && (context.config.name || context.packageJson.name)) {
20
+ context.packageJson.bin = { [context.config.name || context.packageJson.name]: formatBinaryPath(context.config.name || context.packageJson.name, context.config.output.format) };
21
+ await context.fs.write(packageJsonPath, __stryke_json_storm_json.StormJSON.stringify(context.packageJson));
22
+ }
23
+ if (!(0, __stryke_type_checks_is_set_object.isSetObject)(context.packageJson.bin)) throw new Error("Unable to determine the CLI binary name. Please specify the `bin` option in your Shell Shock configuration or ensure that the `name` field is set in your package.json.");
24
+ context.config.bin = Object.keys(context.packageJson.bin);
25
+ }
26
+
27
+ //#endregion
28
+ exports.updatePackageJsonBinary = updatePackageJsonBinary;
@@ -1 +1,27 @@
1
- import{joinPaths as e}from"@stryke/path/join-paths";import{replaceExtension as t}from"@stryke/path/replace";import{isSetObject as n}from"@stryke/type-checks/is-set-object";import{toArray as r}from"@stryke/convert/to-array";import{getUnique as i}from"@stryke/helpers/get-unique";import{StormJSON as a}from"@stryke/json/storm-json";import{kebabCase as o}from"@stryke/string-format/kebab-case";function s(e,n){return`./bin/${o(t(e))}.${n===`cjs`||Array.isArray(n)&&n.includes(`cjs`)?`cjs`:`mjs`}`}async function c(t){let o=e(t.workspaceConfig.workspaceRoot,t.config.projectRoot,`package.json`);if(t.config.bin&&Array.isArray(t.config.bin)&&t.config.bin.length>0?(t.packageJson.bin=Object.fromEntries(i(r(t.config.bin)).map(e=>[e,s(e,t.config.output.format)])),await t.fs.write(o,a.stringify(t.packageJson))):!n(t.packageJson.bin)&&(t.config.name||t.packageJson.name)&&(t.packageJson.bin={[t.config.name||t.packageJson.name]:s(t.config.name||t.packageJson.name,t.config.output.format)},await t.fs.write(o,a.stringify(t.packageJson))),!n(t.packageJson.bin))throw Error("Unable to determine the CLI binary name. Please specify the `bin` option in your Shell Shock configuration or ensure that the `name` field is set in your package.json.");t.config.bin=Object.keys(t.packageJson.bin)}export{c as updatePackageJsonBinary};
1
+ import { getUnique } from "@stryke/helpers/get-unique";
2
+ import { joinPaths } from "@stryke/path/join-paths";
3
+ import { replaceExtension } from "@stryke/path/replace";
4
+ import { isSetObject } from "@stryke/type-checks/is-set-object";
5
+ import { toArray } from "@stryke/convert/to-array";
6
+ import { StormJSON } from "@stryke/json/storm-json";
7
+ import { kebabCase } from "@stryke/string-format/kebab-case";
8
+
9
+ //#region src/helpers/update-package-json.ts
10
+ function formatBinaryPath(name, format) {
11
+ return `./bin/${kebabCase(replaceExtension(name))}.${format === "cjs" || Array.isArray(format) && format.includes("cjs") ? "cjs" : "mjs"}`;
12
+ }
13
+ async function updatePackageJsonBinary(context) {
14
+ const packageJsonPath = joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, "package.json");
15
+ if (context.config.bin && Array.isArray(context.config.bin) && context.config.bin.length > 0) {
16
+ context.packageJson.bin = Object.fromEntries(getUnique(toArray(context.config.bin)).map((bin) => [bin, formatBinaryPath(bin, context.config.output.format)]));
17
+ await context.fs.write(packageJsonPath, StormJSON.stringify(context.packageJson));
18
+ } else if (!isSetObject(context.packageJson.bin) && (context.config.name || context.packageJson.name)) {
19
+ context.packageJson.bin = { [context.config.name || context.packageJson.name]: formatBinaryPath(context.config.name || context.packageJson.name, context.config.output.format) };
20
+ await context.fs.write(packageJsonPath, StormJSON.stringify(context.packageJson));
21
+ }
22
+ if (!isSetObject(context.packageJson.bin)) throw new Error("Unable to determine the CLI binary name. Please specify the `bin` option in your Shell Shock configuration or ensure that the `name` field is set in your package.json.");
23
+ context.config.bin = Object.keys(context.packageJson.bin);
24
+ }
25
+
26
+ //#endregion
27
+ export { updatePackageJsonBinary };
@@ -1 +1,41 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/string-format/title-case`),n=require(`@stryke/type-checks/is-set-string`),r=require(`@stryke/string-format/kebab-case`);function i(e){let t=e.config.bin&&((0,n.isSetString)(e.config.bin)||Array.isArray(e.config.bin)&&e.config.bin.length>0&&e.config.bin[0])?(0,n.isSetString)(e.config.bin)?e.config.bin:e.config.bin[0]:e.config.name||e.packageJson?.name;if(!(0,n.isSetString)(t))throw Error(`No application name found. Please provide a 'bin' option in the configuration or ensure the package.json has a valid 'name' field.`);return(0,r.kebabCase)(t)}function a(e){return(0,t.titleCase)(e.config.name||i(e))}function o(e){return e.config.description||e.packageJson?.description||`The ${a(e)} command-line interface application.`}exports.getAppDescription=o,exports.getAppName=i,exports.getAppTitle=a;
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
3
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
4
+ let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
5
+
6
+ //#region src/helpers/utilities.ts
7
+ /**
8
+ * Retrieves the application name from the context and configuration.
9
+ *
10
+ * @param context - The build context containing workspace and package information.
11
+ * @returns The application name in kebab-case format.
12
+ * @throws An error if no valid application name is found.
13
+ */
14
+ function getAppName(context) {
15
+ const result = context.config.bin && ((0, __stryke_type_checks_is_set_string.isSetString)(context.config.bin) || Array.isArray(context.config.bin) && context.config.bin.length > 0 && context.config.bin[0]) ? (0, __stryke_type_checks_is_set_string.isSetString)(context.config.bin) ? context.config.bin : context.config.bin[0] : context.config.name || context.packageJson?.name;
16
+ if (!(0, __stryke_type_checks_is_set_string.isSetString)(result)) throw new Error("No application name found. Please provide a 'bin' option in the configuration or ensure the package.json has a valid 'name' field.");
17
+ return (0, __stryke_string_format_kebab_case.kebabCase)(result);
18
+ }
19
+ /**
20
+ * Retrieves the application title from the context and configuration.
21
+ *
22
+ * @param context - The build context containing workspace and package information.
23
+ * @returns The application title in title-case format.
24
+ */
25
+ function getAppTitle(context) {
26
+ return (0, __stryke_string_format_title_case.titleCase)(context.config.name || getAppName(context));
27
+ }
28
+ /**
29
+ * Retrieves the application description from the context and configuration.
30
+ *
31
+ * @param context - The build context containing workspace and package information.
32
+ * @returns The application description.
33
+ */
34
+ function getAppDescription(context) {
35
+ return context.config.description || context.packageJson?.description || `The ${getAppTitle(context)} command-line interface application.`;
36
+ }
37
+
38
+ //#endregion
39
+ exports.getAppDescription = getAppDescription;
40
+ exports.getAppName = getAppName;
41
+ exports.getAppTitle = getAppTitle;
@@ -1 +1,38 @@
1
- import{titleCase as e}from"@stryke/string-format/title-case";import{isSetString as t}from"@stryke/type-checks/is-set-string";import{kebabCase as n}from"@stryke/string-format/kebab-case";function r(e){let r=e.config.bin&&(t(e.config.bin)||Array.isArray(e.config.bin)&&e.config.bin.length>0&&e.config.bin[0])?t(e.config.bin)?e.config.bin:e.config.bin[0]:e.config.name||e.packageJson?.name;if(!t(r))throw Error(`No application name found. Please provide a 'bin' option in the configuration or ensure the package.json has a valid 'name' field.`);return n(r)}function i(t){return e(t.config.name||r(t))}function a(e){return e.config.description||e.packageJson?.description||`The ${i(e)} command-line interface application.`}export{a as getAppDescription,r as getAppName,i as getAppTitle};
1
+ import { titleCase } from "@stryke/string-format/title-case";
2
+ import { isSetString } from "@stryke/type-checks/is-set-string";
3
+ import { kebabCase } from "@stryke/string-format/kebab-case";
4
+
5
+ //#region src/helpers/utilities.ts
6
+ /**
7
+ * Retrieves the application name from the context and configuration.
8
+ *
9
+ * @param context - The build context containing workspace and package information.
10
+ * @returns The application name in kebab-case format.
11
+ * @throws An error if no valid application name is found.
12
+ */
13
+ function getAppName(context) {
14
+ const result = context.config.bin && (isSetString(context.config.bin) || Array.isArray(context.config.bin) && context.config.bin.length > 0 && context.config.bin[0]) ? isSetString(context.config.bin) ? context.config.bin : context.config.bin[0] : context.config.name || context.packageJson?.name;
15
+ if (!isSetString(result)) throw new Error("No application name found. Please provide a 'bin' option in the configuration or ensure the package.json has a valid 'name' field.");
16
+ return kebabCase(result);
17
+ }
18
+ /**
19
+ * Retrieves the application title from the context and configuration.
20
+ *
21
+ * @param context - The build context containing workspace and package information.
22
+ * @returns The application title in title-case format.
23
+ */
24
+ function getAppTitle(context) {
25
+ return titleCase(context.config.name || getAppName(context));
26
+ }
27
+ /**
28
+ * Retrieves the application description from the context and configuration.
29
+ *
30
+ * @param context - The build context containing workspace and package information.
31
+ * @returns The application description.
32
+ */
33
+ function getAppDescription(context) {
34
+ return context.config.description || context.packageJson?.description || `The ${getAppTitle(context)} command-line interface application.`;
35
+ }
36
+
37
+ //#endregion
38
+ export { getAppDescription, getAppName, getAppTitle };
package/dist/index.cjs CHANGED
@@ -1 +1,24 @@
1
- Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./helpers/get-default-options.cjs`),t=require(`./powerlines.cjs`),n=require(`./api.cjs`),r=require(`./config.cjs`);async function i(e={}){return e.root??=process.cwd(),n.ShellShockAPI.from(e)}var a=n.ShellShockAPI;exports.ShellShockAPI=n.ShellShockAPI,exports.createShellShock=i,exports.default=a,exports.defineConfig=r.defineConfig,exports.getDefaultOptions=e.getDefaultOptions,exports.shellShock=t.shellShock;
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+ const require_powerlines = require('./powerlines.cjs');
3
+ const require_api = require('./api.cjs');
4
+ const require_config = require('./config.cjs');
5
+
6
+ //#region src/index.ts
7
+ /**
8
+ * Creates a new {@link ShellShockAPI} instance.
9
+ *
10
+ * @param options - The user configuration options.
11
+ * @returns A promise that resolves to a {@link ShellShockAPI} instance.
12
+ */
13
+ async function createShellShock(options = {}) {
14
+ options.root ??= process.cwd();
15
+ return require_api.ShellShockAPI.from(options);
16
+ }
17
+ var src_default = require_api.ShellShockAPI;
18
+
19
+ //#endregion
20
+ exports.ShellShockAPI = require_api.ShellShockAPI;
21
+ exports.createShellShock = createShellShock;
22
+ exports.default = src_default;
23
+ exports.defineConfig = require_config.defineConfig;
24
+ exports.shellShock = require_powerlines.shellShock;
package/dist/index.d.cts CHANGED
@@ -3,9 +3,9 @@ import { Context } from "./types/context.cjs";
3
3
  import { Options, ResolvedConfig, UserConfig } from "./types/config.cjs";
4
4
  import { ShellShockAPI } from "./api.cjs";
5
5
  import { defineConfig } from "./config.cjs";
6
- import { getDefaultOptions } from "./helpers/get-default-options.cjs";
7
6
  import shellShock from "./powerlines.cjs";
8
7
  import { BaseCommandOptions } from "./types/options.cjs";
8
+ import "./types/index.cjs";
9
9
 
10
10
  //#region src/index.d.ts
11
11
 
@@ -17,4 +17,4 @@ import { BaseCommandOptions } from "./types/options.cjs";
17
17
  */
18
18
  declare function createShellShock(options?: Partial<UserConfig>): Promise<ShellShockAPI>;
19
19
  //#endregion
20
- export { BaseCommandOption, BaseCommandOptions, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, Context, NumberCommandOption, Options, ResolvedConfig, SerializedCommandTree, ShellShockAPI, ShellShockAPI as default, StringCommandOption, UserConfig, createShellShock, defineConfig, getDefaultOptions, shellShock };
20
+ export { BaseCommandOption, BaseCommandOptions, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, Context, NumberCommandOption, Options, ResolvedConfig, SerializedCommandTree, ShellShockAPI, ShellShockAPI as default, StringCommandOption, UserConfig, createShellShock, defineConfig, shellShock };
package/dist/index.d.mts CHANGED
@@ -3,7 +3,6 @@ import { Context } from "./types/context.mjs";
3
3
  import { Options, ResolvedConfig, UserConfig } from "./types/config.mjs";
4
4
  import { ShellShockAPI } from "./api.mjs";
5
5
  import { defineConfig } from "./config.mjs";
6
- import { getDefaultOptions } from "./helpers/get-default-options.mjs";
7
6
  import shellShock from "./powerlines.mjs";
8
7
  import { BaseCommandOptions } from "./types/options.mjs";
9
8
  import "./types/index.mjs";
@@ -18,4 +17,4 @@ import "./types/index.mjs";
18
17
  */
19
18
  declare function createShellShock(options?: Partial<UserConfig>): Promise<ShellShockAPI>;
20
19
  //#endregion
21
- export { BaseCommandOption, BaseCommandOptions, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, Context, NumberCommandOption, Options, ResolvedConfig, SerializedCommandTree, ShellShockAPI, ShellShockAPI as default, StringCommandOption, UserConfig, createShellShock, defineConfig, getDefaultOptions, shellShock };
20
+ export { BaseCommandOption, BaseCommandOptions, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, Context, NumberCommandOption, Options, ResolvedConfig, SerializedCommandTree, ShellShockAPI, ShellShockAPI as default, StringCommandOption, UserConfig, createShellShock, defineConfig, shellShock };
package/dist/index.mjs CHANGED
@@ -1 +1,19 @@
1
- import{getDefaultOptions as e}from"./helpers/get-default-options.mjs";import{shellShock as t}from"./powerlines.mjs";import{ShellShockAPI as n}from"./api.mjs";import{defineConfig as r}from"./config.mjs";async function i(e={}){return e.root??=process.cwd(),n.from(e)}var a=n;export{n as ShellShockAPI,i as createShellShock,a as default,r as defineConfig,e as getDefaultOptions,t as shellShock};
1
+ import { shellShock } from "./powerlines.mjs";
2
+ import { ShellShockAPI } from "./api.mjs";
3
+ import { defineConfig } from "./config.mjs";
4
+
5
+ //#region src/index.ts
6
+ /**
7
+ * Creates a new {@link ShellShockAPI} instance.
8
+ *
9
+ * @param options - The user configuration options.
10
+ * @returns A promise that resolves to a {@link ShellShockAPI} instance.
11
+ */
12
+ async function createShellShock(options = {}) {
13
+ options.root ??= process.cwd();
14
+ return ShellShockAPI.from(options);
15
+ }
16
+ var src_default = ShellShockAPI;
17
+
18
+ //#endregion
19
+ export { ShellShockAPI, createShellShock, src_default as default, defineConfig, shellShock };
@@ -0,0 +1,22 @@
1
+
2
+ //#region src/plugin-utils/get-command-tree.ts
3
+ /**
4
+ * Retrieves a specific command tree based on the provided path.
5
+ *
6
+ * @param context - The build context containing the command definitions.
7
+ * @param path - An array of strings representing the command path.
8
+ * @returns The command tree at the specified path, or null if not found.
9
+ */
10
+ function getCommandTree(context, path = []) {
11
+ if (path.length === 0) return null;
12
+ let currentTree = context.commands[path[0]] ?? null;
13
+ if (path.length > 1) {
14
+ const segments = path.slice(1);
15
+ for (const segment of segments) if (currentTree?.children && Object.prototype.hasOwnProperty.call(currentTree.children, segment)) currentTree = currentTree.children[segment] ?? null;
16
+ else return null;
17
+ }
18
+ return currentTree;
19
+ }
20
+
21
+ //#endregion
22
+ exports.getCommandTree = getCommandTree;
@@ -0,0 +1,15 @@
1
+ import { CommandTree } from "../types/command.cjs";
2
+ import { Context } from "../types/context.cjs";
3
+
4
+ //#region src/plugin-utils/get-command-tree.d.ts
5
+
6
+ /**
7
+ * Retrieves a specific command tree based on the provided path.
8
+ *
9
+ * @param context - The build context containing the command definitions.
10
+ * @param path - An array of strings representing the command path.
11
+ * @returns The command tree at the specified path, or null if not found.
12
+ */
13
+ declare function getCommandTree(context: Context, path?: string[]): CommandTree | null;
14
+ //#endregion
15
+ export { getCommandTree };
@@ -0,0 +1,15 @@
1
+ import { CommandTree } from "../types/command.mjs";
2
+ import { Context } from "../types/context.mjs";
3
+
4
+ //#region src/plugin-utils/get-command-tree.d.ts
5
+
6
+ /**
7
+ * Retrieves a specific command tree based on the provided path.
8
+ *
9
+ * @param context - The build context containing the command definitions.
10
+ * @param path - An array of strings representing the command path.
11
+ * @returns The command tree at the specified path, or null if not found.
12
+ */
13
+ declare function getCommandTree(context: Context, path?: string[]): CommandTree | null;
14
+ //#endregion
15
+ export { getCommandTree };
@@ -0,0 +1,21 @@
1
+ //#region src/plugin-utils/get-command-tree.ts
2
+ /**
3
+ * Retrieves a specific command tree based on the provided path.
4
+ *
5
+ * @param context - The build context containing the command definitions.
6
+ * @param path - An array of strings representing the command path.
7
+ * @returns The command tree at the specified path, or null if not found.
8
+ */
9
+ function getCommandTree(context, path = []) {
10
+ if (path.length === 0) return null;
11
+ let currentTree = context.commands[path[0]] ?? null;
12
+ if (path.length > 1) {
13
+ const segments = path.slice(1);
14
+ for (const segment of segments) if (currentTree?.children && Object.prototype.hasOwnProperty.call(currentTree.children, segment)) currentTree = currentTree.children[segment] ?? null;
15
+ else return null;
16
+ }
17
+ return currentTree;
18
+ }
19
+
20
+ //#endregion
21
+ export { getCommandTree };
@@ -0,0 +1,3 @@
1
+ const require_plugin_utils_get_command_tree = require('./get-command-tree.cjs');
2
+
3
+ exports.getCommandTree = require_plugin_utils_get_command_tree.getCommandTree;
@@ -0,0 +1,2 @@
1
+ import { getCommandTree } from "./get-command-tree.cjs";
2
+ export { getCommandTree };
@@ -0,0 +1,2 @@
1
+ import { getCommandTree } from "./get-command-tree.mjs";
2
+ export { getCommandTree };
@@ -0,0 +1,3 @@
1
+ import { getCommandTree } from "./get-command-tree.mjs";
2
+
3
+ export { getCommandTree };