@shell-shock/core 0.17.2 → 0.17.4
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/dist/api.cjs +5 -4
- package/dist/api.mjs +4 -2
- package/dist/api.mjs.map +1 -1
- package/dist/components/command-validation-logic.cjs +44 -11
- package/dist/components/command-validation-logic.mjs +44 -10
- package/dist/components/command-validation-logic.mjs.map +1 -1
- package/dist/components/docs.cjs +1 -2
- package/dist/components/exec-builtin.cjs +91 -99
- package/dist/components/exec-builtin.mjs +90 -97
- package/dist/components/exec-builtin.mjs.map +1 -1
- package/dist/components/helpers.cjs +1 -2
- package/dist/components/options-parser-logic.cjs +1 -2
- package/dist/components/state-builtin.cjs +2 -3
- package/dist/components/state-builtin.mjs +2 -2
- package/dist/components/state-builtin.mjs.map +1 -1
- package/dist/components/usage.cjs +1 -2
- package/dist/components/utils-builtin.cjs +2 -17
- package/dist/components/utils-builtin.mjs +1 -15
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/config.cjs +3 -3
- package/dist/config.mjs +2 -1
- package/dist/contexts/command.cjs +6 -3
- package/dist/contexts/command.mjs +5 -1
- package/dist/contexts/command.mjs.map +1 -1
- package/dist/contexts/options.cjs +7 -4
- package/dist/contexts/options.mjs +5 -1
- package/dist/contexts/options.mjs.map +1 -1
- package/dist/helpers/automd.cjs +1 -2
- package/dist/helpers/docs-helpers.cjs +3 -3
- package/dist/helpers/docs-helpers.mjs +2 -1
- package/dist/helpers/docs-helpers.mjs.map +1 -1
- package/dist/helpers/paths.cjs +3 -3
- package/dist/helpers/paths.mjs +2 -1
- package/dist/helpers/paths.mjs.map +1 -1
- package/dist/helpers/persistence.cjs +7 -5
- package/dist/helpers/persistence.mjs +6 -3
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/helpers/update-package-json.cjs +1 -2
- package/dist/helpers/utilities.cjs +3 -3
- package/dist/helpers/utilities.mjs +2 -1
- package/dist/helpers/utilities.mjs.map +1 -1
- package/dist/helpers/validations.cjs +1 -2
- package/dist/plugin-utils/context-helpers.cjs +21 -12
- package/dist/plugin-utils/context-helpers.mjs +20 -10
- package/dist/plugin-utils/context-helpers.mjs.map +1 -1
- package/dist/plugin-utils/deepkit.cjs +5 -6
- package/dist/plugin-utils/deepkit.mjs +5 -5
- package/dist/plugin-utils/deepkit.mjs.map +1 -1
- package/dist/plugin-utils/description-helpers.cjs +14 -8
- package/dist/plugin-utils/description-helpers.mjs +13 -6
- package/dist/plugin-utils/description-helpers.mjs.map +1 -1
- package/dist/plugin-utils/get-command-tree.cjs +5 -4
- package/dist/plugin-utils/get-command-tree.mjs +4 -2
- package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/reflect.cjs +3 -3
- package/dist/plugin-utils/reflect.mjs +2 -1
- package/dist/plugin-utils/traverse-command-tree.cjs +5 -4
- package/dist/plugin-utils/traverse-command-tree.mjs +4 -2
- package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/type-checks.cjs +11 -7
- package/dist/plugin-utils/type-checks.mjs +10 -5
- package/dist/plugin-utils/type-checks.mjs.map +1 -1
- package/dist/plugin.cjs +8 -5
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +7 -4
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/deepkit.cjs +4 -9
- package/dist/resolver/deepkit.mjs +4 -8
- package/dist/resolver/deepkit.mjs.map +1 -1
- package/dist/resolver/helpers.cjs +5 -4
- package/dist/resolver/helpers.mjs +4 -2
- package/dist/resolver/helpers.mjs.map +1 -1
- package/dist/resolver/module.cjs +1 -2
- package/dist/resolver/resolve.cjs +8 -5
- package/dist/resolver/resolve.mjs +7 -3
- package/dist/resolver/resolve.mjs.map +1 -1
- package/dist/types/command.cjs +65 -12
- package/dist/types/command.d.cts +9 -1
- package/dist/types/command.d.cts.map +1 -1
- package/dist/types/command.d.mts +9 -1
- package/dist/types/command.d.mts.map +1 -1
- package/dist/types/command.mjs +64 -10
- package/dist/types/command.mjs.map +1 -1
- package/dist/types/config.cjs +20 -7
- package/dist/types/config.d.cts +3 -2
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +3 -2
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/config.mjs +19 -5
- package/dist/types/config.mjs.map +1 -1
- package/dist/types/context.cjs +6 -3
- package/dist/types/context.mjs +5 -1
- package/dist/types/env.cjs +38 -3
- package/dist/types/env.d.cts +3 -1
- package/dist/types/env.d.cts.map +1 -1
- package/dist/types/env.d.mts +3 -1
- package/dist/types/env.d.mts.map +1 -1
- package/dist/types/env.mjs +37 -1
- package/dist/types/env.mjs.map +1 -1
- package/dist/types/options.cjs +1 -2
- package/package.json +11 -11
- package/dist/api.cjs.map +0 -1
- package/dist/components/command-validation-logic.cjs.map +0 -1
- package/dist/components/docs.cjs.map +0 -1
- package/dist/components/exec-builtin.cjs.map +0 -1
- package/dist/components/helpers.cjs.map +0 -1
- package/dist/components/options-parser-logic.cjs.map +0 -1
- package/dist/components/state-builtin.cjs.map +0 -1
- package/dist/components/usage.cjs.map +0 -1
- package/dist/components/utils-builtin.cjs.map +0 -1
- package/dist/config.cjs.map +0 -1
- package/dist/contexts/command.cjs.map +0 -1
- package/dist/contexts/options.cjs.map +0 -1
- package/dist/helpers/automd.cjs.map +0 -1
- package/dist/helpers/docs-helpers.cjs.map +0 -1
- package/dist/helpers/paths.cjs.map +0 -1
- package/dist/helpers/persistence.cjs.map +0 -1
- package/dist/helpers/update-package-json.cjs.map +0 -1
- package/dist/helpers/utilities.cjs.map +0 -1
- package/dist/helpers/validations.cjs.map +0 -1
- package/dist/plugin-utils/context-helpers.cjs.map +0 -1
- package/dist/plugin-utils/deepkit.cjs.map +0 -1
- package/dist/plugin-utils/description-helpers.cjs.map +0 -1
- package/dist/plugin-utils/get-command-tree.cjs.map +0 -1
- package/dist/plugin-utils/reflect.cjs.map +0 -1
- package/dist/plugin-utils/traverse-command-tree.cjs.map +0 -1
- package/dist/plugin-utils/type-checks.cjs.map +0 -1
- package/dist/plugin.cjs.map +0 -1
- package/dist/resolver/deepkit.cjs.map +0 -1
- package/dist/resolver/helpers.cjs.map +0 -1
- package/dist/resolver/module.cjs.map +0 -1
- package/dist/resolver/resolve.cjs.map +0 -1
- package/dist/types/command.cjs.map +0 -1
- package/dist/types/config.cjs.map +0 -1
- package/dist/types/context.cjs.map +0 -1
- package/dist/types/env.cjs.map +0 -1
- package/dist/types/options.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deepkit.mjs","names":[],"sources":["../../src/plugin-utils/deepkit.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 { Type } from \"@powerlines/deepkit/vendor/type\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type {\n BaseCommandParameter,\n CommandParameterKind,\n StringCommandParameter\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\nimport { isCommandParameterKind } from \"./type-checks\";\n\n/**\n * Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.\n *\n * @param command - The command parameter or kind to extract the reflection kind from.\n * @param checkVariadic - Whether to check for variadic parameters (arrays).\n * @returns The extracted {@link ReflectionKind}.\n */\nexport function extractReflectionKind(\n command: BaseCommandParameter | CommandParameterKind,\n checkVariadic = true\n): ReflectionKind {\n if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.string) ||\n (isSetObject(command as BaseCommandParameter) &&\n (command as BaseCommandParameter).kind === CommandParameterKinds.string)\n ) {\n return checkVariadic && (command as StringCommandParameter).variadic\n ? ReflectionKind.array\n : ReflectionKind.string;\n } else if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.number) ||\n (isSetObject(command as BaseCommandParameter) &&\n (command as BaseCommandParameter).kind === CommandParameterKinds.number)\n ) {\n return checkVariadic && (command as any).variadic\n ? ReflectionKind.array\n : ReflectionKind.number;\n } else if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.boolean) ||\n (isSetObject(command) && command.kind === CommandParameterKinds.boolean)\n ) {\n return ReflectionKind.boolean;\n } else {\n return ReflectionKind.string;\n }\n}\n\n/**\n * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.\n *\n * @param command - The command parameter or kind to extract the type from.\n * @param checkVariadic - Whether to check for variadic parameters (arrays).\n * @returns The extracted {@link Type}.\n */\nexport function extractType(\n command: BaseCommandParameter | CommandParameterKind,\n checkVariadic = true\n): Type {\n const reflectionKind = extractReflectionKind(command, checkVariadic);\n if (reflectionKind === ReflectionKind.string) {\n return { kind: ReflectionKind.string };\n } else if (reflectionKind === ReflectionKind.number) {\n return { kind: ReflectionKind.number };\n } else if (reflectionKind === ReflectionKind.boolean) {\n return { kind: ReflectionKind.boolean };\n } else if (reflectionKind === ReflectionKind.array) {\n if (isCommandParameterKind(command)) {\n return {\n kind: ReflectionKind.array,\n type: extractType(\n {\n kind: command\n } as BaseCommandParameter,\n false\n )\n };\n } else if (isSetObject(command)) {\n return {\n kind: ReflectionKind.array,\n type: extractType(\n {\n ...command,\n kind: command.kind\n } as BaseCommandParameter,\n false\n )\n };\n } else {\n return {\n kind: ReflectionKind.array,\n type: { kind: ReflectionKind.string }\n };\n }\n } else {\n return { kind: ReflectionKind.string };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"deepkit.mjs","names":[],"sources":["../../src/plugin-utils/deepkit.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 { Type } from \"@powerlines/deepkit/vendor/type\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type {\n BaseCommandParameter,\n CommandParameterKind,\n StringCommandParameter\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\nimport { isCommandParameterKind } from \"./type-checks\";\n\n/**\n * Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.\n *\n * @param command - The command parameter or kind to extract the reflection kind from.\n * @param checkVariadic - Whether to check for variadic parameters (arrays).\n * @returns The extracted {@link ReflectionKind}.\n */\nexport function extractReflectionKind(\n command: BaseCommandParameter | CommandParameterKind,\n checkVariadic = true\n): ReflectionKind {\n if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.string) ||\n (isSetObject(command as BaseCommandParameter) &&\n (command as BaseCommandParameter).kind === CommandParameterKinds.string)\n ) {\n return checkVariadic && (command as StringCommandParameter).variadic\n ? ReflectionKind.array\n : ReflectionKind.string;\n } else if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.number) ||\n (isSetObject(command as BaseCommandParameter) &&\n (command as BaseCommandParameter).kind === CommandParameterKinds.number)\n ) {\n return checkVariadic && (command as any).variadic\n ? ReflectionKind.array\n : ReflectionKind.number;\n } else if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.boolean) ||\n (isSetObject(command) && command.kind === CommandParameterKinds.boolean)\n ) {\n return ReflectionKind.boolean;\n } else {\n return ReflectionKind.string;\n }\n}\n\n/**\n * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.\n *\n * @param command - The command parameter or kind to extract the type from.\n * @param checkVariadic - Whether to check for variadic parameters (arrays).\n * @returns The extracted {@link Type}.\n */\nexport function extractType(\n command: BaseCommandParameter | CommandParameterKind,\n checkVariadic = true\n): Type {\n const reflectionKind = extractReflectionKind(command, checkVariadic);\n if (reflectionKind === ReflectionKind.string) {\n return { kind: ReflectionKind.string };\n } else if (reflectionKind === ReflectionKind.number) {\n return { kind: ReflectionKind.number };\n } else if (reflectionKind === ReflectionKind.boolean) {\n return { kind: ReflectionKind.boolean };\n } else if (reflectionKind === ReflectionKind.array) {\n if (isCommandParameterKind(command)) {\n return {\n kind: ReflectionKind.array,\n type: extractType(\n {\n kind: command\n } as BaseCommandParameter,\n false\n )\n };\n } else if (isSetObject(command)) {\n return {\n kind: ReflectionKind.array,\n type: extractType(\n {\n ...command,\n kind: command.kind\n } as BaseCommandParameter,\n false\n )\n };\n } else {\n return {\n kind: ReflectionKind.array,\n type: { kind: ReflectionKind.string }\n };\n }\n } else {\n return { kind: ReflectionKind.string };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA6BE,KAAA,uBAAA,QAAA,IACC,YAAiB,sBAAsB,UACzC,YAAA,QAAA,IACS,QAAU,SAAI,sBAA0B,OAC9C,QAAM,iBAAgB,QAAW,WACzB,eAAgB,QAC1B,eAAA;UAES,uBAAuB,QAAA,IAChC,YAAgB,sBAAA,UACf,YAAe,QAAA,IACb,QAAA,SAAA,sBAAA,OACA,QAAA,iBAAuB,QAAU,WACxB,eAAI,QACb,eAAuB;UAExB,uBAAA,QAAA,IACA,YAAO,sBAA6B,WAChC,YAAA,QAAe,IAAA,QAAA,SAAA,sBAAA,QACf,QAAA,eAAqB;KAGvB,QAAS,eAAG;;AAGlB,sBAAI,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;AAQJ,SAAI,YAAA,SAAA,gBAAA,MAAA;CACA,MAAM,iBAAgB,sBAAO,SAAA,cAAA;AAC7B,KAAI,mBAAC,eAAA,OACL,QAAO,EAAA,MAAA,eAAqB,QAAA;UAEhC,mBAAA,eAAA;UAGa,mBAAmB,eAAS,QACxC,QAAA,EAAA,MAAA,eAAA,SAAA;UAES,mBAAgB,eAAqB,MAC3C,KAAQ,uBAAqB,QAAK,CACpC,QAAA;EACc,MAAA,eAAW;EAChB,MAAA,YAAuB,EAChB,MAAA,SACV,EAAA,MAAA;EACA;UAES,YAAE,QAAe,CACtB,QAAC;EACA,MAAM,eAAe;EACrB,MAAA,YAAmB;GACb,GAAA;GACN,MAAA,QAAmB;GACxB,EAAA,MAAA;EACK;KAGH,QAAA;EACM,MAAE,eAAA;EACH,MAAA,EAAA,MAAA,eAAoB,QAAA;EACzB;KAIJ,QAAO,EAAA,MAAA,eAAA,QAAA;;AAGb,YAAU,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
const __ΩFormatDescriptionOptions = [
|
|
4
4
|
"replaceNewlines",
|
|
5
5
|
true,
|
|
6
|
+
"If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.",
|
|
6
7
|
"collapseWhitespace",
|
|
8
|
+
"If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.",
|
|
7
9
|
"FormatDescriptionOptions",
|
|
8
|
-
"P)4!8>\")4
|
|
10
|
+
"P)4!8>\"?#)4$8>\"?%Mw&y"
|
|
9
11
|
];
|
|
10
12
|
/**
|
|
11
13
|
* Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
|
|
@@ -28,7 +30,8 @@ formatDescriptionWhitespace.__type = [
|
|
|
28
30
|
"options",
|
|
29
31
|
() => ({}),
|
|
30
32
|
"formatDescriptionWhitespace",
|
|
31
|
-
"
|
|
33
|
+
"Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.",
|
|
34
|
+
"P&2!n\"2#>$&/%?&"
|
|
32
35
|
];
|
|
33
36
|
/**
|
|
34
37
|
* Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
|
|
@@ -45,7 +48,8 @@ function formatDescriptionEscapes(description) {
|
|
|
45
48
|
formatDescriptionEscapes.__type = [
|
|
46
49
|
"description",
|
|
47
50
|
"formatDescriptionEscapes",
|
|
48
|
-
"
|
|
51
|
+
"Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.",
|
|
52
|
+
"P&2!&/\"?#"
|
|
49
53
|
];
|
|
50
54
|
/**
|
|
51
55
|
* Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
|
|
@@ -65,14 +69,16 @@ formatDescription.__type = [
|
|
|
65
69
|
"options",
|
|
66
70
|
() => ({}),
|
|
67
71
|
"formatDescription",
|
|
68
|
-
"
|
|
72
|
+
"Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.",
|
|
73
|
+
"P&2!n\"2#>$&/%?&"
|
|
69
74
|
];
|
|
70
75
|
const __ΩFormatShortDescriptionOptions = [
|
|
71
76
|
() => __ΩFormatDescriptionOptions,
|
|
72
77
|
"length",
|
|
73
78
|
62,
|
|
79
|
+
"The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.",
|
|
74
80
|
"FormatShortDescriptionOptions",
|
|
75
|
-
"Pn!'4\"8
|
|
81
|
+
"Pn!'4\"8>#?$Mw%y"
|
|
76
82
|
];
|
|
77
83
|
/**
|
|
78
84
|
* Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.
|
|
@@ -94,12 +100,12 @@ formatShortDescription.__type = [
|
|
|
94
100
|
"options",
|
|
95
101
|
() => ({}),
|
|
96
102
|
"formatShortDescription",
|
|
97
|
-
"
|
|
103
|
+
"Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.",
|
|
104
|
+
"P&2!n\"2#>$&/%?&"
|
|
98
105
|
];
|
|
99
106
|
|
|
100
107
|
//#endregion
|
|
101
108
|
exports.__ΩFormatDescriptionOptions = __ΩFormatDescriptionOptions;
|
|
102
109
|
exports.__ΩFormatShortDescriptionOptions = __ΩFormatShortDescriptionOptions;
|
|
103
110
|
exports.formatDescription = formatDescription;
|
|
104
|
-
exports.formatShortDescription = formatShortDescription;
|
|
105
|
-
//# sourceMappingURL=description-helpers.cjs.map
|
|
111
|
+
exports.formatShortDescription = formatShortDescription;
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
const __ΩFormatDescriptionOptions = [
|
|
3
3
|
"replaceNewlines",
|
|
4
4
|
true,
|
|
5
|
+
"If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.",
|
|
5
6
|
"collapseWhitespace",
|
|
7
|
+
"If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.",
|
|
6
8
|
"FormatDescriptionOptions",
|
|
7
|
-
"P)4!8>\")4
|
|
9
|
+
"P)4!8>\"?#)4$8>\"?%Mw&y"
|
|
8
10
|
];
|
|
9
11
|
/**
|
|
10
12
|
* Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
|
|
@@ -27,7 +29,8 @@ formatDescriptionWhitespace.__type = [
|
|
|
27
29
|
"options",
|
|
28
30
|
() => ({}),
|
|
29
31
|
"formatDescriptionWhitespace",
|
|
30
|
-
"
|
|
32
|
+
"Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.",
|
|
33
|
+
"P&2!n\"2#>$&/%?&"
|
|
31
34
|
];
|
|
32
35
|
/**
|
|
33
36
|
* Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
|
|
@@ -44,7 +47,8 @@ function formatDescriptionEscapes(description) {
|
|
|
44
47
|
formatDescriptionEscapes.__type = [
|
|
45
48
|
"description",
|
|
46
49
|
"formatDescriptionEscapes",
|
|
47
|
-
"
|
|
50
|
+
"Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.",
|
|
51
|
+
"P&2!&/\"?#"
|
|
48
52
|
];
|
|
49
53
|
/**
|
|
50
54
|
* Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
|
|
@@ -64,14 +68,16 @@ formatDescription.__type = [
|
|
|
64
68
|
"options",
|
|
65
69
|
() => ({}),
|
|
66
70
|
"formatDescription",
|
|
67
|
-
"
|
|
71
|
+
"Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.",
|
|
72
|
+
"P&2!n\"2#>$&/%?&"
|
|
68
73
|
];
|
|
69
74
|
const __ΩFormatShortDescriptionOptions = [
|
|
70
75
|
() => __ΩFormatDescriptionOptions,
|
|
71
76
|
"length",
|
|
72
77
|
62,
|
|
78
|
+
"The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.",
|
|
73
79
|
"FormatShortDescriptionOptions",
|
|
74
|
-
"Pn!'4\"8
|
|
80
|
+
"Pn!'4\"8>#?$Mw%y"
|
|
75
81
|
];
|
|
76
82
|
/**
|
|
77
83
|
* Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.
|
|
@@ -93,7 +99,8 @@ formatShortDescription.__type = [
|
|
|
93
99
|
"options",
|
|
94
100
|
() => ({}),
|
|
95
101
|
"formatShortDescription",
|
|
96
|
-
"
|
|
102
|
+
"Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.",
|
|
103
|
+
"P&2!n\"2#>$&/%?&"
|
|
97
104
|
];
|
|
98
105
|
|
|
99
106
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"description-helpers.mjs","names":[],"sources":["../../src/plugin-utils/description-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\nexport interface FormatDescriptionOptions {\n /**\n * If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.\n *\n * @defaultValue false\n */\n replaceNewlines?: boolean;\n\n /**\n * If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.\n *\n * @defaultValue false\n */\n collapseWhitespace?: boolean;\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionWhitespace(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n let formattedDescription = description.trim();\n if (options.replaceNewlines) {\n formattedDescription = formattedDescription.replace(/\\s*\\n\\s*/g, \" \");\n }\n if (options.collapseWhitespace) {\n formattedDescription = formattedDescription.replace(/\\s{2,}/g, \" \");\n }\n\n return formattedDescription.trim();\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionEscapes(description: string): string {\n return description\n .replaceAll(\"'\", \"\\\\'\")\n .replaceAll('\"', '\\\\\"')\n .replaceAll(\"`\", \"\\\\`\")\n .replace(/\\$\\{/g, \"\\\\${\");\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nexport function formatDescription(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n return formatDescriptionEscapes(\n formatDescriptionWhitespace(description, options)\n );\n}\n\nexport interface FormatShortDescriptionOptions extends FormatDescriptionOptions {\n /**\n * The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.\n *\n * @defaultValue 62\n */\n length?: number;\n}\n\n/**\n * Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.\n *\n * @param description - The full description string.\n * @param options - Options for formatting the short description, including the maximum length.\n * @returns The extracted short description.\n */\nexport function formatShortDescription(\n description: string,\n options: FormatShortDescriptionOptions = {}\n): string {\n const length = options.length ?? 62;\n const formattedDescription = formatDescriptionWhitespace(\n description,\n options\n );\n\n const firstSentenceMatch =\n formattedDescription.indexOf(\"\\n\") < length - 3 ||\n formattedDescription.search(/[.!?\\n]\\s*\\S/) > length - 3\n ? formattedDescription\n .match(/^.*[.!?\\n]\\s?\\S/)?.[0]\n ?.trim()\n ?.slice(0, -1)\n ?.trim()\n : undefined;\n\n let result = (firstSentenceMatch || formattedDescription).trim();\n if (result.trim().length > length) {\n result = `${result.substring(0, Math.max(0, length - 3)).trim()}...`;\n }\n\n return formatDescriptionEscapes(result);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"description-helpers.mjs","names":[],"sources":["../../src/plugin-utils/description-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\nexport interface FormatDescriptionOptions {\n /**\n * If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.\n *\n * @defaultValue false\n */\n replaceNewlines?: boolean;\n\n /**\n * If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.\n *\n * @defaultValue false\n */\n collapseWhitespace?: boolean;\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionWhitespace(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n let formattedDescription = description.trim();\n if (options.replaceNewlines) {\n formattedDescription = formattedDescription.replace(/\\s*\\n\\s*/g, \" \");\n }\n if (options.collapseWhitespace) {\n formattedDescription = formattedDescription.replace(/\\s{2,}/g, \" \");\n }\n\n return formattedDescription.trim();\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionEscapes(description: string): string {\n return description\n .replaceAll(\"'\", \"\\\\'\")\n .replaceAll('\"', '\\\\\"')\n .replaceAll(\"`\", \"\\\\`\")\n .replace(/\\$\\{/g, \"\\\\${\");\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nexport function formatDescription(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n return formatDescriptionEscapes(\n formatDescriptionWhitespace(description, options)\n );\n}\n\nexport interface FormatShortDescriptionOptions extends FormatDescriptionOptions {\n /**\n * The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.\n *\n * @defaultValue 62\n */\n length?: number;\n}\n\n/**\n * Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.\n *\n * @param description - The full description string.\n * @param options - Options for formatting the short description, including the maximum length.\n * @returns The extracted short description.\n */\nexport function formatShortDescription(\n description: string,\n options: FormatShortDescriptionOptions = {}\n): string {\n const length = options.length ?? 62;\n const formattedDescription = formatDescriptionWhitespace(\n description,\n options\n );\n\n const firstSentenceMatch =\n formattedDescription.indexOf(\"\\n\") < length - 3 ||\n formattedDescription.search(/[.!?\\n]\\s*\\S/) > length - 3\n ? formattedDescription\n .match(/^.*[.!?\\n]\\s?\\S/)?.[0]\n ?.trim()\n ?.slice(0, -1)\n ?.trim()\n : undefined;\n\n let result = (firstSentenceMatch || formattedDescription).trim();\n if (result.trim().length > length) {\n result = `${result.substring(0, Math.max(0, length - 3)).trim()}...`;\n }\n\n return formatDescriptionEscapes(result);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4BA,SAAG,4BAAA,aAAA,UAAA,EAAA,EAAA;CACC,IAAE,uBAAa,YAAA,MAAA;AACf,KAAA,QAAA,gBACF,wBAA4B,qBAAA,QAAA,aAAA,IAAA;gCAG5B,wBAAA,qBAAA,QAAA,WAAA,IAAA;AAED,QAAA,qBAAA,MAAA;;AAED,4BAAsB,SAAc;CAAA;OAAiB;CAAgC;QAAqB,EAAE;CAAC;CAAa;CAAA;CAAA;;;;;;;;;;AAU1H,SAAM,yBAAyB,aAAA;AAC3B,QAAA,YACF,WAAA,KAAA,MAAA,CACI,WAAQ,MAAA,OAAA,CACV,WAAA,KAAqB,MAAE,CACzB,QAAA,SAAA,OAAA;;AAEF,yBAAS,SAAyB;CAAC;CAAC;CAAA;CAAA;CAAA;;;;;;;;;;AAUpC,SAAgB,kBAAU,aAAkB,UAAA,EAAA,EAAA;AAC1C,QAAA,yBAAA,4BAAA,aAAA,QAAA,CAAA;;AAEF,kBAAS,SAAA;CAAA;OAAA;CAAA;QAAA,EAAA;CAAA;CAAA;CAAA;CAAA;AACT,MAAK,mCAAqB;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;AAS1B,SAAI,uBAAA,aAAA,UAAA,EAAA,EAAA;CACD,MAAO,SAAQ,QAAI,UAAc;CACnC,MAAA,uBAAA,4BAAA,aAAA,QAAA;CASG,IAAA,WARwB,qBAAuB,QAAA,KAAA,GAAA,SAAA,KAC/C,qBAAsB,OAAA,eAAkB,GAAA,SAAA,IAC1C,qBACK,MAAS,kBAAiB,GAAA,IACnB,MAAC,EACJ,MAAA,GAAA,GAAA,EACD,MAAA,GACD,WACuB,sBAAoB,MAAA;AACjD,KAAA,OAAA,MAAA,CAAA,SAAA,OACH,UAAA,GAAA,OAAA,UAAA,GAAA,KAAA,IAAA,GAAA,SAAA,EAAA,CAAA,CAAA,MAAA,CAAA;AAEA,QAAO,yBAAU,OAAA;;AAEjB,uBAAuB,SAAQ;CAAA;OAAsB;CAAgC;QAAmB,EAAA;CAAA;CAAS;CAAA;CAAA"}
|
|
@@ -33,7 +33,8 @@ getCommandTree.__type = [
|
|
|
33
33
|
"path",
|
|
34
34
|
"CommandTree",
|
|
35
35
|
"getCommandTree",
|
|
36
|
-
"
|
|
36
|
+
"Retrieves a specific command tree based on the provided path.",
|
|
37
|
+
"P\"w!2\"\"2#P\"w$,J/%?&"
|
|
37
38
|
];
|
|
38
39
|
/**
|
|
39
40
|
* Retrieves a list of all command trees defined in the context.
|
|
@@ -57,10 +58,10 @@ getCommandList.__type = [
|
|
|
57
58
|
"context",
|
|
58
59
|
"CommandTree",
|
|
59
60
|
"getCommandList",
|
|
60
|
-
"
|
|
61
|
+
"Retrieves a list of all command trees defined in the context.",
|
|
62
|
+
"P\"w!2\"\"w#F`/$?%"
|
|
61
63
|
];
|
|
62
64
|
|
|
63
65
|
//#endregion
|
|
64
66
|
exports.getCommandList = getCommandList;
|
|
65
|
-
exports.getCommandTree = getCommandTree;
|
|
66
|
-
//# sourceMappingURL=get-command-tree.cjs.map
|
|
67
|
+
exports.getCommandTree = getCommandTree;
|
|
@@ -33,7 +33,8 @@ getCommandTree.__type = [
|
|
|
33
33
|
"path",
|
|
34
34
|
"CommandTree",
|
|
35
35
|
"getCommandTree",
|
|
36
|
-
"
|
|
36
|
+
"Retrieves a specific command tree based on the provided path.",
|
|
37
|
+
"P\"w!2\"\"2#P\"w$,J/%?&"
|
|
37
38
|
];
|
|
38
39
|
/**
|
|
39
40
|
* Retrieves a list of all command trees defined in the context.
|
|
@@ -57,7 +58,8 @@ getCommandList.__type = [
|
|
|
57
58
|
"context",
|
|
58
59
|
"CommandTree",
|
|
59
60
|
"getCommandList",
|
|
60
|
-
"
|
|
61
|
+
"Retrieves a list of all command trees defined in the context.",
|
|
62
|
+
"P\"w!2\"\"w#F`/$?%"
|
|
61
63
|
];
|
|
62
64
|
|
|
63
65
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-command-tree.mjs","names":[],"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 { isDynamicPathSegment } from \"./context-helpers\";\nimport { traverseCommands } from \"./traverse-command-tree\";\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 => !isDynamicPathSegment(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\n/**\n * Retrieves a list of all command trees defined in the context.\n *\n * @param context - The build context containing the command definitions.\n * @returns A promise that resolves to an array of all command trees in the context.\n */\nexport async function getCommandList(context: Context): Promise<CommandTree[]> {\n const commandList: CommandTree[] = [];\n await traverseCommands(context, commandTree => {\n commandList.push(commandTree);\n });\n\n return commandList;\n}\n"],"mappings":";;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;;;AAYV,KAAK,KAAO,WAAW;;AAIxB,KAAO,KAAM,SAAC,GAAW;EAClB,MAAO,WAAU,KACf,MAAA,EAAA,CACA,OAAA,cAAwB,YAAW,CAAC,qBAAa,QAAA,EAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;iCAExD,KAAA,aAAA,YACa,OAAQ,UAAS,eAAc,KAAI,YAAa,UAAA,QAAA,CAC9D,eAAA,YAAA,SAAA,YAAA;MAGe,QAAO;;AAIrB,QAAS;;AAEX,eAAW,SAAa;CAAC;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOzB,eAAc,eAAA,SAAA;CACV,MAAG,cAAiB,EAAE;AACtB,OAAK,iBAAiB,SAAU,cAAA,gBAAA;AAC5B,cAAC,KAAA,YAAA;IACF;EAAC;EAAa;EAAA;EAAU,CAAA,CAAA;AAC3B,QAAI;;AAER,eAAQ,SAAc;CAAA;CAAY;CAAS;CAAgB;CAAA;CAAA"}
|
|
1
|
+
{"version":3,"file":"get-command-tree.mjs","names":[],"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 { isDynamicPathSegment } from \"./context-helpers\";\nimport { traverseCommands } from \"./traverse-command-tree\";\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 => !isDynamicPathSegment(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\n/**\n * Retrieves a list of all command trees defined in the context.\n *\n * @param context - The build context containing the command definitions.\n * @returns A promise that resolves to an array of all command trees in the context.\n */\nexport async function getCommandList(context: Context): Promise<CommandTree[]> {\n const commandList: CommandTree[] = [];\n await traverseCommands(context, commandTree => {\n commandList.push(commandTree);\n });\n\n return commandList;\n}\n"],"mappings":";;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;;;AAYV,KAAK,KAAO,WAAW;;AAIxB,KAAO,KAAM,SAAC,GAAW;EAClB,MAAO,WAAU,KACf,MAAA,EAAA,CACA,OAAA,cAAwB,YAAW,CAAC,qBAAa,QAAA,EAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;iCAExD,KAAA,aAAA,YACa,OAAQ,UAAS,eAAc,KAAI,YAAa,UAAA,QAAA,CAC9D,eAAA,YAAA,SAAA,YAAA;MAGe,QAAO;;AAIrB,QAAS;;AAEX,eAAW,SAAa;CAAC;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOzB,eAAc,eAAA,SAAA;CACV,MAAG,cAAiB,EAAE;AACtB,OAAK,iBAAiB,SAAU,cAAA,gBAAA;AAC5B,cAAC,KAAA,YAAA;IACF;EAAC;EAAa;EAAA;EAAU,CAAA,CAAA;AAC3B,QAAI;;AAER,eAAQ,SAAc;CAAA;CAAY;CAAS;CAAgB;CAAA;CAAA;CAAA"}
|
|
@@ -44,9 +44,9 @@ sortOptions.__type = [
|
|
|
44
44
|
"CommandOption",
|
|
45
45
|
"options",
|
|
46
46
|
"sortOptions",
|
|
47
|
-
"
|
|
47
|
+
"Sort command options alphabetically by name, placing boolean options with negatives appropriately.",
|
|
48
|
+
"P\"w!F2\"\"w!F/#?$"
|
|
48
49
|
];
|
|
49
50
|
|
|
50
51
|
//#endregion
|
|
51
|
-
exports.sortOptions = sortOptions;
|
|
52
|
-
//# sourceMappingURL=reflect.cjs.map
|
|
52
|
+
exports.sortOptions = sortOptions;
|
|
@@ -28,7 +28,8 @@ traverseCommandTree.__type = [
|
|
|
28
28
|
"",
|
|
29
29
|
"visitor",
|
|
30
30
|
"traverseCommandTree",
|
|
31
|
-
"
|
|
31
|
+
"Traverses a command tree and applies a visitor function to each node.",
|
|
32
|
+
"P\"w!2\"P\"w!2#!/$2%$`/&?'"
|
|
32
33
|
];
|
|
33
34
|
/**
|
|
34
35
|
* Traverses all commands in the context and applies a visitor function to each command tree.
|
|
@@ -54,10 +55,10 @@ traverseCommands.__type = [
|
|
|
54
55
|
"",
|
|
55
56
|
"visitor",
|
|
56
57
|
"traverseCommands",
|
|
57
|
-
"
|
|
58
|
+
"Traverses all commands in the context and applies a visitor function to each command tree.",
|
|
59
|
+
"P\"2!P\"w\"2#!/$2%$`/&?'"
|
|
58
60
|
];
|
|
59
61
|
|
|
60
62
|
//#endregion
|
|
61
63
|
exports.traverseCommandTree = traverseCommandTree;
|
|
62
|
-
exports.traverseCommands = traverseCommands;
|
|
63
|
-
//# sourceMappingURL=traverse-command-tree.cjs.map
|
|
64
|
+
exports.traverseCommands = traverseCommands;
|
|
@@ -27,7 +27,8 @@ traverseCommandTree.__type = [
|
|
|
27
27
|
"",
|
|
28
28
|
"visitor",
|
|
29
29
|
"traverseCommandTree",
|
|
30
|
-
"
|
|
30
|
+
"Traverses a command tree and applies a visitor function to each node.",
|
|
31
|
+
"P\"w!2\"P\"w!2#!/$2%$`/&?'"
|
|
31
32
|
];
|
|
32
33
|
/**
|
|
33
34
|
* Traverses all commands in the context and applies a visitor function to each command tree.
|
|
@@ -53,7 +54,8 @@ traverseCommands.__type = [
|
|
|
53
54
|
"",
|
|
54
55
|
"visitor",
|
|
55
56
|
"traverseCommands",
|
|
56
|
-
"
|
|
57
|
+
"Traverses all commands in the context and applies a visitor function to each command tree.",
|
|
58
|
+
"P\"2!P\"w\"2#!/$2%$`/&?'"
|
|
57
59
|
];
|
|
58
60
|
|
|
59
61
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverse-command-tree.mjs","names":[],"sources":["../../src/plugin-utils/traverse-command-tree.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { MaybePromise } from \"@stryke/types/base\";\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Traverses a command tree and applies a visitor function to each node.\n *\n * @param commandTree - The command tree to traverse.\n * @param visitor - The visitor function to apply to each node.\n */\nexport async function traverseCommandTree(\n commandTree: CommandTree,\n visitor: (node: CommandTree) => MaybePromise<void>\n): Promise<void> {\n if (!commandTree.children) {\n return;\n }\n\n await Promise.all(\n Object.values(commandTree.children).map(async childTree => {\n await Promise.resolve(visitor(childTree));\n await traverseCommandTree(childTree, visitor);\n })\n );\n}\n\n/**\n * Traverses all commands in the context and applies a visitor function to each command tree.\n *\n * @param context - The build context containing the command definitions.\n * @param visitor - The visitor function to apply to each command tree.\n */\nexport async function traverseCommands<TContext extends Context>(\n context: TContext,\n visitor: (node: CommandTree) => MaybePromise<void>\n): Promise<void> {\n if (!context.commands) {\n return;\n }\n\n await Promise.all(\n Object.values(context.commands).map(async childTree => {\n await Promise.resolve(visitor(childTree));\n await traverseCommandTree(childTree, visitor);\n })\n );\n}\n"],"mappings":";AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;AAQX,eAAsB,oBAAoB,aAAU,SAAS;AAC5D,KAAA,CAAA,YAAoB,SACb;AAEP,OAAK,QAAQ,IAAA,OAAa,OAAS,YAAA,SAAA,CAAA,IAAA,aAAA,OAAA,cAAA;;AAE5B,QAAM,oBAAoB,WAAW,QAAQ;;;;;;;AAGrD,oBAAc,SAAc;CAAA;CAAe;CAAQ;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOnD,eAAoB,iBAAY,SAAY,SAAa;AACvD,KAAA,CAAA,QAAA,SACK;AAEL,OAAQ,QAAQ,IAAA,OAAW,OAAK,QAAA,SAAiB,CAAA,IAAA,aAAA,OAAA,cAAA;AAChD,QAAQ,QAAM,QAAA,QAAA,UAAA,CAAA;AACV,QAAA,oBAAsB,WAAA,QAAA;IACzB;EAAA;EAAM;EAAA;EAAA,CAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"traverse-command-tree.mjs","names":[],"sources":["../../src/plugin-utils/traverse-command-tree.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { MaybePromise } from \"@stryke/types/base\";\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Traverses a command tree and applies a visitor function to each node.\n *\n * @param commandTree - The command tree to traverse.\n * @param visitor - The visitor function to apply to each node.\n */\nexport async function traverseCommandTree(\n commandTree: CommandTree,\n visitor: (node: CommandTree) => MaybePromise<void>\n): Promise<void> {\n if (!commandTree.children) {\n return;\n }\n\n await Promise.all(\n Object.values(commandTree.children).map(async childTree => {\n await Promise.resolve(visitor(childTree));\n await traverseCommandTree(childTree, visitor);\n })\n );\n}\n\n/**\n * Traverses all commands in the context and applies a visitor function to each command tree.\n *\n * @param context - The build context containing the command definitions.\n * @param visitor - The visitor function to apply to each command tree.\n */\nexport async function traverseCommands<TContext extends Context>(\n context: TContext,\n visitor: (node: CommandTree) => MaybePromise<void>\n): Promise<void> {\n if (!context.commands) {\n return;\n }\n\n await Promise.all(\n Object.values(context.commands).map(async childTree => {\n await Promise.resolve(visitor(childTree));\n await traverseCommandTree(childTree, visitor);\n })\n );\n}\n"],"mappings":";AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;AAQX,eAAsB,oBAAoB,aAAU,SAAS;AAC5D,KAAA,CAAA,YAAoB,SACb;AAEP,OAAK,QAAQ,IAAA,OAAa,OAAS,YAAA,SAAA,CAAA,IAAA,aAAA,OAAA,cAAA;;AAE5B,QAAM,oBAAoB,WAAW,QAAQ;;;;;;;AAGrD,oBAAc,SAAc;CAAA;CAAe;CAAQ;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOnD,eAAoB,iBAAY,SAAY,SAAa;AACvD,KAAA,CAAA,QAAA,SACK;AAEL,OAAQ,QAAQ,IAAA,OAAW,OAAK,QAAA,SAAiB,CAAA,IAAA,aAAA,OAAA,cAAA;AAChD,QAAQ,QAAM,QAAA,QAAA,UAAA,CAAA;AACV,QAAA,oBAAsB,WAAA,QAAA;IACzB;EAAA;EAAM;EAAA;EAAA,CAAA,CAAA,CAAA"}
|
|
@@ -21,7 +21,8 @@ function isCommandParameterKind(obj) {
|
|
|
21
21
|
isCommandParameterKind.__type = [
|
|
22
22
|
"obj",
|
|
23
23
|
"isCommandParameterKind",
|
|
24
|
-
"
|
|
24
|
+
"Type guard to check if a value is a valid {@link CommandParameterKind} type.",
|
|
25
|
+
"P\"2!!/\"?#"
|
|
25
26
|
];
|
|
26
27
|
/**
|
|
27
28
|
* Type guard to check if a value is a valid {@link CommandParameterConfig} type.
|
|
@@ -35,7 +36,8 @@ function isCommandParameterConfig(obj) {
|
|
|
35
36
|
isCommandParameterConfig.__type = [
|
|
36
37
|
"obj",
|
|
37
38
|
"isCommandParameterConfig",
|
|
38
|
-
"
|
|
39
|
+
"Type guard to check if a value is a valid {@link CommandParameterConfig} type.",
|
|
40
|
+
"P\"2!!/\"?#"
|
|
39
41
|
];
|
|
40
42
|
/**
|
|
41
43
|
* Type guard to check if a value is a valid {@link CommandParameter} type.
|
|
@@ -49,7 +51,8 @@ function isCommandParameter(obj) {
|
|
|
49
51
|
isCommandParameter.__type = [
|
|
50
52
|
"obj",
|
|
51
53
|
"isCommandParameter",
|
|
52
|
-
"
|
|
54
|
+
"Type guard to check if a value is a valid {@link CommandParameter} type.",
|
|
55
|
+
"P\"2!!/\"?#"
|
|
53
56
|
];
|
|
54
57
|
/**
|
|
55
58
|
* Type guard to check if a value is a valid {@link CommandOption} type.
|
|
@@ -63,7 +66,8 @@ function isCommandOption(obj) {
|
|
|
63
66
|
isCommandOption.__type = [
|
|
64
67
|
"obj",
|
|
65
68
|
"isCommandOption",
|
|
66
|
-
"
|
|
69
|
+
"Type guard to check if a value is a valid {@link CommandOption} type.",
|
|
70
|
+
"P\"2!!/\"?#"
|
|
67
71
|
];
|
|
68
72
|
/**
|
|
69
73
|
* Type guard to check if a value is a valid {@link CommandArgument} type.
|
|
@@ -77,7 +81,8 @@ function isCommandArgument(obj) {
|
|
|
77
81
|
isCommandArgument.__type = [
|
|
78
82
|
"obj",
|
|
79
83
|
"isCommandArgument",
|
|
80
|
-
"
|
|
84
|
+
"Type guard to check if a value is a valid {@link CommandArgument} type.",
|
|
85
|
+
"P\"2!!/\"?#"
|
|
81
86
|
];
|
|
82
87
|
|
|
83
88
|
//#endregion
|
|
@@ -85,5 +90,4 @@ exports.isCommandArgument = isCommandArgument;
|
|
|
85
90
|
exports.isCommandOption = isCommandOption;
|
|
86
91
|
exports.isCommandParameter = isCommandParameter;
|
|
87
92
|
exports.isCommandParameterConfig = isCommandParameterConfig;
|
|
88
|
-
exports.isCommandParameterKind = isCommandParameterKind;
|
|
89
|
-
//# sourceMappingURL=type-checks.cjs.map
|
|
93
|
+
exports.isCommandParameterKind = isCommandParameterKind;
|
|
@@ -20,7 +20,8 @@ function isCommandParameterKind(obj) {
|
|
|
20
20
|
isCommandParameterKind.__type = [
|
|
21
21
|
"obj",
|
|
22
22
|
"isCommandParameterKind",
|
|
23
|
-
"
|
|
23
|
+
"Type guard to check if a value is a valid {@link CommandParameterKind} type.",
|
|
24
|
+
"P\"2!!/\"?#"
|
|
24
25
|
];
|
|
25
26
|
/**
|
|
26
27
|
* Type guard to check if a value is a valid {@link CommandParameterConfig} type.
|
|
@@ -34,7 +35,8 @@ function isCommandParameterConfig(obj) {
|
|
|
34
35
|
isCommandParameterConfig.__type = [
|
|
35
36
|
"obj",
|
|
36
37
|
"isCommandParameterConfig",
|
|
37
|
-
"
|
|
38
|
+
"Type guard to check if a value is a valid {@link CommandParameterConfig} type.",
|
|
39
|
+
"P\"2!!/\"?#"
|
|
38
40
|
];
|
|
39
41
|
/**
|
|
40
42
|
* Type guard to check if a value is a valid {@link CommandParameter} type.
|
|
@@ -48,7 +50,8 @@ function isCommandParameter(obj) {
|
|
|
48
50
|
isCommandParameter.__type = [
|
|
49
51
|
"obj",
|
|
50
52
|
"isCommandParameter",
|
|
51
|
-
"
|
|
53
|
+
"Type guard to check if a value is a valid {@link CommandParameter} type.",
|
|
54
|
+
"P\"2!!/\"?#"
|
|
52
55
|
];
|
|
53
56
|
/**
|
|
54
57
|
* Type guard to check if a value is a valid {@link CommandOption} type.
|
|
@@ -62,7 +65,8 @@ function isCommandOption(obj) {
|
|
|
62
65
|
isCommandOption.__type = [
|
|
63
66
|
"obj",
|
|
64
67
|
"isCommandOption",
|
|
65
|
-
"
|
|
68
|
+
"Type guard to check if a value is a valid {@link CommandOption} type.",
|
|
69
|
+
"P\"2!!/\"?#"
|
|
66
70
|
];
|
|
67
71
|
/**
|
|
68
72
|
* Type guard to check if a value is a valid {@link CommandArgument} type.
|
|
@@ -76,7 +80,8 @@ function isCommandArgument(obj) {
|
|
|
76
80
|
isCommandArgument.__type = [
|
|
77
81
|
"obj",
|
|
78
82
|
"isCommandArgument",
|
|
79
|
-
"
|
|
83
|
+
"Type guard to check if a value is a valid {@link CommandArgument} type.",
|
|
84
|
+
"P\"2!!/\"?#"
|
|
80
85
|
];
|
|
81
86
|
|
|
82
87
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-checks.mjs","names":[],"sources":["../../src/plugin-utils/type-checks.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isBoolean } from \"@stryke/type-checks/is-boolean\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandParameter,\n CommandParameterConfig,\n CommandParameterKind\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameterKind} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameterKind} type, false otherwise.\n */\nexport function isCommandParameterKind(obj: any): obj is CommandParameterKind {\n return (\n isSetString(obj) &&\n [\n CommandParameterKinds.string,\n CommandParameterKinds.number,\n CommandParameterKinds.boolean\n ].includes(obj as CommandParameterKind)\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameterConfig} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameterConfig} type, false otherwise.\n */\nexport function isCommandParameterConfig(\n obj: any\n): obj is CommandParameterConfig {\n return isSetObject(obj) && \"kind\" in obj && isCommandParameterKind(obj.kind);\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameter} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameter} type, false otherwise.\n */\nexport function isCommandParameter(obj: any): obj is CommandParameter {\n return (\n isCommandParameterConfig(obj) &&\n \"name\" in obj &&\n isSetString(obj.name) &&\n \"title\" in obj &&\n isSetString(obj.title) &&\n \"description\" in obj &&\n isSetString(obj.description) &&\n \"alias\" in obj &&\n Array.isArray(obj.alias) &&\n \"env\" in obj &&\n (isSetString(obj.env) || obj.env === false) &&\n \"optional\" in obj &&\n isBoolean(obj.optional) &&\n \"variadic\" in obj &&\n isBoolean(obj.variadic)\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandOption} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandOption} type, false otherwise.\n */\nexport function isCommandOption(obj: any): obj is CommandOption {\n return (\n isCommandParameterConfig(obj) && isCommandParameter(obj) && \"default\" in obj\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandArgument} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandArgument} type, false otherwise.\n */\nexport function isCommandArgument(obj: any): obj is CommandArgument {\n return isCommandParameterConfig(obj) && isCommandParameter(obj);\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,SAAgB,uBAAS,KAAA;AACzB,QAAS,YAAA,IAAA;EAEP,sBAAA;EACM,sBAA0B;EACjC,sBAAA;EACQ,CAAC,SAAS,IAAC;;AAEpB,uBAAE,SAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOF,SAAM,yBAAsB,KAAA;AACxB,QAAE,YAAgB,IAAA,IAAA,UAAA,OAAoB,uBAAA,IAAA,KAAA;;AAE1C,yBAAA,SAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOA,SAAE,mBAAA,KAAA;AACF,QAAO,yBAAS,IAAwB,IACjC,UAAA,OACA,YAAG,IAAA,KAAA,IACF,WAAC,OACT,YAAA,IAAA,MAAA,4BAEE,YAAA,IAAA,YAAA,IACM,WAAS,OAChB,MAAA,QAAA,IAAA,MAAA,IACG,SAAY,QACZ,YAAgB,IAAI,IAAK,IAAI,IAAE,QAAQ,UACzC,cAAA,OACK,UAAS,IAAA,SAAA,IACR,cAAC,OACL,UAAA,IAAA,SAAyB;;AAE7B,mBAAmB,SAAQ;CAAA;CAAA;CAAA;CAAA;;;;;;;AAO3B,SAAgB,gBAAE,KAAA;AACd,QAAC,yBAAgC,IAAI,IAAA,mBAAQ,IAAA,IAAA,aAAA;;AAEjD,gBAAc,SAAI;CAAQ;CAAG;CAAA;CAAA;;;;;;;AAO7B,SAAgB,kBAAkB,KAAK;AACtC,QAAA,yBAAA,IAAA,IAAA,mBAAA,IAAA;;AAED,kBAAiB,SAAO;CAAA;CAAW;CAAa;
|
|
1
|
+
{"version":3,"file":"type-checks.mjs","names":[],"sources":["../../src/plugin-utils/type-checks.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isBoolean } from \"@stryke/type-checks/is-boolean\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandParameter,\n CommandParameterConfig,\n CommandParameterKind\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameterKind} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameterKind} type, false otherwise.\n */\nexport function isCommandParameterKind(obj: any): obj is CommandParameterKind {\n return (\n isSetString(obj) &&\n [\n CommandParameterKinds.string,\n CommandParameterKinds.number,\n CommandParameterKinds.boolean\n ].includes(obj as CommandParameterKind)\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameterConfig} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameterConfig} type, false otherwise.\n */\nexport function isCommandParameterConfig(\n obj: any\n): obj is CommandParameterConfig {\n return isSetObject(obj) && \"kind\" in obj && isCommandParameterKind(obj.kind);\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameter} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameter} type, false otherwise.\n */\nexport function isCommandParameter(obj: any): obj is CommandParameter {\n return (\n isCommandParameterConfig(obj) &&\n \"name\" in obj &&\n isSetString(obj.name) &&\n \"title\" in obj &&\n isSetString(obj.title) &&\n \"description\" in obj &&\n isSetString(obj.description) &&\n \"alias\" in obj &&\n Array.isArray(obj.alias) &&\n \"env\" in obj &&\n (isSetString(obj.env) || obj.env === false) &&\n \"optional\" in obj &&\n isBoolean(obj.optional) &&\n \"variadic\" in obj &&\n isBoolean(obj.variadic)\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandOption} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandOption} type, false otherwise.\n */\nexport function isCommandOption(obj: any): obj is CommandOption {\n return (\n isCommandParameterConfig(obj) && isCommandParameter(obj) && \"default\" in obj\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandArgument} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandArgument} type, false otherwise.\n */\nexport function isCommandArgument(obj: any): obj is CommandArgument {\n return isCommandParameterConfig(obj) && isCommandParameter(obj);\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,SAAgB,uBAAS,KAAA;AACzB,QAAS,YAAA,IAAA;EAEP,sBAAA;EACM,sBAA0B;EACjC,sBAAA;EACQ,CAAC,SAAS,IAAC;;AAEpB,uBAAE,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOF,SAAM,yBAAsB,KAAA;AACxB,QAAE,YAAgB,IAAA,IAAA,UAAA,OAAoB,uBAAA,IAAA,KAAA;;AAE1C,yBAAA,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOA,SAAE,mBAAA,KAAA;AACF,QAAO,yBAAS,IAAwB,IACjC,UAAA,OACA,YAAG,IAAA,KAAA,IACF,WAAC,OACT,YAAA,IAAA,MAAA,4BAEE,YAAA,IAAA,YAAA,IACM,WAAS,OAChB,MAAA,QAAA,IAAA,MAAA,IACG,SAAY,QACZ,YAAgB,IAAI,IAAK,IAAI,IAAE,QAAQ,UACzC,cAAA,OACK,UAAS,IAAA,SAAA,IACR,cAAC,OACL,UAAA,IAAA,SAAyB;;AAE7B,mBAAmB,SAAQ;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAO3B,SAAgB,gBAAE,KAAA;AACd,QAAC,yBAAgC,IAAI,IAAA,mBAAQ,IAAA,IAAA,aAAA;;AAEjD,gBAAc,SAAI;CAAQ;CAAG;CAAA;CAAA;CAAA;;;;;;;AAO7B,SAAgB,kBAAkB,KAAK;AACtC,QAAA,yBAAA,IAAA,IAAA,mBAAA,IAAA;;AAED,kBAAiB,SAAO;CAAA;CAAW;CAAa;CAAoC;CAAA"}
|
package/dist/plugin.cjs
CHANGED
|
@@ -19,6 +19,8 @@ let _alloy_js_core_components = require("@alloy-js/core/components");
|
|
|
19
19
|
let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
20
20
|
let _powerlines_plugin_automd = require("@powerlines/plugin-automd");
|
|
21
21
|
_powerlines_plugin_automd = require_runtime.__toESM(_powerlines_plugin_automd);
|
|
22
|
+
let _powerlines_plugin_deepkit = require("@powerlines/plugin-deepkit");
|
|
23
|
+
_powerlines_plugin_deepkit = require_runtime.__toESM(_powerlines_plugin_deepkit);
|
|
22
24
|
let _powerlines_plugin_nodejs = require("@powerlines/plugin-nodejs");
|
|
23
25
|
_powerlines_plugin_nodejs = require_runtime.__toESM(_powerlines_plugin_nodejs);
|
|
24
26
|
let _powerlines_plugin_tsdown = require("@powerlines/plugin-tsdown");
|
|
@@ -46,6 +48,7 @@ const MAX_DEPTH = 50;
|
|
|
46
48
|
*/
|
|
47
49
|
const plugin = (options = {}) => {
|
|
48
50
|
return [
|
|
51
|
+
...(0, _powerlines_plugin_deepkit.default)(),
|
|
49
52
|
(0, _powerlines_plugin_tsdown.default)(),
|
|
50
53
|
(0, _powerlines_plugin_automd.default)(),
|
|
51
54
|
{
|
|
@@ -146,6 +149,7 @@ const plugin = (options = {}) => {
|
|
|
146
149
|
alias: [],
|
|
147
150
|
tags: [],
|
|
148
151
|
isVirtual: false,
|
|
152
|
+
source: "file",
|
|
149
153
|
entry: {
|
|
150
154
|
...entry,
|
|
151
155
|
file: entry.file,
|
|
@@ -177,7 +181,6 @@ const plugin = (options = {}) => {
|
|
|
177
181
|
async handler() {
|
|
178
182
|
if (this.inputs.length === 0) this.warn("No commands were found in the project. Please ensure at least one command exists.");
|
|
179
183
|
else {
|
|
180
|
-
this.debug(`Shell Shock will create an application with the following commands: \n${this.inputs.filter((cmd) => !cmd.isVirtual).map((command) => ` - ${command.id}: ${(0, _stryke_path_is_parent_path.isParentPath)(command.entry.file, this.commandsPath) ? (0, _stryke_path_replace.replacePath)(command.entry.file, this.commandsPath) : (0, _stryke_path_file_path_fns.relativePath)(command.entry.file, this.commandsPath)}${command.isVirtual ? " (virtual)" : ""}`).join("\n")}`);
|
|
181
184
|
this.debug("Finding and adding virtual command inputs for each command previously found.");
|
|
182
185
|
this.inputs = this.inputs.reduce((ret, command) => {
|
|
183
186
|
let depth = 0;
|
|
@@ -203,7 +206,8 @@ const plugin = (options = {}) => {
|
|
|
203
206
|
alias: [],
|
|
204
207
|
tags: [],
|
|
205
208
|
isVirtual: true,
|
|
206
|
-
entry: { file }
|
|
209
|
+
entry: { file },
|
|
210
|
+
source: "file"
|
|
207
211
|
});
|
|
208
212
|
}
|
|
209
213
|
}
|
|
@@ -211,7 +215,7 @@ const plugin = (options = {}) => {
|
|
|
211
215
|
}
|
|
212
216
|
return ret;
|
|
213
217
|
}, this.inputs).sort((a, b) => a.segments.length - b.segments.length);
|
|
214
|
-
this.debug(`Final command input list: \n${this.inputs.map((command) => ` - ${command.id}: ${
|
|
218
|
+
this.debug(`Final command input list: \n${this.inputs.map((command) => ` - ${command.id}${command.isVirtual ? " (virtual)" : ""}: ${command.source === "file" ? (0, _stryke_path_replace.replacePath)(command.entry.file, this.commandsPath) : `added by ${command.source}`}`).join("\n")}`);
|
|
215
219
|
}
|
|
216
220
|
}
|
|
217
221
|
}
|
|
@@ -307,5 +311,4 @@ const plugin = (options = {}) => {
|
|
|
307
311
|
|
|
308
312
|
//#endregion
|
|
309
313
|
exports.default = plugin;
|
|
310
|
-
exports.plugin = plugin;
|
|
311
|
-
//# sourceMappingURL=plugin.cjs.map
|
|
314
|
+
exports.plugin = plugin;
|
package/dist/plugin.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.tsx"],"mappings":";;;;;;;AAmFA;cAAa,MAAA,oBAA2B,OAAA,GAAU,OAAA,EAChD,OAAA,GAAS,OAAA,KACR,MAAA,CAAO,QAAA"}
|
package/dist/plugin.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.tsx"],"mappings":";;;;;;;AAmFA;cAAa,MAAA,oBAA2B,OAAA,GAAU,OAAA,EAChD,OAAA,GAAS,OAAA,KACR,MAAA,CAAO,QAAA"}
|
package/dist/plugin.mjs
CHANGED
|
@@ -16,12 +16,13 @@ import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
|
16
16
|
import { For, Show } from "@alloy-js/core/components";
|
|
17
17
|
import { render } from "@powerlines/plugin-alloy/render";
|
|
18
18
|
import automd from "@powerlines/plugin-automd";
|
|
19
|
+
import deepkit from "@powerlines/plugin-deepkit";
|
|
19
20
|
import nodejs from "@powerlines/plugin-nodejs";
|
|
20
21
|
import tsdown from "@powerlines/plugin-tsdown";
|
|
21
22
|
import { toArray } from "@stryke/convert/to-array";
|
|
22
23
|
import { chmodX } from "@stryke/fs/chmod-x";
|
|
23
24
|
import { appendPath } from "@stryke/path/append";
|
|
24
|
-
import { findFilePath
|
|
25
|
+
import { findFilePath } from "@stryke/path/file-path-fns";
|
|
25
26
|
import { isParentPath } from "@stryke/path/is-parent-path";
|
|
26
27
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
27
28
|
import { replacePath } from "@stryke/path/replace";
|
|
@@ -41,6 +42,7 @@ const MAX_DEPTH = 50;
|
|
|
41
42
|
*/
|
|
42
43
|
const plugin = (options = {}) => {
|
|
43
44
|
return [
|
|
45
|
+
...deepkit(),
|
|
44
46
|
tsdown(),
|
|
45
47
|
automd(),
|
|
46
48
|
{
|
|
@@ -141,6 +143,7 @@ const plugin = (options = {}) => {
|
|
|
141
143
|
alias: [],
|
|
142
144
|
tags: [],
|
|
143
145
|
isVirtual: false,
|
|
146
|
+
source: "file",
|
|
144
147
|
entry: {
|
|
145
148
|
...entry,
|
|
146
149
|
file: entry.file,
|
|
@@ -172,7 +175,6 @@ const plugin = (options = {}) => {
|
|
|
172
175
|
async handler() {
|
|
173
176
|
if (this.inputs.length === 0) this.warn("No commands were found in the project. Please ensure at least one command exists.");
|
|
174
177
|
else {
|
|
175
|
-
this.debug(`Shell Shock will create an application with the following commands: \n${this.inputs.filter((cmd) => !cmd.isVirtual).map((command) => ` - ${command.id}: ${isParentPath(command.entry.file, this.commandsPath) ? replacePath(command.entry.file, this.commandsPath) : relativePath(command.entry.file, this.commandsPath)}${command.isVirtual ? " (virtual)" : ""}`).join("\n")}`);
|
|
176
178
|
this.debug("Finding and adding virtual command inputs for each command previously found.");
|
|
177
179
|
this.inputs = this.inputs.reduce((ret, command) => {
|
|
178
180
|
let depth = 0;
|
|
@@ -198,7 +200,8 @@ const plugin = (options = {}) => {
|
|
|
198
200
|
alias: [],
|
|
199
201
|
tags: [],
|
|
200
202
|
isVirtual: true,
|
|
201
|
-
entry: { file }
|
|
203
|
+
entry: { file },
|
|
204
|
+
source: "file"
|
|
202
205
|
});
|
|
203
206
|
}
|
|
204
207
|
}
|
|
@@ -206,7 +209,7 @@ const plugin = (options = {}) => {
|
|
|
206
209
|
}
|
|
207
210
|
return ret;
|
|
208
211
|
}, this.inputs).sort((a, b) => a.segments.length - b.segments.length);
|
|
209
|
-
this.debug(`Final command input list: \n${this.inputs.map((command) => ` - ${command.id}: ${
|
|
212
|
+
this.debug(`Final command input list: \n${this.inputs.map((command) => ` - ${command.id}${command.isVirtual ? " (virtual)" : ""}: ${command.source === "file" ? replacePath(command.entry.file, this.commandsPath) : `added by ${command.source}`}`).join("\n")}`);
|
|
210
213
|
}
|
|
211
214
|
}
|
|
212
215
|
}
|