@shell-shock/core 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/api.cjs +15 -3
- package/dist/api.cjs.map +1 -0
- package/dist/api.d.cts +9 -1
- package/dist/api.d.cts.map +1 -0
- package/dist/api.d.mts +9 -1
- package/dist/api.d.mts.map +1 -0
- package/dist/api.mjs +14 -3
- package/dist/api.mjs.map +1 -0
- package/dist/components/docs.cjs +175 -0
- package/dist/components/docs.cjs.map +1 -0
- package/dist/components/docs.d.cts +81 -0
- package/dist/components/docs.d.cts.map +1 -0
- package/dist/components/docs.d.mts +81 -0
- package/dist/components/docs.d.mts.map +1 -0
- package/dist/components/docs.mjs +171 -0
- package/dist/components/docs.mjs.map +1 -0
- package/dist/components/index.cjs +5 -6
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.mjs +2 -2
- package/dist/config.cjs +2 -1
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +2 -1
- package/dist/config.d.cts.map +1 -0
- package/dist/config.d.mts +2 -1
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +2 -1
- package/dist/config.mjs.map +1 -0
- package/dist/contexts/command.cjs +21 -0
- package/dist/contexts/command.cjs.map +1 -0
- package/dist/contexts/command.d.cts +18 -0
- package/dist/contexts/command.d.cts.map +1 -0
- package/dist/contexts/command.d.mts +18 -0
- package/dist/contexts/command.d.mts.map +1 -0
- package/dist/contexts/command.mjs +19 -0
- package/dist/contexts/command.mjs.map +1 -0
- package/dist/contexts/index.cjs +4 -0
- package/dist/contexts/index.d.cts +2 -0
- package/dist/contexts/index.d.mts +2 -0
- package/dist/contexts/index.mjs +3 -0
- package/dist/helpers/automd.cjs +59 -0
- package/dist/helpers/automd.cjs.map +1 -0
- package/dist/helpers/automd.mjs +58 -0
- package/dist/helpers/automd.mjs.map +1 -0
- package/dist/helpers/docs-helpers.cjs +17 -0
- package/dist/helpers/docs-helpers.cjs.map +1 -0
- package/dist/helpers/docs-helpers.mjs +16 -0
- package/dist/helpers/docs-helpers.mjs.map +1 -0
- package/dist/helpers/persistence.cjs +2 -1
- package/dist/helpers/persistence.cjs.map +1 -0
- package/dist/helpers/persistence.mjs +2 -1
- package/dist/helpers/persistence.mjs.map +1 -0
- package/dist/helpers/resolve-command.cjs +118 -33
- package/dist/helpers/resolve-command.cjs.map +1 -0
- package/dist/helpers/resolve-command.mjs +116 -32
- package/dist/helpers/resolve-command.mjs.map +1 -0
- package/dist/helpers/update-package-json.cjs +18 -10
- package/dist/helpers/update-package-json.cjs.map +1 -0
- package/dist/helpers/update-package-json.mjs +17 -10
- package/dist/helpers/update-package-json.mjs.map +1 -0
- package/dist/helpers/utilities.cjs +30 -30
- package/dist/helpers/utilities.cjs.map +1 -0
- package/dist/helpers/utilities.mjs +29 -28
- package/dist/helpers/utilities.mjs.map +1 -0
- package/dist/helpers/validations.cjs +97 -0
- package/dist/helpers/validations.cjs.map +1 -0
- package/dist/helpers/validations.mjs +97 -0
- package/dist/helpers/validations.mjs.map +1 -0
- package/dist/index.cjs +5 -13
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +6 -17
- package/dist/index.d.mts +6 -17
- package/dist/index.mjs +4 -13
- package/dist/index.mjs.map +1 -0
- package/dist/plugin-utils/context-helpers.cjs +86 -0
- package/dist/plugin-utils/context-helpers.cjs.map +1 -0
- package/dist/plugin-utils/context-helpers.d.cts +58 -0
- package/dist/plugin-utils/context-helpers.d.cts.map +1 -0
- package/dist/plugin-utils/context-helpers.d.mts +58 -0
- package/dist/plugin-utils/context-helpers.d.mts.map +1 -0
- package/dist/plugin-utils/context-helpers.mjs +79 -0
- package/dist/plugin-utils/context-helpers.mjs.map +1 -0
- package/dist/plugin-utils/get-command-tree.cjs +4 -2
- package/dist/plugin-utils/get-command-tree.cjs.map +1 -0
- package/dist/plugin-utils/get-command-tree.d.cts +2 -1
- package/dist/plugin-utils/get-command-tree.d.cts.map +1 -0
- package/dist/plugin-utils/get-command-tree.d.mts +2 -1
- package/dist/plugin-utils/get-command-tree.d.mts.map +1 -0
- package/dist/plugin-utils/get-command-tree.mjs +5 -2
- package/dist/plugin-utils/get-command-tree.mjs.map +1 -0
- package/dist/plugin-utils/index.cjs +14 -1
- package/dist/plugin-utils/index.d.cts +4 -1
- package/dist/plugin-utils/index.d.mts +4 -1
- package/dist/plugin-utils/index.mjs +4 -1
- package/dist/plugin-utils/reflect.cjs +25 -0
- package/dist/plugin-utils/reflect.cjs.map +1 -0
- package/dist/plugin-utils/reflect.d.cts +14 -0
- package/dist/plugin-utils/reflect.d.cts.map +1 -0
- package/dist/plugin-utils/reflect.d.mts +14 -0
- package/dist/plugin-utils/reflect.d.mts.map +1 -0
- package/dist/plugin-utils/reflect.mjs +24 -0
- package/dist/plugin-utils/reflect.mjs.map +1 -0
- package/dist/plugin-utils/traverse-command-tree.cjs +33 -0
- package/dist/plugin-utils/traverse-command-tree.cjs.map +1 -0
- package/dist/plugin-utils/traverse-command-tree.d.cts +23 -0
- package/dist/plugin-utils/traverse-command-tree.d.cts.map +1 -0
- package/dist/plugin-utils/traverse-command-tree.d.mts +23 -0
- package/dist/plugin-utils/traverse-command-tree.d.mts.map +1 -0
- package/dist/plugin-utils/traverse-command-tree.mjs +31 -0
- package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -0
- package/dist/plugin.cjs +284 -0
- package/dist/plugin.cjs.map +1 -0
- package/dist/plugin.d.cts +13 -0
- package/dist/plugin.d.cts.map +1 -0
- package/dist/plugin.d.mts +13 -0
- package/dist/plugin.d.mts.map +1 -0
- package/dist/plugin.mjs +276 -0
- package/dist/plugin.mjs.map +1 -0
- package/dist/types/command.d.cts +14 -4
- package/dist/types/command.d.cts.map +1 -0
- package/dist/types/command.d.mts +14 -4
- package/dist/types/command.d.mts.map +1 -0
- package/dist/types/config.d.cts +74 -10
- package/dist/types/config.d.cts.map +1 -0
- package/dist/types/config.d.mts +74 -10
- package/dist/types/config.d.mts.map +1 -0
- package/dist/types/context.d.cts +7 -4
- package/dist/types/context.d.cts.map +1 -0
- package/dist/types/context.d.mts +7 -4
- package/dist/types/context.d.mts.map +1 -0
- package/dist/types/index.d.cts +4 -4
- package/dist/types/index.d.mts +4 -4
- package/dist/types/internal.cjs +0 -0
- package/dist/types/internal.d.cts +24 -0
- package/dist/types/internal.d.cts.map +1 -0
- package/dist/types/internal.d.mts +24 -0
- package/dist/types/internal.d.mts.map +1 -0
- package/dist/types/internal.mjs +1 -0
- package/dist/types/options.d.cts +2 -1
- package/dist/types/options.d.cts.map +1 -0
- package/dist/types/options.d.mts +2 -1
- package/dist/types/options.d.mts.map +1 -0
- package/dist/types/runtime.cjs +0 -0
- package/dist/types/runtime.d.cts +24 -0
- package/dist/types/runtime.d.cts.map +1 -0
- package/dist/types/runtime.d.mts +24 -0
- package/dist/types/runtime.d.mts.map +1 -0
- package/dist/types/runtime.mjs +1 -0
- package/package.json +223 -91
- package/dist/components/utils-builtin.cjs +0 -453
- package/dist/components/utils-builtin.d.cts +0 -27
- package/dist/components/utils-builtin.d.mts +0 -27
- package/dist/components/utils-builtin.mjs +0 -447
- package/dist/powerlines.cjs +0 -172
- package/dist/powerlines.d.cts +0 -12
- package/dist/powerlines.d.mts +0 -12
- package/dist/powerlines.mjs +0 -168
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
3
|
+
let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
4
|
+
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
5
|
+
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
6
|
+
|
|
7
|
+
//#region src/plugin-utils/context-helpers.ts
|
|
8
|
+
/**
|
|
9
|
+
* Sorts command argument aliases, placing single-character aliases first, followed by multi-character aliases, and then sorting them alphabetically.
|
|
10
|
+
*
|
|
11
|
+
* @param aliases - An array of argument aliases to sort.
|
|
12
|
+
* @returns A new array of sorted aliases.
|
|
13
|
+
*/
|
|
14
|
+
function sortArgAliases(aliases) {
|
|
15
|
+
if (aliases.length === 0) return [];
|
|
16
|
+
const result = aliases.filter((alias) => alias.length === 1);
|
|
17
|
+
result.push(...aliases.filter((alias) => alias.length > 1));
|
|
18
|
+
return result.sort((a, b) => a.localeCompare(b));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves the application name from the context and configuration.
|
|
22
|
+
*
|
|
23
|
+
* @param context - The build context containing workspace and package information.
|
|
24
|
+
* @returns The application name in kebab-case format.
|
|
25
|
+
* @throws An error if no valid application name is found.
|
|
26
|
+
*/
|
|
27
|
+
function getAppName(context) {
|
|
28
|
+
const result = context.config.name || ((0, __stryke_type_checks_is_set_string.isSetString)(context.config.bin) || Array.isArray(context.config.bin) && context.config.bin.length > 0 && (0, __stryke_type_checks_is_set_string.isSetString)(context.config.bin[0]) ? (0, __stryke_type_checks_is_set_string.isSetString)(context.config.bin) ? context.config.bin : context.config.bin[0] : context.packageJson?.name);
|
|
29
|
+
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.");
|
|
30
|
+
return (0, __stryke_string_format_kebab_case.kebabCase)(result);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves the application title from the context and configuration.
|
|
34
|
+
*
|
|
35
|
+
* @param context - The build context containing workspace and package information.
|
|
36
|
+
* @returns The application title in title-case format.
|
|
37
|
+
*/
|
|
38
|
+
function getAppTitle(context) {
|
|
39
|
+
return (0, __stryke_string_format_title_case.titleCase)(context.config.name || getAppName(context));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Retrieves the application description from the context and configuration.
|
|
43
|
+
*
|
|
44
|
+
* @param context - The build context containing workspace and package information.
|
|
45
|
+
* @returns The application description.
|
|
46
|
+
*/
|
|
47
|
+
function getAppDescription(context) {
|
|
48
|
+
return context.config.description || context.packageJson?.description || `The ${getAppTitle(context)} command-line interface application.`;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Retrieves the primary binary name for the application.
|
|
52
|
+
*
|
|
53
|
+
* @param context - The build context containing workspace and package information.
|
|
54
|
+
* @returns The primary binary name as a string.
|
|
55
|
+
*/
|
|
56
|
+
function getAppBin(context) {
|
|
57
|
+
return (0, __stryke_type_checks_is_set_object.isSetObject)(context.config.bin) ? Object.keys(context.config.bin)[0] : (0, __stryke_string_format_kebab_case.kebabCase)(getAppName(context));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Determines if a given command path segment is variable (enclosed in square brackets).
|
|
61
|
+
*
|
|
62
|
+
* @param path - The command path segment to check.
|
|
63
|
+
* @returns True if the path is variable, false otherwise.
|
|
64
|
+
*/
|
|
65
|
+
function isVariableCommandPath(path) {
|
|
66
|
+
return path.startsWith("[") && path.endsWith("]");
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Extracts the variable name from a command path segment by removing enclosing square brackets.
|
|
70
|
+
*
|
|
71
|
+
* @param path - The command path segment.
|
|
72
|
+
* @returns The variable name without square brackets.
|
|
73
|
+
*/
|
|
74
|
+
function getVariableCommandPathName(path) {
|
|
75
|
+
return path.replaceAll(/^\[+/g, "").replaceAll(/\]+$/g, "");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
exports.getAppBin = getAppBin;
|
|
80
|
+
exports.getAppDescription = getAppDescription;
|
|
81
|
+
exports.getAppName = getAppName;
|
|
82
|
+
exports.getAppTitle = getAppTitle;
|
|
83
|
+
exports.getVariableCommandPathName = getVariableCommandPathName;
|
|
84
|
+
exports.isVariableCommandPath = isVariableCommandPath;
|
|
85
|
+
exports.sortArgAliases = sortArgAliases;
|
|
86
|
+
//# sourceMappingURL=context-helpers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-helpers.cjs","names":["kebabCase","titleCase","isSetObject","isSetString","sortArgAliases","aliases","length","result","filter","alias","push","sort","a","b","localeCompare","getAppName","context","config","name","bin","Array","isArray","packageJson","Error","getAppTitle","getAppDescription","description","getAppBin","Object","keys","isVariableCommandPath","path","startsWith","endsWith","getVariableCommandPathName","replaceAll"],"sources":["../../src/plugin-utils/context-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type { Context, UnresolvedContext } from \"../types\";\n\n/**\n * Sorts command argument aliases, placing single-character aliases first, followed by multi-character aliases, and then sorting them alphabetically.\n *\n * @param aliases - An array of argument aliases to sort.\n * @returns A new array of sorted aliases.\n */\nexport function sortArgAliases(aliases: string[]): string[] {\n if (aliases.length === 0) {\n return [];\n }\n\n const result = aliases.filter(alias => alias.length === 1);\n result.push(...aliases.filter(alias => alias.length > 1));\n\n return result.sort((a, b) => a.localeCompare(b));\n}\n\n/**\n * Retrieves the application name from the context and configuration.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The application name in kebab-case format.\n * @throws An error if no valid application name is found.\n */\nexport function getAppName(context: UnresolvedContext | Context): string {\n const result =\n context.config.name ||\n (isSetString(context.config.bin) ||\n (Array.isArray(context.config.bin) &&\n context.config.bin.length > 0 &&\n isSetString(context.config.bin[0]))\n ? isSetString(context.config.bin)\n ? context.config.bin\n : context.config.bin[0]\n : context.packageJson?.name);\n if (!isSetString(result)) {\n throw new Error(\n \"No application name found. Please provide a 'bin' option in the configuration or ensure the package.json has a valid 'name' field.\"\n );\n }\n\n return kebabCase(result);\n}\n\n/**\n * Retrieves the application title from the context and configuration.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The application title in title-case format.\n */\nexport function getAppTitle(context: UnresolvedContext | Context): string {\n return titleCase(context.config.name || getAppName(context));\n}\n\n/**\n * Retrieves the application description from the context and configuration.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The application description.\n */\nexport function getAppDescription(\n context: UnresolvedContext | Context\n): string {\n return (\n context.config.description ||\n context.packageJson?.description ||\n `The ${getAppTitle(context)} command-line interface application.`\n );\n}\n\n/**\n * Retrieves the primary binary name for the application.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The primary binary name as a string.\n */\nexport function getAppBin(context: Context): string {\n return isSetObject(context.config.bin)\n ? Object.keys(context.config.bin)[0]!\n : kebabCase(getAppName(context));\n}\n\n/**\n * Determines if a given command path segment is variable (enclosed in square brackets).\n *\n * @param path - The command path segment to check.\n * @returns True if the path is variable, false otherwise.\n */\nexport function isVariableCommandPath(path: string): boolean {\n return path.startsWith(\"[\") && path.endsWith(\"]\");\n}\n\n/**\n * Extracts the variable name from a command path segment by removing enclosing square brackets.\n *\n * @param path - The command path segment.\n * @returns The variable name without square brackets.\n */\nexport function getVariableCommandPathName(path: string): string {\n return path.replaceAll(/^\\[+/g, \"\").replaceAll(/\\]+$/g, \"\");\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgBI,eAAeC,SAA6B;AAC1D,KAAIA,QAAQC,WAAW,EACrB,QAAO,EAAE;CAGX,MAAMC,SAASF,QAAQG,QAAOC,UAASA,MAAMH,WAAW,EAAE;AAC1DC,QAAOG,KAAK,GAAGL,QAAQG,QAAOC,UAASA,MAAMH,SAAS,EAAE,CAAC;AAEzD,QAAOC,OAAOI,MAAMC,GAAGC,MAAMD,EAAEE,cAAcD,EAAE,CAAC;;;;;;;;;AAUlD,SAAgBE,WAAWC,SAA8C;CACvE,MAAMT,SACJS,QAAQC,OAAOC,6DACFF,QAAQC,OAAOE,IAAI,IAC/BC,MAAMC,QAAQL,QAAQC,OAAOE,IAAI,IAChCH,QAAQC,OAAOE,IAAIb,SAAS,yDAChBU,QAAQC,OAAOE,IAAI,GAAI,uDACrBH,QAAQC,OAAOE,IAAI,GAC7BH,QAAQC,OAAOE,MACfH,QAAQC,OAAOE,IAAI,KACrBH,QAAQM,aAAaJ;AAC3B,KAAI,qDAAaX,OAAO,CACtB,OAAM,IAAIgB,MACR,qIACD;AAGH,yDAAiBhB,OAAO;;;;;;;;AAS1B,SAAgBiB,YAAYR,SAA8C;AACxE,yDAAiBA,QAAQC,OAAOC,QAAQH,WAAWC,QAAQ,CAAC;;;;;;;;AAS9D,SAAgBS,kBACdT,SACQ;AACR,QACEA,QAAQC,OAAOS,eACfV,QAAQM,aAAaI,eACrB,OAAOF,YAAYR,QAAQ,CAAA;;;;;;;;AAU/B,SAAgBW,UAAUX,SAA0B;AAClD,4DAAmBA,QAAQC,OAAOE,IAAI,GAClCS,OAAOC,KAAKb,QAAQC,OAAOE,IAAI,CAAC,sDACtBJ,WAAWC,QAAQ,CAAC;;;;;;;;AASpC,SAAgBc,sBAAsBC,MAAuB;AAC3D,QAAOA,KAAKC,WAAW,IAAI,IAAID,KAAKE,SAAS,IAAI;;;;;;;;AASnD,SAAgBC,2BAA2BH,MAAsB;AAC/D,QAAOA,KAAKI,WAAW,SAAS,GAAG,CAACA,WAAW,SAAS,GAAG"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Context, UnresolvedContext } from "../types/context.cjs";
|
|
2
|
+
import "../types/index.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/plugin-utils/context-helpers.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Sorts command argument aliases, placing single-character aliases first, followed by multi-character aliases, and then sorting them alphabetically.
|
|
8
|
+
*
|
|
9
|
+
* @param aliases - An array of argument aliases to sort.
|
|
10
|
+
* @returns A new array of sorted aliases.
|
|
11
|
+
*/
|
|
12
|
+
declare function sortArgAliases(aliases: string[]): string[];
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves the application name from the context and configuration.
|
|
15
|
+
*
|
|
16
|
+
* @param context - The build context containing workspace and package information.
|
|
17
|
+
* @returns The application name in kebab-case format.
|
|
18
|
+
* @throws An error if no valid application name is found.
|
|
19
|
+
*/
|
|
20
|
+
declare function getAppName(context: UnresolvedContext | Context): string;
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves the application title from the context and configuration.
|
|
23
|
+
*
|
|
24
|
+
* @param context - The build context containing workspace and package information.
|
|
25
|
+
* @returns The application title in title-case format.
|
|
26
|
+
*/
|
|
27
|
+
declare function getAppTitle(context: UnresolvedContext | Context): string;
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves the application description from the context and configuration.
|
|
30
|
+
*
|
|
31
|
+
* @param context - The build context containing workspace and package information.
|
|
32
|
+
* @returns The application description.
|
|
33
|
+
*/
|
|
34
|
+
declare function getAppDescription(context: UnresolvedContext | Context): string;
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves the primary binary name for the application.
|
|
37
|
+
*
|
|
38
|
+
* @param context - The build context containing workspace and package information.
|
|
39
|
+
* @returns The primary binary name as a string.
|
|
40
|
+
*/
|
|
41
|
+
declare function getAppBin(context: Context): string;
|
|
42
|
+
/**
|
|
43
|
+
* Determines if a given command path segment is variable (enclosed in square brackets).
|
|
44
|
+
*
|
|
45
|
+
* @param path - The command path segment to check.
|
|
46
|
+
* @returns True if the path is variable, false otherwise.
|
|
47
|
+
*/
|
|
48
|
+
declare function isVariableCommandPath(path: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Extracts the variable name from a command path segment by removing enclosing square brackets.
|
|
51
|
+
*
|
|
52
|
+
* @param path - The command path segment.
|
|
53
|
+
* @returns The variable name without square brackets.
|
|
54
|
+
*/
|
|
55
|
+
declare function getVariableCommandPathName(path: string): string;
|
|
56
|
+
//#endregion
|
|
57
|
+
export { getAppBin, getAppDescription, getAppName, getAppTitle, getVariableCommandPathName, isVariableCommandPath, sortArgAliases };
|
|
58
|
+
//# sourceMappingURL=context-helpers.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-helpers.d.cts","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA8BA;AAkBA;AA0BA;AAUgB,iBAtDA,cAAA,CAuDL,OAAA,EAAA,MAAA,EAAoB,CAAA,EAAA,MAAO,EAAA;AAetC;AAYA;AAUA;;;;;iBA1EgB,UAAA,UAAoB,oBAAoB;;;;;;;iBA0BxC,WAAA,UAAqB,oBAAoB;;;;;;;iBAUzC,iBAAA,UACL,oBAAoB;;;;;;;iBAef,SAAA,UAAmB;;;;;;;iBAYnB,qBAAA;;;;;;;iBAUA,0BAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Context, UnresolvedContext } from "../types/context.mjs";
|
|
2
|
+
import "../types/index.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/plugin-utils/context-helpers.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Sorts command argument aliases, placing single-character aliases first, followed by multi-character aliases, and then sorting them alphabetically.
|
|
8
|
+
*
|
|
9
|
+
* @param aliases - An array of argument aliases to sort.
|
|
10
|
+
* @returns A new array of sorted aliases.
|
|
11
|
+
*/
|
|
12
|
+
declare function sortArgAliases(aliases: string[]): string[];
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves the application name from the context and configuration.
|
|
15
|
+
*
|
|
16
|
+
* @param context - The build context containing workspace and package information.
|
|
17
|
+
* @returns The application name in kebab-case format.
|
|
18
|
+
* @throws An error if no valid application name is found.
|
|
19
|
+
*/
|
|
20
|
+
declare function getAppName(context: UnresolvedContext | Context): string;
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves the application title from the context and configuration.
|
|
23
|
+
*
|
|
24
|
+
* @param context - The build context containing workspace and package information.
|
|
25
|
+
* @returns The application title in title-case format.
|
|
26
|
+
*/
|
|
27
|
+
declare function getAppTitle(context: UnresolvedContext | Context): string;
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves the application description from the context and configuration.
|
|
30
|
+
*
|
|
31
|
+
* @param context - The build context containing workspace and package information.
|
|
32
|
+
* @returns The application description.
|
|
33
|
+
*/
|
|
34
|
+
declare function getAppDescription(context: UnresolvedContext | Context): string;
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves the primary binary name for the application.
|
|
37
|
+
*
|
|
38
|
+
* @param context - The build context containing workspace and package information.
|
|
39
|
+
* @returns The primary binary name as a string.
|
|
40
|
+
*/
|
|
41
|
+
declare function getAppBin(context: Context): string;
|
|
42
|
+
/**
|
|
43
|
+
* Determines if a given command path segment is variable (enclosed in square brackets).
|
|
44
|
+
*
|
|
45
|
+
* @param path - The command path segment to check.
|
|
46
|
+
* @returns True if the path is variable, false otherwise.
|
|
47
|
+
*/
|
|
48
|
+
declare function isVariableCommandPath(path: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Extracts the variable name from a command path segment by removing enclosing square brackets.
|
|
51
|
+
*
|
|
52
|
+
* @param path - The command path segment.
|
|
53
|
+
* @returns The variable name without square brackets.
|
|
54
|
+
*/
|
|
55
|
+
declare function getVariableCommandPathName(path: string): string;
|
|
56
|
+
//#endregion
|
|
57
|
+
export { getAppBin, getAppDescription, getAppName, getAppTitle, getVariableCommandPathName, isVariableCommandPath, sortArgAliases };
|
|
58
|
+
//# sourceMappingURL=context-helpers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-helpers.d.mts","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA8BA;AAkBA;AA0BA;AAUgB,iBAtDA,cAAA,CAuDL,OAAA,EAAA,MAAA,EAAoB,CAAA,EAAA,MAAO,EAAA;AAetC;AAYA;AAUA;;;;;iBA1EgB,UAAA,UAAoB,oBAAoB;;;;;;;iBA0BxC,WAAA,UAAqB,oBAAoB;;;;;;;iBAUzC,iBAAA,UACL,oBAAoB;;;;;;;iBAef,SAAA,UAAmB;;;;;;;iBAYnB,qBAAA;;;;;;;iBAUA,0BAAA"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
2
|
+
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
3
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
4
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
5
|
+
|
|
6
|
+
//#region src/plugin-utils/context-helpers.ts
|
|
7
|
+
/**
|
|
8
|
+
* Sorts command argument aliases, placing single-character aliases first, followed by multi-character aliases, and then sorting them alphabetically.
|
|
9
|
+
*
|
|
10
|
+
* @param aliases - An array of argument aliases to sort.
|
|
11
|
+
* @returns A new array of sorted aliases.
|
|
12
|
+
*/
|
|
13
|
+
function sortArgAliases(aliases) {
|
|
14
|
+
if (aliases.length === 0) return [];
|
|
15
|
+
const result = aliases.filter((alias) => alias.length === 1);
|
|
16
|
+
result.push(...aliases.filter((alias) => alias.length > 1));
|
|
17
|
+
return result.sort((a, b) => a.localeCompare(b));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves the application name from the context and configuration.
|
|
21
|
+
*
|
|
22
|
+
* @param context - The build context containing workspace and package information.
|
|
23
|
+
* @returns The application name in kebab-case format.
|
|
24
|
+
* @throws An error if no valid application name is found.
|
|
25
|
+
*/
|
|
26
|
+
function getAppName(context) {
|
|
27
|
+
const result = context.config.name || (isSetString(context.config.bin) || Array.isArray(context.config.bin) && context.config.bin.length > 0 && isSetString(context.config.bin[0]) ? isSetString(context.config.bin) ? context.config.bin : context.config.bin[0] : context.packageJson?.name);
|
|
28
|
+
if (!isSetString(result)) throw new Error("No application name found. Please provide a 'bin' option in the configuration or ensure the package.json has a valid 'name' field.");
|
|
29
|
+
return kebabCase(result);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves the application title from the context and configuration.
|
|
33
|
+
*
|
|
34
|
+
* @param context - The build context containing workspace and package information.
|
|
35
|
+
* @returns The application title in title-case format.
|
|
36
|
+
*/
|
|
37
|
+
function getAppTitle(context) {
|
|
38
|
+
return titleCase(context.config.name || getAppName(context));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Retrieves the application description from the context and configuration.
|
|
42
|
+
*
|
|
43
|
+
* @param context - The build context containing workspace and package information.
|
|
44
|
+
* @returns The application description.
|
|
45
|
+
*/
|
|
46
|
+
function getAppDescription(context) {
|
|
47
|
+
return context.config.description || context.packageJson?.description || `The ${getAppTitle(context)} command-line interface application.`;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Retrieves the primary binary name for the application.
|
|
51
|
+
*
|
|
52
|
+
* @param context - The build context containing workspace and package information.
|
|
53
|
+
* @returns The primary binary name as a string.
|
|
54
|
+
*/
|
|
55
|
+
function getAppBin(context) {
|
|
56
|
+
return isSetObject(context.config.bin) ? Object.keys(context.config.bin)[0] : kebabCase(getAppName(context));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Determines if a given command path segment is variable (enclosed in square brackets).
|
|
60
|
+
*
|
|
61
|
+
* @param path - The command path segment to check.
|
|
62
|
+
* @returns True if the path is variable, false otherwise.
|
|
63
|
+
*/
|
|
64
|
+
function isVariableCommandPath(path) {
|
|
65
|
+
return path.startsWith("[") && path.endsWith("]");
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Extracts the variable name from a command path segment by removing enclosing square brackets.
|
|
69
|
+
*
|
|
70
|
+
* @param path - The command path segment.
|
|
71
|
+
* @returns The variable name without square brackets.
|
|
72
|
+
*/
|
|
73
|
+
function getVariableCommandPathName(path) {
|
|
74
|
+
return path.replaceAll(/^\[+/g, "").replaceAll(/\]+$/g, "");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
export { getAppBin, getAppDescription, getAppName, getAppTitle, getVariableCommandPathName, isVariableCommandPath, sortArgAliases };
|
|
79
|
+
//# sourceMappingURL=context-helpers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-helpers.mjs","names":["kebabCase","titleCase","isSetObject","isSetString","sortArgAliases","aliases","length","result","filter","alias","push","sort","a","b","localeCompare","getAppName","context","config","name","bin","Array","isArray","packageJson","Error","getAppTitle","getAppDescription","description","getAppBin","Object","keys","isVariableCommandPath","path","startsWith","endsWith","getVariableCommandPathName","replaceAll"],"sources":["../../src/plugin-utils/context-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type { Context, UnresolvedContext } from \"../types\";\n\n/**\n * Sorts command argument aliases, placing single-character aliases first, followed by multi-character aliases, and then sorting them alphabetically.\n *\n * @param aliases - An array of argument aliases to sort.\n * @returns A new array of sorted aliases.\n */\nexport function sortArgAliases(aliases: string[]): string[] {\n if (aliases.length === 0) {\n return [];\n }\n\n const result = aliases.filter(alias => alias.length === 1);\n result.push(...aliases.filter(alias => alias.length > 1));\n\n return result.sort((a, b) => a.localeCompare(b));\n}\n\n/**\n * Retrieves the application name from the context and configuration.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The application name in kebab-case format.\n * @throws An error if no valid application name is found.\n */\nexport function getAppName(context: UnresolvedContext | Context): string {\n const result =\n context.config.name ||\n (isSetString(context.config.bin) ||\n (Array.isArray(context.config.bin) &&\n context.config.bin.length > 0 &&\n isSetString(context.config.bin[0]))\n ? isSetString(context.config.bin)\n ? context.config.bin\n : context.config.bin[0]\n : context.packageJson?.name);\n if (!isSetString(result)) {\n throw new Error(\n \"No application name found. Please provide a 'bin' option in the configuration or ensure the package.json has a valid 'name' field.\"\n );\n }\n\n return kebabCase(result);\n}\n\n/**\n * Retrieves the application title from the context and configuration.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The application title in title-case format.\n */\nexport function getAppTitle(context: UnresolvedContext | Context): string {\n return titleCase(context.config.name || getAppName(context));\n}\n\n/**\n * Retrieves the application description from the context and configuration.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The application description.\n */\nexport function getAppDescription(\n context: UnresolvedContext | Context\n): string {\n return (\n context.config.description ||\n context.packageJson?.description ||\n `The ${getAppTitle(context)} command-line interface application.`\n );\n}\n\n/**\n * Retrieves the primary binary name for the application.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The primary binary name as a string.\n */\nexport function getAppBin(context: Context): string {\n return isSetObject(context.config.bin)\n ? Object.keys(context.config.bin)[0]!\n : kebabCase(getAppName(context));\n}\n\n/**\n * Determines if a given command path segment is variable (enclosed in square brackets).\n *\n * @param path - The command path segment to check.\n * @returns True if the path is variable, false otherwise.\n */\nexport function isVariableCommandPath(path: string): boolean {\n return path.startsWith(\"[\") && path.endsWith(\"]\");\n}\n\n/**\n * Extracts the variable name from a command path segment by removing enclosing square brackets.\n *\n * @param path - The command path segment.\n * @returns The variable name without square brackets.\n */\nexport function getVariableCommandPathName(path: string): string {\n return path.replaceAll(/^\\[+/g, \"\").replaceAll(/\\]+$/g, \"\");\n}\n"],"mappings":";;;;;;;;;;;;AA8BA,SAAgBI,eAAeC,SAA6B;AAC1D,KAAIA,QAAQC,WAAW,EACrB,QAAO,EAAE;CAGX,MAAMC,SAASF,QAAQG,QAAOC,UAASA,MAAMH,WAAW,EAAE;AAC1DC,QAAOG,KAAK,GAAGL,QAAQG,QAAOC,UAASA,MAAMH,SAAS,EAAE,CAAC;AAEzD,QAAOC,OAAOI,MAAMC,GAAGC,MAAMD,EAAEE,cAAcD,EAAE,CAAC;;;;;;;;;AAUlD,SAAgBE,WAAWC,SAA8C;CACvE,MAAMT,SACJS,QAAQC,OAAOC,SACdf,YAAYa,QAAQC,OAAOE,IAAI,IAC/BC,MAAMC,QAAQL,QAAQC,OAAOE,IAAI,IAChCH,QAAQC,OAAOE,IAAIb,SAAS,KAC5BH,YAAYa,QAAQC,OAAOE,IAAI,GAAI,GACjChB,YAAYa,QAAQC,OAAOE,IAAI,GAC7BH,QAAQC,OAAOE,MACfH,QAAQC,OAAOE,IAAI,KACrBH,QAAQM,aAAaJ;AAC3B,KAAI,CAACf,YAAYI,OAAO,CACtB,OAAM,IAAIgB,MACR,qIACD;AAGH,QAAOvB,UAAUO,OAAO;;;;;;;;AAS1B,SAAgBiB,YAAYR,SAA8C;AACxE,QAAOf,UAAUe,QAAQC,OAAOC,QAAQH,WAAWC,QAAQ,CAAC;;;;;;;;AAS9D,SAAgBS,kBACdT,SACQ;AACR,QACEA,QAAQC,OAAOS,eACfV,QAAQM,aAAaI,eACrB,OAAOF,YAAYR,QAAQ,CAAA;;;;;;;;AAU/B,SAAgBW,UAAUX,SAA0B;AAClD,QAAOd,YAAYc,QAAQC,OAAOE,IAAI,GAClCS,OAAOC,KAAKb,QAAQC,OAAOE,IAAI,CAAC,KAChCnB,UAAUe,WAAWC,QAAQ,CAAC;;;;;;;;AASpC,SAAgBc,sBAAsBC,MAAuB;AAC3D,QAAOA,KAAKC,WAAW,IAAI,IAAID,KAAKE,SAAS,IAAI;;;;;;;;AASnD,SAAgBC,2BAA2BH,MAAsB;AAC/D,QAAOA,KAAKI,WAAW,SAAS,GAAG,CAACA,WAAW,SAAS,GAAG"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const require_plugin_utils_context_helpers = require('./context-helpers.cjs');
|
|
1
2
|
|
|
2
3
|
//#region src/plugin-utils/get-command-tree.ts
|
|
3
4
|
/**
|
|
@@ -11,7 +12,7 @@ function getCommandTree(context, path = []) {
|
|
|
11
12
|
if (path.length === 0) return null;
|
|
12
13
|
let currentTree = context.commands[path[0]] ?? null;
|
|
13
14
|
if (path.length > 1) {
|
|
14
|
-
const segments = path.slice(1);
|
|
15
|
+
const segments = path.slice(1).filter((segment) => !require_plugin_utils_context_helpers.isVariableCommandPath(segment));
|
|
15
16
|
for (const segment of segments) if (currentTree?.children && Object.prototype.hasOwnProperty.call(currentTree.children, segment)) currentTree = currentTree.children[segment] ?? null;
|
|
16
17
|
else return null;
|
|
17
18
|
}
|
|
@@ -19,4 +20,5 @@ function getCommandTree(context, path = []) {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
//#endregion
|
|
22
|
-
exports.getCommandTree = getCommandTree;
|
|
23
|
+
exports.getCommandTree = getCommandTree;
|
|
24
|
+
//# sourceMappingURL=get-command-tree.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-command-tree.cjs","names":["isVariableCommandPath","getCommandTree","context","path","length","currentTree","commands","segments","slice","filter","segment","children","Object","prototype","hasOwnProperty","call"],"sources":["../../src/plugin-utils/get-command-tree.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { isVariableCommandPath } from \"./context-helpers\";\n\n/**\n * Retrieves a specific command tree based on the provided path.\n *\n * @param context - The build context containing the command definitions.\n * @param path - An array of strings representing the command path.\n * @returns The command tree at the specified path, or null if not found.\n */\nexport function getCommandTree(\n context: Context,\n path = [] as string[]\n): CommandTree | null {\n if (path.length === 0) {\n return null;\n }\n\n let currentTree: CommandTree | null = context.commands[path[0]!] ?? null;\n if (path.length > 1) {\n const segments = path\n .slice(1)\n .filter(segment => !isVariableCommandPath(segment));\n for (const segment of segments) {\n if (\n currentTree?.children &&\n Object.prototype.hasOwnProperty.call(currentTree.children, segment)\n ) {\n currentTree = currentTree.children[segment] ?? null;\n } else {\n return null;\n }\n }\n }\n\n return currentTree;\n}\n"],"mappings":";;;;;;;;;;AA6BA,SAAgBC,eACdC,SACAC,OAAO,EAAc,EACD;AACpB,KAAIA,KAAKC,WAAW,EAClB,QAAO;CAGT,IAAIC,cAAkCH,QAAQI,SAASH,KAAK,OAAQ;AACpE,KAAIA,KAAKC,SAAS,GAAG;EACnB,MAAMG,WAAWJ,KACdK,MAAM,EAAE,CACRC,QAAOC,YAAW,CAACV,2DAAsBU,QAAQ,CAAC;AACrD,OAAK,MAAMA,WAAWH,SACpB,KACEF,aAAaM,YACbC,OAAOC,UAAUC,eAAeC,KAAKV,YAAYM,UAAUD,QAAQ,CAEnEL,eAAcA,YAAYM,SAASD,YAAY;MAE/C,QAAO;;AAKb,QAAOL"}
|
|
@@ -12,4 +12,5 @@ import { Context } from "../types/context.cjs";
|
|
|
12
12
|
*/
|
|
13
13
|
declare function getCommandTree(context: Context, path?: string[]): CommandTree | null;
|
|
14
14
|
//#endregion
|
|
15
|
-
export { getCommandTree };
|
|
15
|
+
export { getCommandTree };
|
|
16
|
+
//# sourceMappingURL=get-command-tree.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-command-tree.d.cts","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"sourcesContent":[],"mappings":";;;;;;;AA6BA;;;;;iBAAgB,cAAA,UACL,2BAER"}
|
|
@@ -12,4 +12,5 @@ import { Context } from "../types/context.mjs";
|
|
|
12
12
|
*/
|
|
13
13
|
declare function getCommandTree(context: Context, path?: string[]): CommandTree | null;
|
|
14
14
|
//#endregion
|
|
15
|
-
export { getCommandTree };
|
|
15
|
+
export { getCommandTree };
|
|
16
|
+
//# sourceMappingURL=get-command-tree.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-command-tree.d.mts","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"sourcesContent":[],"mappings":";;;;;;;AA6BA;;;;;iBAAgB,cAAA,UACL,2BAER"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isVariableCommandPath } from "./context-helpers.mjs";
|
|
2
|
+
|
|
1
3
|
//#region src/plugin-utils/get-command-tree.ts
|
|
2
4
|
/**
|
|
3
5
|
* Retrieves a specific command tree based on the provided path.
|
|
@@ -10,7 +12,7 @@ function getCommandTree(context, path = []) {
|
|
|
10
12
|
if (path.length === 0) return null;
|
|
11
13
|
let currentTree = context.commands[path[0]] ?? null;
|
|
12
14
|
if (path.length > 1) {
|
|
13
|
-
const segments = path.slice(1);
|
|
15
|
+
const segments = path.slice(1).filter((segment) => !isVariableCommandPath(segment));
|
|
14
16
|
for (const segment of segments) if (currentTree?.children && Object.prototype.hasOwnProperty.call(currentTree.children, segment)) currentTree = currentTree.children[segment] ?? null;
|
|
15
17
|
else return null;
|
|
16
18
|
}
|
|
@@ -18,4 +20,5 @@ function getCommandTree(context, path = []) {
|
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
//#endregion
|
|
21
|
-
export { getCommandTree };
|
|
23
|
+
export { getCommandTree };
|
|
24
|
+
//# sourceMappingURL=get-command-tree.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-command-tree.mjs","names":["isVariableCommandPath","getCommandTree","context","path","length","currentTree","commands","segments","slice","filter","segment","children","Object","prototype","hasOwnProperty","call"],"sources":["../../src/plugin-utils/get-command-tree.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { isVariableCommandPath } from \"./context-helpers\";\n\n/**\n * Retrieves a specific command tree based on the provided path.\n *\n * @param context - The build context containing the command definitions.\n * @param path - An array of strings representing the command path.\n * @returns The command tree at the specified path, or null if not found.\n */\nexport function getCommandTree(\n context: Context,\n path = [] as string[]\n): CommandTree | null {\n if (path.length === 0) {\n return null;\n }\n\n let currentTree: CommandTree | null = context.commands[path[0]!] ?? null;\n if (path.length > 1) {\n const segments = path\n .slice(1)\n .filter(segment => !isVariableCommandPath(segment));\n for (const segment of segments) {\n if (\n currentTree?.children &&\n Object.prototype.hasOwnProperty.call(currentTree.children, segment)\n ) {\n currentTree = currentTree.children[segment] ?? null;\n } else {\n return null;\n }\n }\n }\n\n return currentTree;\n}\n"],"mappings":";;;;;;;;;;AA6BA,SAAgBC,eACdC,SACAC,OAAO,EAAc,EACD;AACpB,KAAIA,KAAKC,WAAW,EAClB,QAAO;CAGT,IAAIC,cAAkCH,QAAQI,SAASH,KAAK,OAAQ;AACpE,KAAIA,KAAKC,SAAS,GAAG;EACnB,MAAMG,WAAWJ,KACdK,MAAM,EAAE,CACRC,QAAOC,YAAW,CAACV,sBAAsBU,QAAQ,CAAC;AACrD,OAAK,MAAMA,WAAWH,SACpB,KACEF,aAAaM,YACbC,OAAOC,UAAUC,eAAeC,KAAKV,YAAYM,UAAUD,QAAQ,CAEnEL,eAAcA,YAAYM,SAASD,YAAY;MAE/C,QAAO;;AAKb,QAAOL"}
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
const require_plugin_utils_context_helpers = require('./context-helpers.cjs');
|
|
2
|
+
const require_plugin_utils_reflect = require('./reflect.cjs');
|
|
1
3
|
const require_plugin_utils_get_command_tree = require('./get-command-tree.cjs');
|
|
4
|
+
const require_plugin_utils_traverse_command_tree = require('./traverse-command-tree.cjs');
|
|
2
5
|
|
|
3
|
-
exports.
|
|
6
|
+
exports.getAppBin = require_plugin_utils_context_helpers.getAppBin;
|
|
7
|
+
exports.getAppDescription = require_plugin_utils_context_helpers.getAppDescription;
|
|
8
|
+
exports.getAppName = require_plugin_utils_context_helpers.getAppName;
|
|
9
|
+
exports.getAppTitle = require_plugin_utils_context_helpers.getAppTitle;
|
|
10
|
+
exports.getCommandTree = require_plugin_utils_get_command_tree.getCommandTree;
|
|
11
|
+
exports.getVariableCommandPathName = require_plugin_utils_context_helpers.getVariableCommandPathName;
|
|
12
|
+
exports.isVariableCommandPath = require_plugin_utils_context_helpers.isVariableCommandPath;
|
|
13
|
+
exports.sortArgAliases = require_plugin_utils_context_helpers.sortArgAliases;
|
|
14
|
+
exports.sortOptions = require_plugin_utils_reflect.sortOptions;
|
|
15
|
+
exports.traverseCommandTree = require_plugin_utils_traverse_command_tree.traverseCommandTree;
|
|
16
|
+
exports.traverseCommands = require_plugin_utils_traverse_command_tree.traverseCommands;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
import { getAppBin, getAppDescription, getAppName, getAppTitle, getVariableCommandPathName, isVariableCommandPath, sortArgAliases } from "./context-helpers.cjs";
|
|
1
2
|
import { getCommandTree } from "./get-command-tree.cjs";
|
|
2
|
-
|
|
3
|
+
import { sortOptions } from "./reflect.cjs";
|
|
4
|
+
import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.cjs";
|
|
5
|
+
export { getAppBin, getAppDescription, getAppName, getAppTitle, getCommandTree, getVariableCommandPathName, isVariableCommandPath, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
import { getAppBin, getAppDescription, getAppName, getAppTitle, getVariableCommandPathName, isVariableCommandPath, sortArgAliases } from "./context-helpers.mjs";
|
|
1
2
|
import { getCommandTree } from "./get-command-tree.mjs";
|
|
2
|
-
|
|
3
|
+
import { sortOptions } from "./reflect.mjs";
|
|
4
|
+
import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.mjs";
|
|
5
|
+
export { getAppBin, getAppDescription, getAppName, getAppTitle, getCommandTree, getVariableCommandPathName, isVariableCommandPath, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { getAppBin, getAppDescription, getAppName, getAppTitle, getVariableCommandPathName, isVariableCommandPath, sortArgAliases } from "./context-helpers.mjs";
|
|
2
|
+
import { sortOptions } from "./reflect.mjs";
|
|
1
3
|
import { getCommandTree } from "./get-command-tree.mjs";
|
|
4
|
+
import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.mjs";
|
|
2
5
|
|
|
3
|
-
export { getCommandTree };
|
|
6
|
+
export { getAppBin, getAppDescription, getAppName, getAppTitle, getCommandTree, getVariableCommandPathName, isVariableCommandPath, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
3
|
+
|
|
4
|
+
//#region src/plugin-utils/reflect.ts
|
|
5
|
+
/**
|
|
6
|
+
* Sort command options alphabetically by name, placing boolean options with negatives appropriately.
|
|
7
|
+
*
|
|
8
|
+
* @param options - The array of command options to sort.
|
|
9
|
+
* @returns A new array of sorted command options.
|
|
10
|
+
*/
|
|
11
|
+
function sortOptions(options) {
|
|
12
|
+
if (!options || options.length === 0) return [];
|
|
13
|
+
return options.filter((arg) => arg.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.boolean || !arg.isNegativeOf).sort((a, b) => a.name.localeCompare(b.name)).reduce((ret, arg) => {
|
|
14
|
+
ret.push(arg);
|
|
15
|
+
if (arg.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean) {
|
|
16
|
+
const negativeArg = options.find((a) => a.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean && a.isNegativeOf === arg.name);
|
|
17
|
+
if (negativeArg) ret.push(negativeArg);
|
|
18
|
+
}
|
|
19
|
+
return ret;
|
|
20
|
+
}, []);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
exports.sortOptions = sortOptions;
|
|
25
|
+
//# sourceMappingURL=reflect.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflect.cjs","names":["ReflectionKind","sortOptions","options","length","filter","arg","kind","boolean","isNegativeOf","sort","a","b","name","localeCompare","reduce","ret","push","negativeArg","find"],"sources":["../../src/plugin-utils/reflect.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport type { CommandOption } from \"../types/command\";\n\n/**\n * Sort command options alphabetically by name, placing boolean options with negatives appropriately.\n *\n * @param options - The array of command options to sort.\n * @returns A new array of sorted command options.\n */\nexport function sortOptions(options: CommandOption[]): CommandOption[] {\n if (!options || options.length === 0) {\n return [];\n }\n\n return options\n .filter(arg => arg.kind !== ReflectionKind.boolean || !arg.isNegativeOf)\n .sort((a, b) => a.name.localeCompare(b.name))\n .reduce((ret, arg) => {\n ret.push(arg);\n\n if (arg.kind === ReflectionKind.boolean) {\n // Add the negative argument if it exists\n const negativeArg = options.find(\n a => a.kind === ReflectionKind.boolean && a.isNegativeOf === arg.name\n );\n if (negativeArg) {\n ret.push(negativeArg);\n }\n }\n\n return ret;\n }, [] as CommandOption[]);\n}\n"],"mappings":";;;;;;;;;;AA2BA,SAAgBC,YAAYC,SAA2C;AACrE,KAAI,CAACA,WAAWA,QAAQC,WAAW,EACjC,QAAO,EAAE;AAGX,QAAOD,QACJE,QAAOC,QAAOA,IAAIC,SAASN,gDAAeO,WAAW,CAACF,IAAIG,aAAa,CACvEC,MAAMC,GAAGC,MAAMD,EAAEE,KAAKC,cAAcF,EAAEC,KAAK,CAAC,CAC5CE,QAAQC,KAAKV,QAAQ;AACpBU,MAAIC,KAAKX,IAAI;AAEb,MAAIA,IAAIC,SAASN,gDAAeO,SAAS;GAEvC,MAAMU,cAAcf,QAAQgB,MAC1BR,MAAKA,EAAEJ,SAASN,gDAAeO,WAAWG,EAAEF,iBAAiBH,IAAIO,KAClE;AACD,OAAIK,YACFF,KAAIC,KAAKC,YAAY;;AAIzB,SAAOF;IACN,EAAqB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CommandOption } from "../types/command.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/plugin-utils/reflect.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Sort command options alphabetically by name, placing boolean options with negatives appropriately.
|
|
7
|
+
*
|
|
8
|
+
* @param options - The array of command options to sort.
|
|
9
|
+
* @returns A new array of sorted command options.
|
|
10
|
+
*/
|
|
11
|
+
declare function sortOptions(options: CommandOption[]): CommandOption[];
|
|
12
|
+
//#endregion
|
|
13
|
+
export { sortOptions };
|
|
14
|
+
//# sourceMappingURL=reflect.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflect.d.cts","names":[],"sources":["../../src/plugin-utils/reflect.ts"],"sourcesContent":[],"mappings":";;;;;;AA2BA;;;;iBAAgB,WAAA,UAAqB,kBAAkB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CommandOption } from "../types/command.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/plugin-utils/reflect.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Sort command options alphabetically by name, placing boolean options with negatives appropriately.
|
|
7
|
+
*
|
|
8
|
+
* @param options - The array of command options to sort.
|
|
9
|
+
* @returns A new array of sorted command options.
|
|
10
|
+
*/
|
|
11
|
+
declare function sortOptions(options: CommandOption[]): CommandOption[];
|
|
12
|
+
//#endregion
|
|
13
|
+
export { sortOptions };
|
|
14
|
+
//# sourceMappingURL=reflect.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflect.d.mts","names":[],"sources":["../../src/plugin-utils/reflect.ts"],"sourcesContent":[],"mappings":";;;;;;AA2BA;;;;iBAAgB,WAAA,UAAqB,kBAAkB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
2
|
+
|
|
3
|
+
//#region src/plugin-utils/reflect.ts
|
|
4
|
+
/**
|
|
5
|
+
* Sort command options alphabetically by name, placing boolean options with negatives appropriately.
|
|
6
|
+
*
|
|
7
|
+
* @param options - The array of command options to sort.
|
|
8
|
+
* @returns A new array of sorted command options.
|
|
9
|
+
*/
|
|
10
|
+
function sortOptions(options) {
|
|
11
|
+
if (!options || options.length === 0) return [];
|
|
12
|
+
return options.filter((arg) => arg.kind !== ReflectionKind.boolean || !arg.isNegativeOf).sort((a, b) => a.name.localeCompare(b.name)).reduce((ret, arg) => {
|
|
13
|
+
ret.push(arg);
|
|
14
|
+
if (arg.kind === ReflectionKind.boolean) {
|
|
15
|
+
const negativeArg = options.find((a) => a.kind === ReflectionKind.boolean && a.isNegativeOf === arg.name);
|
|
16
|
+
if (negativeArg) ret.push(negativeArg);
|
|
17
|
+
}
|
|
18
|
+
return ret;
|
|
19
|
+
}, []);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { sortOptions };
|
|
24
|
+
//# sourceMappingURL=reflect.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflect.mjs","names":["ReflectionKind","sortOptions","options","length","filter","arg","kind","boolean","isNegativeOf","sort","a","b","name","localeCompare","reduce","ret","push","negativeArg","find"],"sources":["../../src/plugin-utils/reflect.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport type { CommandOption } from \"../types/command\";\n\n/**\n * Sort command options alphabetically by name, placing boolean options with negatives appropriately.\n *\n * @param options - The array of command options to sort.\n * @returns A new array of sorted command options.\n */\nexport function sortOptions(options: CommandOption[]): CommandOption[] {\n if (!options || options.length === 0) {\n return [];\n }\n\n return options\n .filter(arg => arg.kind !== ReflectionKind.boolean || !arg.isNegativeOf)\n .sort((a, b) => a.name.localeCompare(b.name))\n .reduce((ret, arg) => {\n ret.push(arg);\n\n if (arg.kind === ReflectionKind.boolean) {\n // Add the negative argument if it exists\n const negativeArg = options.find(\n a => a.kind === ReflectionKind.boolean && a.isNegativeOf === arg.name\n );\n if (negativeArg) {\n ret.push(negativeArg);\n }\n }\n\n return ret;\n }, [] as CommandOption[]);\n}\n"],"mappings":";;;;;;;;;AA2BA,SAAgBC,YAAYC,SAA2C;AACrE,KAAI,CAACA,WAAWA,QAAQC,WAAW,EACjC,QAAO,EAAE;AAGX,QAAOD,QACJE,QAAOC,QAAOA,IAAIC,SAASN,eAAeO,WAAW,CAACF,IAAIG,aAAa,CACvEC,MAAMC,GAAGC,MAAMD,EAAEE,KAAKC,cAAcF,EAAEC,KAAK,CAAC,CAC5CE,QAAQC,KAAKV,QAAQ;AACpBU,MAAIC,KAAKX,IAAI;AAEb,MAAIA,IAAIC,SAASN,eAAeO,SAAS;GAEvC,MAAMU,cAAcf,QAAQgB,MAC1BR,MAAKA,EAAEJ,SAASN,eAAeO,WAAWG,EAAEF,iBAAiBH,IAAIO,KAClE;AACD,OAAIK,YACFF,KAAIC,KAAKC,YAAY;;AAIzB,SAAOF;IACN,EAAqB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/plugin-utils/traverse-command-tree.ts
|
|
3
|
+
/**
|
|
4
|
+
* Traverses a command tree and applies a visitor function to each node.
|
|
5
|
+
*
|
|
6
|
+
* @param commandTree - The command tree to traverse.
|
|
7
|
+
* @param visitor - The visitor function to apply to each node.
|
|
8
|
+
*/
|
|
9
|
+
async function traverseCommandTree(commandTree, visitor) {
|
|
10
|
+
if (!commandTree.children) return;
|
|
11
|
+
await Promise.all(Object.values(commandTree.children).map(async (childTree) => {
|
|
12
|
+
await Promise.resolve(visitor(childTree));
|
|
13
|
+
await traverseCommandTree(childTree, visitor);
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Traverses all commands in the context and applies a visitor function to each command tree.
|
|
18
|
+
*
|
|
19
|
+
* @param context - The build context containing the command definitions.
|
|
20
|
+
* @param visitor - The visitor function to apply to each command tree.
|
|
21
|
+
*/
|
|
22
|
+
async function traverseCommands(context, visitor) {
|
|
23
|
+
if (!context.commands) return;
|
|
24
|
+
await Promise.all(Object.values(context.commands).map(async (childTree) => {
|
|
25
|
+
await Promise.resolve(visitor(childTree));
|
|
26
|
+
await traverseCommandTree(childTree, visitor);
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
exports.traverseCommandTree = traverseCommandTree;
|
|
32
|
+
exports.traverseCommands = traverseCommands;
|
|
33
|
+
//# sourceMappingURL=traverse-command-tree.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traverse-command-tree.cjs","names":["traverseCommandTree","commandTree","visitor","children","Promise","all","Object","values","map","childTree","resolve","traverseCommands","context","commands"],"sources":["../../src/plugin-utils/traverse-command-tree.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { MaybePromise } from \"@stryke/types/base\";\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Traverses a command tree and applies a visitor function to each node.\n *\n * @param commandTree - The command tree to traverse.\n * @param visitor - The visitor function to apply to each node.\n */\nexport async function traverseCommandTree(\n commandTree: CommandTree,\n visitor: (node: CommandTree) => MaybePromise<void>\n): Promise<void> {\n if (!commandTree.children) {\n return;\n }\n\n await Promise.all(\n Object.values(commandTree.children).map(async childTree => {\n await Promise.resolve(visitor(childTree));\n await traverseCommandTree(childTree, visitor);\n })\n );\n}\n\n/**\n * Traverses all commands in the context and applies a visitor function to each command tree.\n *\n * @param context - The build context containing the command definitions.\n * @param visitor - The visitor function to apply to each command tree.\n */\nexport async function traverseCommands<TContext extends Context>(\n context: TContext,\n visitor: (node: CommandTree) => MaybePromise<void>\n): Promise<void> {\n if (!context.commands) {\n return;\n }\n\n await Promise.all(\n Object.values(context.commands).map(async childTree => {\n await Promise.resolve(visitor(childTree));\n await traverseCommandTree(childTree, visitor);\n })\n );\n}\n"],"mappings":";;;;;;;;AA4BA,eAAsBA,oBACpBC,aACAC,SACe;AACf,KAAI,CAACD,YAAYE,SACf;AAGF,OAAMC,QAAQC,IACZC,OAAOC,OAAON,YAAYE,SAAS,CAACK,IAAI,OAAMC,cAAa;AACzD,QAAML,QAAQM,QAAQR,QAAQO,UAAU,CAAC;AACzC,QAAMT,oBAAoBS,WAAWP,QAAQ;GAEjD,CAAC;;;;;;;;AASH,eAAsBS,iBACpBC,SACAV,SACe;AACf,KAAI,CAACU,QAAQC,SACX;AAGF,OAAMT,QAAQC,IACZC,OAAOC,OAAOK,QAAQC,SAAS,CAACL,IAAI,OAAMC,cAAa;AACrD,QAAML,QAAQM,QAAQR,QAAQO,UAAU,CAAC;AACzC,QAAMT,oBAAoBS,WAAWP,QAAQ;GAEjD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CommandTree } from "../types/command.cjs";
|
|
2
|
+
import { Context } from "../types/context.cjs";
|
|
3
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
4
|
+
|
|
5
|
+
//#region src/plugin-utils/traverse-command-tree.d.ts
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Traverses a command tree and applies a visitor function to each node.
|
|
9
|
+
*
|
|
10
|
+
* @param commandTree - The command tree to traverse.
|
|
11
|
+
* @param visitor - The visitor function to apply to each node.
|
|
12
|
+
*/
|
|
13
|
+
declare function traverseCommandTree(commandTree: CommandTree, visitor: (node: CommandTree) => MaybePromise<void>): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Traverses all commands in the context and applies a visitor function to each command tree.
|
|
16
|
+
*
|
|
17
|
+
* @param context - The build context containing the command definitions.
|
|
18
|
+
* @param visitor - The visitor function to apply to each command tree.
|
|
19
|
+
*/
|
|
20
|
+
declare function traverseCommands<TContext extends Context>(context: TContext, visitor: (node: CommandTree) => MaybePromise<void>): Promise<void>;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { traverseCommandTree, traverseCommands };
|
|
23
|
+
//# sourceMappingURL=traverse-command-tree.d.cts.map
|