@shell-shock/preset-script 0.6.76 → 0.6.78
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/README.md +16 -7
- package/dist/command-entry-BlT9_UEL.cjs +367 -0
- package/dist/command-entry-DWSekIys.mjs +339 -0
- package/dist/command-entry-DWSekIys.mjs.map +1 -0
- package/dist/components/bin-entry.cjs +20 -18
- package/dist/components/bin-entry.d.cts +2 -3
- package/dist/components/bin-entry.d.cts.map +1 -1
- package/dist/components/bin-entry.d.mts +2 -3
- package/dist/components/bin-entry.mjs +10 -6
- package/dist/components/command-entry.cjs +4 -204
- package/dist/components/command-entry.d.cts +1 -2
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts +1 -2
- package/dist/components/command-entry.mjs +2 -201
- package/dist/components/command-router.cjs +7 -7
- package/dist/components/command-router.d.cts +0 -1
- package/dist/components/command-router.d.cts.map +1 -1
- package/dist/components/command-router.d.mts +0 -1
- package/dist/components/command-router.mjs +3 -3
- package/dist/components/exit-function-declaration.cjs +11 -11
- package/dist/components/exit-function-declaration.d.cts.map +1 -1
- package/dist/components/exit-function-declaration.mjs +3 -3
- package/dist/components/index.cjs +6 -7
- package/dist/components/index.mjs +1 -2
- package/dist/components/virtual-command-entry.cjs +3 -154
- package/dist/components/virtual-command-entry.d.cts +1 -2
- package/dist/components/virtual-command-entry.d.cts.map +1 -1
- package/dist/components/virtual-command-entry.d.mts +1 -2
- package/dist/components/virtual-command-entry.mjs +2 -152
- package/dist/generator.cjs +108 -0
- package/dist/generator.d.cts +10 -0
- package/dist/generator.d.cts.map +1 -0
- package/dist/generator.d.mts +10 -0
- package/dist/generator.d.mts.map +1 -0
- package/dist/generator.mjs +107 -0
- package/dist/generator.mjs.map +1 -0
- package/dist/helpers/get-global-options.cjs +0 -1
- package/dist/helpers/get-global-options.d.cts +0 -1
- package/dist/helpers/get-global-options.d.cts.map +1 -1
- package/dist/helpers/get-global-options.d.mts +0 -1
- package/dist/index.cjs +9 -90
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +11 -89
- package/dist/types/index.cjs +1 -0
- package/dist/types/index.mjs +2 -0
- package/dist/types/plugin.d.cts +0 -1
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +0 -1
- package/package.json +32 -18
- package/dist/_virtual/_rolldown/runtime.cjs +0 -29
- package/dist/components/command-entry.mjs.map +0 -1
- package/dist/components/virtual-command-entry.mjs.map +0 -1
|
@@ -1,206 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
3
|
-
const require_components_virtual_command_entry = require('./virtual-command-entry.cjs');
|
|
4
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
6
|
-
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
7
|
-
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
8
|
-
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
9
|
-
let _powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
|
|
10
|
-
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
11
|
-
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
12
|
-
let _stryke_path_replace = require("@stryke/path/replace");
|
|
13
|
-
let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
14
|
-
let defu = require("defu");
|
|
15
|
-
defu = require_runtime.__toESM(defu, 1);
|
|
16
|
-
let _shell_shock_core_components_command_validation_logic = require("@shell-shock/core/components/command-validation-logic");
|
|
17
|
-
let _shell_shock_core_components_helpers = require("@shell-shock/core/components/helpers");
|
|
18
|
-
let _shell_shock_core_components_options_parser_logic = require("@shell-shock/core/components/options-parser-logic");
|
|
19
|
-
let _stryke_path_find = require("@stryke/path/find");
|
|
20
|
-
let _stryke_path_join = require("@stryke/path/join");
|
|
21
|
-
let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
22
|
-
let _stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
|
|
2
|
+
const require_command_entry = require('../command-entry-BlT9_UEL.cjs');
|
|
23
3
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return [(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code` return withCommand("${command.path}", [${command.segments.map((segment) => (0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment) ? (0, _stryke_string_format_camel_case.camelCase)((0, _shell_shock_core_plugin_utils.getDynamicPathSegmentName)(segment)) : `"${segment}"`).join(", ")}], [${Object.keys(command.options).length > 0 ? `options` : ""}${command.args.length > 0 ? `${Object.keys(command.options).length > 0 ? ", " : ""}${command.args.map((arg) => (0, _stryke_string_format_camel_case.camelCase)(arg.name)).join(", ")}` : ""}], handle${(0, _stryke_string_format_pascal_case.pascalCase)(command.name)}); `), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* A component that generates the `handler` function declaration for a command.
|
|
31
|
-
*/
|
|
32
|
-
function CommandHandlerDeclaration(props) {
|
|
33
|
-
const { command, banner, children } = props;
|
|
34
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
35
|
-
return [
|
|
36
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_options_parser_logic.OptionsInterfaceDeclaration, { command }),
|
|
37
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
38
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
39
|
-
get heading() {
|
|
40
|
-
return `The ${command.title} (${(0, _shell_shock_core_plugin_utils.getAppBin)(context)} ${command.segments.map((segment) => (0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment) ? `[${(0, _stryke_string_format_constant_case.constantCase)((0, _shell_shock_core_plugin_utils.getDynamicPathSegmentName)(segment))}]` : segment).join(" ")}) command.`;
|
|
41
|
-
},
|
|
42
|
-
get children() {
|
|
43
|
-
return [
|
|
44
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { get children() {
|
|
45
|
-
return `${command.description.replace(/\.+$/, "")}.`;
|
|
46
|
-
} }),
|
|
47
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
48
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocTitle, { get children() {
|
|
49
|
-
return command.title;
|
|
50
|
-
} }),
|
|
51
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
52
|
-
name: "args",
|
|
53
|
-
children: `The command-line arguments passed to the command.`
|
|
54
|
-
})
|
|
55
|
-
];
|
|
56
|
-
}
|
|
57
|
-
}),
|
|
58
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
59
|
-
"export": true,
|
|
60
|
-
async: true,
|
|
61
|
-
name: "handler",
|
|
62
|
-
parameters: [{
|
|
63
|
-
name: "args",
|
|
64
|
-
type: "string[]",
|
|
65
|
-
default: "useArgs()"
|
|
66
|
-
}],
|
|
67
|
-
get children() {
|
|
68
|
-
return [
|
|
69
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_options_parser_logic.CommandParserLogic, {
|
|
70
|
-
command,
|
|
71
|
-
get appSpecificEnvPrefix() {
|
|
72
|
-
return context.config.appSpecificEnvPrefix;
|
|
73
|
-
},
|
|
74
|
-
get isCaseSensitive() {
|
|
75
|
-
return context.config.isCaseSensitive;
|
|
76
|
-
}
|
|
77
|
-
}),
|
|
78
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
79
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
80
|
-
get when() {
|
|
81
|
-
return Boolean(banner);
|
|
82
|
-
},
|
|
83
|
-
children: banner
|
|
84
|
-
}),
|
|
85
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
86
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
87
|
-
condition: _alloy_js_core.code`!isHelp()`,
|
|
88
|
-
get children() {
|
|
89
|
-
return [_alloy_js_core.code`writeLine("");`, (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
90
|
-
get condition() {
|
|
91
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_helpers.IsDebug, {});
|
|
92
|
-
},
|
|
93
|
-
children: _alloy_js_core.code`writeLine(textColors.body.tertiary("Debug mode is enabled. Additional debug information may be logged to the console.")); `
|
|
94
|
-
})];
|
|
95
|
-
}
|
|
96
|
-
}),
|
|
97
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
98
|
-
children,
|
|
99
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
100
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
101
|
-
condition: _alloy_js_core.code`options.help`,
|
|
102
|
-
children: _alloy_js_core.code`return showHelp(); `
|
|
103
|
-
}),
|
|
104
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
105
|
-
return [(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}), (0, _alloy_js_core_jsx_runtime.createComponent)(CommandInvocation, { command })];
|
|
106
|
-
} })
|
|
107
|
-
];
|
|
108
|
-
}
|
|
109
|
-
})
|
|
110
|
-
];
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* The command entry point for the Shell Shock project.
|
|
114
|
-
*/
|
|
115
|
-
function CommandEntry(props) {
|
|
116
|
-
const { command, imports, builtinImports, ...rest } = props;
|
|
117
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
118
|
-
const filePath = (0, _alloy_js_core.computed)(() => (0, _stryke_path_join.joinPaths)(command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)).join("/"), "index.ts"));
|
|
119
|
-
const commandSourcePath = (0, _alloy_js_core.computed)(() => (0, _stryke_path_replace.replaceExtension)((0, _stryke_path_find.relativePath)((0, _stryke_path_join.joinPaths)(context.entryPath, (0, _stryke_path_find.findFilePath)(filePath.value)), command.entry.input?.file || command.entry.file)));
|
|
120
|
-
const typeDefinition = (0, _alloy_js_core.computed)(() => ({
|
|
121
|
-
...command.entry,
|
|
122
|
-
output: command.id
|
|
123
|
-
}));
|
|
124
|
-
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_entry_file.EntryFile, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
125
|
-
get path() {
|
|
126
|
-
return filePath.value;
|
|
127
|
-
},
|
|
128
|
-
get typeDefinition() {
|
|
129
|
-
return typeDefinition.value;
|
|
130
|
-
},
|
|
131
|
-
get imports() {
|
|
132
|
-
return (0, defu.default)(imports ?? {}, { [commandSourcePath.value.startsWith(".") ? commandSourcePath.value : `./${commandSourcePath.value}`]: `handle${(0, _stryke_string_format_pascal_case.pascalCase)(command.name)}` });
|
|
133
|
-
},
|
|
134
|
-
get builtinImports() {
|
|
135
|
-
return (0, defu.default)(builtinImports ?? {}, {
|
|
136
|
-
env: [
|
|
137
|
-
"env",
|
|
138
|
-
"isDevelopment",
|
|
139
|
-
"isDebug"
|
|
140
|
-
],
|
|
141
|
-
console: [
|
|
142
|
-
"debug",
|
|
143
|
-
"warn",
|
|
144
|
-
"error",
|
|
145
|
-
"writeLine",
|
|
146
|
-
"textColors"
|
|
147
|
-
],
|
|
148
|
-
utils: ["isMinimal", "isUnicodeSupported"],
|
|
149
|
-
state: [
|
|
150
|
-
{
|
|
151
|
-
name: "GlobalOptions",
|
|
152
|
-
type: true
|
|
153
|
-
},
|
|
154
|
-
"useGlobal",
|
|
155
|
-
"useGlobalOptions",
|
|
156
|
-
"useArgs",
|
|
157
|
-
"hasFlag",
|
|
158
|
-
"isHelp",
|
|
159
|
-
"withCommand"
|
|
160
|
-
],
|
|
161
|
-
[(0, _stryke_path_join.joinPaths)("help", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showHelp"],
|
|
162
|
-
[(0, _stryke_path_join.joinPaths)("banner", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showBanner"]
|
|
163
|
-
});
|
|
164
|
-
},
|
|
165
|
-
get children() {
|
|
166
|
-
return [
|
|
167
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
168
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_options_parser_logic.OptionsInterfaceDeclaration, { command }),
|
|
169
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
170
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(CommandHandlerDeclaration, {
|
|
171
|
-
command,
|
|
172
|
-
banner: _alloy_js_core.code`await showBanner(); `,
|
|
173
|
-
get children() {
|
|
174
|
-
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_command_validation_logic.CommandValidationLogic, { command }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
175
|
-
condition: _alloy_js_core.code`failures.length > 0`,
|
|
176
|
-
get children() {
|
|
177
|
-
return _alloy_js_core.code`error(\`The following validation failures were found while processing the user provided input, and must be corrected before the \${italic("${command.title}")} command can be executed: \\n\\n\${failures.map(failure => " - " + failure).join("\\n")}\`);
|
|
178
|
-
options.help = true; `;
|
|
179
|
-
}
|
|
180
|
-
})];
|
|
181
|
-
}
|
|
182
|
-
})
|
|
183
|
-
];
|
|
184
|
-
}
|
|
185
|
-
})), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
186
|
-
get each() {
|
|
187
|
-
return Object.values(command.children);
|
|
188
|
-
},
|
|
189
|
-
children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
190
|
-
get when() {
|
|
191
|
-
return child.virtual;
|
|
192
|
-
},
|
|
193
|
-
get fallback() {
|
|
194
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(CommandEntry, { command: child });
|
|
195
|
-
},
|
|
196
|
-
get children() {
|
|
197
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_virtual_command_entry.VirtualCommandEntry, { command: child });
|
|
198
|
-
}
|
|
199
|
-
})
|
|
200
|
-
})];
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
//#endregion
|
|
204
|
-
exports.CommandEntry = CommandEntry;
|
|
205
|
-
exports.CommandHandlerDeclaration = CommandHandlerDeclaration;
|
|
206
|
-
exports.CommandInvocation = CommandInvocation;
|
|
4
|
+
exports.CommandEntry = require_command_entry.CommandEntry;
|
|
5
|
+
exports.CommandHandlerDeclaration = require_command_entry.CommandHandlerDeclaration;
|
|
6
|
+
exports.CommandInvocation = require_command_entry.CommandInvocation;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Children } from "@alloy-js/core";
|
|
2
|
-
import { EntryFileProps } from "@
|
|
2
|
+
import { EntryFileProps } from "@shell-shock/core/contexts/power-plant";
|
|
3
3
|
import { CommandTree } from "@shell-shock/core";
|
|
4
|
-
|
|
5
4
|
//#region src/components/command-entry.d.ts
|
|
6
5
|
declare function CommandInvocation(props: {
|
|
7
6
|
command: CommandTree;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"mappings":";;;;iBA2DgB,kBAAkB;EAAS,SAAS;IAAa;UAyBhD;EACf,SAAS;EACT,SAAS;EACT,WAAW;;;;;iBAMG,0BACd,OAAO,iCAA8B;UAyDtB,0BAA0B,KACzC;EAGA,SAAS;;;;;iBAMK,aAAa,OAAO,oBAAiB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Children } from "@alloy-js/core";
|
|
2
|
-
import { EntryFileProps } from "@
|
|
2
|
+
import { EntryFileProps } from "@shell-shock/core/contexts/power-plant";
|
|
3
3
|
import { CommandTree } from "@shell-shock/core";
|
|
4
|
-
|
|
5
4
|
//#region src/components/command-entry.d.ts
|
|
6
5
|
declare function CommandInvocation(props: {
|
|
7
6
|
command: CommandTree;
|
|
@@ -1,202 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
3
|
-
import { For, Show, code, computed } from "@alloy-js/core";
|
|
4
|
-
import { ElseClause, FunctionDeclaration, IfStatement } from "@alloy-js/typescript";
|
|
5
|
-
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
6
|
-
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
7
|
-
import { EntryFile } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
8
|
-
import { TSDoc, TSDocParam, TSDocRemarks, TSDocTitle } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
9
|
-
import { getAppBin, getDynamicPathSegmentName, isDynamicPathSegment } from "@shell-shock/core/plugin-utils";
|
|
10
|
-
import { replaceExtension } from "@stryke/path/replace";
|
|
11
|
-
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
12
|
-
import defu from "defu";
|
|
13
|
-
import { CommandValidationLogic } from "@shell-shock/core/components/command-validation-logic";
|
|
14
|
-
import { IsDebug } from "@shell-shock/core/components/helpers";
|
|
15
|
-
import { CommandParserLogic, OptionsInterfaceDeclaration } from "@shell-shock/core/components/options-parser-logic";
|
|
16
|
-
import { findFilePath, relativePath } from "@stryke/path/find";
|
|
17
|
-
import { joinPaths } from "@stryke/path/join";
|
|
18
|
-
import { camelCase } from "@stryke/string-format/camel-case";
|
|
19
|
-
import { constantCase } from "@stryke/string-format/constant-case";
|
|
1
|
+
import { n as CommandHandlerDeclaration, r as CommandInvocation, t as CommandEntry } from "../command-entry-DWSekIys.mjs";
|
|
20
2
|
|
|
21
|
-
|
|
22
|
-
function CommandInvocation(props) {
|
|
23
|
-
const { command } = props;
|
|
24
|
-
return [memo(() => code` return withCommand("${command.path}", [${command.segments.map((segment) => isDynamicPathSegment(segment) ? camelCase(getDynamicPathSegmentName(segment)) : `"${segment}"`).join(", ")}], [${Object.keys(command.options).length > 0 ? `options` : ""}${command.args.length > 0 ? `${Object.keys(command.options).length > 0 ? ", " : ""}${command.args.map((arg) => camelCase(arg.name)).join(", ")}` : ""}], handle${pascalCase(command.name)}); `), createIntrinsic("hbr", {})];
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* A component that generates the `handler` function declaration for a command.
|
|
28
|
-
*/
|
|
29
|
-
function CommandHandlerDeclaration(props) {
|
|
30
|
-
const { command, banner, children } = props;
|
|
31
|
-
const context = usePowerlines();
|
|
32
|
-
return [
|
|
33
|
-
createComponent(OptionsInterfaceDeclaration, { command }),
|
|
34
|
-
createComponent(Spacing, {}),
|
|
35
|
-
createComponent(TSDoc, {
|
|
36
|
-
get heading() {
|
|
37
|
-
return `The ${command.title} (${getAppBin(context)} ${command.segments.map((segment) => isDynamicPathSegment(segment) ? `[${constantCase(getDynamicPathSegmentName(segment))}]` : segment).join(" ")}) command.`;
|
|
38
|
-
},
|
|
39
|
-
get children() {
|
|
40
|
-
return [
|
|
41
|
-
createComponent(TSDocRemarks, { get children() {
|
|
42
|
-
return `${command.description.replace(/\.+$/, "")}.`;
|
|
43
|
-
} }),
|
|
44
|
-
createIntrinsic("hbr", {}),
|
|
45
|
-
createComponent(TSDocTitle, { get children() {
|
|
46
|
-
return command.title;
|
|
47
|
-
} }),
|
|
48
|
-
createComponent(TSDocParam, {
|
|
49
|
-
name: "args",
|
|
50
|
-
children: `The command-line arguments passed to the command.`
|
|
51
|
-
})
|
|
52
|
-
];
|
|
53
|
-
}
|
|
54
|
-
}),
|
|
55
|
-
createComponent(FunctionDeclaration, {
|
|
56
|
-
"export": true,
|
|
57
|
-
async: true,
|
|
58
|
-
name: "handler",
|
|
59
|
-
parameters: [{
|
|
60
|
-
name: "args",
|
|
61
|
-
type: "string[]",
|
|
62
|
-
default: "useArgs()"
|
|
63
|
-
}],
|
|
64
|
-
get children() {
|
|
65
|
-
return [
|
|
66
|
-
createComponent(CommandParserLogic, {
|
|
67
|
-
command,
|
|
68
|
-
get appSpecificEnvPrefix() {
|
|
69
|
-
return context.config.appSpecificEnvPrefix;
|
|
70
|
-
},
|
|
71
|
-
get isCaseSensitive() {
|
|
72
|
-
return context.config.isCaseSensitive;
|
|
73
|
-
}
|
|
74
|
-
}),
|
|
75
|
-
createComponent(Spacing, {}),
|
|
76
|
-
createComponent(Show, {
|
|
77
|
-
get when() {
|
|
78
|
-
return Boolean(banner);
|
|
79
|
-
},
|
|
80
|
-
children: banner
|
|
81
|
-
}),
|
|
82
|
-
createComponent(Spacing, {}),
|
|
83
|
-
createComponent(IfStatement, {
|
|
84
|
-
condition: code`!isHelp()`,
|
|
85
|
-
get children() {
|
|
86
|
-
return [code`writeLine("");`, createComponent(IfStatement, {
|
|
87
|
-
get condition() {
|
|
88
|
-
return createComponent(IsDebug, {});
|
|
89
|
-
},
|
|
90
|
-
children: code`writeLine(textColors.body.tertiary("Debug mode is enabled. Additional debug information may be logged to the console.")); `
|
|
91
|
-
})];
|
|
92
|
-
}
|
|
93
|
-
}),
|
|
94
|
-
createComponent(Spacing, {}),
|
|
95
|
-
children,
|
|
96
|
-
createComponent(Spacing, {}),
|
|
97
|
-
createComponent(IfStatement, {
|
|
98
|
-
condition: code`options.help`,
|
|
99
|
-
children: code`return showHelp(); `
|
|
100
|
-
}),
|
|
101
|
-
createComponent(ElseClause, { get children() {
|
|
102
|
-
return [createIntrinsic("hbr", {}), createComponent(CommandInvocation, { command })];
|
|
103
|
-
} })
|
|
104
|
-
];
|
|
105
|
-
}
|
|
106
|
-
})
|
|
107
|
-
];
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* The command entry point for the Shell Shock project.
|
|
111
|
-
*/
|
|
112
|
-
function CommandEntry(props) {
|
|
113
|
-
const { command, imports, builtinImports, ...rest } = props;
|
|
114
|
-
const context = usePowerlines();
|
|
115
|
-
const filePath = computed(() => joinPaths(command.segments.filter((segment) => !isDynamicPathSegment(segment)).join("/"), "index.ts"));
|
|
116
|
-
const commandSourcePath = computed(() => replaceExtension(relativePath(joinPaths(context.entryPath, findFilePath(filePath.value)), command.entry.input?.file || command.entry.file)));
|
|
117
|
-
const typeDefinition = computed(() => ({
|
|
118
|
-
...command.entry,
|
|
119
|
-
output: command.id
|
|
120
|
-
}));
|
|
121
|
-
return [createComponent(EntryFile, mergeProps(rest, {
|
|
122
|
-
get path() {
|
|
123
|
-
return filePath.value;
|
|
124
|
-
},
|
|
125
|
-
get typeDefinition() {
|
|
126
|
-
return typeDefinition.value;
|
|
127
|
-
},
|
|
128
|
-
get imports() {
|
|
129
|
-
return defu(imports ?? {}, { [commandSourcePath.value.startsWith(".") ? commandSourcePath.value : `./${commandSourcePath.value}`]: `handle${pascalCase(command.name)}` });
|
|
130
|
-
},
|
|
131
|
-
get builtinImports() {
|
|
132
|
-
return defu(builtinImports ?? {}, {
|
|
133
|
-
env: [
|
|
134
|
-
"env",
|
|
135
|
-
"isDevelopment",
|
|
136
|
-
"isDebug"
|
|
137
|
-
],
|
|
138
|
-
console: [
|
|
139
|
-
"debug",
|
|
140
|
-
"warn",
|
|
141
|
-
"error",
|
|
142
|
-
"writeLine",
|
|
143
|
-
"textColors"
|
|
144
|
-
],
|
|
145
|
-
utils: ["isMinimal", "isUnicodeSupported"],
|
|
146
|
-
state: [
|
|
147
|
-
{
|
|
148
|
-
name: "GlobalOptions",
|
|
149
|
-
type: true
|
|
150
|
-
},
|
|
151
|
-
"useGlobal",
|
|
152
|
-
"useGlobalOptions",
|
|
153
|
-
"useArgs",
|
|
154
|
-
"hasFlag",
|
|
155
|
-
"isHelp",
|
|
156
|
-
"withCommand"
|
|
157
|
-
],
|
|
158
|
-
[joinPaths("help", ...command.segments.filter((segment) => !isDynamicPathSegment(segment)))]: ["showHelp"],
|
|
159
|
-
[joinPaths("banner", ...command.segments.filter((segment) => !isDynamicPathSegment(segment)))]: ["showBanner"]
|
|
160
|
-
});
|
|
161
|
-
},
|
|
162
|
-
get children() {
|
|
163
|
-
return [
|
|
164
|
-
createComponent(Spacing, {}),
|
|
165
|
-
createComponent(OptionsInterfaceDeclaration, { command }),
|
|
166
|
-
createComponent(Spacing, {}),
|
|
167
|
-
createComponent(CommandHandlerDeclaration, {
|
|
168
|
-
command,
|
|
169
|
-
banner: code`await showBanner(); `,
|
|
170
|
-
get children() {
|
|
171
|
-
return [createComponent(CommandValidationLogic, { command }), createComponent(IfStatement, {
|
|
172
|
-
condition: code`failures.length > 0`,
|
|
173
|
-
get children() {
|
|
174
|
-
return code`error(\`The following validation failures were found while processing the user provided input, and must be corrected before the \${italic("${command.title}")} command can be executed: \\n\\n\${failures.map(failure => " - " + failure).join("\\n")}\`);
|
|
175
|
-
options.help = true; `;
|
|
176
|
-
}
|
|
177
|
-
})];
|
|
178
|
-
}
|
|
179
|
-
})
|
|
180
|
-
];
|
|
181
|
-
}
|
|
182
|
-
})), createComponent(For, {
|
|
183
|
-
get each() {
|
|
184
|
-
return Object.values(command.children);
|
|
185
|
-
},
|
|
186
|
-
children: (child) => createComponent(Show, {
|
|
187
|
-
get when() {
|
|
188
|
-
return child.virtual;
|
|
189
|
-
},
|
|
190
|
-
get fallback() {
|
|
191
|
-
return createComponent(CommandEntry, { command: child });
|
|
192
|
-
},
|
|
193
|
-
get children() {
|
|
194
|
-
return createComponent(VirtualCommandEntry, { command: child });
|
|
195
|
-
}
|
|
196
|
-
})
|
|
197
|
-
})];
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
//#endregion
|
|
201
|
-
export { CommandEntry, CommandHandlerDeclaration, CommandInvocation };
|
|
202
|
-
//# sourceMappingURL=command-entry.mjs.map
|
|
3
|
+
export { CommandEntry, CommandHandlerDeclaration, CommandInvocation };
|
|
@@ -2,11 +2,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
3
|
let _alloy_js_core = require("@alloy-js/core");
|
|
4
4
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
5
|
-
let
|
|
6
|
-
let
|
|
5
|
+
let _power_plant_alloy_js_core_components_spacing = require("@power-plant/alloy-js/core/components/spacing");
|
|
6
|
+
let _shell_shock_core_contexts_power_plant = require("@shell-shock/core/contexts/power-plant");
|
|
7
7
|
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
8
8
|
let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
9
|
-
let
|
|
9
|
+
let _power_plant_alloy_js_typescript_components_dynamic_import_statement = require("@power-plant/alloy-js/typescript/components/dynamic-import-statement");
|
|
10
10
|
let _shell_shock_core_contexts_command = require("@shell-shock/core/contexts/command");
|
|
11
11
|
|
|
12
12
|
//#region src/components/command-router.tsx
|
|
@@ -18,7 +18,7 @@ function CommandRouterRoute() {
|
|
|
18
18
|
return !command.virtual;
|
|
19
19
|
},
|
|
20
20
|
get children() {
|
|
21
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
21
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_dynamic_import_statement.DynamicImportStatement, {
|
|
22
22
|
get name() {
|
|
23
23
|
return `handle${(0, _stryke_string_format_pascal_case.pascalCase)(command.name)}`;
|
|
24
24
|
},
|
|
@@ -51,7 +51,7 @@ function CommandRouter(props) {
|
|
|
51
51
|
type: "string",
|
|
52
52
|
initializer: _alloy_js_core.code`"";`
|
|
53
53
|
}),
|
|
54
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
54
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
55
55
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
56
56
|
get when() {
|
|
57
57
|
return commands && Object.keys(commands).length > 0;
|
|
@@ -64,7 +64,7 @@ function CommandRouter(props) {
|
|
|
64
64
|
get children() {
|
|
65
65
|
return _alloy_js_core.code`command = args[${index.value}];`;
|
|
66
66
|
}
|
|
67
|
-
}), (0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
67
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {})];
|
|
68
68
|
}
|
|
69
69
|
}),
|
|
70
70
|
(0, _alloy_js_core_jsx_runtime.createComponent)(CommandRouterBody, {
|
|
@@ -81,7 +81,7 @@ function CommandRouter(props) {
|
|
|
81
81
|
*/
|
|
82
82
|
function CommandRouterBody(props) {
|
|
83
83
|
const { commands, route } = props;
|
|
84
|
-
const context = (0,
|
|
84
|
+
const context = (0, _shell_shock_core_contexts_power_plant.usePowerlines)();
|
|
85
85
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
86
86
|
get when() {
|
|
87
87
|
return commands && Object.keys(commands).length > 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-router.d.cts","names":[],"sources":["../../src/components/command-router.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"command-router.d.cts","names":[],"sources":["../../src/components/command-router.tsx"],"mappings":";;;iBAkCgB,sBAAkB;UAuBjB;EACf;EACA,WAAW,eAAe;EAC1B,QAAQ;;;;;iBAMM,cAAc,OAAO,qBAAkB;;;;iBAmCvC,kBAAkB,OAAO,qBAAkB"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { For, Show, code, computed } from "@alloy-js/core";
|
|
3
3
|
import { ElseIfClause, IfStatement, VarDeclaration } from "@alloy-js/typescript";
|
|
4
|
-
import { Spacing } from "@
|
|
5
|
-
import { usePowerlines } from "@
|
|
4
|
+
import { Spacing } from "@power-plant/alloy-js/core/components/spacing";
|
|
5
|
+
import { usePowerlines } from "@shell-shock/core/contexts/power-plant";
|
|
6
6
|
import { isDynamicPathSegment } from "@shell-shock/core/plugin-utils";
|
|
7
7
|
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
8
|
-
import { DynamicImportStatement } from "@
|
|
8
|
+
import { DynamicImportStatement } from "@power-plant/alloy-js/typescript/components/dynamic-import-statement";
|
|
9
9
|
import { CommandContext, useCommand } from "@shell-shock/core/contexts/command";
|
|
10
10
|
|
|
11
11
|
//#region src/components/command-router.tsx
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
3
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
4
|
-
let
|
|
5
|
-
let
|
|
4
|
+
let _power_plant_alloy_js_core_components_spacing = require("@power-plant/alloy-js/core/components/spacing");
|
|
5
|
+
let _shell_shock_core_contexts_power_plant = require("@shell-shock/core/contexts/power-plant");
|
|
6
6
|
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
7
|
-
let
|
|
7
|
+
let _power_plant_alloy_js_core_helpers_code = require("@power-plant/alloy-js/core/helpers/code");
|
|
8
8
|
|
|
9
9
|
//#region src/components/exit-function-declaration.tsx
|
|
10
10
|
/**
|
|
11
11
|
* The `exit` handler function declaration code for the Shell Shock project.
|
|
12
12
|
*/
|
|
13
13
|
function ExitFunctionDeclaration() {
|
|
14
|
-
const context = (0,
|
|
14
|
+
const context = (0, _shell_shock_core_contexts_power_plant.usePowerlines)();
|
|
15
15
|
return [
|
|
16
16
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
17
17
|
"export": true,
|
|
@@ -56,26 +56,26 @@ function ExitFunctionDeclaration() {
|
|
|
56
56
|
];
|
|
57
57
|
}
|
|
58
58
|
}),
|
|
59
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
59
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
60
60
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
61
61
|
"let": true,
|
|
62
62
|
name: "isExiting",
|
|
63
63
|
type: "boolean",
|
|
64
|
-
initializer:
|
|
64
|
+
initializer: _power_plant_alloy_js_core_helpers_code.code`false;`
|
|
65
65
|
}),
|
|
66
66
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
67
67
|
"const": true,
|
|
68
68
|
name: "callbackAsyncQueue",
|
|
69
69
|
type: "Array<[(code: number | string) => Promise<void> | void, number]>",
|
|
70
|
-
initializer:
|
|
70
|
+
initializer: _power_plant_alloy_js_core_helpers_code.code`[];`
|
|
71
71
|
}),
|
|
72
72
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
73
73
|
"const": true,
|
|
74
74
|
name: "callbackSyncQueue",
|
|
75
75
|
type: "Array<(code: number | string) => void>",
|
|
76
|
-
initializer:
|
|
76
|
+
initializer: _power_plant_alloy_js_core_helpers_code.code`[];`
|
|
77
77
|
}),
|
|
78
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
78
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
79
79
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
80
80
|
"export": true,
|
|
81
81
|
async: true,
|
|
@@ -87,7 +87,7 @@ function ExitFunctionDeclaration() {
|
|
|
87
87
|
}],
|
|
88
88
|
get children() {
|
|
89
89
|
return [
|
|
90
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() =>
|
|
90
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _power_plant_alloy_js_core_helpers_code.code`
|
|
91
91
|
try {
|
|
92
92
|
if (isExiting) {
|
|
93
93
|
return;
|
|
@@ -110,7 +110,7 @@ function ExitFunctionDeclaration() {
|
|
|
110
110
|
|
|
111
111
|
const terminate = (force = false) => { `),
|
|
112
112
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
113
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() =>
|
|
113
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _power_plant_alloy_js_core_helpers_code.code`
|
|
114
114
|
verbose(\`The ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} application exited \${options.exception ? \`early due to an exception\` : "successfully"}\${options.startDate ? \`. Total run time is \${Date.now() - options.startDate.getTime() > 5000 ? Math.floor((Date.now() - options.startDate.getTime()) / 1000) : Date.now() - options.startDate.getTime()} \${Date.now() - options.startDate.getTime() > 5000 ? "seconds" : "milliseconds"}\` : ""}...\`);
|
|
115
115
|
if (!options.skipProcessExit) {
|
|
116
116
|
process.nextTick(() => process.exit(exitCode));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit-function-declaration.d.cts","names":[],"sources":["../../src/components/exit-function-declaration.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"exit-function-declaration.d.cts","names":[],"sources":["../../src/components/exit-function-declaration.tsx"],"mappings":";;;;iBAiCgB,oDAAuB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { FunctionDeclaration, InterfaceDeclaration, InterfaceMember, VarDeclaration } from "@alloy-js/typescript";
|
|
3
|
-
import { Spacing } from "@
|
|
4
|
-
import { usePowerlines } from "@
|
|
3
|
+
import { Spacing } from "@power-plant/alloy-js/core/components/spacing";
|
|
4
|
+
import { usePowerlines } from "@shell-shock/core/contexts/power-plant";
|
|
5
5
|
import { getAppTitle } from "@shell-shock/core/plugin-utils";
|
|
6
|
-
import { code } from "@
|
|
6
|
+
import { code } from "@power-plant/alloy-js/core/helpers/code";
|
|
7
7
|
|
|
8
8
|
//#region src/components/exit-function-declaration.tsx
|
|
9
9
|
/**
|
|
@@ -2,17 +2,16 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_components_exit_function_declaration = require('./exit-function-declaration.cjs');
|
|
3
3
|
const require_components_bin_entry = require('./bin-entry.cjs');
|
|
4
4
|
const require_components_command_router = require('./command-router.cjs');
|
|
5
|
-
const
|
|
6
|
-
const require_components_command_entry = require('./command-entry.cjs');
|
|
5
|
+
const require_command_entry = require('../command-entry-BlT9_UEL.cjs');
|
|
7
6
|
|
|
8
7
|
exports.BinEntry = require_components_bin_entry.BinEntry;
|
|
9
|
-
exports.CommandEntry =
|
|
10
|
-
exports.CommandHandlerDeclaration =
|
|
11
|
-
exports.CommandInvocation =
|
|
8
|
+
exports.CommandEntry = require_command_entry.CommandEntry;
|
|
9
|
+
exports.CommandHandlerDeclaration = require_command_entry.CommandHandlerDeclaration;
|
|
10
|
+
exports.CommandInvocation = require_command_entry.CommandInvocation;
|
|
12
11
|
exports.CommandRouter = require_components_command_router.CommandRouter;
|
|
13
12
|
exports.CommandRouterBody = require_components_command_router.CommandRouterBody;
|
|
14
13
|
exports.CommandRouterRoute = require_components_command_router.CommandRouterRoute;
|
|
15
14
|
exports.ExitFunctionDeclaration = require_components_exit_function_declaration.ExitFunctionDeclaration;
|
|
16
15
|
exports.RunApplication = require_components_bin_entry.RunApplication;
|
|
17
|
-
exports.VirtualCommandEntry =
|
|
18
|
-
exports.VirtualCommandHandlerDeclaration =
|
|
16
|
+
exports.VirtualCommandEntry = require_command_entry.VirtualCommandEntry;
|
|
17
|
+
exports.VirtualCommandHandlerDeclaration = require_command_entry.VirtualCommandHandlerDeclaration;
|