@shell-shock/core 0.17.8 → 0.17.10
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/_virtual/_rolldown/runtime.cjs +29 -1
- package/dist/api.cjs +148 -1
- package/dist/api.d.cts +6 -6
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.mts +6 -6
- package/dist/api.d.mts.map +1 -1
- package/dist/api.mjs +145 -1
- package/dist/api.mjs.map +1 -1
- package/dist/components/command-validation-logic.cjs +292 -1
- package/dist/components/command-validation-logic.mjs +289 -1
- package/dist/components/command-validation-logic.mjs.map +1 -1
- package/dist/components/docs.cjs +265 -1
- package/dist/components/docs.mjs +256 -1
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/exec-builtin.cjs +429 -13
- package/dist/components/exec-builtin.mjs +425 -13
- package/dist/components/exec-builtin.mjs.map +1 -1
- package/dist/components/helpers.cjs +120 -1
- package/dist/components/helpers.mjs +112 -1
- package/dist/components/helpers.mjs.map +1 -1
- package/dist/components/index.cjs +58 -1
- package/dist/components/index.mjs +10 -1
- package/dist/components/options-parser-logic.cjs +960 -5
- package/dist/components/options-parser-logic.d.cts +1 -1
- package/dist/components/options-parser-logic.mjs +945 -5
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/state-builtin.cjs +629 -8
- package/dist/components/state-builtin.mjs +622 -8
- package/dist/components/state-builtin.mjs.map +1 -1
- package/dist/components/usage.cjs +117 -1
- package/dist/components/usage.mjs +114 -1
- package/dist/components/usage.mjs.map +1 -1
- package/dist/components/utils-builtin.cjs +838 -33
- package/dist/components/utils-builtin.mjs +828 -33
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/config.cjs +31 -1
- package/dist/config.mjs +29 -1
- package/dist/config.mjs.map +1 -1
- package/dist/contexts/command.cjs +26 -1
- package/dist/contexts/command.mjs +23 -1
- package/dist/contexts/command.mjs.map +1 -1
- package/dist/contexts/index.cjs +9 -1
- package/dist/contexts/index.mjs +4 -1
- package/dist/contexts/options.cjs +63 -1
- package/dist/contexts/options.mjs +58 -1
- package/dist/contexts/options.mjs.map +1 -1
- package/dist/helpers/automd.cjs +71 -1
- package/dist/helpers/automd.mjs +70 -1
- package/dist/helpers/automd.mjs.map +1 -1
- package/dist/helpers/docs-helpers.cjs +23 -1
- package/dist/helpers/docs-helpers.mjs +22 -1
- package/dist/helpers/docs-helpers.mjs.map +1 -1
- package/dist/helpers/paths.cjs +137 -1
- package/dist/helpers/paths.mjs +133 -1
- package/dist/helpers/paths.mjs.map +1 -1
- package/dist/helpers/persistence.cjs +115 -1
- package/dist/helpers/persistence.mjs +112 -1
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/helpers/update-package-json.cjs +65 -1
- package/dist/helpers/update-package-json.mjs +63 -1
- package/dist/helpers/update-package-json.mjs.map +1 -1
- package/dist/helpers/utilities.cjs +95 -1
- package/dist/helpers/utilities.mjs +93 -1
- package/dist/helpers/utilities.mjs.map +1 -1
- package/dist/helpers/validations.cjs +71 -1
- package/dist/helpers/validations.mjs +71 -1
- package/dist/helpers/validations.mjs.map +1 -1
- package/dist/index.cjs +53 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +7 -1
- package/dist/plugin-utils/compute-bin.cjs +50 -1
- package/dist/plugin-utils/compute-bin.mjs +49 -1
- package/dist/plugin-utils/compute-bin.mjs.map +1 -1
- package/dist/plugin-utils/context-helpers.cjs +231 -1
- package/dist/plugin-utils/context-helpers.mjs +221 -1
- package/dist/plugin-utils/context-helpers.mjs.map +1 -1
- package/dist/plugin-utils/deepkit.cjs +71 -1
- package/dist/plugin-utils/deepkit.mjs +69 -1
- package/dist/plugin-utils/deepkit.mjs.map +1 -1
- package/dist/plugin-utils/description-helpers.cjs +111 -2
- package/dist/plugin-utils/description-helpers.mjs +107 -2
- package/dist/plugin-utils/description-helpers.mjs.map +1 -1
- package/dist/plugin-utils/get-command-tree.cjs +117 -1
- package/dist/plugin-utils/get-command-tree.mjs +114 -1
- package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +39 -1
- package/dist/plugin-utils/index.mjs +10 -1
- package/dist/plugin-utils/reflect.cjs +52 -1
- package/dist/plugin-utils/reflect.mjs +52 -1
- package/dist/plugin-utils/reflect.mjs.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.cjs +64 -1
- package/dist/plugin-utils/traverse-command-tree.mjs +62 -1
- package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/type-checks.cjs +93 -1
- package/dist/plugin-utils/type-checks.mjs +88 -1
- package/dist/plugin-utils/type-checks.mjs.map +1 -1
- package/dist/plugin.cjs +471 -4
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +465 -4
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/deepkit.cjs +135 -1
- package/dist/resolver/deepkit.mjs +134 -1
- package/dist/resolver/deepkit.mjs.map +1 -1
- package/dist/resolver/helpers.cjs +173 -1
- package/dist/resolver/helpers.mjs +168 -1
- package/dist/resolver/helpers.mjs.map +1 -1
- package/dist/resolver/module.cjs +145 -1
- package/dist/resolver/module.mjs +144 -1
- package/dist/resolver/module.mjs.map +1 -1
- package/dist/resolver/resolve.cjs +222 -1
- package/dist/resolver/resolve.mjs +221 -1
- package/dist/resolver/resolve.mjs.map +1 -1
- package/dist/types/command.cjs +441 -1
- package/dist/types/command.d.cts +1 -1
- package/dist/types/command.d.mts +2 -2
- package/dist/types/command.mjs +405 -1
- package/dist/types/command.mjs.map +1 -1
- package/dist/types/config.cjs +134 -1
- package/dist/types/config.d.cts +10 -8
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +10 -8
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/config.mjs +127 -1
- package/dist/types/config.mjs.map +1 -1
- package/dist/types/context.cjs +37 -1
- package/dist/types/context.mjs +34 -1
- package/dist/types/context.mjs.map +1 -1
- package/dist/types/env.cjs +52 -1
- package/dist/types/env.d.cts +1 -1
- package/dist/types/env.d.mts +1 -1
- package/dist/types/env.mjs +50 -1
- package/dist/types/env.mjs.map +1 -1
- package/dist/types/index.cjs +50 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +6 -1
- package/dist/types/options.cjs +12 -1
- package/dist/types/options.mjs +10 -1
- package/package.json +22 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-package-json.mjs","names":[],"sources":["../../src/helpers/update-package-json.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 { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { getAppName } from \"../plugin-utils/context-helpers\";\nimport type { Context } from \"../types/context\";\n\nexport function formatBinaryPath(\n format: string | string[] | undefined\n): string {\n return `./dist/bin.${\n format === \"cjs\" || (Array.isArray(format) && format.includes(\"cjs\"))\n ? \"cjs\"\n : \"mjs\"\n }`;\n}\n\nexport async function updatePackageJsonBinary(context: Context): Promise<void> {\n const packageJsonPath = joinPaths(\n context.config.cwd
|
|
1
|
+
{"version":3,"file":"update-package-json.mjs","names":[],"sources":["../../src/helpers/update-package-json.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 { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { getAppName } from \"../plugin-utils/context-helpers\";\nimport type { Context } from \"../types/context\";\n\nexport function formatBinaryPath(\n format: string | string[] | undefined\n): string {\n return `./dist/bin.${\n format === \"cjs\" || (Array.isArray(format) && format.includes(\"cjs\"))\n ? \"cjs\"\n : \"mjs\"\n }`;\n}\n\nexport async function updatePackageJsonBinary(context: Context): Promise<void> {\n const packageJsonPath = joinPaths(\n context.config.cwd,\n context.config.root,\n \"package.json\"\n );\n\n if (!context.packageJson) {\n const packageJson = await context.fs.read(packageJsonPath);\n if (packageJson) {\n context.packageJson ??= JSON.parse(packageJson);\n }\n }\n\n if (context.packageJson) {\n if (\n context.config.bin &&\n Array.isArray(context.config.bin) &&\n context.config.bin.length > 0\n ) {\n context.packageJson.bin = Object.fromEntries(\n getUnique(toArray(context.config.bin)).map(bin => [\n bin,\n formatBinaryPath(context.config.output.format)\n ])\n );\n\n await context.fs.write(\n packageJsonPath,\n StormJSON.stringify(context.packageJson)\n );\n } else {\n if (\n Array.isArray(context.config.output.format) &&\n context.config.output.format.length > 1\n ) {\n context.packageJson.bin = {\n [kebabCase(getAppName(context))]: formatBinaryPath(\n toArray(context.config.output.format)[0]\n )\n };\n context.packageJson.bin = toArray(context.config.output.format).reduce(\n (ret, format) => {\n ret[`${kebabCase(getAppName(context))}-${format}`] =\n formatBinaryPath(format);\n\n return ret;\n },\n context.packageJson.bin\n );\n } else {\n context.packageJson.bin = {\n [kebabCase(getAppName(context))]: formatBinaryPath(\n context.config.output.format\n )\n };\n }\n\n await context.fs.write(\n packageJsonPath,\n StormJSON.stringify(context.packageJson)\n );\n }\n\n if (!isSetObject(context.packageJson.bin)) {\n throw new Error(\n \"Unable to determine the CLI binary name. Please specify the `bin` option in your Shell Shock configuration or ensure that the `name` field is set in your package.json.\"\n );\n }\n\n context.config.bin = context.packageJson.bin;\n }\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE9B,QAAO;;AA0BT,SAAgB,iBAAc,QAAA;AAC5B,QAAO,cAAC,WAAA,SAAA,MAAA,QAAA,OAAA,IAAA,OAAA,SAAA,MAAA,GAAA,QAAA;;AAEV,iBAAgB,SAAS;CAAA;CAAM;CAA0B;CAAe;AACxE,eAAY,wBAAA,SAAA;CACV,MAAM,kBAAI,UAAA,QAAA,OAAA,KAAA,QAAA,OAAA,MAAA,eAAA;AACV,KAAE,CAAA,QAAA,aAAA;EACJ,MAAA,cAAA,MAAA,QAAA,GAAA,KAAA,gBAAA;kBAEM,SAAO,gBAAS,KAAA,MAAA,YAA+B;;AAGnD,KAAE,QAAQ,aAAW;AACnB,MAAC,QAAQ,OAAI,OAAA,MAAA,QAAA,QAAA,OAAA,IAAA,IAAA,QAAA,OAAA,IAAA,SAAA,GAAA;AACd,WAAA,YAAA,MAAA,OAAA,YAAA,UAAA,QAAA,QAAA,OAAA,IAAA,CAAA,CAAA,IAAA,cAAA,QAAA,CAAA,KAAA,iBAAA,QAAA,OAAA,OAAA,OAAA,CAAA,EAAA;IAAA;IAAA;IAAA;IAAA,CAAA,CAAA,CAAA;;SAEI;AACH,OAAM,MAAA,QAAc,QAAM,OAAQ,OAAQ,OAAA,IAAA,QAAgB,OAAA,OAAA,OAAA,SAAA,GAAA;AACtD,YAAA,YAAa,MAAA,GACf,UAAQ,WAAgB,QAAU,CAAC,GAAA,iBAAY,QAAA,QAAA,OAAA,OAAA,OAAA,CAAA,GAAA,EACjD;AACF,YAAA,YAAA,MAAA,QAAA,QAAA,OAAA,OAAA,OAAA,CAAA,OAAA,cAAA,KAAA,WAAA;;AAEI,YAAQ;OACP;KAAA;KAAA;KAAA;KAAA;KAAA,CAAA,EAAA,QAAA,YAAA,IAAA;SAED,SAAM,YAAgB,MAAM,GAC5B,UAAe,WAAW,QAAE,CAAA,GAAA,iBAAA,QAAA,OAAA,OAAA,OAAA,EAC5B;AAEA,SAAE,QAAU,GAAA,MAAQ,iBAAoB,UAAU,UAAE,QAAA,YAAA,CAAA;;AAEtD,MAAI,CAAC,YAAC,QAAiB,YAAc,IAAC,CACpC,OAAG,IAAA,MAAA,0KAAA;;;;AAKT,wBAAkB,SAAU;CAAA;CAAQ;CAAW;CAAA;CAAA"}
|
|
@@ -1 +1,95 @@
|
|
|
1
|
-
require(
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
let _stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
|
|
3
|
+
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
4
|
+
let _stryke_cli_utils_tree = require("@stryke/cli/utils/tree");
|
|
5
|
+
let _stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
6
|
+
|
|
7
|
+
//#region src/helpers/utilities.ts
|
|
8
|
+
const __ΩRecord = [
|
|
9
|
+
"K",
|
|
10
|
+
"T",
|
|
11
|
+
"Record",
|
|
12
|
+
"l'e#\"Rb!b\"Pde\"!N#!w#y"
|
|
13
|
+
];
|
|
14
|
+
function __assignType(fn, args) {
|
|
15
|
+
fn.__type = args;
|
|
16
|
+
return fn;
|
|
17
|
+
}
|
|
18
|
+
function innerFormatCommandTree(command) {
|
|
19
|
+
return {
|
|
20
|
+
name: `${command.name}${command.isVirtual ? " (virtual)" : ""}`,
|
|
21
|
+
children: Object.values(command.children ?? {}).map(innerFormatCommandTree)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
innerFormatCommandTree.__type = [
|
|
25
|
+
"CommandTree",
|
|
26
|
+
"command",
|
|
27
|
+
"innerFormatCommandTree",
|
|
28
|
+
"P\"w!2\"!/#"
|
|
29
|
+
];
|
|
30
|
+
function formatCommandTree(context) {
|
|
31
|
+
return (0, _stryke_cli_utils_tree.formatTree)({
|
|
32
|
+
name: context.config.name,
|
|
33
|
+
children: Object.values(context.commands ?? {}).map(innerFormatCommandTree)
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
formatCommandTree.__type = [
|
|
37
|
+
"Context",
|
|
38
|
+
"context",
|
|
39
|
+
"formatCommandTree",
|
|
40
|
+
"P\"w!2\"&/#"
|
|
41
|
+
];
|
|
42
|
+
/**
|
|
43
|
+
* Retrieves the global command options based on the context configuration.
|
|
44
|
+
*
|
|
45
|
+
* @param context - The build context.
|
|
46
|
+
* @param command - The command for which to retrieve global options.
|
|
47
|
+
* @returns A record of global command options.
|
|
48
|
+
*/
|
|
49
|
+
function getGlobalOptions(context, command) {
|
|
50
|
+
let options;
|
|
51
|
+
if (Array.isArray(context.config.globalOptions)) options = Object.fromEntries((0, _stryke_helpers_get_unique.getUniqueBy)(context.config.globalOptions, __assignType((item) => item.name, [
|
|
52
|
+
"CommandOption",
|
|
53
|
+
"item",
|
|
54
|
+
"",
|
|
55
|
+
"P\"w!2\"\"/#"
|
|
56
|
+
])).map(__assignType((option) => [option.name, option], [
|
|
57
|
+
"option",
|
|
58
|
+
"",
|
|
59
|
+
"P\"2!\"/\""
|
|
60
|
+
])));
|
|
61
|
+
else if ((0, _stryke_type_checks_is_function.isFunction)(context.config.globalOptions)) options = Object.fromEntries((0, _stryke_helpers_get_unique.getUniqueBy)(context.config.globalOptions(context, command), __assignType((item) => item.name, [
|
|
62
|
+
"CommandOption",
|
|
63
|
+
"item",
|
|
64
|
+
"",
|
|
65
|
+
"P\"w!2\"\"/#"
|
|
66
|
+
])).map(__assignType((option) => [option.name, option], [
|
|
67
|
+
"option",
|
|
68
|
+
"",
|
|
69
|
+
"P\"2!\"/\""
|
|
70
|
+
])));
|
|
71
|
+
else options = {};
|
|
72
|
+
return Object.fromEntries(Object.entries(options).map(__assignType(([key, value]) => [key, {
|
|
73
|
+
...value,
|
|
74
|
+
env: value.env ?? (0, _stryke_string_format_constant_case.constantCase)(key)
|
|
75
|
+
}], [
|
|
76
|
+
"param0",
|
|
77
|
+
"",
|
|
78
|
+
"P\"2!\"/\""
|
|
79
|
+
])));
|
|
80
|
+
}
|
|
81
|
+
getGlobalOptions.__type = [
|
|
82
|
+
"Context",
|
|
83
|
+
"context",
|
|
84
|
+
"CommandBase",
|
|
85
|
+
"command",
|
|
86
|
+
() => __ΩRecord,
|
|
87
|
+
"CommandOption",
|
|
88
|
+
"getGlobalOptions",
|
|
89
|
+
"Retrieves the global command options based on the context configuration.",
|
|
90
|
+
"P\"w!2\"\"w#2$&\"w&o%#/'?("
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
exports.formatCommandTree = formatCommandTree;
|
|
95
|
+
exports.getGlobalOptions = getGlobalOptions;
|
|
@@ -1,2 +1,94 @@
|
|
|
1
|
-
import{constantCase
|
|
1
|
+
import { constantCase } from "@stryke/string-format/constant-case";
|
|
2
|
+
import { getUniqueBy } from "@stryke/helpers/get-unique";
|
|
3
|
+
import { formatTree } from "@stryke/cli/utils/tree";
|
|
4
|
+
import { isFunction } from "@stryke/type-checks/is-function";
|
|
5
|
+
|
|
6
|
+
//#region src/helpers/utilities.ts
|
|
7
|
+
const __ΩRecord = [
|
|
8
|
+
"K",
|
|
9
|
+
"T",
|
|
10
|
+
"Record",
|
|
11
|
+
"l'e#\"Rb!b\"Pde\"!N#!w#y"
|
|
12
|
+
];
|
|
13
|
+
function __assignType(fn, args) {
|
|
14
|
+
fn.__type = args;
|
|
15
|
+
return fn;
|
|
16
|
+
}
|
|
17
|
+
function innerFormatCommandTree(command) {
|
|
18
|
+
return {
|
|
19
|
+
name: `${command.name}${command.isVirtual ? " (virtual)" : ""}`,
|
|
20
|
+
children: Object.values(command.children ?? {}).map(innerFormatCommandTree)
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
innerFormatCommandTree.__type = [
|
|
24
|
+
"CommandTree",
|
|
25
|
+
"command",
|
|
26
|
+
"innerFormatCommandTree",
|
|
27
|
+
"P\"w!2\"!/#"
|
|
28
|
+
];
|
|
29
|
+
function formatCommandTree(context) {
|
|
30
|
+
return formatTree({
|
|
31
|
+
name: context.config.name,
|
|
32
|
+
children: Object.values(context.commands ?? {}).map(innerFormatCommandTree)
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
formatCommandTree.__type = [
|
|
36
|
+
"Context",
|
|
37
|
+
"context",
|
|
38
|
+
"formatCommandTree",
|
|
39
|
+
"P\"w!2\"&/#"
|
|
40
|
+
];
|
|
41
|
+
/**
|
|
42
|
+
* Retrieves the global command options based on the context configuration.
|
|
43
|
+
*
|
|
44
|
+
* @param context - The build context.
|
|
45
|
+
* @param command - The command for which to retrieve global options.
|
|
46
|
+
* @returns A record of global command options.
|
|
47
|
+
*/
|
|
48
|
+
function getGlobalOptions(context, command) {
|
|
49
|
+
let options;
|
|
50
|
+
if (Array.isArray(context.config.globalOptions)) options = Object.fromEntries(getUniqueBy(context.config.globalOptions, __assignType((item) => item.name, [
|
|
51
|
+
"CommandOption",
|
|
52
|
+
"item",
|
|
53
|
+
"",
|
|
54
|
+
"P\"w!2\"\"/#"
|
|
55
|
+
])).map(__assignType((option) => [option.name, option], [
|
|
56
|
+
"option",
|
|
57
|
+
"",
|
|
58
|
+
"P\"2!\"/\""
|
|
59
|
+
])));
|
|
60
|
+
else if (isFunction(context.config.globalOptions)) options = Object.fromEntries(getUniqueBy(context.config.globalOptions(context, command), __assignType((item) => item.name, [
|
|
61
|
+
"CommandOption",
|
|
62
|
+
"item",
|
|
63
|
+
"",
|
|
64
|
+
"P\"w!2\"\"/#"
|
|
65
|
+
])).map(__assignType((option) => [option.name, option], [
|
|
66
|
+
"option",
|
|
67
|
+
"",
|
|
68
|
+
"P\"2!\"/\""
|
|
69
|
+
])));
|
|
70
|
+
else options = {};
|
|
71
|
+
return Object.fromEntries(Object.entries(options).map(__assignType(([key, value]) => [key, {
|
|
72
|
+
...value,
|
|
73
|
+
env: value.env ?? constantCase(key)
|
|
74
|
+
}], [
|
|
75
|
+
"param0",
|
|
76
|
+
"",
|
|
77
|
+
"P\"2!\"/\""
|
|
78
|
+
])));
|
|
79
|
+
}
|
|
80
|
+
getGlobalOptions.__type = [
|
|
81
|
+
"Context",
|
|
82
|
+
"context",
|
|
83
|
+
"CommandBase",
|
|
84
|
+
"command",
|
|
85
|
+
() => __ΩRecord,
|
|
86
|
+
"CommandOption",
|
|
87
|
+
"getGlobalOptions",
|
|
88
|
+
"Retrieves the global command options based on the context configuration.",
|
|
89
|
+
"P\"w!2\"\"w#2$&\"w&o%#/'?("
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
//#endregion
|
|
93
|
+
export { formatCommandTree, getGlobalOptions };
|
|
2
94
|
//# sourceMappingURL=utilities.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.mjs","names":[],"sources":["../../src/helpers/utilities.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 { TreeItem } from \"@stryke/cli/utils/tree\";\nimport { formatTree } from \"@stryke/cli/utils/tree\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport type { CommandBase, CommandOption, CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\n\nfunction innerFormatCommandTree(command: CommandTree): TreeItem {\n return {\n name: `${command.name}${command.isVirtual ? \" (virtual)\" : \"\"}`,\n children: Object.values(command.children ?? {}).map(innerFormatCommandTree)\n };\n}\n\nexport function formatCommandTree(context: Context): string {\n return formatTree({\n name: context.config.name,\n children: Object.values(context.commands ?? {}).map(innerFormatCommandTree)\n });\n}\n\n/**\n * Retrieves the global command options based on the context configuration.\n *\n * @param context - The build context.\n * @param command - The command for which to retrieve global options.\n * @returns A record of global command options.\n */\nexport function getGlobalOptions(\n context: Context,\n command: CommandBase\n): Record<string, CommandOption> {\n let options!: Record<string, CommandOption>;\n if (Array.isArray(context.config.globalOptions)) {\n options = Object.fromEntries(\n getUniqueBy(\n context.config.globalOptions,\n (item: CommandOption) => item.name\n ).map(option => [option.name, option])\n );\n } else if (isFunction(context.config.globalOptions)) {\n options = Object.fromEntries(\n getUniqueBy(\n context.config.globalOptions(context, command),\n (item: CommandOption) => item.name\n ).map(option => [option.name, option])\n );\n } else {\n options = {};\n }\n\n return Object.fromEntries(\n Object.entries(options).map(([key, value]) => [\n key,\n { ...value, env: value.env ?? constantCase(key) }\n ])\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"utilities.mjs","names":[],"sources":["../../src/helpers/utilities.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 { TreeItem } from \"@stryke/cli/utils/tree\";\nimport { formatTree } from \"@stryke/cli/utils/tree\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport type { CommandBase, CommandOption, CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\n\nfunction innerFormatCommandTree(command: CommandTree): TreeItem {\n return {\n name: `${command.name}${command.isVirtual ? \" (virtual)\" : \"\"}`,\n children: Object.values(command.children ?? {}).map(innerFormatCommandTree)\n };\n}\n\nexport function formatCommandTree(context: Context): string {\n return formatTree({\n name: context.config.name,\n children: Object.values(context.commands ?? {}).map(innerFormatCommandTree)\n });\n}\n\n/**\n * Retrieves the global command options based on the context configuration.\n *\n * @param context - The build context.\n * @param command - The command for which to retrieve global options.\n * @returns A record of global command options.\n */\nexport function getGlobalOptions(\n context: Context,\n command: CommandBase\n): Record<string, CommandOption> {\n let options!: Record<string, CommandOption>;\n if (Array.isArray(context.config.globalOptions)) {\n options = Object.fromEntries(\n getUniqueBy(\n context.config.globalOptions,\n (item: CommandOption) => item.name\n ).map(option => [option.name, option])\n );\n } else if (isFunction(context.config.globalOptions)) {\n options = Object.fromEntries(\n getUniqueBy(\n context.config.globalOptions(context, command),\n (item: CommandOption) => item.name\n ).map(option => [option.name, option])\n );\n } else {\n options = {};\n }\n\n return Object.fromEntries(\n Object.entries(options).map(([key, value]) => [\n key,\n { ...value, env: value.env ?? constantCase(key) }\n ])\n );\n}\n"],"mappings":";;;;;;AAAA,MAAM,YAAY;CAAC;CAAK;CAAK;CAAU;CAAyB;;AAE9D,IAAG,SAAS;;;AAOd,SAAS,uBAAuB,SAAG;AAClC,QAAA;EACA,MAAA,GAAA,QAAoB,OAAM,QAAQ,YAAK,eAAkB;EACzD,UAAa,OAAO,OAAM,QAAQ,YAAa,EAAC,CAAA,CAAG,IAAC,uBAAA;;;;;;;;;AAIrD,SAAgB,kBAAkB,SAAS;;EAE3C,MAAO,QAAO,OAAW;EACzB,UAAS,OAAY,OAAO,QAAQ,YAAU,EAAI,CAAC,CAAA,IAAA,uBAAA;EACnD,CAAA;;AAEA,kBAAS,SAAkB;CAAC;CAAQ;CAAc;CAAU;CAAA;;;;;;;;AAQ5D,SAAG,iBAAA,SAAA,SAAA;CACH,IAAA;iDAEA,WAAO,OAAS,YAAiB,YAAU,QAAU,OAAO,eAAA,cAAA,SAAA,KAAA,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA,IAAA,cAAA,WAAA,CAAA,OAAA,MAAA,OAAA,EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA;UACnD,WAAW,QAAA,OAAA,cAAA,CAChB,WAAM,OAAQ,YAAW,YAAA,QAAA,OAAA,cAAA,SAAA,QAAA,EAAA,cAAA,SAAA,KAAA,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA,IAAA,cAAA,WAAA,CAAA,OAAA,MAAA,OAAA,EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA;KAEzB,WAAA,EAAA;;EAGF,GAAA;EACC,KAAA,MAAU,OAAI,aAAe,IAAO;EACtC,CAAA,EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA;;AAED,iBAAiB,SAAO;CAAA;CAAY;CAAS;CAAgB;OAAO;CAAA;CAAA;CAAA;CAAA;CAAA"}
|
|
@@ -1 +1,71 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_types_command = require('../types/command.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/validations.ts
|
|
4
|
+
const __ΩValidationFailure = [
|
|
5
|
+
"code",
|
|
6
|
+
"details",
|
|
7
|
+
"ValidationFailure",
|
|
8
|
+
"P&4!&4\"Mw#y"
|
|
9
|
+
];
|
|
10
|
+
function validateArguments(command) {
|
|
11
|
+
const failures = [];
|
|
12
|
+
let sequential = false;
|
|
13
|
+
for (const argument of command.args ?? []) if ((argument.kind === require_types_command.CommandParameterKinds.string || argument.kind === require_types_command.CommandParameterKinds.number) && argument.variadic) if (!sequential) sequential = true;
|
|
14
|
+
else failures.push({
|
|
15
|
+
code: "SEQUENTIAL_VARIADIC_ARGUMENTS",
|
|
16
|
+
details: `Sequential variadic arguments are not allowed - since the argument preceding ${argument.name} is variadic, it must not also be variadic.`
|
|
17
|
+
});
|
|
18
|
+
else sequential = false;
|
|
19
|
+
return failures;
|
|
20
|
+
}
|
|
21
|
+
validateArguments.__type = [
|
|
22
|
+
"CommandTree",
|
|
23
|
+
"command",
|
|
24
|
+
() => __ΩValidationFailure,
|
|
25
|
+
"validateArguments",
|
|
26
|
+
"P\"w!2\"n#F/$"
|
|
27
|
+
];
|
|
28
|
+
function validateOptions(command) {
|
|
29
|
+
const failures = [];
|
|
30
|
+
const optionNames = (Set.Ω = [["&"]], /* @__PURE__ */ new Set());
|
|
31
|
+
for (const option of Object.values(command.options ?? {})) {
|
|
32
|
+
if (optionNames.has(option.name)) failures.push({
|
|
33
|
+
code: "DUPLICATE_OPTION_NAME",
|
|
34
|
+
details: `Duplicate option name "${option.name}" found in command.`
|
|
35
|
+
});
|
|
36
|
+
optionNames.add(option.name);
|
|
37
|
+
for (const alias of option.alias) {
|
|
38
|
+
if (optionNames.has(alias)) failures.push({
|
|
39
|
+
code: "DUPLICATE_OPTION_ALIAS",
|
|
40
|
+
details: `Duplicate option name "${alias}" (an alias of "${option.name}") found in command.`
|
|
41
|
+
});
|
|
42
|
+
optionNames.add(alias);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return failures;
|
|
46
|
+
}
|
|
47
|
+
validateOptions.__type = [
|
|
48
|
+
"CommandTree",
|
|
49
|
+
"command",
|
|
50
|
+
() => __ΩValidationFailure,
|
|
51
|
+
"validateOptions",
|
|
52
|
+
"P\"w!2\"n#F/$"
|
|
53
|
+
];
|
|
54
|
+
function validateCommand(command) {
|
|
55
|
+
const results = [];
|
|
56
|
+
let failures = validateOptions(command);
|
|
57
|
+
if (failures.length > 0) results.push(...failures);
|
|
58
|
+
failures = validateArguments(command);
|
|
59
|
+
if (failures.length > 0) results.push(...failures);
|
|
60
|
+
return results;
|
|
61
|
+
}
|
|
62
|
+
validateCommand.__type = [
|
|
63
|
+
"CommandTree",
|
|
64
|
+
"command",
|
|
65
|
+
() => __ΩValidationFailure,
|
|
66
|
+
"validateCommand",
|
|
67
|
+
"P\"w!2\"n#F/$"
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
exports.validateCommand = validateCommand;
|
|
@@ -1,2 +1,72 @@
|
|
|
1
|
-
import{CommandParameterKinds
|
|
1
|
+
import { CommandParameterKinds } from "../types/command.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/validations.ts
|
|
4
|
+
const __ΩValidationFailure = [
|
|
5
|
+
"code",
|
|
6
|
+
"details",
|
|
7
|
+
"ValidationFailure",
|
|
8
|
+
"P&4!&4\"Mw#y"
|
|
9
|
+
];
|
|
10
|
+
function validateArguments(command) {
|
|
11
|
+
const failures = [];
|
|
12
|
+
let sequential = false;
|
|
13
|
+
for (const argument of command.args ?? []) if ((argument.kind === CommandParameterKinds.string || argument.kind === CommandParameterKinds.number) && argument.variadic) if (!sequential) sequential = true;
|
|
14
|
+
else failures.push({
|
|
15
|
+
code: "SEQUENTIAL_VARIADIC_ARGUMENTS",
|
|
16
|
+
details: `Sequential variadic arguments are not allowed - since the argument preceding ${argument.name} is variadic, it must not also be variadic.`
|
|
17
|
+
});
|
|
18
|
+
else sequential = false;
|
|
19
|
+
return failures;
|
|
20
|
+
}
|
|
21
|
+
validateArguments.__type = [
|
|
22
|
+
"CommandTree",
|
|
23
|
+
"command",
|
|
24
|
+
() => __ΩValidationFailure,
|
|
25
|
+
"validateArguments",
|
|
26
|
+
"P\"w!2\"n#F/$"
|
|
27
|
+
];
|
|
28
|
+
function validateOptions(command) {
|
|
29
|
+
const failures = [];
|
|
30
|
+
const optionNames = (Set.Ω = [["&"]], /* @__PURE__ */ new Set());
|
|
31
|
+
for (const option of Object.values(command.options ?? {})) {
|
|
32
|
+
if (optionNames.has(option.name)) failures.push({
|
|
33
|
+
code: "DUPLICATE_OPTION_NAME",
|
|
34
|
+
details: `Duplicate option name "${option.name}" found in command.`
|
|
35
|
+
});
|
|
36
|
+
optionNames.add(option.name);
|
|
37
|
+
for (const alias of option.alias) {
|
|
38
|
+
if (optionNames.has(alias)) failures.push({
|
|
39
|
+
code: "DUPLICATE_OPTION_ALIAS",
|
|
40
|
+
details: `Duplicate option name "${alias}" (an alias of "${option.name}") found in command.`
|
|
41
|
+
});
|
|
42
|
+
optionNames.add(alias);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return failures;
|
|
46
|
+
}
|
|
47
|
+
validateOptions.__type = [
|
|
48
|
+
"CommandTree",
|
|
49
|
+
"command",
|
|
50
|
+
() => __ΩValidationFailure,
|
|
51
|
+
"validateOptions",
|
|
52
|
+
"P\"w!2\"n#F/$"
|
|
53
|
+
];
|
|
54
|
+
function validateCommand(command) {
|
|
55
|
+
const results = [];
|
|
56
|
+
let failures = validateOptions(command);
|
|
57
|
+
if (failures.length > 0) results.push(...failures);
|
|
58
|
+
failures = validateArguments(command);
|
|
59
|
+
if (failures.length > 0) results.push(...failures);
|
|
60
|
+
return results;
|
|
61
|
+
}
|
|
62
|
+
validateCommand.__type = [
|
|
63
|
+
"CommandTree",
|
|
64
|
+
"command",
|
|
65
|
+
() => __ΩValidationFailure,
|
|
66
|
+
"validateCommand",
|
|
67
|
+
"P\"w!2\"n#F/$"
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
export { validateCommand };
|
|
2
72
|
//# sourceMappingURL=validations.mjs.map
|
|
@@ -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 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":"
|
|
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,uBAAsB;CAAA;CAAS;CAAM;CAAA;CAAA;;CAG3C,MAAO,WAAU,EAAA;CACf,IAAI,aAAQ;AACZ,MAAA,MAAS,YAAM,QAAA,QAAA,EAAA,CACjB,MAAA,SAAA,SAAA,sBAAA,UAAA,SAAA,SAAA,sBAAA,WAAA,SAAA,0BAEO,cAAS;;EAGV,MAAU;EACT,SAAM,gFAAgC,SAAA,KAAA;EACtC,CAAA;KAGD,cAAS;AAGb,QAAM;;AAER,kBAAiB,SAAK;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AACtB,SAAgB,gBAAC,SAAA;CACf,MAAM,WAAW,EAAC;CAClB,MAAM,eAAE,IAAA,IAAA,CAAA,CAAA,IAAA,CAAA,kBAAA,IAAA,KAAA;AACR,MAAI,MAAA,UAAA,OAAA,OAAA,QAAA,WAAA,EAAA,CAAA,EAAA;AACF,MAAE,YAAK,IAAA,OAAA,KAAA,CACL,UAAA,KAAa;GACf,MAAA;GACF,SAAA,0BAAA,OAAA,KAAA;;AAGF,cAAA,IAAA,OAAA,KAAA;;AAEM,OAAC,YAAS,IAAA,MAAgB,CACxB,UAAS,KAAC;;IAEV,SAAW,0BAAoB,MAAA,kBAAA,OAAA,KAAA;IAChC,CAAA;AAED,eAAS,IAAK,MAAA;;;AAGlB,QAAM;;AAER,gBAAgB,SAAI;CAAM;CAAM;OAAA;CAAA;CAAA;CAAA;;CAE9B,MAAM,UAAO,EAAK;CAClB,IAAI,WAAI,gBAAuB,QAAC;AAChC,KAAI,SAAE,SAAc,EAClB,SAAM,KAAO,GAAA,SAAA;AAEf,YAAU,kBAAO,QAAA;AACjB,KAAI,SAAQ,SAAS,EACnB,SAAM,KAAA,GAAA,SAAA;AAER,QAAI;;AAEN,gBAAE,SAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,53 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_types_command = require('./types/command.cjs');
|
|
3
|
+
const require_types_config = require('./types/config.cjs');
|
|
4
|
+
const require_types_context = require('./types/context.cjs');
|
|
5
|
+
const require_types_options = require('./types/options.cjs');
|
|
6
|
+
const require_api = require('./api.cjs');
|
|
7
|
+
|
|
8
|
+
exports.CommandParameterKinds = require_types_command.CommandParameterKinds;
|
|
9
|
+
exports.ShellShockAPI = require_api.ShellShockAPI;
|
|
10
|
+
exports.__ΩAsCommandParameterConfig = require_types_command.__ΩAsCommandParameterConfig;
|
|
11
|
+
exports.__ΩBaseBooleanCommandParameter = require_types_command.__ΩBaseBooleanCommandParameter;
|
|
12
|
+
exports.__ΩBaseCommandOptions = require_types_options.__ΩBaseCommandOptions;
|
|
13
|
+
exports.__ΩBaseCommandParameter = require_types_command.__ΩBaseCommandParameter;
|
|
14
|
+
exports.__ΩBaseNumberCommandParameter = require_types_command.__ΩBaseNumberCommandParameter;
|
|
15
|
+
exports.__ΩBaseSingleCommandParameter = require_types_command.__ΩBaseSingleCommandParameter;
|
|
16
|
+
exports.__ΩBaseStringCommandParameter = require_types_command.__ΩBaseStringCommandParameter;
|
|
17
|
+
exports.__ΩBaseVariadicCommandParameter = require_types_command.__ΩBaseVariadicCommandParameter;
|
|
18
|
+
exports.__ΩBooleanCommandOption = require_types_command.__ΩBooleanCommandOption;
|
|
19
|
+
exports.__ΩBooleanCommandParameter = require_types_command.__ΩBooleanCommandParameter;
|
|
20
|
+
exports.__ΩBooleanCommandParameterConfig = require_types_command.__ΩBooleanCommandParameterConfig;
|
|
21
|
+
exports.__ΩCommandArgument = require_types_command.__ΩCommandArgument;
|
|
22
|
+
exports.__ΩCommandArgumentConfig = require_types_command.__ΩCommandArgumentConfig;
|
|
23
|
+
exports.__ΩCommandBase = require_types_command.__ΩCommandBase;
|
|
24
|
+
exports.__ΩCommandConfig = require_types_command.__ΩCommandConfig;
|
|
25
|
+
exports.__ΩCommandMetadata = require_types_command.__ΩCommandMetadata;
|
|
26
|
+
exports.__ΩCommandModule = require_types_command.__ΩCommandModule;
|
|
27
|
+
exports.__ΩCommandOption = require_types_command.__ΩCommandOption;
|
|
28
|
+
exports.__ΩCommandOptionConfig = require_types_command.__ΩCommandOptionConfig;
|
|
29
|
+
exports.__ΩCommandParameter = require_types_command.__ΩCommandParameter;
|
|
30
|
+
exports.__ΩCommandParameterConfig = require_types_command.__ΩCommandParameterConfig;
|
|
31
|
+
exports.__ΩCommandParameterKind = require_types_command.__ΩCommandParameterKind;
|
|
32
|
+
exports.__ΩCommandParameterType = require_types_command.__ΩCommandParameterType;
|
|
33
|
+
exports.__ΩCommandTree = require_types_command.__ΩCommandTree;
|
|
34
|
+
exports.__ΩContext = require_types_context.__ΩContext;
|
|
35
|
+
exports.__ΩEngineOptions = require_types_config.__ΩEngineOptions;
|
|
36
|
+
exports.__ΩNumberCommandParameter = require_types_command.__ΩNumberCommandParameter;
|
|
37
|
+
exports.__ΩNumberCommandParameterConfig = require_types_command.__ΩNumberCommandParameterConfig;
|
|
38
|
+
exports.__ΩOptions = require_types_config.__ΩOptions;
|
|
39
|
+
exports.__ΩOutputConfig = require_types_config.__ΩOutputConfig;
|
|
40
|
+
exports.__ΩReferenceOptions = require_types_config.__ΩReferenceOptions;
|
|
41
|
+
exports.__ΩResolvedConfig = require_types_config.__ΩResolvedConfig;
|
|
42
|
+
exports.__ΩSerializedCommandTree = require_types_command.__ΩSerializedCommandTree;
|
|
43
|
+
exports.__ΩSingleBooleanCommandParameter = require_types_command.__ΩSingleBooleanCommandParameter;
|
|
44
|
+
exports.__ΩSingleNumberCommandParameter = require_types_command.__ΩSingleNumberCommandParameter;
|
|
45
|
+
exports.__ΩSingleStringCommandParameter = require_types_command.__ΩSingleStringCommandParameter;
|
|
46
|
+
exports.__ΩStringCommandParameter = require_types_command.__ΩStringCommandParameter;
|
|
47
|
+
exports.__ΩStringCommandParameterConfig = require_types_command.__ΩStringCommandParameterConfig;
|
|
48
|
+
exports.__ΩUnresolvedContext = require_types_context.__ΩUnresolvedContext;
|
|
49
|
+
exports.__ΩUserConfig = require_types_config.__ΩUserConfig;
|
|
50
|
+
exports.__ΩVariadicBooleanCommandParameter = require_types_command.__ΩVariadicBooleanCommandParameter;
|
|
51
|
+
exports.__ΩVariadicNumberCommandParameter = require_types_command.__ΩVariadicNumberCommandParameter;
|
|
52
|
+
exports.__ΩVariadicStringCommandParameter = require_types_command.__ΩVariadicStringCommandParameter;
|
|
53
|
+
exports.createShellShock = require_api.createShellShock;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ShellShockAPI, createShellShock } from "./api.cjs";
|
|
2
1
|
import { AsCommandParameterConfig, BaseBooleanCommandParameter, BaseCommandParameter, BaseNumberCommandParameter, BaseSingleCommandParameter, BaseStringCommandParameter, BaseVariadicCommandParameter, BooleanCommandOption, BooleanCommandParameter, BooleanCommandParameterConfig, CommandArgument, CommandArgumentConfig, CommandBase, CommandConfig, CommandMetadata, CommandModule, CommandOption, CommandOptionConfig, CommandParameter, CommandParameterConfig, CommandParameterKind, CommandParameterKinds, CommandParameterType, CommandTree, NumberCommandParameter, NumberCommandParameterConfig, SerializedCommandTree, SingleBooleanCommandParameter, SingleNumberCommandParameter, SingleStringCommandParameter, StringCommandParameter, StringCommandParameterConfig, VariadicBooleanCommandParameter, VariadicNumberCommandParameter, VariadicStringCommandParameter } from "./types/command.cjs";
|
|
3
2
|
import { Context, UnresolvedContext } from "./types/context.cjs";
|
|
4
|
-
import { Options, OutputConfig, ReferenceOptions, ResolvedConfig, UserConfig } from "./types/config.cjs";
|
|
3
|
+
import { EngineOptions, Options, OutputConfig, ReferenceOptions, ResolvedConfig, UserConfig } from "./types/config.cjs";
|
|
4
|
+
import { ShellShockAPI, createShellShock } from "./api.cjs";
|
|
5
5
|
import { BaseCommandOptions } from "./types/options.cjs";
|
|
6
|
-
export { AsCommandParameterConfig, BaseBooleanCommandParameter, BaseCommandOptions, BaseCommandParameter, BaseNumberCommandParameter, BaseSingleCommandParameter, BaseStringCommandParameter, BaseVariadicCommandParameter, BooleanCommandOption, BooleanCommandParameter, BooleanCommandParameterConfig, CommandArgument, CommandArgumentConfig, CommandBase, CommandConfig, CommandMetadata, CommandModule, CommandOption, CommandOptionConfig, CommandParameter, CommandParameterConfig, CommandParameterKind, CommandParameterKinds, CommandParameterType, CommandTree, Context, NumberCommandParameter, NumberCommandParameterConfig, Options, OutputConfig, ReferenceOptions, ResolvedConfig, SerializedCommandTree, ShellShockAPI, SingleBooleanCommandParameter, SingleNumberCommandParameter, SingleStringCommandParameter, StringCommandParameter, StringCommandParameterConfig, UnresolvedContext, UserConfig, VariadicBooleanCommandParameter, VariadicNumberCommandParameter, VariadicStringCommandParameter, createShellShock };
|
|
6
|
+
export { AsCommandParameterConfig, BaseBooleanCommandParameter, BaseCommandOptions, BaseCommandParameter, BaseNumberCommandParameter, BaseSingleCommandParameter, BaseStringCommandParameter, BaseVariadicCommandParameter, BooleanCommandOption, BooleanCommandParameter, BooleanCommandParameterConfig, CommandArgument, CommandArgumentConfig, CommandBase, CommandConfig, CommandMetadata, CommandModule, CommandOption, CommandOptionConfig, CommandParameter, CommandParameterConfig, CommandParameterKind, CommandParameterKinds, CommandParameterType, CommandTree, Context, EngineOptions, NumberCommandParameter, NumberCommandParameterConfig, Options, OutputConfig, ReferenceOptions, ResolvedConfig, SerializedCommandTree, ShellShockAPI, SingleBooleanCommandParameter, SingleNumberCommandParameter, SingleStringCommandParameter, StringCommandParameter, StringCommandParameterConfig, UnresolvedContext, UserConfig, VariadicBooleanCommandParameter, VariadicNumberCommandParameter, VariadicStringCommandParameter, createShellShock };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ShellShockAPI, createShellShock } from "./api.mjs";
|
|
2
1
|
import { AsCommandParameterConfig, BaseBooleanCommandParameter, BaseCommandParameter, BaseNumberCommandParameter, BaseSingleCommandParameter, BaseStringCommandParameter, BaseVariadicCommandParameter, BooleanCommandOption, BooleanCommandParameter, BooleanCommandParameterConfig, CommandArgument, CommandArgumentConfig, CommandBase, CommandConfig, CommandMetadata, CommandModule, CommandOption, CommandOptionConfig, CommandParameter, CommandParameterConfig, CommandParameterKind, CommandParameterKinds, CommandParameterType, CommandTree, NumberCommandParameter, NumberCommandParameterConfig, SerializedCommandTree, SingleBooleanCommandParameter, SingleNumberCommandParameter, SingleStringCommandParameter, StringCommandParameter, StringCommandParameterConfig, VariadicBooleanCommandParameter, VariadicNumberCommandParameter, VariadicStringCommandParameter } from "./types/command.mjs";
|
|
3
2
|
import { Context, UnresolvedContext } from "./types/context.mjs";
|
|
4
|
-
import { Options, OutputConfig, ReferenceOptions, ResolvedConfig, UserConfig } from "./types/config.mjs";
|
|
3
|
+
import { EngineOptions, Options, OutputConfig, ReferenceOptions, ResolvedConfig, UserConfig } from "./types/config.mjs";
|
|
4
|
+
import { ShellShockAPI, createShellShock } from "./api.mjs";
|
|
5
5
|
import { BaseCommandOptions } from "./types/options.mjs";
|
|
6
|
-
export { AsCommandParameterConfig, BaseBooleanCommandParameter, BaseCommandOptions, BaseCommandParameter, BaseNumberCommandParameter, BaseSingleCommandParameter, BaseStringCommandParameter, BaseVariadicCommandParameter, BooleanCommandOption, BooleanCommandParameter, BooleanCommandParameterConfig, CommandArgument, CommandArgumentConfig, CommandBase, CommandConfig, CommandMetadata, CommandModule, CommandOption, CommandOptionConfig, CommandParameter, CommandParameterConfig, CommandParameterKind, CommandParameterKinds, CommandParameterType, CommandTree, Context, NumberCommandParameter, NumberCommandParameterConfig, Options, OutputConfig, ReferenceOptions, ResolvedConfig, SerializedCommandTree, ShellShockAPI, SingleBooleanCommandParameter, SingleNumberCommandParameter, SingleStringCommandParameter, StringCommandParameter, StringCommandParameterConfig, UnresolvedContext, UserConfig, VariadicBooleanCommandParameter, VariadicNumberCommandParameter, VariadicStringCommandParameter, createShellShock };
|
|
6
|
+
export { AsCommandParameterConfig, BaseBooleanCommandParameter, BaseCommandOptions, BaseCommandParameter, BaseNumberCommandParameter, BaseSingleCommandParameter, BaseStringCommandParameter, BaseVariadicCommandParameter, BooleanCommandOption, BooleanCommandParameter, BooleanCommandParameterConfig, CommandArgument, CommandArgumentConfig, CommandBase, CommandConfig, CommandMetadata, CommandModule, CommandOption, CommandOptionConfig, CommandParameter, CommandParameterConfig, CommandParameterKind, CommandParameterKinds, CommandParameterType, CommandTree, Context, EngineOptions, NumberCommandParameter, NumberCommandParameterConfig, Options, OutputConfig, ReferenceOptions, ResolvedConfig, SerializedCommandTree, ShellShockAPI, SingleBooleanCommandParameter, SingleNumberCommandParameter, SingleStringCommandParameter, StringCommandParameter, StringCommandParameterConfig, UnresolvedContext, UserConfig, VariadicBooleanCommandParameter, VariadicNumberCommandParameter, VariadicStringCommandParameter, createShellShock };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CommandParameterKinds, __ΩAsCommandParameterConfig, __ΩBaseBooleanCommandParameter, __ΩBaseCommandParameter, __ΩBaseNumberCommandParameter, __ΩBaseSingleCommandParameter, __ΩBaseStringCommandParameter, __ΩBaseVariadicCommandParameter, __ΩBooleanCommandOption, __ΩBooleanCommandParameter, __ΩBooleanCommandParameterConfig, __ΩCommandArgument, __ΩCommandArgumentConfig, __ΩCommandBase, __ΩCommandConfig, __ΩCommandMetadata, __ΩCommandModule, __ΩCommandOption, __ΩCommandOptionConfig, __ΩCommandParameter, __ΩCommandParameterConfig, __ΩCommandParameterKind, __ΩCommandParameterType, __ΩCommandTree, __ΩNumberCommandParameter, __ΩNumberCommandParameterConfig, __ΩSerializedCommandTree, __ΩSingleBooleanCommandParameter, __ΩSingleNumberCommandParameter, __ΩSingleStringCommandParameter, __ΩStringCommandParameter, __ΩStringCommandParameterConfig, __ΩVariadicBooleanCommandParameter, __ΩVariadicNumberCommandParameter, __ΩVariadicStringCommandParameter } from "./types/command.mjs";
|
|
2
|
+
import { __ΩEngineOptions, __ΩOptions, __ΩOutputConfig, __ΩReferenceOptions, __ΩResolvedConfig, __ΩUserConfig } from "./types/config.mjs";
|
|
3
|
+
import { __ΩContext, __ΩUnresolvedContext } from "./types/context.mjs";
|
|
4
|
+
import { __ΩBaseCommandOptions } from "./types/options.mjs";
|
|
5
|
+
import { ShellShockAPI, createShellShock } from "./api.mjs";
|
|
6
|
+
|
|
7
|
+
export { CommandParameterKinds, ShellShockAPI, __ΩAsCommandParameterConfig, __ΩBaseBooleanCommandParameter, __ΩBaseCommandOptions, __ΩBaseCommandParameter, __ΩBaseNumberCommandParameter, __ΩBaseSingleCommandParameter, __ΩBaseStringCommandParameter, __ΩBaseVariadicCommandParameter, __ΩBooleanCommandOption, __ΩBooleanCommandParameter, __ΩBooleanCommandParameterConfig, __ΩCommandArgument, __ΩCommandArgumentConfig, __ΩCommandBase, __ΩCommandConfig, __ΩCommandMetadata, __ΩCommandModule, __ΩCommandOption, __ΩCommandOptionConfig, __ΩCommandParameter, __ΩCommandParameterConfig, __ΩCommandParameterKind, __ΩCommandParameterType, __ΩCommandTree, __ΩContext, __ΩEngineOptions, __ΩNumberCommandParameter, __ΩNumberCommandParameterConfig, __ΩOptions, __ΩOutputConfig, __ΩReferenceOptions, __ΩResolvedConfig, __ΩSerializedCommandTree, __ΩSingleBooleanCommandParameter, __ΩSingleNumberCommandParameter, __ΩSingleStringCommandParameter, __ΩStringCommandParameter, __ΩStringCommandParameterConfig, __ΩUnresolvedContext, __ΩUserConfig, __ΩVariadicBooleanCommandParameter, __ΩVariadicNumberCommandParameter, __ΩVariadicStringCommandParameter, createShellShock };
|
|
@@ -1 +1,50 @@
|
|
|
1
|
-
require(
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_context_helpers = require('./context-helpers.cjs');
|
|
3
|
+
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
4
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
5
|
+
|
|
6
|
+
//#region src/plugin-utils/compute-bin.ts
|
|
7
|
+
function __assignType(fn, args) {
|
|
8
|
+
fn.__type = args;
|
|
9
|
+
return fn;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Compute the command tree for the CLI application, starting from the root bin command. This will be used to determine which commands are available in the CLI application and their respective details.
|
|
13
|
+
*
|
|
14
|
+
* @param context - The plugin context containing the necessary information to compute the command tree.
|
|
15
|
+
* @returns The computed command tree for the CLI application, starting from the root bin command. This will include all commands discovered in the project and their respective details, organized in a hierarchical structure based on their segments and paths.
|
|
16
|
+
*/
|
|
17
|
+
function computeBin(context) {
|
|
18
|
+
return (0, _alloy_js_core.computed)(() => ({
|
|
19
|
+
id: "",
|
|
20
|
+
name: require_context_helpers.getAppName(context),
|
|
21
|
+
title: require_context_helpers.getAppTitle(context),
|
|
22
|
+
description: require_context_helpers.getAppDescription(context),
|
|
23
|
+
isVirtual: true,
|
|
24
|
+
path: null,
|
|
25
|
+
segments: [],
|
|
26
|
+
alias: [],
|
|
27
|
+
tags: [],
|
|
28
|
+
source: "file",
|
|
29
|
+
options: Object.fromEntries(context.globalOptions.map(__assignType((option) => [option.name, option], [
|
|
30
|
+
"option",
|
|
31
|
+
"",
|
|
32
|
+
"P\"2!\"/\""
|
|
33
|
+
]))),
|
|
34
|
+
args: [],
|
|
35
|
+
entry: { file: (0, _stryke_path_join_paths.joinPaths)(context.entryPath, "bin.ts") },
|
|
36
|
+
parent: null,
|
|
37
|
+
children: context.commands
|
|
38
|
+
})).value;
|
|
39
|
+
}
|
|
40
|
+
computeBin.__type = [
|
|
41
|
+
"Context",
|
|
42
|
+
"context",
|
|
43
|
+
"CommandTree",
|
|
44
|
+
"computeBin",
|
|
45
|
+
"Compute the command tree for the CLI application, starting from the root bin command. This will be used to determine which commands are available in the CLI application and their respective details.",
|
|
46
|
+
"P\"w!2\"\"w#/$?%"
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
exports.computeBin = computeBin;
|