@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,2 +1,89 @@
|
|
|
1
|
-
import{CommandParameterKinds
|
|
1
|
+
import { CommandParameterKinds } from "../types/command.mjs";
|
|
2
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
3
|
+
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
4
|
+
import { isBoolean } from "@stryke/type-checks/is-boolean";
|
|
5
|
+
|
|
6
|
+
//#region src/plugin-utils/type-checks.ts
|
|
7
|
+
/**
|
|
8
|
+
* Type guard to check if a value is a valid {@link CommandParameterKind} type.
|
|
9
|
+
*
|
|
10
|
+
* @param obj - The value to check.
|
|
11
|
+
* @returns True if the value is a valid {@link CommandParameterKind} type, false otherwise.
|
|
12
|
+
*/
|
|
13
|
+
function isCommandParameterKind(obj) {
|
|
14
|
+
return isSetString(obj) && [
|
|
15
|
+
CommandParameterKinds.string,
|
|
16
|
+
CommandParameterKinds.number,
|
|
17
|
+
CommandParameterKinds.boolean
|
|
18
|
+
].includes(obj);
|
|
19
|
+
}
|
|
20
|
+
isCommandParameterKind.__type = [
|
|
21
|
+
"obj",
|
|
22
|
+
"isCommandParameterKind",
|
|
23
|
+
"Type guard to check if a value is a valid {@link CommandParameterKind} type.",
|
|
24
|
+
"P\"2!!/\"?#"
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* Type guard to check if a value is a valid {@link CommandParameterConfig} type.
|
|
28
|
+
*
|
|
29
|
+
* @param obj - The value to check.
|
|
30
|
+
* @returns True if the value is a valid {@link CommandParameterConfig} type, false otherwise.
|
|
31
|
+
*/
|
|
32
|
+
function isCommandParameterConfig(obj) {
|
|
33
|
+
return isSetObject(obj) && "kind" in obj && isCommandParameterKind(obj.kind);
|
|
34
|
+
}
|
|
35
|
+
isCommandParameterConfig.__type = [
|
|
36
|
+
"obj",
|
|
37
|
+
"isCommandParameterConfig",
|
|
38
|
+
"Type guard to check if a value is a valid {@link CommandParameterConfig} type.",
|
|
39
|
+
"P\"2!!/\"?#"
|
|
40
|
+
];
|
|
41
|
+
/**
|
|
42
|
+
* Type guard to check if a value is a valid {@link CommandParameter} type.
|
|
43
|
+
*
|
|
44
|
+
* @param obj - The value to check.
|
|
45
|
+
* @returns True if the value is a valid {@link CommandParameter} type, false otherwise.
|
|
46
|
+
*/
|
|
47
|
+
function isCommandParameter(obj) {
|
|
48
|
+
return isCommandParameterConfig(obj) && "name" in obj && isSetString(obj.name) && "title" in obj && isSetString(obj.title) && "description" in obj && isSetString(obj.description) && "alias" in obj && Array.isArray(obj.alias) && "env" in obj && (isSetString(obj.env) || obj.env === false) && "optional" in obj && isBoolean(obj.optional) && "variadic" in obj && isBoolean(obj.variadic);
|
|
49
|
+
}
|
|
50
|
+
isCommandParameter.__type = [
|
|
51
|
+
"obj",
|
|
52
|
+
"isCommandParameter",
|
|
53
|
+
"Type guard to check if a value is a valid {@link CommandParameter} type.",
|
|
54
|
+
"P\"2!!/\"?#"
|
|
55
|
+
];
|
|
56
|
+
/**
|
|
57
|
+
* Type guard to check if a value is a valid {@link CommandOption} type.
|
|
58
|
+
*
|
|
59
|
+
* @param obj - The value to check.
|
|
60
|
+
* @returns True if the value is a valid {@link CommandOption} type, false otherwise.
|
|
61
|
+
*/
|
|
62
|
+
function isCommandOption(obj) {
|
|
63
|
+
return isCommandParameterConfig(obj) && isCommandParameter(obj) && "default" in obj;
|
|
64
|
+
}
|
|
65
|
+
isCommandOption.__type = [
|
|
66
|
+
"obj",
|
|
67
|
+
"isCommandOption",
|
|
68
|
+
"Type guard to check if a value is a valid {@link CommandOption} type.",
|
|
69
|
+
"P\"2!!/\"?#"
|
|
70
|
+
];
|
|
71
|
+
/**
|
|
72
|
+
* Type guard to check if a value is a valid {@link CommandArgument} type.
|
|
73
|
+
*
|
|
74
|
+
* @param obj - The value to check.
|
|
75
|
+
* @returns True if the value is a valid {@link CommandArgument} type, false otherwise.
|
|
76
|
+
*/
|
|
77
|
+
function isCommandArgument(obj) {
|
|
78
|
+
return isCommandParameterConfig(obj) && isCommandParameter(obj);
|
|
79
|
+
}
|
|
80
|
+
isCommandArgument.__type = [
|
|
81
|
+
"obj",
|
|
82
|
+
"isCommandArgument",
|
|
83
|
+
"Type guard to check if a value is a valid {@link CommandArgument} type.",
|
|
84
|
+
"P\"2!!/\"?#"
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
export { isCommandArgument, isCommandOption, isCommandParameter, isCommandParameterConfig, isCommandParameterKind };
|
|
2
89
|
//# sourceMappingURL=type-checks.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-checks.mjs","names":[],"sources":["../../src/plugin-utils/type-checks.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isBoolean } from \"@stryke/type-checks/is-boolean\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandParameter,\n CommandParameterConfig,\n CommandParameterKind\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameterKind} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameterKind} type, false otherwise.\n */\nexport function isCommandParameterKind(obj: any): obj is CommandParameterKind {\n return (\n isSetString(obj) &&\n [\n CommandParameterKinds.string,\n CommandParameterKinds.number,\n CommandParameterKinds.boolean\n ].includes(obj as CommandParameterKind)\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameterConfig} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameterConfig} type, false otherwise.\n */\nexport function isCommandParameterConfig(\n obj: any\n): obj is CommandParameterConfig {\n return isSetObject(obj) && \"kind\" in obj && isCommandParameterKind(obj.kind);\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameter} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameter} type, false otherwise.\n */\nexport function isCommandParameter(obj: any): obj is CommandParameter {\n return (\n isCommandParameterConfig(obj) &&\n \"name\" in obj &&\n isSetString(obj.name) &&\n \"title\" in obj &&\n isSetString(obj.title) &&\n \"description\" in obj &&\n isSetString(obj.description) &&\n \"alias\" in obj &&\n Array.isArray(obj.alias) &&\n \"env\" in obj &&\n (isSetString(obj.env) || obj.env === false) &&\n \"optional\" in obj &&\n isBoolean(obj.optional) &&\n \"variadic\" in obj &&\n isBoolean(obj.variadic)\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandOption} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandOption} type, false otherwise.\n */\nexport function isCommandOption(obj: any): obj is CommandOption {\n return (\n isCommandParameterConfig(obj) && isCommandParameter(obj) && \"default\" in obj\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandArgument} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandArgument} type, false otherwise.\n */\nexport function isCommandArgument(obj: any): obj is CommandArgument {\n return isCommandParameterConfig(obj) && isCommandParameter(obj);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"type-checks.mjs","names":[],"sources":["../../src/plugin-utils/type-checks.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isBoolean } from \"@stryke/type-checks/is-boolean\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandParameter,\n CommandParameterConfig,\n CommandParameterKind\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameterKind} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameterKind} type, false otherwise.\n */\nexport function isCommandParameterKind(obj: any): obj is CommandParameterKind {\n return (\n isSetString(obj) &&\n [\n CommandParameterKinds.string,\n CommandParameterKinds.number,\n CommandParameterKinds.boolean\n ].includes(obj as CommandParameterKind)\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameterConfig} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameterConfig} type, false otherwise.\n */\nexport function isCommandParameterConfig(\n obj: any\n): obj is CommandParameterConfig {\n return isSetObject(obj) && \"kind\" in obj && isCommandParameterKind(obj.kind);\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameter} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameter} type, false otherwise.\n */\nexport function isCommandParameter(obj: any): obj is CommandParameter {\n return (\n isCommandParameterConfig(obj) &&\n \"name\" in obj &&\n isSetString(obj.name) &&\n \"title\" in obj &&\n isSetString(obj.title) &&\n \"description\" in obj &&\n isSetString(obj.description) &&\n \"alias\" in obj &&\n Array.isArray(obj.alias) &&\n \"env\" in obj &&\n (isSetString(obj.env) || obj.env === false) &&\n \"optional\" in obj &&\n isBoolean(obj.optional) &&\n \"variadic\" in obj &&\n isBoolean(obj.variadic)\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandOption} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandOption} type, false otherwise.\n */\nexport function isCommandOption(obj: any): obj is CommandOption {\n return (\n isCommandParameterConfig(obj) && isCommandParameter(obj) && \"default\" in obj\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandArgument} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandArgument} type, false otherwise.\n */\nexport function isCommandArgument(obj: any): obj is CommandArgument {\n return isCommandParameterConfig(obj) && isCommandParameter(obj);\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,SAAgB,uBAAS,KAAA;AACzB,QAAS,YAAA,IAAA,IAAA;EAAqB,sBAAkB;EAAQ,sBAAA;EAAA,sBAAA;EAAA,CAAA,SAAA,IAAA;;AAExD,uBAAE,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOF,SAAS,yBAAA,KAAA;AACP,QAAE,YAAiB,IAAC,IAAA,UAAA,OAAA,uBAAA,IAAA,KAAA;;AAEtB,yBAAM,SAA4B;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOlC,SAAE,mBAAA,KAAA;AACA,QAAM,yBAA0B,IAAI,IAAC,UAAa,OAAA,YAAA,IAAuB,KAAK,IAAA,WAAA,OAAA,YAAA,IAAA,MAAA,IAAA,iBAAA,OAAA,YAAA,IAAA,YAAA,IAAA,WAAA,OAAA,MAAA,QAAA,IAAA,MAAA,IAAA,SAAA,QAAA,YAAA,IAAA,IAAA,IAAA,IAAA,QAAA,UAAA,cAAA,OAAA,UAAA,IAAA,SAAA,IAAA,cAAA,OAAA,UAAA,IAAA,SAAA;;AAEhF,mBAAmB,SAAS;CAAC;CAAK;CAAA;CAAA;CAAA;;;;;;;AAOlC,SAAA,gBAAA,KAAA;;;AAGA,gBAAgB,SAAS;CAAC;CAAO;CAAmB;CAAsB;CAAA;;;;;;;AAO1E,SAAI,kBAA8B,KAAC;AACjC,QAAO,yBAAU,IAAA,IAAA,mBAAA,IAAA;;AAEnB,kBAAkB,SAAE;CAAA;CAAA;CAAA;CAAA;CAAA"}
|
package/dist/plugin.cjs
CHANGED
|
@@ -1,4 +1,471 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_context_helpers = require('./plugin-utils/context-helpers.cjs');
|
|
4
|
+
const require_components_docs = require('./components/docs.cjs');
|
|
5
|
+
const require_components_exec_builtin = require('./components/exec-builtin.cjs');
|
|
6
|
+
const require_deepkit = require('./plugin-utils/deepkit.cjs');
|
|
7
|
+
const require_traverse_command_tree = require('./plugin-utils/traverse-command-tree.cjs');
|
|
8
|
+
const require_get_command_tree = require('./plugin-utils/get-command-tree.cjs');
|
|
9
|
+
require('./plugin-utils/index.cjs');
|
|
10
|
+
const require_components_state_builtin = require('./components/state-builtin.cjs');
|
|
11
|
+
const require_components_utils_builtin = require('./components/utils-builtin.cjs');
|
|
12
|
+
const require_automd = require('./helpers/automd.cjs');
|
|
13
|
+
const require_paths = require('./helpers/paths.cjs');
|
|
14
|
+
const require_persistence = require('./helpers/persistence.cjs');
|
|
15
|
+
const require_update_package_json = require('./helpers/update-package-json.cjs');
|
|
16
|
+
const require_utilities = require('./helpers/utilities.cjs');
|
|
17
|
+
const require_validations = require('./helpers/validations.cjs');
|
|
18
|
+
const require_resolve = require('./resolver/resolve.cjs');
|
|
19
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
20
|
+
let _alloy_js_core_components = require("@alloy-js/core/components");
|
|
21
|
+
let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
22
|
+
let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
23
|
+
let _powerlines_plugin_automd = require("@powerlines/plugin-automd");
|
|
24
|
+
_powerlines_plugin_automd = require_runtime.__toESM(_powerlines_plugin_automd);
|
|
25
|
+
let _powerlines_plugin_env_helpers = require("@powerlines/plugin-env/helpers");
|
|
26
|
+
let _powerlines_plugin_nodejs = require("@powerlines/plugin-nodejs");
|
|
27
|
+
_powerlines_plugin_nodejs = require_runtime.__toESM(_powerlines_plugin_nodejs);
|
|
28
|
+
let _powerlines_plugin_tsdown = require("@powerlines/plugin-tsdown");
|
|
29
|
+
_powerlines_plugin_tsdown = require_runtime.__toESM(_powerlines_plugin_tsdown);
|
|
30
|
+
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
31
|
+
let _stryke_fs_chmod_x = require("@stryke/fs/chmod-x");
|
|
32
|
+
let _stryke_path_append = require("@stryke/path/append");
|
|
33
|
+
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
34
|
+
let _stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
|
|
35
|
+
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
36
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
37
|
+
let _stryke_path_resolve_parent_path = require("@stryke/path/resolve-parent-path");
|
|
38
|
+
let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
39
|
+
let _stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
|
|
40
|
+
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
41
|
+
let _stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
|
|
42
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
43
|
+
let defu = require("defu");
|
|
44
|
+
let powerlines_utils = require("powerlines/utils");
|
|
45
|
+
|
|
46
|
+
//#region src/plugin.tsx
|
|
47
|
+
function __assignType(fn, args) {
|
|
48
|
+
fn.__type = args;
|
|
49
|
+
return fn;
|
|
50
|
+
}
|
|
51
|
+
const MAX_DEPTH = 50;
|
|
52
|
+
/**
|
|
53
|
+
* The core Powerlines plugin to build Shell Shock projects.
|
|
54
|
+
*/
|
|
55
|
+
const plugin = __assignType((options = {}) => {
|
|
56
|
+
return [
|
|
57
|
+
(_powerlines_plugin_tsdown.default.Ω = [["Context", "\"w!"]], (0, _powerlines_plugin_tsdown.default)()),
|
|
58
|
+
(_powerlines_plugin_automd.default.Ω = [["Context", "\"w!"]], (0, _powerlines_plugin_automd.default)()),
|
|
59
|
+
{
|
|
60
|
+
name: "shell-shock:config",
|
|
61
|
+
config: __assignType(async function config() {
|
|
62
|
+
this.debug("Resolving the Shell Shock configuration.");
|
|
63
|
+
return (0, defu.defu)(options, {
|
|
64
|
+
name: require_context_helpers.getAppName(this),
|
|
65
|
+
title: require_context_helpers.getAppTitle(this),
|
|
66
|
+
description: require_context_helpers.getAppDescription(this),
|
|
67
|
+
platform: "node",
|
|
68
|
+
projectType: "application",
|
|
69
|
+
framework: "shell-shock",
|
|
70
|
+
isCaseSensitive: false,
|
|
71
|
+
output: {
|
|
72
|
+
format: "esm",
|
|
73
|
+
dts: false
|
|
74
|
+
},
|
|
75
|
+
input: !this.config.input || Array.isArray(this.config.input) && this.config.input.length === 0 || (0, _stryke_type_checks_is_object.isObject)(this.config.input) && Object.keys(this.config.input).length === 0 ? ["src/**/command.ts", "src/**/command.tsx"] : void 0,
|
|
76
|
+
resolve: {
|
|
77
|
+
external: ["@powerlines/deepkit"],
|
|
78
|
+
skipNodeModulesBundle: true
|
|
79
|
+
},
|
|
80
|
+
tsdown: {
|
|
81
|
+
dts: false,
|
|
82
|
+
nodeProtocol: true,
|
|
83
|
+
unbundle: false
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}, ["config", "P\"/!"]),
|
|
87
|
+
configResolved: {
|
|
88
|
+
order: "pre",
|
|
89
|
+
async handler() {
|
|
90
|
+
this.debug("Shell Shock configuration has been resolved.");
|
|
91
|
+
await require_update_package_json.updatePackageJsonBinary(this);
|
|
92
|
+
this.config.appSpecificEnvPrefix = (0, _stryke_type_checks_is_set_string.isSetString)(this.config.autoAssignEnv) ? this.config.autoAssignEnv : (0, _stryke_string_format_constant_case.constantCase)(require_context_helpers.getAppName(this));
|
|
93
|
+
if (!this.config.env.prefix || !Array.isArray(this.config.env.prefix)) this.config.env.prefix = (0, _stryke_convert_to_array.toArray)(this.config.env.prefix);
|
|
94
|
+
if (!this.config.env.prefix.includes(this.config.appSpecificEnvPrefix)) this.config.env.prefix.push(this.config.appSpecificEnvPrefix);
|
|
95
|
+
this.config.bin = ((0, _stryke_type_checks_is_set_string.isSetString)(this.packageJson.bin) ? { [(0, _stryke_string_format_kebab_case.kebabCase)(this.config.name)]: this.packageJson.bin } : this.packageJson.bin) ?? { [(0, _stryke_string_format_kebab_case.kebabCase)(this.config.name)]: require_update_package_json.formatBinaryPath(this.config.output.format) };
|
|
96
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(this.config.reference)) if (this.config.reference.includes("{command}")) this.config.reference = {
|
|
97
|
+
app: this.config.reference.substring(0, this.config.reference.indexOf("{command}")).replace(/\/?$/, "/"),
|
|
98
|
+
commands: this.config.reference
|
|
99
|
+
};
|
|
100
|
+
else if (this.config.reference.includes("{commands}")) this.config.reference = {
|
|
101
|
+
app: this.config.reference.substring(0, this.config.reference.indexOf("{commands}")).replace(/\/?$/, "/"),
|
|
102
|
+
commands: this.config.reference
|
|
103
|
+
};
|
|
104
|
+
else this.config.reference = { app: this.config.reference };
|
|
105
|
+
this.inputs ??= [];
|
|
106
|
+
this.globalOptions = Object.values(require_utilities.getGlobalOptions(this, {
|
|
107
|
+
id: null,
|
|
108
|
+
name: this.config.name,
|
|
109
|
+
path: null,
|
|
110
|
+
segments: [],
|
|
111
|
+
title: this.config.title,
|
|
112
|
+
description: this.config.description,
|
|
113
|
+
alias: [],
|
|
114
|
+
isVirtual: false
|
|
115
|
+
}));
|
|
116
|
+
this.globalOptions = this.globalOptions.map(__assignType((option) => ({
|
|
117
|
+
...option,
|
|
118
|
+
name: (0, _stryke_string_format_camel_case.camelCase)(option.name),
|
|
119
|
+
alias: option.alias ?? [],
|
|
120
|
+
optional: option.optional ?? false
|
|
121
|
+
}), [
|
|
122
|
+
"option",
|
|
123
|
+
"",
|
|
124
|
+
"P\"2!\"/\""
|
|
125
|
+
]));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
...(_powerlines_plugin_nodejs.default.Ω = [["Context", "\"w!"]], (0, _powerlines_plugin_nodejs.default)((0, defu.defu)(options ?? {}, { env: {
|
|
130
|
+
types: "@shell-shock/core/types/env#ShellShockEnv",
|
|
131
|
+
validate: false
|
|
132
|
+
} }))),
|
|
133
|
+
{
|
|
134
|
+
name: "shell-shock:inputs",
|
|
135
|
+
async configResolved() {
|
|
136
|
+
this.debug(`Checking for commands using input: ${JSON.stringify(this.config.input)}`);
|
|
137
|
+
this.commandsPath = await require_paths.findCommandsRoot(this);
|
|
138
|
+
this.debug(`Resolved commands root path: ${this.commandsPath}`);
|
|
139
|
+
const inputs = await (0, powerlines_utils.resolveInputs)(this, this.config.input);
|
|
140
|
+
this.debug(`Found ${inputs.length} entry points specified in the configuration options.`);
|
|
141
|
+
this.inputs = inputs.reduce(__assignType((ret, entry) => {
|
|
142
|
+
if (entry.file !== this.commandsPath && !(0, _stryke_path_is_parent_path.isParentPath)(entry.file, this.commandsPath)) throw new Error(`Command entry point "${entry.file}" is not located within the commands root "${this.commandsPath}". Please ensure that all command entry points are located within the current project.`);
|
|
143
|
+
const id = require_paths.resolveCommandId(this, entry.file);
|
|
144
|
+
if (!ret.some(__assignType((existing) => existing.id === id, [
|
|
145
|
+
"existing",
|
|
146
|
+
"",
|
|
147
|
+
"P\"2!\"/\""
|
|
148
|
+
]))) {
|
|
149
|
+
const name = require_paths.resolveCommandName(entry.file);
|
|
150
|
+
let segments = require_paths.resolveCommandPath(this, entry.file).split("/").filter(Boolean);
|
|
151
|
+
segments = segments.map(__assignType((segment, index) => {
|
|
152
|
+
const found = segments.findIndex(__assignType((existing) => existing === segment, [
|
|
153
|
+
"existing",
|
|
154
|
+
"",
|
|
155
|
+
"P\"2!\"/\""
|
|
156
|
+
]));
|
|
157
|
+
if (found !== -1 && found !== index) segment += `_${segments.filter(__assignType((segment) => require_context_helpers.isDynamicPathSegment(segment) && require_context_helpers.getDynamicPathSegmentName(segment).replace(/_\d+$/, "") === segment, [
|
|
158
|
+
"segment",
|
|
159
|
+
"",
|
|
160
|
+
"P\"2!\"/\""
|
|
161
|
+
])).length}`;
|
|
162
|
+
return segment;
|
|
163
|
+
}, [
|
|
164
|
+
"segment",
|
|
165
|
+
"index",
|
|
166
|
+
"",
|
|
167
|
+
"P\"2!\"2\"\"/#"
|
|
168
|
+
]));
|
|
169
|
+
ret.push({
|
|
170
|
+
id,
|
|
171
|
+
path: segments.join("/"),
|
|
172
|
+
segments,
|
|
173
|
+
name,
|
|
174
|
+
alias: [],
|
|
175
|
+
tags: [],
|
|
176
|
+
isVirtual: false,
|
|
177
|
+
source: "file",
|
|
178
|
+
entry: {
|
|
179
|
+
...entry,
|
|
180
|
+
file: entry.file,
|
|
181
|
+
input: {
|
|
182
|
+
file: entry.file,
|
|
183
|
+
name: entry.name
|
|
184
|
+
},
|
|
185
|
+
output: name
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
return ret;
|
|
190
|
+
}, [
|
|
191
|
+
"ret",
|
|
192
|
+
"entry",
|
|
193
|
+
"",
|
|
194
|
+
"P\"2!\"2\"\"/#"
|
|
195
|
+
]), this.inputs);
|
|
196
|
+
this.debug(`Shell Shock will process ${this.inputs.length} command entry files: \n${this.inputs.map(__assignType((command) => ` - ${command.id}: ${(0, _stryke_path_replace.replacePath)(command.entry.file, this.commandsPath)}`, [
|
|
197
|
+
"command",
|
|
198
|
+
"",
|
|
199
|
+
"P\"2!\"/\""
|
|
200
|
+
])).join("\n")}`);
|
|
201
|
+
},
|
|
202
|
+
prepare: __assignType(async function prepare() {
|
|
203
|
+
this.debug("Rendering base built-in modules for the Shell Shock application.");
|
|
204
|
+
return (0, _powerlines_plugin_alloy_render.render)(this, [
|
|
205
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_state_builtin.StateBuiltin, {}),
|
|
206
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_utils_builtin.UtilsBuiltin, {}),
|
|
207
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_exec_builtin.ExecBuiltin, {})
|
|
208
|
+
]);
|
|
209
|
+
}, ["prepare", "P\"/!"])
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: "shell-shock:virtual-inputs",
|
|
213
|
+
configResolved: {
|
|
214
|
+
order: "post",
|
|
215
|
+
async handler() {
|
|
216
|
+
if (this.inputs.length === 0) this.warn("No commands were found in the project. Please ensure at least one command exists.");
|
|
217
|
+
else {
|
|
218
|
+
this.debug("Finding and adding virtual command inputs for each command previously found.");
|
|
219
|
+
this.inputs = this.inputs.reduce(__assignType((ret, command) => {
|
|
220
|
+
let depth = 0;
|
|
221
|
+
let parentPath = (0, _stryke_path_resolve_parent_path.resolveParentPath)((0, _stryke_path_file_path_fns.findFilePath)(command.entry.file));
|
|
222
|
+
if ((0, _stryke_path_is_parent_path.isParentPath)(parentPath, this.commandsPath)) while (parentPath !== this.commandsPath) {
|
|
223
|
+
if (depth++ > MAX_DEPTH) throw new Error(`Unable to process virtual commands for ${command.name} \n\nPlease ensure ${command.entry.file} is a valid command entry file and does not have an invalid path.`);
|
|
224
|
+
if (!ret.some(__assignType((existing) => (0, _stryke_path_file_path_fns.findFilePath)(existing.entry.file) === parentPath, [
|
|
225
|
+
"existing",
|
|
226
|
+
"",
|
|
227
|
+
"P\"2!\"/\""
|
|
228
|
+
]))) {
|
|
229
|
+
const file = (0, _stryke_path_join_paths.joinPaths)(parentPath, "command.ts");
|
|
230
|
+
const id = require_paths.resolveCommandId(this, file);
|
|
231
|
+
if (!ret.some(__assignType((existing) => existing.id === id, [
|
|
232
|
+
"existing",
|
|
233
|
+
"",
|
|
234
|
+
"P\"2!\"/\""
|
|
235
|
+
]))) {
|
|
236
|
+
const name = require_paths.resolveCommandName(file);
|
|
237
|
+
let segments = require_paths.resolveCommandPath(this, file).split("/").filter(Boolean);
|
|
238
|
+
segments = segments.map(__assignType((segment, index) => {
|
|
239
|
+
const found = segments.findIndex(__assignType((existing) => existing === segment, [
|
|
240
|
+
"existing",
|
|
241
|
+
"",
|
|
242
|
+
"P\"2!\"/\""
|
|
243
|
+
]));
|
|
244
|
+
if (found !== -1 && found !== index) segment += `_${segments.filter(__assignType((segment) => require_context_helpers.isDynamicPathSegment(segment) && require_context_helpers.getDynamicPathSegmentName(segment).replace(/_\d+$/, "") === segment, [
|
|
245
|
+
"segment",
|
|
246
|
+
"",
|
|
247
|
+
"P\"2!\"/\""
|
|
248
|
+
])).length}`;
|
|
249
|
+
return segment;
|
|
250
|
+
}, [
|
|
251
|
+
"segment",
|
|
252
|
+
"index",
|
|
253
|
+
"",
|
|
254
|
+
"P\"2!\"2\"\"/#"
|
|
255
|
+
]));
|
|
256
|
+
ret.push({
|
|
257
|
+
id,
|
|
258
|
+
path: segments.join("/"),
|
|
259
|
+
segments,
|
|
260
|
+
name,
|
|
261
|
+
alias: [],
|
|
262
|
+
tags: [],
|
|
263
|
+
isVirtual: true,
|
|
264
|
+
entry: { file },
|
|
265
|
+
source: "file"
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
parentPath = (0, _stryke_path_resolve_parent_path.resolveParentPath)(parentPath);
|
|
270
|
+
}
|
|
271
|
+
return ret;
|
|
272
|
+
}, [
|
|
273
|
+
"ret",
|
|
274
|
+
"command",
|
|
275
|
+
"",
|
|
276
|
+
"P\"2!\"2\"\"/#"
|
|
277
|
+
]), this.inputs).sort(__assignType((a, b) => a.segments.length - b.segments.length, [
|
|
278
|
+
"a",
|
|
279
|
+
"b",
|
|
280
|
+
"",
|
|
281
|
+
"P\"2!\"2\"\"/#"
|
|
282
|
+
]));
|
|
283
|
+
this.debug(`Final command input list: \n${this.inputs.map(__assignType((command) => ` - ${command.id}${command.isVirtual ? " (virtual)" : ""}: ${command.source === "file" ? (0, _stryke_path_replace.replacePath)(command.entry.file, this.commandsPath) : `added by ${command.source}`}`, [
|
|
284
|
+
"command",
|
|
285
|
+
"",
|
|
286
|
+
"P\"2!\"/\""
|
|
287
|
+
])).join("\n")}`);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
name: "shell-shock:update-env",
|
|
294
|
+
configResolved: {
|
|
295
|
+
order: "post",
|
|
296
|
+
async handler() {
|
|
297
|
+
this.debug("Adding global options to the CLI application's environment variables.");
|
|
298
|
+
for (const option of Object.values(this.globalOptions).filter(__assignType((option) => Boolean(option.env), [
|
|
299
|
+
"option",
|
|
300
|
+
"",
|
|
301
|
+
"P\"2!\"/\""
|
|
302
|
+
])).filter(__assignType((option) => !this.env.types.env.getPropertyOrUndefined(option.env), [
|
|
303
|
+
"option",
|
|
304
|
+
"",
|
|
305
|
+
"P\"2!\"/\""
|
|
306
|
+
]))) this.env.types.env.addProperty({
|
|
307
|
+
name: option.env,
|
|
308
|
+
optional: option.optional ? true : void 0,
|
|
309
|
+
description: option.description,
|
|
310
|
+
visibility: _powerlines_deepkit_vendor_type.ReflectionVisibility.public,
|
|
311
|
+
type: require_deepkit.extractType(option),
|
|
312
|
+
default: option.default,
|
|
313
|
+
tags: {
|
|
314
|
+
title: option.title,
|
|
315
|
+
alias: option.alias.filter(__assignType((alias) => alias.length > 1, [
|
|
316
|
+
"alias",
|
|
317
|
+
"",
|
|
318
|
+
"P\"2!\"/\""
|
|
319
|
+
])).map(__assignType((alias) => (0, _stryke_string_format_constant_case.constantCase)(alias), [
|
|
320
|
+
"alias",
|
|
321
|
+
"",
|
|
322
|
+
"P\"2!\"/\""
|
|
323
|
+
])),
|
|
324
|
+
domain: "cli"
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
await (0, _powerlines_plugin_env_helpers.writeEnvTypeReflection)(this, this.env.types.env, "env");
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: "shell-shock:resolve-commands",
|
|
333
|
+
prepare: {
|
|
334
|
+
order: "post",
|
|
335
|
+
async handler() {
|
|
336
|
+
this.debug("Initializing the CLI application's command tree.");
|
|
337
|
+
this.commands = {};
|
|
338
|
+
if (this.config.command !== "prepare" && this.config.skipCache !== true && this.persistedMeta?.checksum === this.meta.checksum && this.fs.existsSync(require_persistence.getCommandsPersistencePath(this))) {
|
|
339
|
+
this.debug(`Skipping command resolution as the meta checksum has not changed.`);
|
|
340
|
+
await require_persistence.readCommandsPersistence(this);
|
|
341
|
+
} else {
|
|
342
|
+
for (const input of this.inputs.filter(__assignType((input) => input.segments.filter(__assignType((segment) => !require_context_helpers.isDynamicPathSegment(segment) && !require_context_helpers.isPathSegmentGroup(segment), [
|
|
343
|
+
"segment",
|
|
344
|
+
"",
|
|
345
|
+
"P\"2!\"/\""
|
|
346
|
+
])).length === 1, [
|
|
347
|
+
"input",
|
|
348
|
+
"",
|
|
349
|
+
"P\"2!\"/\""
|
|
350
|
+
]))) this.commands[input.name] = await require_resolve.resolve({
|
|
351
|
+
context: this,
|
|
352
|
+
command: input
|
|
353
|
+
});
|
|
354
|
+
this.debug("Post-processing commands to ensure proper reflection.");
|
|
355
|
+
await require_traverse_command_tree.traverseCommands(this, __assignType((command) => {
|
|
356
|
+
command.options = Object.fromEntries(Object.entries(command.options).map(__assignType(([name, option]) => [(0, _stryke_string_format_camel_case.camelCase)(name), {
|
|
357
|
+
...option,
|
|
358
|
+
name: (0, _stryke_string_format_camel_case.camelCase)(name),
|
|
359
|
+
alias: option.alias ?? [],
|
|
360
|
+
optional: option.optional ?? false
|
|
361
|
+
}], [
|
|
362
|
+
"param0",
|
|
363
|
+
"",
|
|
364
|
+
"P\"2!\"/\""
|
|
365
|
+
])));
|
|
366
|
+
}, [
|
|
367
|
+
"command",
|
|
368
|
+
"",
|
|
369
|
+
"P\"2!\"/\""
|
|
370
|
+
]));
|
|
371
|
+
await require_persistence.writeCommandsPersistence(this);
|
|
372
|
+
}
|
|
373
|
+
this.debug("Validating the CLI applications command tree.");
|
|
374
|
+
let isValid = true;
|
|
375
|
+
await require_traverse_command_tree.traverseCommands(this, __assignType((command) => {
|
|
376
|
+
const failures = require_validations.validateCommand(command);
|
|
377
|
+
if (failures.length > 0) {
|
|
378
|
+
this.error(`Found ${failures.length} issue${failures.length > 1 ? "s" : ""} with the ${command.title} command: \n${failures.map(__assignType((failure) => ` - ${failure.code}: ${failure.details}`, [
|
|
379
|
+
"failure",
|
|
380
|
+
"",
|
|
381
|
+
"P\"2!\"/\""
|
|
382
|
+
])).join("\n")}\n`);
|
|
383
|
+
isValid = false;
|
|
384
|
+
}
|
|
385
|
+
}, [
|
|
386
|
+
"command",
|
|
387
|
+
"",
|
|
388
|
+
"P\"2!\"/\""
|
|
389
|
+
]));
|
|
390
|
+
if (!isValid) throw new Error(`One or more commands in the command tree are invalid. Please review the errors above and correct them before proceeding.`);
|
|
391
|
+
this.info(`\nCreating an application with the following command tree: \n${require_utilities.formatCommandTree(this)}\n`);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
name: "shell-shock:chmod+x",
|
|
397
|
+
configResolved() {
|
|
398
|
+
this.config.tsdown.hooks ??= {};
|
|
399
|
+
this.config.tsdown.hooks["build:done"] = __assignType(async (_) => {
|
|
400
|
+
await Promise.all(Object.values(this.config.bin).map(__assignType(async (bin) => {
|
|
401
|
+
const path = (0, _stryke_path_append.appendPath)(bin, (0, _stryke_path_join_paths.joinPaths)(this.config.cwd, this.config.root));
|
|
402
|
+
if (this.fs.existsSync(path)) {
|
|
403
|
+
this.debug(`Adding hashbang to binary executable output file: ${path}`);
|
|
404
|
+
const content = await this.fs.read(path);
|
|
405
|
+
if (content && !content.startsWith("#!")) await this.fs.write(path, `#!/usr/bin/env ${this.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node\n\n${content}`);
|
|
406
|
+
this.debug(`Adding executable permissions (chmod+x) to binary executable output file: ${path}`);
|
|
407
|
+
await (0, _stryke_fs_chmod_x.chmodX)(path);
|
|
408
|
+
} else this.warn(`Expected binary output file not found at path: ${path}. Skipping adding hashbang and executable permissions (chmod+x).`);
|
|
409
|
+
}, [
|
|
410
|
+
"bin",
|
|
411
|
+
"",
|
|
412
|
+
"P\"2!\"/\""
|
|
413
|
+
])));
|
|
414
|
+
}, [
|
|
415
|
+
"chunks",
|
|
416
|
+
"_",
|
|
417
|
+
"",
|
|
418
|
+
"PP!P!F4!MK2\"\"/#"
|
|
419
|
+
]);
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
name: "shell-shock:docs",
|
|
424
|
+
configResolved: __assignType(function configResolved() {
|
|
425
|
+
this.config.automd ??= {};
|
|
426
|
+
this.config.automd.generators = {
|
|
427
|
+
...this.config.automd.generators ?? {},
|
|
428
|
+
commands: require_automd.commands(this)
|
|
429
|
+
};
|
|
430
|
+
}, ["configResolved", "P\"/!"]),
|
|
431
|
+
async docs() {
|
|
432
|
+
this.debug("Rendering entrypoint modules for the Shell Shock `script` preset.");
|
|
433
|
+
const commands = this.inputs.map(__assignType((input) => require_get_command_tree.getCommandTree(this, input.segments), [
|
|
434
|
+
"input",
|
|
435
|
+
"",
|
|
436
|
+
"P\"2!\"/\""
|
|
437
|
+
])).filter(Boolean);
|
|
438
|
+
return (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core_components.For, {
|
|
439
|
+
get each() {
|
|
440
|
+
return Object.values(commands);
|
|
441
|
+
},
|
|
442
|
+
doubleHardline: true,
|
|
443
|
+
get children() {
|
|
444
|
+
return __assignType((child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core_components.Show, {
|
|
445
|
+
get when() {
|
|
446
|
+
return !child.isVirtual;
|
|
447
|
+
},
|
|
448
|
+
get children() {
|
|
449
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_docs.CommandDocsFile, { command: child });
|
|
450
|
+
}
|
|
451
|
+
}), [
|
|
452
|
+
"child",
|
|
453
|
+
"",
|
|
454
|
+
"P\"2!\"/\""
|
|
455
|
+
]);
|
|
456
|
+
}
|
|
457
|
+
}));
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
];
|
|
461
|
+
}, [
|
|
462
|
+
"Options",
|
|
463
|
+
"options",
|
|
464
|
+
() => ({}),
|
|
465
|
+
"",
|
|
466
|
+
"P\"w!2\">#!F/$"
|
|
467
|
+
]);
|
|
468
|
+
|
|
469
|
+
//#endregion
|
|
470
|
+
exports.default = plugin;
|
|
471
|
+
exports.plugin = plugin;
|
package/dist/plugin.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.tsx"],"mappings":";;;;;;;AAqFA;cAAa,MAAA,oBAA2B,OAAA,GAAU,OAAA,EAChD,OAAA,GAAS,OAAA,KACR,MAAA,CAAO,QAAA"}
|
package/dist/plugin.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.tsx"],"mappings":";;;;;;;AAqFA;cAAa,MAAA,oBAA2B,OAAA,GAAU,OAAA,EAChD,OAAA,GAAS,OAAA,KACR,MAAA,CAAO,QAAA"}
|