@shell-shock/core 0.10.0 → 0.12.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/dist/components/docs.cjs +4 -4
- package/dist/components/docs.cjs.map +1 -1
- package/dist/components/docs.d.cts +5 -5
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts +5 -5
- package/dist/components/docs.d.mts.map +1 -1
- package/dist/components/helpers.cjs +9 -0
- package/dist/components/helpers.cjs.map +1 -1
- package/dist/components/helpers.d.cts +15 -7
- package/dist/components/helpers.d.cts.map +1 -1
- package/dist/components/helpers.d.mts +15 -7
- package/dist/components/helpers.d.mts.map +1 -1
- package/dist/components/helpers.mjs +9 -1
- package/dist/components/helpers.mjs.map +1 -1
- package/dist/components/index.cjs +1 -0
- 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/components/options-parser-logic.cjs +167 -87
- package/dist/components/options-parser-logic.cjs.map +1 -1
- package/dist/components/options-parser-logic.d.cts +15 -15
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts +15 -15
- package/dist/components/options-parser-logic.d.mts.map +1 -1
- package/dist/components/options-parser-logic.mjs +163 -83
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/usage.cjs +5 -5
- package/dist/components/usage.cjs.map +1 -1
- package/dist/components/usage.d.cts +2 -2
- package/dist/components/usage.d.cts.map +1 -1
- package/dist/components/usage.d.mts +2 -2
- package/dist/components/usage.mjs +4 -4
- package/dist/components/usage.mjs.map +1 -1
- package/dist/components/utils-builtin.cjs +2 -2
- package/dist/components/utils-builtin.cjs.map +1 -1
- package/dist/components/utils-builtin.d.cts +9 -9
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts +9 -9
- package/dist/components/utils-builtin.d.mts.map +1 -1
- package/dist/components/utils-builtin.mjs +5 -5
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/contexts/options.cjs +2 -2
- package/dist/contexts/options.cjs.map +1 -1
- package/dist/contexts/options.d.cts +1 -1
- package/dist/contexts/options.d.cts.map +1 -1
- package/dist/contexts/options.d.mts +1 -1
- package/dist/contexts/options.d.mts.map +1 -1
- package/dist/contexts/options.mjs +4 -4
- package/dist/contexts/options.mjs.map +1 -1
- package/dist/helpers/automd.cjs +2 -2
- package/dist/helpers/automd.cjs.map +1 -1
- package/dist/helpers/automd.mjs.map +1 -1
- package/dist/helpers/paths.cjs +125 -0
- package/dist/helpers/paths.cjs.map +1 -0
- package/dist/helpers/paths.mjs +121 -0
- package/dist/helpers/paths.mjs.map +1 -0
- package/dist/helpers/persistence.cjs +68 -116
- package/dist/helpers/persistence.cjs.map +1 -1
- package/dist/helpers/persistence.mjs +68 -116
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/helpers/update-package-json.cjs +4 -4
- package/dist/helpers/update-package-json.cjs.map +1 -1
- package/dist/helpers/utilities.cjs +1 -1
- package/dist/helpers/utilities.mjs +1 -1
- package/dist/helpers/validations.cjs +2 -3
- package/dist/helpers/validations.cjs.map +1 -1
- package/dist/helpers/validations.mjs +2 -2
- package/dist/helpers/validations.mjs.map +1 -1
- package/dist/index.cjs +14 -11
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/plugin-utils/deepkit.cjs +72 -0
- package/dist/plugin-utils/deepkit.cjs.map +1 -0
- package/dist/plugin-utils/deepkit.d.cts +24 -0
- package/dist/plugin-utils/deepkit.d.cts.map +1 -0
- package/dist/plugin-utils/deepkit.d.mts +24 -0
- package/dist/plugin-utils/deepkit.d.mts.map +1 -0
- package/dist/plugin-utils/deepkit.mjs +70 -0
- package/dist/plugin-utils/deepkit.mjs.map +1 -0
- package/dist/plugin-utils/description-helpers.cjs +105 -0
- package/dist/plugin-utils/description-helpers.cjs.map +1 -0
- package/dist/plugin-utils/description-helpers.d.cts +44 -0
- package/dist/plugin-utils/description-helpers.d.cts.map +1 -0
- package/dist/plugin-utils/description-helpers.d.mts +44 -0
- package/dist/plugin-utils/description-helpers.d.mts.map +1 -0
- package/dist/plugin-utils/description-helpers.mjs +101 -0
- package/dist/plugin-utils/description-helpers.mjs.map +1 -0
- package/dist/plugin-utils/get-command-tree.cjs +2 -2
- package/dist/plugin-utils/get-command-tree.cjs.map +1 -1
- package/dist/plugin-utils/index.cjs +32 -18
- 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 +4 -5
- package/dist/plugin-utils/reflect.cjs.map +1 -1
- package/dist/plugin-utils/reflect.mjs +4 -4
- package/dist/plugin-utils/reflect.mjs.map +1 -1
- package/dist/plugin-utils/type-checks.cjs +89 -0
- package/dist/plugin-utils/type-checks.cjs.map +1 -0
- package/dist/plugin-utils/type-checks.d.cts +42 -0
- package/dist/plugin-utils/type-checks.d.cts.map +1 -0
- package/dist/plugin-utils/type-checks.d.mts +42 -0
- package/dist/plugin-utils/type-checks.d.mts.map +1 -0
- package/dist/plugin-utils/type-checks.mjs +84 -0
- package/dist/plugin-utils/type-checks.mjs.map +1 -0
- package/dist/plugin.cjs +31 -29
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +15 -13
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/deepkit.cjs +132 -0
- package/dist/resolver/deepkit.cjs.map +1 -0
- package/dist/resolver/deepkit.mjs +131 -0
- package/dist/resolver/deepkit.mjs.map +1 -0
- package/dist/resolver/helpers.cjs +167 -0
- package/dist/resolver/helpers.cjs.map +1 -0
- package/dist/resolver/helpers.mjs +162 -0
- package/dist/resolver/helpers.mjs.map +1 -0
- package/dist/resolver/module.cjs +144 -0
- package/dist/resolver/module.cjs.map +1 -0
- package/dist/resolver/module.mjs +143 -0
- package/dist/resolver/module.mjs.map +1 -0
- package/dist/resolver/resolve.cjs +209 -0
- package/dist/resolver/resolve.cjs.map +1 -0
- package/dist/resolver/resolve.mjs +208 -0
- package/dist/resolver/resolve.mjs.map +1 -0
- package/dist/types/command.cjs +127 -104
- package/dist/types/command.cjs.map +1 -1
- package/dist/types/command.d.cts +39 -78
- package/dist/types/command.d.cts.map +1 -1
- package/dist/types/command.d.mts +39 -78
- package/dist/types/command.d.mts.map +1 -1
- package/dist/types/command.mjs +115 -95
- package/dist/types/command.mjs.map +1 -1
- package/dist/types/config.cjs +5 -3
- package/dist/types/config.cjs.map +1 -1
- package/dist/types/config.d.cts +7 -3
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +7 -3
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/config.mjs +5 -3
- package/dist/types/config.mjs.map +1 -1
- package/dist/types/context.cjs +1 -1
- package/dist/types/context.cjs.map +1 -1
- package/dist/types/context.d.cts +2 -2
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts +2 -2
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/context.mjs +1 -1
- package/dist/types/context.mjs.map +1 -1
- package/dist/types/index.cjs +13 -10
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +2 -2
- package/package.json +24 -75
- package/dist/helpers/resolve-command.cjs +0 -430
- package/dist/helpers/resolve-command.cjs.map +0 -1
- package/dist/helpers/resolve-command.mjs +0 -425
- package/dist/helpers/resolve-command.mjs.map +0 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/plugin-utils/description-helpers.ts
|
|
3
|
+
const __ΩFormatDescriptionOptions = [
|
|
4
|
+
"replaceNewlines",
|
|
5
|
+
true,
|
|
6
|
+
"collapseWhitespace",
|
|
7
|
+
"FormatDescriptionOptions",
|
|
8
|
+
"P)4!8>\")4#8>\"Mw$y"
|
|
9
|
+
];
|
|
10
|
+
/**
|
|
11
|
+
* Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
|
|
15
|
+
*
|
|
16
|
+
* @param description - The full description string.
|
|
17
|
+
* @returns The formatted description string.
|
|
18
|
+
*/
|
|
19
|
+
function formatDescriptionWhitespace(description, options = {}) {
|
|
20
|
+
let formattedDescription = description.trim();
|
|
21
|
+
if (options.replaceNewlines) formattedDescription = formattedDescription.replace(/\s*\n\s*/g, " ");
|
|
22
|
+
if (options.collapseWhitespace) formattedDescription = formattedDescription.replace(/\s{2,}/g, " ");
|
|
23
|
+
return formattedDescription.trim();
|
|
24
|
+
}
|
|
25
|
+
formatDescriptionWhitespace.__type = [
|
|
26
|
+
"description",
|
|
27
|
+
() => __ΩFormatDescriptionOptions,
|
|
28
|
+
"options",
|
|
29
|
+
() => ({}),
|
|
30
|
+
"formatDescriptionWhitespace",
|
|
31
|
+
"P&2!n\"2#>$&/%"
|
|
32
|
+
];
|
|
33
|
+
/**
|
|
34
|
+
* Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
|
|
38
|
+
*
|
|
39
|
+
* @param description - The full description string.
|
|
40
|
+
* @returns The formatted description string.
|
|
41
|
+
*/
|
|
42
|
+
function formatDescriptionEscapes(description) {
|
|
43
|
+
return description.replaceAll("'", "\\'").replaceAll("\"", "\\\"").replaceAll("`", "\\`").replace(/\$\{/g, "\\${");
|
|
44
|
+
}
|
|
45
|
+
formatDescriptionEscapes.__type = [
|
|
46
|
+
"description",
|
|
47
|
+
"formatDescriptionEscapes",
|
|
48
|
+
"P&2!&/\""
|
|
49
|
+
];
|
|
50
|
+
/**
|
|
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
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
|
|
55
|
+
*
|
|
56
|
+
* @param description - The full description string.
|
|
57
|
+
* @returns The formatted description string.
|
|
58
|
+
*/
|
|
59
|
+
function formatDescription(description, options = {}) {
|
|
60
|
+
return formatDescriptionEscapes(formatDescriptionWhitespace(description, options));
|
|
61
|
+
}
|
|
62
|
+
formatDescription.__type = [
|
|
63
|
+
"description",
|
|
64
|
+
() => __ΩFormatDescriptionOptions,
|
|
65
|
+
"options",
|
|
66
|
+
() => ({}),
|
|
67
|
+
"formatDescription",
|
|
68
|
+
"P&2!n\"2#>$&/%"
|
|
69
|
+
];
|
|
70
|
+
const __ΩFormatShortDescriptionOptions = [
|
|
71
|
+
() => __ΩFormatDescriptionOptions,
|
|
72
|
+
"length",
|
|
73
|
+
60,
|
|
74
|
+
"FormatShortDescriptionOptions",
|
|
75
|
+
"Pn!'4\"8>#Mw$y"
|
|
76
|
+
];
|
|
77
|
+
/**
|
|
78
|
+
* Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.
|
|
79
|
+
*
|
|
80
|
+
* @param description - The full description string.
|
|
81
|
+
* @param options - Options for formatting the short description, including the maximum length.
|
|
82
|
+
* @returns The extracted short description.
|
|
83
|
+
*/
|
|
84
|
+
function formatShortDescription(description, options = {}) {
|
|
85
|
+
const length = options.length ?? 60;
|
|
86
|
+
const formattedDescription = formatDescriptionWhitespace(description, options);
|
|
87
|
+
let result = ((formattedDescription.indexOf("\n") < length + 1 || formattedDescription.search(/[.!?\n]\s*\S/) > length + 1 ? formattedDescription.trim().match(/^.*[.!?\n]\s?\S/)?.[0]?.trim()?.slice(0, -1)?.trim() : void 0) || formattedDescription).trim();
|
|
88
|
+
if (result.trim().length > length) result = `${result.substring(0, Math.max(0, length - 3)).trim()}...`;
|
|
89
|
+
return formatDescriptionEscapes(result);
|
|
90
|
+
}
|
|
91
|
+
formatShortDescription.__type = [
|
|
92
|
+
"description",
|
|
93
|
+
() => __ΩFormatShortDescriptionOptions,
|
|
94
|
+
"options",
|
|
95
|
+
() => ({}),
|
|
96
|
+
"formatShortDescription",
|
|
97
|
+
"P&2!n\"2#>$&/%"
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
//#endregion
|
|
101
|
+
exports.__ΩFormatDescriptionOptions = __ΩFormatDescriptionOptions;
|
|
102
|
+
exports.__ΩFormatShortDescriptionOptions = __ΩFormatShortDescriptionOptions;
|
|
103
|
+
exports.formatDescription = formatDescription;
|
|
104
|
+
exports.formatShortDescription = formatShortDescription;
|
|
105
|
+
//# sourceMappingURL=description-helpers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description-helpers.cjs","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 60\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 ?? 60;\n const formattedDescription = formatDescriptionWhitespace(\n description,\n options\n );\n\n const firstSentenceMatch =\n formattedDescription.indexOf(\"\\n\") < length + 1 ||\n formattedDescription.search(/[.!?\\n]\\s*\\S/) > length + 1\n ? formattedDescription\n .trim()\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,IAAI,uBAAe,YAAA,MAAA;AACnB,KAAA,QAAA,gBACI,wBAAsB,qBAAA,QAAA,aAAA,IAAA;gCAG5B,wBAAA,qBAAA,QAAA,WAAA,IAAA;AAED,QAAA,qBAAA,MAAA;;AAED,4BAA4B,SAAS;CAAC;OAAqB;CAA6B;QAAkB,EAAE;CAAG;CAAW;CAAA;;;;;;;;;;AAU1H,SAAS,yBAAsB,aAAA;AAC3B,QAAO,YACT,WAAA,KAAA,MAAA,CACO,WAAW,MAAK,OAAM,CACtB,WAAW,KAAK,MAAM,CAC7B,QAAA,SAAA,OAAA;;AAEF,yBAAyB,SAAS;CAAC;CAAC;CAAA;CAAA;;;;;;;;;;AAUpC,SAAgB,kBAAkB,aAAU,UAAA,EAAA,EAAA;AAC1C,QAAA,yBAAA,4BAAA,aAAA,QAAA,CAAA;;AAEF,kBAAkB,SAAC;CAAA;OAAA;CAAA;QAAA,EAAA;CAAA;CAAA;CAAA;AACnB,MAAM,mCAAoB;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;AAS1B,SAAU,uBAAA,aAAA,UAAA,EAAA,EAAA;CACN,MAAM,SAAS,QAAQ,UAAU;CACpC,MAAA,uBAAA,4BAAA,aAAA,QAAA;CAUE,IAAA,WAT4B,qBAAoB,QAAA,KAAA,GAAA,SAAA,KAC3C,qBAAqB,OAAO,eAAQ,GAAA,SAAA,IAC1C,qBACW,MAAM,CACN,MAAM,kBAAE,GAAA,IACP,MAAM,EACV,MAAA,GAAA,GAAA,EACI,MAAM,GACV,WACP,sBAAA,MAAA;AACH,KAAA,OAAA,MAAA,CAAA,SAAA;AAGI,QAAA,yBAAA,OAAA;;AAEJ,uBAAG,SAAA;CAAA;OAAA;CAAA;QAAA,EAAA;CAAA;CAAA;CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//#region src/plugin-utils/description-helpers.d.ts
|
|
2
|
+
interface FormatDescriptionOptions {
|
|
3
|
+
/**
|
|
4
|
+
* 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
|
+
* @defaultValue false
|
|
7
|
+
*/
|
|
8
|
+
replaceNewlines?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 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.
|
|
11
|
+
*
|
|
12
|
+
* @defaultValue false
|
|
13
|
+
*/
|
|
14
|
+
collapseWhitespace?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
|
|
21
|
+
*
|
|
22
|
+
* @param description - The full description string.
|
|
23
|
+
* @returns The formatted description string.
|
|
24
|
+
*/
|
|
25
|
+
declare function formatDescription(description: string, options?: FormatDescriptionOptions): string;
|
|
26
|
+
interface FormatShortDescriptionOptions extends FormatDescriptionOptions {
|
|
27
|
+
/**
|
|
28
|
+
* The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.
|
|
29
|
+
*
|
|
30
|
+
* @defaultValue 60
|
|
31
|
+
*/
|
|
32
|
+
length?: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.
|
|
36
|
+
*
|
|
37
|
+
* @param description - The full description string.
|
|
38
|
+
* @param options - Options for formatting the short description, including the maximum length.
|
|
39
|
+
* @returns The extracted short description.
|
|
40
|
+
*/
|
|
41
|
+
declare function formatShortDescription(description: string, options?: FormatShortDescriptionOptions): string;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { FormatDescriptionOptions, FormatShortDescriptionOptions, formatDescription, formatShortDescription };
|
|
44
|
+
//# sourceMappingURL=description-helpers.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description-helpers.d.cts","names":[],"sources":["../../src/plugin-utils/description-helpers.ts"],"sourcesContent":[],"mappings":";UAkBiB,wBAAA;EAAA;AAkEjB;AASA;AAgBA;;;;;;;;;;;;;;;;;;;iBAzBgB,iBAAA,gCAEL;UAOM,6BAAA,SAAsC;;;;;;;;;;;;;;;iBAgBvC,sBAAA,gCAEL"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//#region src/plugin-utils/description-helpers.d.ts
|
|
2
|
+
interface FormatDescriptionOptions {
|
|
3
|
+
/**
|
|
4
|
+
* 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
|
+
* @defaultValue false
|
|
7
|
+
*/
|
|
8
|
+
replaceNewlines?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 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.
|
|
11
|
+
*
|
|
12
|
+
* @defaultValue false
|
|
13
|
+
*/
|
|
14
|
+
collapseWhitespace?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
|
|
21
|
+
*
|
|
22
|
+
* @param description - The full description string.
|
|
23
|
+
* @returns The formatted description string.
|
|
24
|
+
*/
|
|
25
|
+
declare function formatDescription(description: string, options?: FormatDescriptionOptions): string;
|
|
26
|
+
interface FormatShortDescriptionOptions extends FormatDescriptionOptions {
|
|
27
|
+
/**
|
|
28
|
+
* The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.
|
|
29
|
+
*
|
|
30
|
+
* @defaultValue 60
|
|
31
|
+
*/
|
|
32
|
+
length?: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.
|
|
36
|
+
*
|
|
37
|
+
* @param description - The full description string.
|
|
38
|
+
* @param options - Options for formatting the short description, including the maximum length.
|
|
39
|
+
* @returns The extracted short description.
|
|
40
|
+
*/
|
|
41
|
+
declare function formatShortDescription(description: string, options?: FormatShortDescriptionOptions): string;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { FormatDescriptionOptions, FormatShortDescriptionOptions, formatDescription, formatShortDescription };
|
|
44
|
+
//# sourceMappingURL=description-helpers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description-helpers.d.mts","names":[],"sources":["../../src/plugin-utils/description-helpers.ts"],"sourcesContent":[],"mappings":";UAkBiB,wBAAA;EAAA;AAkEjB;AASA;AAgBA;;;;;;;;;;;;;;;;;;;iBAzBgB,iBAAA,gCAEL;UAOM,6BAAA,SAAsC;;;;;;;;;;;;;;;iBAgBvC,sBAAA,gCAEL"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
//#region src/plugin-utils/description-helpers.ts
|
|
2
|
+
const __ΩFormatDescriptionOptions = [
|
|
3
|
+
"replaceNewlines",
|
|
4
|
+
true,
|
|
5
|
+
"collapseWhitespace",
|
|
6
|
+
"FormatDescriptionOptions",
|
|
7
|
+
"P)4!8>\")4#8>\"Mw$y"
|
|
8
|
+
];
|
|
9
|
+
/**
|
|
10
|
+
* Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
|
|
14
|
+
*
|
|
15
|
+
* @param description - The full description string.
|
|
16
|
+
* @returns The formatted description string.
|
|
17
|
+
*/
|
|
18
|
+
function formatDescriptionWhitespace(description, options = {}) {
|
|
19
|
+
let formattedDescription = description.trim();
|
|
20
|
+
if (options.replaceNewlines) formattedDescription = formattedDescription.replace(/\s*\n\s*/g, " ");
|
|
21
|
+
if (options.collapseWhitespace) formattedDescription = formattedDescription.replace(/\s{2,}/g, " ");
|
|
22
|
+
return formattedDescription.trim();
|
|
23
|
+
}
|
|
24
|
+
formatDescriptionWhitespace.__type = [
|
|
25
|
+
"description",
|
|
26
|
+
() => __ΩFormatDescriptionOptions,
|
|
27
|
+
"options",
|
|
28
|
+
() => ({}),
|
|
29
|
+
"formatDescriptionWhitespace",
|
|
30
|
+
"P&2!n\"2#>$&/%"
|
|
31
|
+
];
|
|
32
|
+
/**
|
|
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
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
|
|
37
|
+
*
|
|
38
|
+
* @param description - The full description string.
|
|
39
|
+
* @returns The formatted description string.
|
|
40
|
+
*/
|
|
41
|
+
function formatDescriptionEscapes(description) {
|
|
42
|
+
return description.replaceAll("'", "\\'").replaceAll("\"", "\\\"").replaceAll("`", "\\`").replace(/\$\{/g, "\\${");
|
|
43
|
+
}
|
|
44
|
+
formatDescriptionEscapes.__type = [
|
|
45
|
+
"description",
|
|
46
|
+
"formatDescriptionEscapes",
|
|
47
|
+
"P&2!&/\""
|
|
48
|
+
];
|
|
49
|
+
/**
|
|
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
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
|
|
54
|
+
*
|
|
55
|
+
* @param description - The full description string.
|
|
56
|
+
* @returns The formatted description string.
|
|
57
|
+
*/
|
|
58
|
+
function formatDescription(description, options = {}) {
|
|
59
|
+
return formatDescriptionEscapes(formatDescriptionWhitespace(description, options));
|
|
60
|
+
}
|
|
61
|
+
formatDescription.__type = [
|
|
62
|
+
"description",
|
|
63
|
+
() => __ΩFormatDescriptionOptions,
|
|
64
|
+
"options",
|
|
65
|
+
() => ({}),
|
|
66
|
+
"formatDescription",
|
|
67
|
+
"P&2!n\"2#>$&/%"
|
|
68
|
+
];
|
|
69
|
+
const __ΩFormatShortDescriptionOptions = [
|
|
70
|
+
() => __ΩFormatDescriptionOptions,
|
|
71
|
+
"length",
|
|
72
|
+
60,
|
|
73
|
+
"FormatShortDescriptionOptions",
|
|
74
|
+
"Pn!'4\"8>#Mw$y"
|
|
75
|
+
];
|
|
76
|
+
/**
|
|
77
|
+
* Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.
|
|
78
|
+
*
|
|
79
|
+
* @param description - The full description string.
|
|
80
|
+
* @param options - Options for formatting the short description, including the maximum length.
|
|
81
|
+
* @returns The extracted short description.
|
|
82
|
+
*/
|
|
83
|
+
function formatShortDescription(description, options = {}) {
|
|
84
|
+
const length = options.length ?? 60;
|
|
85
|
+
const formattedDescription = formatDescriptionWhitespace(description, options);
|
|
86
|
+
let result = ((formattedDescription.indexOf("\n") < length + 1 || formattedDescription.search(/[.!?\n]\s*\S/) > length + 1 ? formattedDescription.trim().match(/^.*[.!?\n]\s?\S/)?.[0]?.trim()?.slice(0, -1)?.trim() : void 0) || formattedDescription).trim();
|
|
87
|
+
if (result.trim().length > length) result = `${result.substring(0, Math.max(0, length - 3)).trim()}...`;
|
|
88
|
+
return formatDescriptionEscapes(result);
|
|
89
|
+
}
|
|
90
|
+
formatShortDescription.__type = [
|
|
91
|
+
"description",
|
|
92
|
+
() => __ΩFormatShortDescriptionOptions,
|
|
93
|
+
"options",
|
|
94
|
+
() => ({}),
|
|
95
|
+
"formatShortDescription",
|
|
96
|
+
"P&2!n\"2#>$&/%"
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
export { __ΩFormatDescriptionOptions, __ΩFormatShortDescriptionOptions, formatDescription, formatShortDescription };
|
|
101
|
+
//# sourceMappingURL=description-helpers.mjs.map
|
|
@@ -0,0 +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 60\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 ?? 60;\n const formattedDescription = formatDescriptionWhitespace(\n description,\n options\n );\n\n const firstSentenceMatch =\n formattedDescription.indexOf(\"\\n\") < length + 1 ||\n formattedDescription.search(/[.!?\\n]\\s*\\S/) > length + 1\n ? formattedDescription\n .trim()\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,IAAI,uBAAe,YAAA,MAAA;AACnB,KAAA,QAAA,gBACI,wBAAsB,qBAAA,QAAA,aAAA,IAAA;gCAG5B,wBAAA,qBAAA,QAAA,WAAA,IAAA;AAED,QAAA,qBAAA,MAAA;;AAED,4BAA4B,SAAS;CAAC;OAAqB;CAA6B;QAAkB,EAAE;CAAG;CAAW;CAAA;;;;;;;;;;AAU1H,SAAS,yBAAsB,aAAA;AAC3B,QAAO,YACT,WAAA,KAAA,MAAA,CACO,WAAW,MAAK,OAAM,CACtB,WAAW,KAAK,MAAM,CAC7B,QAAA,SAAA,OAAA;;AAEF,yBAAyB,SAAS;CAAC;CAAC;CAAA;CAAA;;;;;;;;;;AAUpC,SAAgB,kBAAkB,aAAU,UAAA,EAAA,EAAA;AAC1C,QAAA,yBAAA,4BAAA,aAAA,QAAA,CAAA;;AAEF,kBAAkB,SAAC;CAAA;OAAA;CAAA;QAAA,EAAA;CAAA;CAAA;CAAA;AACnB,MAAM,mCAAoB;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;AAS1B,SAAU,uBAAA,aAAA,UAAA,EAAA,EAAA;CACN,MAAM,SAAS,QAAQ,UAAU;CACpC,MAAA,uBAAA,4BAAA,aAAA,QAAA;CAUE,IAAA,WAT4B,qBAAoB,QAAA,KAAA,GAAA,SAAA,KAC3C,qBAAqB,OAAO,eAAQ,GAAA,SAAA,IAC1C,qBACW,MAAM,CACN,MAAM,kBAAE,GAAA,IACP,MAAM,EACV,MAAA,GAAA,GAAA,EACI,MAAM,GACV,WACP,sBAAA,MAAA;AACH,KAAA,OAAA,MAAA,CAAA,SAAA;AAGI,QAAA,yBAAA,OAAA;;AAEJ,uBAAG,SAAA;CAAA;OAAA;CAAA;QAAA,EAAA;CAAA;CAAA;CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_context_helpers = require('./context-helpers.cjs');
|
|
2
2
|
|
|
3
3
|
//#region src/plugin-utils/get-command-tree.ts
|
|
4
4
|
function __assignType(fn, args) {
|
|
@@ -16,7 +16,7 @@ function getCommandTree(context, path = []) {
|
|
|
16
16
|
if (path.length === 0) return null;
|
|
17
17
|
let currentTree = context.commands[path[0]] ?? null;
|
|
18
18
|
if (path.length > 1) {
|
|
19
|
-
const segments = path.slice(1).filter(__assignType((segment) => !
|
|
19
|
+
const segments = path.slice(1).filter(__assignType((segment) => !require_context_helpers.isDynamicPathSegment(segment), [
|
|
20
20
|
"segment",
|
|
21
21
|
"",
|
|
22
22
|
"P\"2!\"/\""
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-command-tree.cjs","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\";\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"],"mappings":";;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;;AAUX,SAAgB,eAAe,SAAS,OAAO,EAAE,EAAE;uBAE3C,QAAO;CAEX,IAAI,cAAc,QAAQ,SAAS,KAAK,OAAO;;EAE3C,MAAM,WAAW,KACZ,MAAM,EAAE,CACR,OAAO,cAAa,YAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"get-command-tree.cjs","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\";\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"],"mappings":";;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;;AAUX,SAAgB,eAAe,SAAS,OAAO,EAAE,EAAE;uBAE3C,QAAO;CAEX,IAAI,cAAc,QAAQ,SAAS,KAAK,OAAO;;EAE3C,MAAM,WAAW,KACZ,MAAM,EAAE,CACR,OAAO,cAAa,YAAW,CAAC,6CAAW,QAAA,EAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;iCAEtD,KAAA,aAAA,YACc,OAAO,UAAU,eAAe,KAAK,YAAU,UAAA,QAAA,CAC9D,eAAA,YAAA,SAAA,YAAA;MAGe,QAAO;;AAInB,QAAO;;AAEX,eAAe,SAAS;CAAC;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
|
|
@@ -1,19 +1,33 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
1
|
+
const require_context_helpers = require('./context-helpers.cjs');
|
|
2
|
+
const require_reflect = require('./reflect.cjs');
|
|
3
|
+
const require_type_checks = require('./type-checks.cjs');
|
|
4
|
+
const require_deepkit = require('./deepkit.cjs');
|
|
5
|
+
const require_description_helpers = require('./description-helpers.cjs');
|
|
6
|
+
const require_get_command_tree = require('./get-command-tree.cjs');
|
|
7
|
+
const require_traverse_command_tree = require('./traverse-command-tree.cjs');
|
|
5
8
|
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
9
|
+
exports.__ΩFormatDescriptionOptions = require_description_helpers.__ΩFormatDescriptionOptions;
|
|
10
|
+
exports.__ΩFormatShortDescriptionOptions = require_description_helpers.__ΩFormatShortDescriptionOptions;
|
|
11
|
+
exports.extractReflectionKind = require_deepkit.extractReflectionKind;
|
|
12
|
+
exports.extractType = require_deepkit.extractType;
|
|
13
|
+
exports.formatDescription = require_description_helpers.formatDescription;
|
|
14
|
+
exports.formatShortDescription = require_description_helpers.formatShortDescription;
|
|
15
|
+
exports.getAppBin = require_context_helpers.getAppBin;
|
|
16
|
+
exports.getAppDescription = require_context_helpers.getAppDescription;
|
|
17
|
+
exports.getAppName = require_context_helpers.getAppName;
|
|
18
|
+
exports.getAppTitle = require_context_helpers.getAppTitle;
|
|
19
|
+
exports.getCommandTree = require_get_command_tree.getCommandTree;
|
|
20
|
+
exports.getDynamicPathSegmentName = require_context_helpers.getDynamicPathSegmentName;
|
|
21
|
+
exports.getPathSegmentGroupName = require_context_helpers.getPathSegmentGroupName;
|
|
22
|
+
exports.getPathSegmentName = require_context_helpers.getPathSegmentName;
|
|
23
|
+
exports.isCommandArgument = require_type_checks.isCommandArgument;
|
|
24
|
+
exports.isCommandOption = require_type_checks.isCommandOption;
|
|
25
|
+
exports.isCommandParameter = require_type_checks.isCommandParameter;
|
|
26
|
+
exports.isCommandParameterConfig = require_type_checks.isCommandParameterConfig;
|
|
27
|
+
exports.isCommandParameterKind = require_type_checks.isCommandParameterKind;
|
|
28
|
+
exports.isDynamicPathSegment = require_context_helpers.isDynamicPathSegment;
|
|
29
|
+
exports.isPathSegmentGroup = require_context_helpers.isPathSegmentGroup;
|
|
30
|
+
exports.sortArgAliases = require_context_helpers.sortArgAliases;
|
|
31
|
+
exports.sortOptions = require_reflect.sortOptions;
|
|
32
|
+
exports.traverseCommandTree = require_traverse_command_tree.traverseCommandTree;
|
|
33
|
+
exports.traverseCommands = require_traverse_command_tree.traverseCommands;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { getAppBin, getAppDescription, getAppName, getAppTitle, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases } from "./context-helpers.cjs";
|
|
2
|
+
import { extractReflectionKind, extractType } from "./deepkit.cjs";
|
|
3
|
+
import { FormatDescriptionOptions, FormatShortDescriptionOptions, formatDescription, formatShortDescription } from "./description-helpers.cjs";
|
|
2
4
|
import { getCommandTree } from "./get-command-tree.cjs";
|
|
3
5
|
import { sortOptions } from "./reflect.cjs";
|
|
4
6
|
import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.cjs";
|
|
5
|
-
|
|
7
|
+
import { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind } from "./type-checks.cjs";
|
|
8
|
+
export { FormatDescriptionOptions, FormatShortDescriptionOptions, extractReflectionKind, extractType, formatDescription, formatShortDescription, getAppBin, getAppDescription, getAppName, getAppTitle, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { getAppBin, getAppDescription, getAppName, getAppTitle, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases } from "./context-helpers.mjs";
|
|
2
|
+
import { extractReflectionKind, extractType } from "./deepkit.mjs";
|
|
3
|
+
import { FormatDescriptionOptions, FormatShortDescriptionOptions, formatDescription, formatShortDescription } from "./description-helpers.mjs";
|
|
2
4
|
import { getCommandTree } from "./get-command-tree.mjs";
|
|
3
5
|
import { sortOptions } from "./reflect.mjs";
|
|
4
6
|
import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.mjs";
|
|
5
|
-
|
|
7
|
+
import { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind } from "./type-checks.mjs";
|
|
8
|
+
export { FormatDescriptionOptions, FormatShortDescriptionOptions, extractReflectionKind, extractType, formatDescription, formatShortDescription, getAppBin, getAppDescription, getAppName, getAppTitle, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { getAppBin, getAppDescription, getAppName, getAppTitle, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases } from "./context-helpers.mjs";
|
|
2
2
|
import { sortOptions } from "./reflect.mjs";
|
|
3
|
+
import { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind } from "./type-checks.mjs";
|
|
4
|
+
import { extractReflectionKind, extractType } from "./deepkit.mjs";
|
|
5
|
+
import { __ΩFormatDescriptionOptions, __ΩFormatShortDescriptionOptions, formatDescription, formatShortDescription } from "./description-helpers.mjs";
|
|
3
6
|
import { getCommandTree } from "./get-command-tree.mjs";
|
|
4
7
|
import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.mjs";
|
|
5
8
|
|
|
6
|
-
export { getAppBin, getAppDescription, getAppName, getAppTitle, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
|
|
9
|
+
export { __ΩFormatDescriptionOptions, __ΩFormatShortDescriptionOptions, extractReflectionKind, extractType, formatDescription, formatShortDescription, getAppBin, getAppDescription, getAppName, getAppTitle, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
1
|
+
const require_types_command = require('../types/command.cjs');
|
|
3
2
|
|
|
4
3
|
//#region src/plugin-utils/reflect.ts
|
|
5
4
|
function __assignType(fn, args) {
|
|
@@ -14,7 +13,7 @@ function __assignType(fn, args) {
|
|
|
14
13
|
*/
|
|
15
14
|
function sortOptions(options) {
|
|
16
15
|
if (!options || options.length === 0) return [];
|
|
17
|
-
return options.filter(__assignType((arg) => arg.kind !==
|
|
16
|
+
return options.filter(__assignType((arg) => arg.kind !== require_types_command.CommandParameterKinds.boolean || !arg.isNegativeOf, [
|
|
18
17
|
"arg",
|
|
19
18
|
"",
|
|
20
19
|
"P\"2!\"/\""
|
|
@@ -25,8 +24,8 @@ function sortOptions(options) {
|
|
|
25
24
|
"P\"2!\"2\"\"/#"
|
|
26
25
|
])).reduce(__assignType((ret, arg) => {
|
|
27
26
|
ret.push(arg);
|
|
28
|
-
if (arg.kind ===
|
|
29
|
-
const negativeArg = options.find(__assignType((a) => a.kind ===
|
|
27
|
+
if (arg.kind === require_types_command.CommandParameterKinds.boolean) {
|
|
28
|
+
const negativeArg = options.find(__assignType((a) => a.kind === require_types_command.CommandParameterKinds.boolean && a.isNegativeOf === arg.name, [
|
|
30
29
|
"a",
|
|
31
30
|
"",
|
|
32
31
|
"P\"2!\"/\""
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reflect.cjs","names":[],"sources":["../../src/plugin-utils/reflect.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {
|
|
1
|
+
{"version":3,"file":"reflect.cjs","names":[],"sources":["../../src/plugin-utils/reflect.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandOption } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * Sort command options alphabetically by name, placing boolean options with negatives appropriately.\n *\n * @param options - The array of command options to sort.\n * @returns A new array of sorted command options.\n */\nexport function sortOptions(options: CommandOption[]): CommandOption[] {\n if (!options || options.length === 0) {\n return [];\n }\n\n return options\n .filter(\n arg => arg.kind !== CommandParameterKinds.boolean || !arg.isNegativeOf\n )\n .sort((a, b) => a.name.localeCompare(b.name))\n .reduce((ret, arg) => {\n ret.push(arg);\n\n if (arg.kind === CommandParameterKinds.boolean) {\n // Add the negative argument if it exists\n const negativeArg = options.find(\n a =>\n a.kind === CommandParameterKinds.boolean &&\n a.isNegativeOf === arg.name\n );\n if (negativeArg) {\n ret.push(negativeArg);\n }\n }\n\n return ret;\n }, [] as CommandOption[]);\n}\n"],"mappings":";;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;AASX,SAAgB,YAAY,SAAS;AACjC,KAAI,CAAC,WAAW,QAAQ,WAAW;gBAI9B,OAAO,cAAa,QAAO,IAAI,SAAS,4CAAqB,WAAA,CAAA,IAAA,cAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA;;;;;KAE7D,OAAO,cAAc,KAAK,QAAQ;AACnC,MAAI,KAAK,IAAI;;GAGT,MAAM,cAAc,QAAQ,KAAK,cAAa,MAAK,EAAE,SAAS,4CAAsB,WAC/F,EAAA,iBAAA,IAAA,MAAA;IAAA;IAAA;IAAA;IAAA,CAAA,CAAA;AACW,OAAI,YACA,KAAI,KAAK,YAAY;;AAG7B,SAAO;IACR;EAAC;EAAK;EAAA;EAAA;EAAA,CAAA,EAAA,EAAA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CommandParameterKinds } from "../types/command.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin-utils/reflect.ts
|
|
4
4
|
function __assignType(fn, args) {
|
|
@@ -13,7 +13,7 @@ function __assignType(fn, args) {
|
|
|
13
13
|
*/
|
|
14
14
|
function sortOptions(options) {
|
|
15
15
|
if (!options || options.length === 0) return [];
|
|
16
|
-
return options.filter(__assignType((arg) => arg.kind !==
|
|
16
|
+
return options.filter(__assignType((arg) => arg.kind !== CommandParameterKinds.boolean || !arg.isNegativeOf, [
|
|
17
17
|
"arg",
|
|
18
18
|
"",
|
|
19
19
|
"P\"2!\"/\""
|
|
@@ -24,8 +24,8 @@ function sortOptions(options) {
|
|
|
24
24
|
"P\"2!\"2\"\"/#"
|
|
25
25
|
])).reduce(__assignType((ret, arg) => {
|
|
26
26
|
ret.push(arg);
|
|
27
|
-
if (arg.kind ===
|
|
28
|
-
const negativeArg = options.find(__assignType((a) => a.kind ===
|
|
27
|
+
if (arg.kind === CommandParameterKinds.boolean) {
|
|
28
|
+
const negativeArg = options.find(__assignType((a) => a.kind === CommandParameterKinds.boolean && a.isNegativeOf === arg.name, [
|
|
29
29
|
"a",
|
|
30
30
|
"",
|
|
31
31
|
"P\"2!\"/\""
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reflect.mjs","names":[],"sources":["../../src/plugin-utils/reflect.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {
|
|
1
|
+
{"version":3,"file":"reflect.mjs","names":[],"sources":["../../src/plugin-utils/reflect.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandOption } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * Sort command options alphabetically by name, placing boolean options with negatives appropriately.\n *\n * @param options - The array of command options to sort.\n * @returns A new array of sorted command options.\n */\nexport function sortOptions(options: CommandOption[]): CommandOption[] {\n if (!options || options.length === 0) {\n return [];\n }\n\n return options\n .filter(\n arg => arg.kind !== CommandParameterKinds.boolean || !arg.isNegativeOf\n )\n .sort((a, b) => a.name.localeCompare(b.name))\n .reduce((ret, arg) => {\n ret.push(arg);\n\n if (arg.kind === CommandParameterKinds.boolean) {\n // Add the negative argument if it exists\n const negativeArg = options.find(\n a =>\n a.kind === CommandParameterKinds.boolean &&\n a.isNegativeOf === arg.name\n );\n if (negativeArg) {\n ret.push(negativeArg);\n }\n }\n\n return ret;\n }, [] as CommandOption[]);\n}\n"],"mappings":";;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;AASX,SAAgB,YAAY,SAAS;AACjC,KAAI,CAAC,WAAW,QAAQ,WAAW;gBAI9B,OAAO,cAAa,QAAO,IAAI,SAAS,sBAAqB,WAAA,CAAA,IAAA,cAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA;;;;;KAE7D,OAAO,cAAc,KAAK,QAAQ;AACnC,MAAI,KAAK,IAAI;;GAGT,MAAM,cAAc,QAAQ,KAAK,cAAa,MAAK,EAAE,SAAS,sBAAsB,WAC/F,EAAA,iBAAA,IAAA,MAAA;IAAA;IAAA;IAAA;IAAA,CAAA,CAAA;AACW,OAAI,YACA,KAAI,KAAK,YAAY;;AAG7B,SAAO;IACR;EAAC;EAAK;EAAA;EAAA;EAAA,CAAA,EAAA,EAAA,CAAA"}
|