@shell-shock/core 0.10.0 → 0.11.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/helpers.d.cts +6 -6
- package/dist/components/helpers.d.mts +6 -6
- package/dist/components/helpers.d.mts.map +1 -1
- package/dist/components/options-parser-logic.cjs +31 -31
- package/dist/components/options-parser-logic.cjs.map +1 -1
- package/dist/components/options-parser-logic.d.cts +9 -9
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts +9 -9
- package/dist/components/options-parser-logic.d.mts.map +1 -1
- package/dist/components/options-parser-logic.mjs +26 -26
- 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.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/get-command-tree.cjs +2 -2
- package/dist/plugin-utils/get-command-tree.cjs.map +1 -1
- package/dist/plugin-utils/index.cjs +27 -18
- package/dist/plugin-utils/index.d.cts +3 -1
- package/dist/plugin-utils/index.d.mts +3 -1
- package/dist/plugin-utils/index.mjs +3 -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 +28 -24
- 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 +12 -8
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/deepkit.cjs +129 -0
- package/dist/resolver/deepkit.cjs.map +1 -0
- package/dist/resolver/deepkit.mjs +128 -0
- package/dist/resolver/deepkit.mjs.map +1 -0
- package/dist/resolver/helpers.cjs +173 -0
- package/dist/resolver/helpers.cjs.map +1 -0
- package/dist/resolver/helpers.mjs +168 -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/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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validations.cjs","names":[],"sources":["../../src/helpers/validations.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":"validations.cjs","names":[],"sources":["../../src/helpers/validations.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\";\nimport { CommandParameterKinds } from \"../types\";\n\nexport interface ValidationFailure {\n code: string;\n details: string;\n}\n\nexport function validateArguments(command: CommandTree): ValidationFailure[] {\n const failures: ValidationFailure[] = [];\n\n let sequential = false;\n for (const argument of command.args ?? []) {\n if (\n (argument.kind === CommandParameterKinds.string ||\n argument.kind === CommandParameterKinds.number) &&\n argument.variadic\n ) {\n if (!sequential) {\n sequential = true;\n } else {\n failures.push({\n code: \"SEQUENTIAL_VARIADIC_ARGUMENTS\",\n details: `Sequential variadic arguments are not allowed - since the argument preceding ${argument.name} is variadic, it must not also be variadic.`\n });\n }\n } else {\n sequential = false;\n }\n }\n\n return failures;\n}\n\nexport function validateOptions(command: CommandTree): ValidationFailure[] {\n const failures: ValidationFailure[] = [];\n\n const optionNames = new Set<string>();\n for (const option of Object.values(command.options ?? {})) {\n if (optionNames.has(option.name)) {\n failures.push({\n code: \"DUPLICATE_OPTION_NAME\",\n details: `Duplicate option name \"${option.name}\" found in command.`\n });\n }\n optionNames.add(option.name);\n\n for (const alias of option.alias) {\n if (optionNames.has(alias)) {\n failures.push({\n code: \"DUPLICATE_OPTION_ALIAS\",\n details: `Duplicate option name \"${alias}\" (an alias of \"${\n option.name\n }\") found in command.`\n });\n }\n optionNames.add(alias);\n }\n }\n\n return failures;\n}\n\nexport function validateCommand(command: CommandTree): ValidationFailure[] {\n const results: ValidationFailure[] = [];\n\n let failures = validateOptions(command);\n if (failures.length > 0) {\n results.push(...failures);\n }\n\n failures = validateArguments(command);\n if (failures.length > 0) {\n results.push(...failures);\n }\n\n return results;\n}\n"],"mappings":";;;AAkBA,MAAM,uBAAuB;CAAC;CAAQ;CAAK;CAAA;CAAA;;CAGvC,MAAM,WAAW,EAAE;CACnB,IAAI,aAAM;AACV,MAAK,MAAM,YAAE,QAAA,QAAA,EAAA,CACjB,MAAA,SAAA,SAAA,4CAAA,mFAEY,SAAS,SACT,KAAI,CAAC;KAIV,UAAA,KAAA;EACa,MAAM;EACN,SAAS,gFAA4B,SAAA,KAAA;EACxC,CAAC;KAIN,cAAC;AAGT,QAAO;;AAEX,kBAAM,SAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AACN,SAAW,gBAAA,SAAA;CACP,MAAM,WAAW,EAAE;CACnB,MAAA,eAAA,IAAA,IAAA,CAAA,CAAA,IAAA,CAAA,kBAAA,IAAA,KAAA;AACF,MAAA,MAAA,UAAA,OAAA,OAAA,QAAA,WAAA,EAAA,CAAA,EAAA;mCAEU,UAAK,KAAA;GACjB,MAAA;;GAEa,CAAC;;AAGN,OAAK,MAAM,SAAS,OAAO,OAAI;AAC3B,OAAI,YAAY,IAAI,MAAM,CACtB,UAAS,KAAK;IACV,MAAA;IACA,SAAS,0BAAQ,MAAA,kBAAA,OAAA,KAAA;IACpB,CAAC;AAEd,eAAA,IAAA,MAAA;;;AAGA,QAAO;;AAEX,gBAAgB,SAAM;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AACtB,SAAgB,gBAAgB,SAAQ;CACpC,MAAM,UAAU,EAAE;CAClB,IAAI,WAAW,gBAAG,QAAA;AAClB,KAAI,SAAS,SAAS,EAClB,SAAE,KAAA,GAAA,SAAA;AAEN,YAAW,kBAAa,QAAA;AACxB,KAAA,SAAA,SAAA,EACF,SAAA,KAAA,GAAA,SAAA;AAEE,QAAO"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CommandParameterKinds } from "../types/command.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/helpers/validations.ts
|
|
4
4
|
const __ΩValidationFailure = [
|
|
@@ -10,7 +10,7 @@ const __ΩValidationFailure = [
|
|
|
10
10
|
function validateArguments(command) {
|
|
11
11
|
const failures = [];
|
|
12
12
|
let sequential = false;
|
|
13
|
-
for (const argument of command.
|
|
13
|
+
for (const argument of command.args ?? []) if ((argument.kind === CommandParameterKinds.string || argument.kind === CommandParameterKinds.number) && argument.variadic) if (!sequential) sequential = true;
|
|
14
14
|
else failures.push({
|
|
15
15
|
code: "SEQUENTIAL_VARIADIC_ARGUMENTS",
|
|
16
16
|
details: `Sequential variadic arguments are not allowed - since the argument preceding ${argument.name} is variadic, it must not also be variadic.`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validations.mjs","names":[],"sources":["../../src/helpers/validations.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":"validations.mjs","names":[],"sources":["../../src/helpers/validations.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\";\nimport { CommandParameterKinds } from \"../types\";\n\nexport interface ValidationFailure {\n code: string;\n details: string;\n}\n\nexport function validateArguments(command: CommandTree): ValidationFailure[] {\n const failures: ValidationFailure[] = [];\n\n let sequential = false;\n for (const argument of command.args ?? []) {\n if (\n (argument.kind === CommandParameterKinds.string ||\n argument.kind === CommandParameterKinds.number) &&\n argument.variadic\n ) {\n if (!sequential) {\n sequential = true;\n } else {\n failures.push({\n code: \"SEQUENTIAL_VARIADIC_ARGUMENTS\",\n details: `Sequential variadic arguments are not allowed - since the argument preceding ${argument.name} is variadic, it must not also be variadic.`\n });\n }\n } else {\n sequential = false;\n }\n }\n\n return failures;\n}\n\nexport function validateOptions(command: CommandTree): ValidationFailure[] {\n const failures: ValidationFailure[] = [];\n\n const optionNames = new Set<string>();\n for (const option of Object.values(command.options ?? {})) {\n if (optionNames.has(option.name)) {\n failures.push({\n code: \"DUPLICATE_OPTION_NAME\",\n details: `Duplicate option name \"${option.name}\" found in command.`\n });\n }\n optionNames.add(option.name);\n\n for (const alias of option.alias) {\n if (optionNames.has(alias)) {\n failures.push({\n code: \"DUPLICATE_OPTION_ALIAS\",\n details: `Duplicate option name \"${alias}\" (an alias of \"${\n option.name\n }\") found in command.`\n });\n }\n optionNames.add(alias);\n }\n }\n\n return failures;\n}\n\nexport function validateCommand(command: CommandTree): ValidationFailure[] {\n const results: ValidationFailure[] = [];\n\n let failures = validateOptions(command);\n if (failures.length > 0) {\n results.push(...failures);\n }\n\n failures = validateArguments(command);\n if (failures.length > 0) {\n results.push(...failures);\n }\n\n return results;\n}\n"],"mappings":";;;AAkBA,MAAM,uBAAuB;CAAC;CAAQ;CAAK;CAAA;CAAA;;CAGvC,MAAM,WAAW,EAAE;CACnB,IAAI,aAAM;AACV,MAAK,MAAM,YAAE,QAAA,QAAA,EAAA,CACjB,MAAA,SAAA,SAAA,sBAAA,6DAEY,SAAS,SACT,KAAI,CAAC;KAIV,UAAA,KAAA;EACa,MAAM;EACN,SAAS,gFAA4B,SAAA,KAAA;EACxC,CAAC;KAIN,cAAC;AAGT,QAAO;;AAEX,kBAAM,SAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AACN,SAAW,gBAAA,SAAA;CACP,MAAM,WAAW,EAAE;CACnB,MAAA,eAAA,IAAA,IAAA,CAAA,CAAA,IAAA,CAAA,kBAAA,IAAA,KAAA;AACF,MAAA,MAAA,UAAA,OAAA,OAAA,QAAA,WAAA,EAAA,CAAA,EAAA;mCAEU,UAAK,KAAA;GACjB,MAAA;;GAEa,CAAC;;AAGN,OAAK,MAAM,SAAS,OAAO,OAAI;AAC3B,OAAI,YAAY,IAAI,MAAM,CACtB,UAAS,KAAK;IACV,MAAA;IACA,SAAS,0BAAQ,MAAA,kBAAA,OAAA,KAAA;IACpB,CAAC;AAEd,eAAA,IAAA,MAAA;;;AAGA,QAAO;;AAEX,gBAAgB,SAAM;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AACtB,SAAgB,gBAAgB,SAAQ;CACpC,MAAM,UAAU,EAAE;CAClB,IAAI,WAAW,gBAAG,QAAA;AAClB,KAAI,SAAS,SAAS,EAClB,SAAE,KAAA,GAAA,SAAA;AAEN,YAAW,kBAAa,QAAA;AACxB,KAAA,SAAA,SAAA,EACF,SAAA,KAAA,GAAA,SAAA;AAEE,QAAO"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,43 +1,46 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
const require_api = require('./api.cjs');
|
|
3
2
|
const require_types_command = require('./types/command.cjs');
|
|
4
3
|
const require_types_config = require('./types/config.cjs');
|
|
5
4
|
const require_types_context = require('./types/context.cjs');
|
|
6
5
|
const require_types_options = require('./types/options.cjs');
|
|
7
6
|
const require_types_runtime = require('./types/runtime.cjs');
|
|
7
|
+
const require_api = require('./api.cjs');
|
|
8
8
|
|
|
9
9
|
//#region src/index.ts
|
|
10
10
|
var src_default = require_api.ShellShockAPI;
|
|
11
11
|
|
|
12
12
|
//#endregion
|
|
13
|
+
exports.CommandParameterKinds = require_types_command.CommandParameterKinds;
|
|
13
14
|
exports.ShellShockAPI = require_api.ShellShockAPI;
|
|
15
|
+
exports.__ΩAsCommandParameterConfig = require_types_command.__ΩAsCommandParameterConfig;
|
|
14
16
|
exports.__ΩBaseCommandOptions = require_types_options.__ΩBaseCommandOptions;
|
|
15
17
|
exports.__ΩBaseCommandParameter = require_types_command.__ΩBaseCommandParameter;
|
|
16
|
-
exports.__ΩBooleanCommandArgument = require_types_command.__ΩBooleanCommandArgument;
|
|
17
18
|
exports.__ΩBooleanCommandOption = require_types_command.__ΩBooleanCommandOption;
|
|
18
19
|
exports.__ΩBooleanCommandParameter = require_types_command.__ΩBooleanCommandParameter;
|
|
20
|
+
exports.__ΩBooleanCommandParameterConfig = require_types_command.__ΩBooleanCommandParameterConfig;
|
|
19
21
|
exports.__ΩCommandArgument = require_types_command.__ΩCommandArgument;
|
|
22
|
+
exports.__ΩCommandArgumentConfig = require_types_command.__ΩCommandArgumentConfig;
|
|
20
23
|
exports.__ΩCommandBase = require_types_command.__ΩCommandBase;
|
|
24
|
+
exports.__ΩCommandConfig = require_types_command.__ΩCommandConfig;
|
|
21
25
|
exports.__ΩCommandContext = require_types_runtime.__ΩCommandContext;
|
|
22
|
-
exports.__Ω
|
|
26
|
+
exports.__ΩCommandMetadata = require_types_command.__ΩCommandMetadata;
|
|
23
27
|
exports.__ΩCommandModule = require_types_command.__ΩCommandModule;
|
|
24
28
|
exports.__ΩCommandOption = require_types_command.__ΩCommandOption;
|
|
25
|
-
exports.__Ω
|
|
29
|
+
exports.__ΩCommandOptionConfig = require_types_command.__ΩCommandOptionConfig;
|
|
30
|
+
exports.__ΩCommandParameter = require_types_command.__ΩCommandParameter;
|
|
31
|
+
exports.__ΩCommandParameterConfig = require_types_command.__ΩCommandParameterConfig;
|
|
32
|
+
exports.__ΩCommandParameterKind = require_types_command.__ΩCommandParameterKind;
|
|
33
|
+
exports.__ΩCommandParameterType = require_types_command.__ΩCommandParameterType;
|
|
26
34
|
exports.__ΩCommandTree = require_types_command.__ΩCommandTree;
|
|
27
35
|
exports.__ΩContext = require_types_context.__ΩContext;
|
|
28
|
-
exports.__ΩMetadata = require_types_command.__ΩMetadata;
|
|
29
|
-
exports.__ΩNumberCommandArgument = require_types_command.__ΩNumberCommandArgument;
|
|
30
|
-
exports.__ΩNumberCommandOption = require_types_command.__ΩNumberCommandOption;
|
|
31
36
|
exports.__ΩNumberCommandParameter = require_types_command.__ΩNumberCommandParameter;
|
|
37
|
+
exports.__ΩNumberCommandParameterConfig = require_types_command.__ΩNumberCommandParameterConfig;
|
|
32
38
|
exports.__ΩOptions = require_types_config.__ΩOptions;
|
|
33
39
|
exports.__ΩOutputConfig = require_types_config.__ΩOutputConfig;
|
|
34
40
|
exports.__ΩResolvedConfig = require_types_config.__ΩResolvedConfig;
|
|
35
|
-
exports.__ΩSerializedCommandArgument = require_types_command.__ΩSerializedCommandArgument;
|
|
36
|
-
exports.__ΩSerializedCommandOption = require_types_command.__ΩSerializedCommandOption;
|
|
37
41
|
exports.__ΩSerializedCommandTree = require_types_command.__ΩSerializedCommandTree;
|
|
38
|
-
exports.__ΩStringCommandArgument = require_types_command.__ΩStringCommandArgument;
|
|
39
|
-
exports.__ΩStringCommandOption = require_types_command.__ΩStringCommandOption;
|
|
40
42
|
exports.__ΩStringCommandParameter = require_types_command.__ΩStringCommandParameter;
|
|
43
|
+
exports.__ΩStringCommandParameterConfig = require_types_command.__ΩStringCommandParameterConfig;
|
|
41
44
|
exports.__ΩUnresolvedContext = require_types_context.__ΩUnresolvedContext;
|
|
42
45
|
exports.__ΩUserConfig = require_types_config.__ΩUserConfig;
|
|
43
46
|
exports.createShellShock = require_api.createShellShock;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AsCommandParameterConfig, BaseCommandParameter, BooleanCommandOption, BooleanCommandParameter, BooleanCommandParameterConfig, CommandArgument, CommandArgumentConfig, CommandBase, CommandConfig, CommandMetadata, CommandModule, CommandOption, CommandOptionConfig, CommandParameter, CommandParameterConfig, CommandParameterKind, CommandParameterKinds, CommandParameterType, CommandTree, NumberCommandParameter, NumberCommandParameterConfig, SerializedCommandTree, StringCommandParameter, StringCommandParameterConfig } from "./types/command.cjs";
|
|
2
2
|
import { Context, UnresolvedContext } from "./types/context.cjs";
|
|
3
3
|
import { Options, OutputConfig, ResolvedConfig, UserConfig } from "./types/config.cjs";
|
|
4
4
|
import { ShellShockAPI, createShellShock } from "./api.cjs";
|
|
5
5
|
import { BaseCommandOptions } from "./types/options.cjs";
|
|
6
6
|
import { CommandContext } from "./types/runtime.cjs";
|
|
7
7
|
import "./types/index.cjs";
|
|
8
|
-
export { BaseCommandOptions, BaseCommandParameter,
|
|
8
|
+
export { AsCommandParameterConfig, BaseCommandOptions, BaseCommandParameter, BooleanCommandOption, BooleanCommandParameter, BooleanCommandParameterConfig, CommandArgument, CommandArgumentConfig, CommandBase, CommandConfig, CommandContext, CommandMetadata, CommandModule, CommandOption, CommandOptionConfig, CommandParameter, CommandParameterConfig, CommandParameterKind, CommandParameterKinds, CommandParameterType, CommandTree, Context, NumberCommandParameter, NumberCommandParameterConfig, Options, OutputConfig, ResolvedConfig, SerializedCommandTree, ShellShockAPI, ShellShockAPI as default, StringCommandParameter, StringCommandParameterConfig, UnresolvedContext, UserConfig, createShellShock };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AsCommandParameterConfig, BaseCommandParameter, BooleanCommandOption, BooleanCommandParameter, BooleanCommandParameterConfig, CommandArgument, CommandArgumentConfig, CommandBase, CommandConfig, CommandMetadata, CommandModule, CommandOption, CommandOptionConfig, CommandParameter, CommandParameterConfig, CommandParameterKind, CommandParameterKinds, CommandParameterType, CommandTree, NumberCommandParameter, NumberCommandParameterConfig, SerializedCommandTree, StringCommandParameter, StringCommandParameterConfig } from "./types/command.mjs";
|
|
2
2
|
import { Context, UnresolvedContext } from "./types/context.mjs";
|
|
3
3
|
import { Options, OutputConfig, ResolvedConfig, UserConfig } from "./types/config.mjs";
|
|
4
4
|
import { ShellShockAPI, createShellShock } from "./api.mjs";
|
|
5
5
|
import { BaseCommandOptions } from "./types/options.mjs";
|
|
6
6
|
import { CommandContext } from "./types/runtime.mjs";
|
|
7
7
|
import "./types/index.mjs";
|
|
8
|
-
export { BaseCommandOptions, BaseCommandParameter,
|
|
8
|
+
export { AsCommandParameterConfig, BaseCommandOptions, BaseCommandParameter, BooleanCommandOption, BooleanCommandParameter, BooleanCommandParameterConfig, CommandArgument, CommandArgumentConfig, CommandBase, CommandConfig, CommandContext, CommandMetadata, CommandModule, CommandOption, CommandOptionConfig, CommandParameter, CommandParameterConfig, CommandParameterKind, CommandParameterKinds, CommandParameterType, CommandTree, Context, NumberCommandParameter, NumberCommandParameterConfig, Options, OutputConfig, ResolvedConfig, SerializedCommandTree, ShellShockAPI, ShellShockAPI as default, StringCommandParameter, StringCommandParameterConfig, UnresolvedContext, UserConfig, createShellShock };
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { __ΩBaseCommandParameter, __ΩBooleanCommandArgument, __ΩBooleanCommandOption, __ΩBooleanCommandParameter, __ΩCommandArgument, __ΩCommandBase, __ΩCommandInput, __ΩCommandModule, __ΩCommandOption, __ΩCommandParameterSchema, __ΩCommandTree, __ΩMetadata, __ΩNumberCommandArgument, __ΩNumberCommandOption, __ΩNumberCommandParameter, __ΩSerializedCommandArgument, __ΩSerializedCommandOption, __ΩSerializedCommandTree, __ΩStringCommandArgument, __ΩStringCommandOption, __ΩStringCommandParameter } from "./types/command.mjs";
|
|
1
|
+
import { CommandParameterKinds, __ΩAsCommandParameterConfig, __ΩBaseCommandParameter, __ΩBooleanCommandOption, __ΩBooleanCommandParameter, __ΩBooleanCommandParameterConfig, __ΩCommandArgument, __ΩCommandArgumentConfig, __ΩCommandBase, __ΩCommandConfig, __ΩCommandMetadata, __ΩCommandModule, __ΩCommandOption, __ΩCommandOptionConfig, __ΩCommandParameter, __ΩCommandParameterConfig, __ΩCommandParameterKind, __ΩCommandParameterType, __ΩCommandTree, __ΩNumberCommandParameter, __ΩNumberCommandParameterConfig, __ΩSerializedCommandTree, __ΩStringCommandParameter, __ΩStringCommandParameterConfig } from "./types/command.mjs";
|
|
3
2
|
import { __ΩOptions, __ΩOutputConfig, __ΩResolvedConfig, __ΩUserConfig } from "./types/config.mjs";
|
|
4
3
|
import { __ΩContext, __ΩUnresolvedContext } from "./types/context.mjs";
|
|
5
4
|
import { __ΩBaseCommandOptions } from "./types/options.mjs";
|
|
6
5
|
import { __ΩCommandContext } from "./types/runtime.mjs";
|
|
6
|
+
import { ShellShockAPI, createShellShock } from "./api.mjs";
|
|
7
7
|
|
|
8
8
|
//#region src/index.ts
|
|
9
9
|
var src_default = ShellShockAPI;
|
|
10
10
|
|
|
11
11
|
//#endregion
|
|
12
|
-
export { ShellShockAPI, __Ω
|
|
12
|
+
export { CommandParameterKinds, ShellShockAPI, __ΩAsCommandParameterConfig, __ΩBaseCommandOptions, __ΩBaseCommandParameter, __ΩBooleanCommandOption, __ΩBooleanCommandParameter, __ΩBooleanCommandParameterConfig, __ΩCommandArgument, __ΩCommandArgumentConfig, __ΩCommandBase, __ΩCommandConfig, __ΩCommandContext, __ΩCommandMetadata, __ΩCommandModule, __ΩCommandOption, __ΩCommandOptionConfig, __ΩCommandParameter, __ΩCommandParameterConfig, __ΩCommandParameterKind, __ΩCommandParameterType, __ΩCommandTree, __ΩContext, __ΩNumberCommandParameter, __ΩNumberCommandParameterConfig, __ΩOptions, __ΩOutputConfig, __ΩResolvedConfig, __ΩSerializedCommandTree, __ΩStringCommandParameter, __ΩStringCommandParameterConfig, __ΩUnresolvedContext, __ΩUserConfig, createShellShock, src_default as default };
|
|
13
13
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_types_command = require('../types/command.cjs');
|
|
3
|
+
const require_type_checks = require('./type-checks.cjs');
|
|
4
|
+
let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
5
|
+
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
6
|
+
|
|
7
|
+
//#region src/plugin-utils/deepkit.ts
|
|
8
|
+
/**
|
|
9
|
+
* Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
|
|
10
|
+
*
|
|
11
|
+
* @param command - The command parameter or kind to extract the reflection kind from.
|
|
12
|
+
* @param checkVariadic - Whether to check for variadic parameters (arrays).
|
|
13
|
+
* @returns The extracted {@link ReflectionKind}.
|
|
14
|
+
*/
|
|
15
|
+
function extractReflectionKind(command, checkVariadic = true) {
|
|
16
|
+
if (require_type_checks.isCommandParameterKind(command) && command === require_types_command.CommandParameterKinds.string || (0, __stryke_type_checks_is_set_object.isSetObject)(command) && command.kind === require_types_command.CommandParameterKinds.string) return checkVariadic && command.variadic ? __powerlines_deepkit_vendor_type.ReflectionKind.array : __powerlines_deepkit_vendor_type.ReflectionKind.string;
|
|
17
|
+
else if (require_type_checks.isCommandParameterKind(command) && command === require_types_command.CommandParameterKinds.number || (0, __stryke_type_checks_is_set_object.isSetObject)(command) && command.kind === require_types_command.CommandParameterKinds.number) return checkVariadic && command.variadic ? __powerlines_deepkit_vendor_type.ReflectionKind.array : __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
18
|
+
else if (require_type_checks.isCommandParameterKind(command) && command === require_types_command.CommandParameterKinds.boolean || (0, __stryke_type_checks_is_set_object.isSetObject)(command) && command.kind === require_types_command.CommandParameterKinds.boolean) return __powerlines_deepkit_vendor_type.ReflectionKind.boolean;
|
|
19
|
+
else return __powerlines_deepkit_vendor_type.ReflectionKind.string;
|
|
20
|
+
}
|
|
21
|
+
extractReflectionKind.__type = [
|
|
22
|
+
"BaseCommandParameter",
|
|
23
|
+
"CommandParameterKind",
|
|
24
|
+
"command",
|
|
25
|
+
"checkVariadic",
|
|
26
|
+
() => __powerlines_deepkit_vendor_type.__ΩReflectionKind,
|
|
27
|
+
"extractReflectionKind",
|
|
28
|
+
"PP\"w!\"w\"J2#\"2$n%/&"
|
|
29
|
+
];
|
|
30
|
+
/**
|
|
31
|
+
* Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
|
|
32
|
+
*
|
|
33
|
+
* @param command - The command parameter or kind to extract the type from.
|
|
34
|
+
* @param checkVariadic - Whether to check for variadic parameters (arrays).
|
|
35
|
+
* @returns The extracted {@link Type}.
|
|
36
|
+
*/
|
|
37
|
+
function extractType(command, checkVariadic = true) {
|
|
38
|
+
const reflectionKind = extractReflectionKind(command, checkVariadic);
|
|
39
|
+
if (reflectionKind === __powerlines_deepkit_vendor_type.ReflectionKind.string) return { kind: __powerlines_deepkit_vendor_type.ReflectionKind.string };
|
|
40
|
+
else if (reflectionKind === __powerlines_deepkit_vendor_type.ReflectionKind.number) return { kind: __powerlines_deepkit_vendor_type.ReflectionKind.number };
|
|
41
|
+
else if (reflectionKind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean) return { kind: __powerlines_deepkit_vendor_type.ReflectionKind.boolean };
|
|
42
|
+
else if (reflectionKind === __powerlines_deepkit_vendor_type.ReflectionKind.array) if (require_type_checks.isCommandParameterKind(command)) return {
|
|
43
|
+
kind: __powerlines_deepkit_vendor_type.ReflectionKind.array,
|
|
44
|
+
type: extractType({ kind: command }, false)
|
|
45
|
+
};
|
|
46
|
+
else if ((0, __stryke_type_checks_is_set_object.isSetObject)(command)) return {
|
|
47
|
+
kind: __powerlines_deepkit_vendor_type.ReflectionKind.array,
|
|
48
|
+
type: extractType({
|
|
49
|
+
...command,
|
|
50
|
+
kind: command.kind
|
|
51
|
+
}, false)
|
|
52
|
+
};
|
|
53
|
+
else return {
|
|
54
|
+
kind: __powerlines_deepkit_vendor_type.ReflectionKind.array,
|
|
55
|
+
type: { kind: __powerlines_deepkit_vendor_type.ReflectionKind.string }
|
|
56
|
+
};
|
|
57
|
+
else return { kind: __powerlines_deepkit_vendor_type.ReflectionKind.string };
|
|
58
|
+
}
|
|
59
|
+
extractType.__type = [
|
|
60
|
+
"BaseCommandParameter",
|
|
61
|
+
"CommandParameterKind",
|
|
62
|
+
"command",
|
|
63
|
+
"checkVariadic",
|
|
64
|
+
"Type",
|
|
65
|
+
"extractType",
|
|
66
|
+
"PP\"w!\"w\"J2#\"2$\"w%/&"
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
exports.extractReflectionKind = extractReflectionKind;
|
|
71
|
+
exports.extractType = extractType;
|
|
72
|
+
//# sourceMappingURL=deepkit.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deepkit.cjs","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":";;;;;;;;;;;;;;;AAcI,KAAK,2CAAuB,QAAI,0HAEf,QAAQ,wEAErB,QAAO,iBAAiB,QAAQ,WAC1B,gDAAe,QACf,gDAAe;UAEf,2CAAQ,QAAA,IACd,YAAY,4CAAE,8DACD,QAAE,IACX,QAAQ,SAAK,4CAAA,OACjB,QAAO,iBAAiB,QAAQ,WAC1B,gDAAe;UAGf,2CAAuB,QAAQ,IAC5C,YAAA,4CAAA,+DACoB,QAAQ,IAAI,QAAQ,SAAS,4CAAsB,QAChE,QAAO,gDAAe;KAGtB,QAAO,gDAAe;;AAG9B,sBAAkB,SAAA;CAAA;CAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;;;;;;;;AAQlB,SAAgB,YAAW,SAAA,gBAAA,MAAA;CACvB,MAAM,iBAAiB,sBAAE,SAAA,cAAA;AACzB,KAAI,mBAAI,gDAAA,OACJ,QAAO,EAAE,MAAM,gDAAe,QAAA;UAEzB,mBAAmB,gDAAe,OACvC,QAAO,EAAE,MAAM,gDAAe,QAAQ;UAEjC,mBAAmB,gDAAe,QACvC,QAAO,EAAE,MAAM,gDAAI,SAAA;UAEf,mBAAA,gDAAA,MACJ,KAAI,2CAAuB,QAAG,CAC1B,QAAO;EACH,MAAM,gDAAe;EACjC,MAAA,YAAA,EACgB,MAAM,SACjB,EAAA,MAAA;EACI;8DAEb,QAAA;EAEE,MAAA,gDAAA;EACc,MAAM,YAAY;GACjC,GAAA;GACmB,MAAM,QAAQ;GACjB,EAAE,MAAK;EACX;KAGD,QAAO;EACH,MAAK,gDAAA;EACb,MAAA,EAAA,MAAA,gDAAA,QAAA;EACK;KAIL,QAAO,EAAE,MAAM,gDAAe,QAAI;;AAG1C,YAAY,SAAS;CAAC;CAAwB;CAAQ;CAAA;CAAA;CAAA;CAAA;CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseCommandParameter, CommandParameterKind } from "../types/command.cjs";
|
|
2
|
+
import { ReflectionKind, Type } from "@powerlines/deepkit/vendor/type";
|
|
3
|
+
|
|
4
|
+
//#region src/plugin-utils/deepkit.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
|
|
8
|
+
*
|
|
9
|
+
* @param command - The command parameter or kind to extract the reflection kind from.
|
|
10
|
+
* @param checkVariadic - Whether to check for variadic parameters (arrays).
|
|
11
|
+
* @returns The extracted {@link ReflectionKind}.
|
|
12
|
+
*/
|
|
13
|
+
declare function extractReflectionKind(command: BaseCommandParameter | CommandParameterKind, checkVariadic?: boolean): ReflectionKind;
|
|
14
|
+
/**
|
|
15
|
+
* Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
|
|
16
|
+
*
|
|
17
|
+
* @param command - The command parameter or kind to extract the type from.
|
|
18
|
+
* @param checkVariadic - Whether to check for variadic parameters (arrays).
|
|
19
|
+
* @returns The extracted {@link Type}.
|
|
20
|
+
*/
|
|
21
|
+
declare function extractType(command: BaseCommandParameter | CommandParameterKind, checkVariadic?: boolean): Type;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { extractReflectionKind, extractType };
|
|
24
|
+
//# sourceMappingURL=deepkit.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deepkit.d.cts","names":[],"sources":["../../src/plugin-utils/deepkit.ts"],"sourcesContent":[],"mappings":";;;;;;AAoCA;;;;;AAwCA;AACW,iBAzCK,qBAAA,CAyCL,OAAA,EAxCA,oBAwCA,GAxCuB,oBAwCvB,EAAA,aAAA,CAAA,EAAA,OAAA,CAAA,EAtCR,cAsCQ;;;;;;;;iBADK,WAAA,UACL,uBAAuB,gDAE/B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseCommandParameter, CommandParameterKind } from "../types/command.mjs";
|
|
2
|
+
import { ReflectionKind, Type } from "@powerlines/deepkit/vendor/type";
|
|
3
|
+
|
|
4
|
+
//#region src/plugin-utils/deepkit.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
|
|
8
|
+
*
|
|
9
|
+
* @param command - The command parameter or kind to extract the reflection kind from.
|
|
10
|
+
* @param checkVariadic - Whether to check for variadic parameters (arrays).
|
|
11
|
+
* @returns The extracted {@link ReflectionKind}.
|
|
12
|
+
*/
|
|
13
|
+
declare function extractReflectionKind(command: BaseCommandParameter | CommandParameterKind, checkVariadic?: boolean): ReflectionKind;
|
|
14
|
+
/**
|
|
15
|
+
* Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
|
|
16
|
+
*
|
|
17
|
+
* @param command - The command parameter or kind to extract the type from.
|
|
18
|
+
* @param checkVariadic - Whether to check for variadic parameters (arrays).
|
|
19
|
+
* @returns The extracted {@link Type}.
|
|
20
|
+
*/
|
|
21
|
+
declare function extractType(command: BaseCommandParameter | CommandParameterKind, checkVariadic?: boolean): Type;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { extractReflectionKind, extractType };
|
|
24
|
+
//# sourceMappingURL=deepkit.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deepkit.d.mts","names":[],"sources":["../../src/plugin-utils/deepkit.ts"],"sourcesContent":[],"mappings":";;;;;;AAoCA;;;;;AAwCA;AACW,iBAzCK,qBAAA,CAyCL,OAAA,EAxCA,oBAwCA,GAxCuB,oBAwCvB,EAAA,aAAA,CAAA,EAAA,OAAA,CAAA,EAtCR,cAsCQ;;;;;;;;iBADK,WAAA,UACL,uBAAuB,gDAE/B"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { CommandParameterKinds } from "../types/command.mjs";
|
|
2
|
+
import { isCommandParameterKind } from "./type-checks.mjs";
|
|
3
|
+
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
4
|
+
import { ReflectionKind, __ΩReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
5
|
+
|
|
6
|
+
//#region src/plugin-utils/deepkit.ts
|
|
7
|
+
/**
|
|
8
|
+
* Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
|
|
9
|
+
*
|
|
10
|
+
* @param command - The command parameter or kind to extract the reflection kind from.
|
|
11
|
+
* @param checkVariadic - Whether to check for variadic parameters (arrays).
|
|
12
|
+
* @returns The extracted {@link ReflectionKind}.
|
|
13
|
+
*/
|
|
14
|
+
function extractReflectionKind(command, checkVariadic = true) {
|
|
15
|
+
if (isCommandParameterKind(command) && command === CommandParameterKinds.string || isSetObject(command) && command.kind === CommandParameterKinds.string) return checkVariadic && command.variadic ? ReflectionKind.array : ReflectionKind.string;
|
|
16
|
+
else if (isCommandParameterKind(command) && command === CommandParameterKinds.number || isSetObject(command) && command.kind === CommandParameterKinds.number) return checkVariadic && command.variadic ? ReflectionKind.array : ReflectionKind.number;
|
|
17
|
+
else if (isCommandParameterKind(command) && command === CommandParameterKinds.boolean || isSetObject(command) && command.kind === CommandParameterKinds.boolean) return ReflectionKind.boolean;
|
|
18
|
+
else return ReflectionKind.string;
|
|
19
|
+
}
|
|
20
|
+
extractReflectionKind.__type = [
|
|
21
|
+
"BaseCommandParameter",
|
|
22
|
+
"CommandParameterKind",
|
|
23
|
+
"command",
|
|
24
|
+
"checkVariadic",
|
|
25
|
+
() => __ΩReflectionKind,
|
|
26
|
+
"extractReflectionKind",
|
|
27
|
+
"PP\"w!\"w\"J2#\"2$n%/&"
|
|
28
|
+
];
|
|
29
|
+
/**
|
|
30
|
+
* Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
|
|
31
|
+
*
|
|
32
|
+
* @param command - The command parameter or kind to extract the type from.
|
|
33
|
+
* @param checkVariadic - Whether to check for variadic parameters (arrays).
|
|
34
|
+
* @returns The extracted {@link Type}.
|
|
35
|
+
*/
|
|
36
|
+
function extractType(command, checkVariadic = true) {
|
|
37
|
+
const reflectionKind = extractReflectionKind(command, checkVariadic);
|
|
38
|
+
if (reflectionKind === ReflectionKind.string) return { kind: ReflectionKind.string };
|
|
39
|
+
else if (reflectionKind === ReflectionKind.number) return { kind: ReflectionKind.number };
|
|
40
|
+
else if (reflectionKind === ReflectionKind.boolean) return { kind: ReflectionKind.boolean };
|
|
41
|
+
else if (reflectionKind === ReflectionKind.array) if (isCommandParameterKind(command)) return {
|
|
42
|
+
kind: ReflectionKind.array,
|
|
43
|
+
type: extractType({ kind: command }, false)
|
|
44
|
+
};
|
|
45
|
+
else if (isSetObject(command)) return {
|
|
46
|
+
kind: ReflectionKind.array,
|
|
47
|
+
type: extractType({
|
|
48
|
+
...command,
|
|
49
|
+
kind: command.kind
|
|
50
|
+
}, false)
|
|
51
|
+
};
|
|
52
|
+
else return {
|
|
53
|
+
kind: ReflectionKind.array,
|
|
54
|
+
type: { kind: ReflectionKind.string }
|
|
55
|
+
};
|
|
56
|
+
else return { kind: ReflectionKind.string };
|
|
57
|
+
}
|
|
58
|
+
extractType.__type = [
|
|
59
|
+
"BaseCommandParameter",
|
|
60
|
+
"CommandParameterKind",
|
|
61
|
+
"command",
|
|
62
|
+
"checkVariadic",
|
|
63
|
+
"Type",
|
|
64
|
+
"extractType",
|
|
65
|
+
"PP\"w!\"w\"J2#\"2$\"w%/&"
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
export { extractReflectionKind, extractType };
|
|
70
|
+
//# sourceMappingURL=deepkit.mjs.map
|
|
@@ -0,0 +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":";;;;;;;;;;;;;;AAcI,KAAK,uBAAuB,QAAI,gDAE3B,YAAY,QAAQ,kDAErB,QAAO,iBAAiB,QAAQ,WAC1B,eAAe,QACf,eAAe;UAEf,uBAAQ,QAAA,IACd,YAAY,sBAAE,UACb,YAAY,QAAE,IACX,QAAQ,SAAK,sBAAA,OACjB,QAAO,iBAAiB,QAAQ,WAC1B,eAAe;UAGf,uBAAuB,QAAQ,IAC5C,YAAA,sBAAA,WACQ,YAAY,QAAQ,IAAI,QAAQ,SAAS,sBAAsB,QAChE,QAAO,eAAe;KAGtB,QAAO,eAAe;;AAG9B,sBAAkB,SAAA;CAAA;CAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;;;;;;;;AAQlB,SAAgB,YAAW,SAAA,gBAAA,MAAA;CACvB,MAAM,iBAAiB,sBAAE,SAAA,cAAA;AACzB,KAAI,mBAAI,eAAA,OACJ,QAAO,EAAE,MAAM,eAAe,QAAA;UAEzB,mBAAmB,eAAe,OACvC,QAAO,EAAE,MAAM,eAAe,QAAQ;UAEjC,mBAAmB,eAAe,QACvC,QAAO,EAAE,MAAM,eAAI,SAAA;UAEf,mBAAA,eAAA,MACJ,KAAI,uBAAuB,QAAG,CAC1B,QAAO;EACH,MAAM,eAAe;EACjC,MAAA,YAAA,EACgB,MAAM,SACjB,EAAA,MAAA;EACI;UAEb,YAAA,QAAA;EAEE,MAAA,eAAA;EACc,MAAM,YAAY;GACjC,GAAA;GACmB,MAAM,QAAQ;GACjB,EAAE,MAAK;EACX;KAGD,QAAO;EACH,MAAK,eAAA;EACb,MAAA,EAAA,MAAA,eAAA,QAAA;EACK;KAIL,QAAO,EAAE,MAAM,eAAe,QAAI;;AAG1C,YAAY,SAAS;CAAC;CAAwB;CAAQ;CAAA;CAAA;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,28 @@
|
|
|
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_get_command_tree = require('./get-command-tree.cjs');
|
|
6
|
+
const require_traverse_command_tree = require('./traverse-command-tree.cjs');
|
|
5
7
|
|
|
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.
|
|
8
|
+
exports.extractReflectionKind = require_deepkit.extractReflectionKind;
|
|
9
|
+
exports.extractType = require_deepkit.extractType;
|
|
10
|
+
exports.getAppBin = require_context_helpers.getAppBin;
|
|
11
|
+
exports.getAppDescription = require_context_helpers.getAppDescription;
|
|
12
|
+
exports.getAppName = require_context_helpers.getAppName;
|
|
13
|
+
exports.getAppTitle = require_context_helpers.getAppTitle;
|
|
14
|
+
exports.getCommandTree = require_get_command_tree.getCommandTree;
|
|
15
|
+
exports.getDynamicPathSegmentName = require_context_helpers.getDynamicPathSegmentName;
|
|
16
|
+
exports.getPathSegmentGroupName = require_context_helpers.getPathSegmentGroupName;
|
|
17
|
+
exports.getPathSegmentName = require_context_helpers.getPathSegmentName;
|
|
18
|
+
exports.isCommandArgument = require_type_checks.isCommandArgument;
|
|
19
|
+
exports.isCommandOption = require_type_checks.isCommandOption;
|
|
20
|
+
exports.isCommandParameter = require_type_checks.isCommandParameter;
|
|
21
|
+
exports.isCommandParameterConfig = require_type_checks.isCommandParameterConfig;
|
|
22
|
+
exports.isCommandParameterKind = require_type_checks.isCommandParameterKind;
|
|
23
|
+
exports.isDynamicPathSegment = require_context_helpers.isDynamicPathSegment;
|
|
24
|
+
exports.isPathSegmentGroup = require_context_helpers.isPathSegmentGroup;
|
|
25
|
+
exports.sortArgAliases = require_context_helpers.sortArgAliases;
|
|
26
|
+
exports.sortOptions = require_reflect.sortOptions;
|
|
27
|
+
exports.traverseCommandTree = require_traverse_command_tree.traverseCommandTree;
|
|
28
|
+
exports.traverseCommands = require_traverse_command_tree.traverseCommands;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getAppBin, getAppDescription, getAppName, getAppTitle, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases } from "./context-helpers.cjs";
|
|
2
|
+
import { extractReflectionKind, extractType } from "./deepkit.cjs";
|
|
2
3
|
import { getCommandTree } from "./get-command-tree.cjs";
|
|
3
4
|
import { sortOptions } from "./reflect.cjs";
|
|
4
5
|
import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.cjs";
|
|
5
|
-
|
|
6
|
+
import { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind } from "./type-checks.cjs";
|
|
7
|
+
export { extractReflectionKind, extractType, getAppBin, getAppDescription, getAppName, getAppTitle, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getAppBin, getAppDescription, getAppName, getAppTitle, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases } from "./context-helpers.mjs";
|
|
2
|
+
import { extractReflectionKind, extractType } from "./deepkit.mjs";
|
|
2
3
|
import { getCommandTree } from "./get-command-tree.mjs";
|
|
3
4
|
import { sortOptions } from "./reflect.mjs";
|
|
4
5
|
import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.mjs";
|
|
5
|
-
|
|
6
|
+
import { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind } from "./type-checks.mjs";
|
|
7
|
+
export { extractReflectionKind, extractType, getAppBin, getAppDescription, getAppName, getAppTitle, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
|
|
@@ -1,6 +1,8 @@
|
|
|
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";
|
|
3
5
|
import { getCommandTree } from "./get-command-tree.mjs";
|
|
4
6
|
import { traverseCommandTree, traverseCommands } from "./traverse-command-tree.mjs";
|
|
5
7
|
|
|
6
|
-
export { getAppBin, getAppDescription, getAppName, getAppTitle, getCommandTree, getDynamicPathSegmentName, getPathSegmentGroupName, getPathSegmentName, isDynamicPathSegment, isPathSegmentGroup, sortArgAliases, sortOptions, traverseCommandTree, traverseCommands };
|
|
8
|
+
export { extractReflectionKind, extractType, 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!\"/\""
|