@shell-shock/preset-cli 0.1.4 → 0.1.6
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 +1 -1
- package/dist/components/banner-function-declaration.d.cts +2 -2
- package/dist/components/command-entry.cjs +165 -4
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts +2 -2
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +166 -5
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/virtual-command-entry.cjs +1 -1
- package/dist/components/virtual-command-entry.d.cts +2 -2
- package/dist/components/virtual-command-entry.d.mts +2 -2
- package/dist/components/virtual-command-entry.mjs +1 -1
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ This package is part of the ⚡<b>Shell Shock</b> monorepo. The Shell Shock pack
|
|
|
27
27
|
|
|
28
28
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
29
29
|
|
|
30
|
-
[](https://stormsoftware.com/projects/shell-shock/) [](http://commitizen.github.io/cz-cli/)  
|
|
31
31
|
|
|
32
32
|
<!-- prettier-ignore-start -->
|
|
33
33
|
<!-- markdownlint-disable -->
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
2
|
import { BannerFunctionDeclarationProps } from "@shell-shock/preset-script/components/banner-function-declaration";
|
|
3
3
|
|
|
4
4
|
//#region src/components/banner-function-declaration.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
7
7
|
*/
|
|
8
|
-
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps):
|
|
8
|
+
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core0.Children;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { BannerFunctionDeclaration };
|
|
11
11
|
//# sourceMappingURL=banner-function-declaration.d.cts.map
|
|
@@ -3,13 +3,16 @@ const require_components_banner_function_declaration = require('./banner-functio
|
|
|
3
3
|
const require_components_virtual_command_entry = require('./virtual-command-entry.cjs');
|
|
4
4
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
5
|
let __alloy_js_core = require("@alloy-js/core");
|
|
6
|
+
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
6
7
|
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
7
8
|
let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
|
|
9
|
+
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
8
10
|
let __powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
|
|
9
11
|
let __shell_shock_preset_script_components_command_entry = require("@shell-shock/preset-script/components/command-entry");
|
|
10
12
|
let __stryke_path_find = require("@stryke/path/find");
|
|
11
13
|
let __stryke_path_join = require("@stryke/path/join");
|
|
12
14
|
let __stryke_path_replace = require("@stryke/path/replace");
|
|
15
|
+
let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
13
16
|
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
14
17
|
let defu = require("defu");
|
|
15
18
|
defu = require_rolldown_runtime.__toESM(defu);
|
|
@@ -21,7 +24,7 @@ defu = require_rolldown_runtime.__toESM(defu);
|
|
|
21
24
|
function CommandEntry(props) {
|
|
22
25
|
const { command, imports, builtinImports, ...rest } = props;
|
|
23
26
|
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
24
|
-
const filePath = (0, __alloy_js_core.computed)(() => (0, __stryke_path_join.joinPaths)(command.
|
|
27
|
+
const filePath = (0, __alloy_js_core.computed)(() => (0, __stryke_path_join.joinPaths)(command.segments.filter((segment) => !(0, __shell_shock_core_plugin_utils_context_helpers.isDynamicPathSegment)(segment)).join("/"), "index.ts"));
|
|
25
28
|
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)));
|
|
26
29
|
const typeDefinition = (0, __alloy_js_core.computed)(() => ({
|
|
27
30
|
...command.entry,
|
|
@@ -39,8 +42,14 @@ function CommandEntry(props) {
|
|
|
39
42
|
},
|
|
40
43
|
get builtinImports() {
|
|
41
44
|
return (0, defu.default)(builtinImports ?? {}, {
|
|
42
|
-
env: [
|
|
45
|
+
env: [
|
|
46
|
+
"env",
|
|
47
|
+
"isCI",
|
|
48
|
+
"isDevelopment",
|
|
49
|
+
"isDebug"
|
|
50
|
+
],
|
|
43
51
|
console: [
|
|
52
|
+
"debug",
|
|
44
53
|
"warn",
|
|
45
54
|
"error",
|
|
46
55
|
"table",
|
|
@@ -53,7 +62,8 @@ function CommandEntry(props) {
|
|
|
53
62
|
"getArgs",
|
|
54
63
|
"hasFlag",
|
|
55
64
|
"isMinimal",
|
|
56
|
-
"isUnicodeSupported"
|
|
65
|
+
"isUnicodeSupported",
|
|
66
|
+
"internal_commandContext"
|
|
57
67
|
]
|
|
58
68
|
});
|
|
59
69
|
},
|
|
@@ -62,7 +72,158 @@ function CommandEntry(props) {
|
|
|
62
72
|
(0, __alloy_js_core_jsx_runtime.createComponent)(require_components_banner_function_declaration.BannerFunctionDeclaration, { command }),
|
|
63
73
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
64
74
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
65
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_entry.CommandHandlerDeclaration, {
|
|
75
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_entry.CommandHandlerDeclaration, {
|
|
76
|
+
command,
|
|
77
|
+
get children() {
|
|
78
|
+
return [
|
|
79
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
80
|
+
name: "failures",
|
|
81
|
+
type: "string[]",
|
|
82
|
+
initializer: __alloy_js_core.code`[];`
|
|
83
|
+
}),
|
|
84
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
85
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
86
|
+
get each() {
|
|
87
|
+
return Object.values(command.options ?? {});
|
|
88
|
+
},
|
|
89
|
+
doubleHardline: true,
|
|
90
|
+
children: (option) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
91
|
+
get when() {
|
|
92
|
+
return !option.optional;
|
|
93
|
+
},
|
|
94
|
+
get children() {
|
|
95
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
96
|
+
get condition() {
|
|
97
|
+
return __alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}`;
|
|
98
|
+
},
|
|
99
|
+
get children() {
|
|
100
|
+
return __alloy_js_core.code`failures.push("Missing required \\"${option.name}\\" option");`;
|
|
101
|
+
}
|
|
102
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
103
|
+
get when() {
|
|
104
|
+
return (option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && option.variadic;
|
|
105
|
+
},
|
|
106
|
+
get children() {
|
|
107
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
108
|
+
get condition() {
|
|
109
|
+
return __alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0`;
|
|
110
|
+
},
|
|
111
|
+
get children() {
|
|
112
|
+
return __alloy_js_core.code`failures.push("No values were provided to the required \\"${option.name}\\" array option");`;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
})];
|
|
117
|
+
}
|
|
118
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
119
|
+
get when() {
|
|
120
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
121
|
+
},
|
|
122
|
+
get children() {
|
|
123
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
124
|
+
get when() {
|
|
125
|
+
return option.variadic;
|
|
126
|
+
},
|
|
127
|
+
get fallback() {
|
|
128
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
129
|
+
get condition() {
|
|
130
|
+
return __alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} && Number.isNaN(options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`})`;
|
|
131
|
+
},
|
|
132
|
+
get children() {
|
|
133
|
+
return __alloy_js_core.code`failures.push("Invalid numeric value provided for the \\"${option.name}\\" option");`;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
get children() {
|
|
138
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
139
|
+
get condition() {
|
|
140
|
+
return __alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}.some(value => Number.isNaN(value))`;
|
|
141
|
+
},
|
|
142
|
+
get children() {
|
|
143
|
+
return __alloy_js_core.code`failures.push("Invalid numeric value provided in the \\"${option.name}\\" array option");`;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
})]
|
|
150
|
+
}),
|
|
151
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
152
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
153
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
154
|
+
get each() {
|
|
155
|
+
return command.arguments;
|
|
156
|
+
},
|
|
157
|
+
doubleHardline: true,
|
|
158
|
+
children: (argument) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
159
|
+
get when() {
|
|
160
|
+
return !argument.optional;
|
|
161
|
+
},
|
|
162
|
+
get children() {
|
|
163
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
164
|
+
get condition() {
|
|
165
|
+
return __alloy_js_core.code`!${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}`;
|
|
166
|
+
},
|
|
167
|
+
get children() {
|
|
168
|
+
return __alloy_js_core.code`failures.push("Missing required \\"${argument.name}\\" positional argument");`;
|
|
169
|
+
}
|
|
170
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
171
|
+
get when() {
|
|
172
|
+
return (argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && argument.variadic;
|
|
173
|
+
},
|
|
174
|
+
get children() {
|
|
175
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
176
|
+
get condition() {
|
|
177
|
+
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}.length === 0`;
|
|
178
|
+
},
|
|
179
|
+
get children() {
|
|
180
|
+
return __alloy_js_core.code`failures.push("No values were provided to the required \\"${argument.name}\\" array positional argument");`;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
})];
|
|
185
|
+
}
|
|
186
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
187
|
+
get when() {
|
|
188
|
+
return argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
189
|
+
},
|
|
190
|
+
get children() {
|
|
191
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
192
|
+
get when() {
|
|
193
|
+
return argument.variadic;
|
|
194
|
+
},
|
|
195
|
+
get fallback() {
|
|
196
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
197
|
+
get condition() {
|
|
198
|
+
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} && Number.isNaN(${(0, __stryke_string_format_camel_case.camelCase)(argument.name)})`;
|
|
199
|
+
},
|
|
200
|
+
get children() {
|
|
201
|
+
return __alloy_js_core.code`failures.push("Invalid numeric value provided for the \\"${argument.name}\\" positional argument");`;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
},
|
|
205
|
+
get children() {
|
|
206
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
207
|
+
get condition() {
|
|
208
|
+
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}.some(value => Number.isNaN(value))`;
|
|
209
|
+
},
|
|
210
|
+
get children() {
|
|
211
|
+
return __alloy_js_core.code`failures.push("Invalid numeric value provided in the \\"${argument.name}\\" array positional argument");`;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
})]
|
|
218
|
+
}),
|
|
219
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
220
|
+
condition: __alloy_js_core.code`failures.length > 0`,
|
|
221
|
+
children: __alloy_js_core.code`error(colors.text.message.description.error("The following validation failures were found while processing the user provided input, and must be corrected before the command line process can be executed: \\n\\n") + failures.map(failure => colors.text.body.secondary(" - " + failure)).join("\\n"));
|
|
222
|
+
options.help = true; `
|
|
223
|
+
})
|
|
224
|
+
];
|
|
225
|
+
}
|
|
226
|
+
})
|
|
66
227
|
];
|
|
67
228
|
}
|
|
68
229
|
})), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UA6CiB,iBAAA,SAA0B,KACzC;WAGS;;AAJX;;;AAA2C,iBAU3B,YAAA,CAV2B,KAAA,EAUP,iBAVO,CAAA,EAUU,eAAA,CAAA,QAVV"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core1 from "@alloy-js/core";
|
|
2
2
|
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
3
3
|
import { CommandTree } from "@shell-shock/core/types/command";
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinitio
|
|
|
9
9
|
/**
|
|
10
10
|
* The command entry point for the Shell Shock project.
|
|
11
11
|
*/
|
|
12
|
-
declare function CommandEntry(props: CommandEntryProps):
|
|
12
|
+
declare function CommandEntry(props: CommandEntryProps): _alloy_js_core1.Children;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { CommandEntry, CommandEntryProps };
|
|
15
15
|
//# sourceMappingURL=command-entry.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UA6CiB,iBAAA,SAA0B,KACzC;WAGS;;AAJX;;;AAA2C,iBAU3B,YAAA,CAV2B,KAAA,EAUP,iBAVO,CAAA,EAUU,eAAA,CAAA,QAVV"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { BannerFunctionDeclaration } from "./banner-function-declaration.mjs";
|
|
2
2
|
import { VirtualCommandEntry } from "./virtual-command-entry.mjs";
|
|
3
3
|
import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
4
|
-
import { For, Show, computed } from "@alloy-js/core";
|
|
4
|
+
import { For, Show, code, computed } from "@alloy-js/core";
|
|
5
|
+
import { ElseIfClause, IfStatement, VarDeclaration } from "@alloy-js/typescript";
|
|
5
6
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
6
7
|
import { isDynamicPathSegment } from "@shell-shock/core/plugin-utils/context-helpers";
|
|
8
|
+
import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
7
9
|
import { EntryFile } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
8
10
|
import { CommandHandlerDeclaration } from "@shell-shock/preset-script/components/command-entry";
|
|
9
11
|
import { findFilePath, relativePath } from "@stryke/path/find";
|
|
10
12
|
import { joinPaths } from "@stryke/path/join";
|
|
11
13
|
import { replaceExtension } from "@stryke/path/replace";
|
|
14
|
+
import { camelCase } from "@stryke/string-format/camel-case";
|
|
12
15
|
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
13
16
|
import defu from "defu";
|
|
14
17
|
|
|
@@ -19,7 +22,7 @@ import defu from "defu";
|
|
|
19
22
|
function CommandEntry(props) {
|
|
20
23
|
const { command, imports, builtinImports, ...rest } = props;
|
|
21
24
|
const context = usePowerlines();
|
|
22
|
-
const filePath = computed(() => joinPaths(command.
|
|
25
|
+
const filePath = computed(() => joinPaths(command.segments.filter((segment) => !isDynamicPathSegment(segment)).join("/"), "index.ts"));
|
|
23
26
|
const commandSourcePath = computed(() => replaceExtension(relativePath(joinPaths(context.entryPath, findFilePath(filePath.value)), command.entry.input?.file || command.entry.file)));
|
|
24
27
|
const typeDefinition = computed(() => ({
|
|
25
28
|
...command.entry,
|
|
@@ -37,8 +40,14 @@ function CommandEntry(props) {
|
|
|
37
40
|
},
|
|
38
41
|
get builtinImports() {
|
|
39
42
|
return defu(builtinImports ?? {}, {
|
|
40
|
-
env: [
|
|
43
|
+
env: [
|
|
44
|
+
"env",
|
|
45
|
+
"isCI",
|
|
46
|
+
"isDevelopment",
|
|
47
|
+
"isDebug"
|
|
48
|
+
],
|
|
41
49
|
console: [
|
|
50
|
+
"debug",
|
|
42
51
|
"warn",
|
|
43
52
|
"error",
|
|
44
53
|
"table",
|
|
@@ -51,7 +60,8 @@ function CommandEntry(props) {
|
|
|
51
60
|
"getArgs",
|
|
52
61
|
"hasFlag",
|
|
53
62
|
"isMinimal",
|
|
54
|
-
"isUnicodeSupported"
|
|
63
|
+
"isUnicodeSupported",
|
|
64
|
+
"internal_commandContext"
|
|
55
65
|
]
|
|
56
66
|
});
|
|
57
67
|
},
|
|
@@ -60,7 +70,158 @@ function CommandEntry(props) {
|
|
|
60
70
|
createComponent(BannerFunctionDeclaration, { command }),
|
|
61
71
|
createIntrinsic("hbr", {}),
|
|
62
72
|
createIntrinsic("hbr", {}),
|
|
63
|
-
createComponent(CommandHandlerDeclaration, {
|
|
73
|
+
createComponent(CommandHandlerDeclaration, {
|
|
74
|
+
command,
|
|
75
|
+
get children() {
|
|
76
|
+
return [
|
|
77
|
+
createComponent(VarDeclaration, {
|
|
78
|
+
name: "failures",
|
|
79
|
+
type: "string[]",
|
|
80
|
+
initializer: code`[];`
|
|
81
|
+
}),
|
|
82
|
+
createIntrinsic("hbr", {}),
|
|
83
|
+
createComponent(For, {
|
|
84
|
+
get each() {
|
|
85
|
+
return Object.values(command.options ?? {});
|
|
86
|
+
},
|
|
87
|
+
doubleHardline: true,
|
|
88
|
+
children: (option) => [createComponent(Show, {
|
|
89
|
+
get when() {
|
|
90
|
+
return !option.optional;
|
|
91
|
+
},
|
|
92
|
+
get children() {
|
|
93
|
+
return [createComponent(IfStatement, {
|
|
94
|
+
get condition() {
|
|
95
|
+
return code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}`;
|
|
96
|
+
},
|
|
97
|
+
get children() {
|
|
98
|
+
return code`failures.push("Missing required \\"${option.name}\\" option");`;
|
|
99
|
+
}
|
|
100
|
+
}), createComponent(Show, {
|
|
101
|
+
get when() {
|
|
102
|
+
return (option.kind === ReflectionKind.string || option.kind === ReflectionKind.number) && option.variadic;
|
|
103
|
+
},
|
|
104
|
+
get children() {
|
|
105
|
+
return createComponent(ElseIfClause, {
|
|
106
|
+
get condition() {
|
|
107
|
+
return code`options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}.length === 0`;
|
|
108
|
+
},
|
|
109
|
+
get children() {
|
|
110
|
+
return code`failures.push("No values were provided to the required \\"${option.name}\\" array option");`;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
})];
|
|
115
|
+
}
|
|
116
|
+
}), createComponent(Show, {
|
|
117
|
+
get when() {
|
|
118
|
+
return option.kind === ReflectionKind.number;
|
|
119
|
+
},
|
|
120
|
+
get children() {
|
|
121
|
+
return createComponent(Show, {
|
|
122
|
+
get when() {
|
|
123
|
+
return option.variadic;
|
|
124
|
+
},
|
|
125
|
+
get fallback() {
|
|
126
|
+
return createComponent(IfStatement, {
|
|
127
|
+
get condition() {
|
|
128
|
+
return code`options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`} && Number.isNaN(options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`})`;
|
|
129
|
+
},
|
|
130
|
+
get children() {
|
|
131
|
+
return code`failures.push("Invalid numeric value provided for the \\"${option.name}\\" option");`;
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
get children() {
|
|
136
|
+
return createComponent(IfStatement, {
|
|
137
|
+
get condition() {
|
|
138
|
+
return code`options${option.name.includes("?") ? `["${option.name}"]` : `.${camelCase(option.name)}`}.some(value => Number.isNaN(value))`;
|
|
139
|
+
},
|
|
140
|
+
get children() {
|
|
141
|
+
return code`failures.push("Invalid numeric value provided in the \\"${option.name}\\" array option");`;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
})]
|
|
148
|
+
}),
|
|
149
|
+
createIntrinsic("hbr", {}),
|
|
150
|
+
createIntrinsic("hbr", {}),
|
|
151
|
+
createComponent(For, {
|
|
152
|
+
get each() {
|
|
153
|
+
return command.arguments;
|
|
154
|
+
},
|
|
155
|
+
doubleHardline: true,
|
|
156
|
+
children: (argument) => [createComponent(Show, {
|
|
157
|
+
get when() {
|
|
158
|
+
return !argument.optional;
|
|
159
|
+
},
|
|
160
|
+
get children() {
|
|
161
|
+
return [createComponent(IfStatement, {
|
|
162
|
+
get condition() {
|
|
163
|
+
return code`!${camelCase(argument.name)}`;
|
|
164
|
+
},
|
|
165
|
+
get children() {
|
|
166
|
+
return code`failures.push("Missing required \\"${argument.name}\\" positional argument");`;
|
|
167
|
+
}
|
|
168
|
+
}), createComponent(Show, {
|
|
169
|
+
get when() {
|
|
170
|
+
return (argument.kind === ReflectionKind.string || argument.kind === ReflectionKind.number) && argument.variadic;
|
|
171
|
+
},
|
|
172
|
+
get children() {
|
|
173
|
+
return createComponent(ElseIfClause, {
|
|
174
|
+
get condition() {
|
|
175
|
+
return code`${camelCase(argument.name)}.length === 0`;
|
|
176
|
+
},
|
|
177
|
+
get children() {
|
|
178
|
+
return code`failures.push("No values were provided to the required \\"${argument.name}\\" array positional argument");`;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
})];
|
|
183
|
+
}
|
|
184
|
+
}), createComponent(Show, {
|
|
185
|
+
get when() {
|
|
186
|
+
return argument.kind === ReflectionKind.number;
|
|
187
|
+
},
|
|
188
|
+
get children() {
|
|
189
|
+
return createComponent(Show, {
|
|
190
|
+
get when() {
|
|
191
|
+
return argument.variadic;
|
|
192
|
+
},
|
|
193
|
+
get fallback() {
|
|
194
|
+
return createComponent(IfStatement, {
|
|
195
|
+
get condition() {
|
|
196
|
+
return code`${camelCase(argument.name)} && Number.isNaN(${camelCase(argument.name)})`;
|
|
197
|
+
},
|
|
198
|
+
get children() {
|
|
199
|
+
return code`failures.push("Invalid numeric value provided for the \\"${argument.name}\\" positional argument");`;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
get children() {
|
|
204
|
+
return createComponent(IfStatement, {
|
|
205
|
+
get condition() {
|
|
206
|
+
return code`${camelCase(argument.name)}.some(value => Number.isNaN(value))`;
|
|
207
|
+
},
|
|
208
|
+
get children() {
|
|
209
|
+
return code`failures.push("Invalid numeric value provided in the \\"${argument.name}\\" array positional argument");`;
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
})]
|
|
216
|
+
}),
|
|
217
|
+
createComponent(IfStatement, {
|
|
218
|
+
condition: code`failures.length > 0`,
|
|
219
|
+
children: code`error(colors.text.message.description.error("The following validation failures were found while processing the user provided input, and must be corrected before the command line process can be executed: \\n\\n") + failures.map(failure => colors.text.body.secondary(" - " + failure)).join("\\n"));
|
|
220
|
+
options.help = true; `
|
|
221
|
+
})
|
|
222
|
+
];
|
|
223
|
+
}
|
|
224
|
+
})
|
|
64
225
|
];
|
|
65
226
|
}
|
|
66
227
|
})), createComponent(For, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.mjs","names":["computed","For","Show","usePowerlines","EntryFile","isDynamicPathSegment","CommandHandlerDeclaration","findFilePath","relativePath","joinPaths","replaceExtension","pascalCase","defu","BannerFunctionDeclaration","VirtualCommandEntry","CommandEntry","props","command","imports","builtinImports","rest","context","filePath","path","segments","filter","segment","join","commandSourcePath","entryPath","value","entry","input","file","typeDefinition","output","id","_$createComponent","_$mergeProps","name","env","console","utils","children","_$createIntrinsic","each","Object","values","child","when","isVirtual","fallback"],"sources":["../../src/components/command-entry.tsx"],"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 { computed, For, Show } from \"@alloy-js/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\n\nimport { isDynamicPathSegment } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { CommandHandlerDeclaration } from \"@shell-shock/preset-script/components/command-entry\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport interface CommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.path.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n const commandSourcePath = computed(() =>\n replaceExtension(\n relativePath(\n joinPaths(context.entryPath, findFilePath(filePath.value)),\n command.entry.input?.file || command.entry.file\n )\n )\n );\n const typeDefinition = computed(() => ({\n ...command.entry,\n output: command.id\n }));\n\n return (\n <>\n <EntryFile\n {...rest}\n path={filePath.value}\n typeDefinition={typeDefinition.value}\n imports={defu(imports ?? {}, {\n [commandSourcePath.value]: `handle${pascalCase(command.name)}`\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isCI\"],\n console: [\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\"\n ],\n utils: [\"getArgs\", \"hasFlag\", \"isMinimal\", \"isUnicodeSupported\"]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <CommandHandlerDeclaration command={command} />\n </EntryFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6CA,SAAgBe,aAAaC,OAA0B;CACrD,MAAM,EAAEC,SAASC,SAASC,gBAAgB,GAAGC,SAASJ;CAEtD,MAAMK,UAAUlB,eAAiC;CACjD,MAAMmB,WAAWtB,eACfS,UACEQ,QAAQM,KA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EAACE,SAAS+B,OAAK,CAAA;;GAAA,IAAAL,WAAA;AAAA,WAAAN,gBACrCvB,qBAAmB,EAACG,SAAS+B,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"command-entry.mjs","names":["code","computed","For","Show","ElseIfClause","IfStatement","VarDeclaration","ReflectionKind","usePowerlines","EntryFile","isDynamicPathSegment","CommandHandlerDeclaration","findFilePath","relativePath","joinPaths","replaceExtension","camelCase","pascalCase","defu","BannerFunctionDeclaration","VirtualCommandEntry","CommandEntry","props","command","imports","builtinImports","rest","context","filePath","segments","filter","segment","join","commandSourcePath","entryPath","value","entry","input","file","typeDefinition","output","id","_$createComponent","_$mergeProps","path","name","env","console","utils","children","_$createIntrinsic","type","initializer","each","Object","values","options","doubleHardline","option","when","optional","condition","includes","kind","string","number","variadic","fallback","arguments","argument","child","isVirtual"],"sources":["../../src/components/command-entry.tsx"],"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 { code, computed, For, Show } from \"@alloy-js/core\";\nimport {\n ElseIfClause,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { isDynamicPathSegment } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type {\n CommandTree,\n NumberCommandArgument,\n NumberCommandOption\n} from \"@shell-shock/core/types/command\";\nimport { CommandHandlerDeclaration } from \"@shell-shock/preset-script/components/command-entry\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport interface CommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n const commandSourcePath = computed(() =>\n replaceExtension(\n relativePath(\n joinPaths(context.entryPath, findFilePath(filePath.value)),\n command.entry.input?.file || command.entry.file\n )\n )\n );\n const typeDefinition = computed(() => ({\n ...command.entry,\n output: command.id\n }));\n\n return (\n <>\n <EntryFile\n {...rest}\n path={filePath.value}\n typeDefinition={typeDefinition.value}\n imports={defu(imports ?? {}, {\n [commandSourcePath.value]: `handle${pascalCase(command.name)}`\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isCI\", \"isDevelopment\", \"isDebug\"],\n console: [\n \"debug\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\"\n ],\n utils: [\n \"getArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <CommandHandlerDeclaration command={command}>\n <VarDeclaration\n name=\"failures\"\n type=\"string[]\"\n initializer={code`[];`}\n />\n <hbr />\n <For each={Object.values(command.options ?? {})} doubleHardline>\n {option => (\n <>\n <Show when={!option.optional}>\n <IfStatement\n condition={code`!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }`}>\n {code`failures.push(\"Missing required \\\\\"${option.name}\\\\\" option\");`}\n </IfStatement>\n <Show\n when={\n (option.kind === ReflectionKind.string ||\n option.kind === ReflectionKind.number) &&\n option.variadic\n }>\n <ElseIfClause\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0`}>\n {code`failures.push(\"No values were provided to the required \\\\\"${\n option.name\n }\\\\\" array option\");`}\n </ElseIfClause>\n </Show>\n </Show>\n <Show when={option.kind === ReflectionKind.number}>\n <Show\n when={(option as NumberCommandOption).variadic}\n fallback={\n <IfStatement\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } && Number.isNaN(options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n })`}>\n {code`failures.push(\"Invalid numeric value provided for the \\\\\"${\n option.name\n }\\\\\" option\");`}\n </IfStatement>\n }>\n <IfStatement\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.some(value => Number.isNaN(value))`}>\n {code`failures.push(\"Invalid numeric value provided in the \\\\\"${\n option.name\n }\\\\\" array option\");`}\n </IfStatement>\n </Show>\n </Show>\n </>\n )}\n </For>\n <hbr />\n <hbr />\n <For each={command.arguments} doubleHardline>\n {argument => (\n <>\n <Show when={!argument.optional}>\n <IfStatement condition={code`!${camelCase(argument.name)}`}>\n {code`failures.push(\"Missing required \\\\\"${\n argument.name\n }\\\\\" positional argument\");`}\n </IfStatement>\n <Show\n when={\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n }>\n <ElseIfClause\n condition={code`${camelCase(argument.name)}.length === 0`}>\n {code`failures.push(\"No values were provided to the required \\\\\"${\n argument.name\n }\\\\\" array positional argument\");`}\n </ElseIfClause>\n </Show>\n </Show>\n <Show when={argument.kind === ReflectionKind.number}>\n <Show\n when={(argument as NumberCommandArgument).variadic}\n fallback={\n <IfStatement\n condition={code`${camelCase(\n argument.name\n )} && Number.isNaN(${camelCase(argument.name)})`}>\n {code`failures.push(\"Invalid numeric value provided for the \\\\\"${\n argument.name\n }\\\\\" positional argument\");`}\n </IfStatement>\n }>\n <IfStatement\n condition={code`${camelCase(argument.name)}.some(value => Number.isNaN(value))`}>\n {code`failures.push(\"Invalid numeric value provided in the \\\\\"${\n argument.name\n }\\\\\" array positional argument\");`}\n </IfStatement>\n </Show>\n </Show>\n </>\n )}\n </For>\n <IfStatement condition={code`failures.length > 0`}>\n {code`error(colors.text.message.description.error(\"The following validation failures were found while processing the user provided input, and must be corrected before the command line process can be executed: \\\\n\\\\n\") + failures.map(failure => colors.text.body.secondary(\" - \" + failure)).join(\"\\\\n\"));\n options.help = true; `}\n </IfStatement>\n </CommandHandlerDeclaration>\n </EntryFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuDA,SAAgBqB,aAAaC,OAA0B;CACrD,MAAM,EAAEC,SAASC,SAASC,gBAAgB,GAAGC,SAASJ;CAEtD,MAAMK,UAAUnB,eAAiC;CACjD,MAAMoB,WAAW3B,eACfa,UACES,QAAQM,SACLC,QAAOC,YAAW,CAACrB,qBAAqBqB,QAAQ,CAAC,CACjDC,KAAK,IAAI,EACZ,WAEJ,CAA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I;AAAA,iBAAEU,SAASN,SAASxD,eAAe0D;;SAAM,IAAAhB,WAAA;AAAA,iBAAAP,gBAChDvC,MAAI;WAAA,IACHwD,OAAI;AAAA,mBAAGU,SAAmCH;;WAAQ,IAClDC,WAAQ;AAAA,mBAAAzB,gBACLrC,aAAW;aAAA,IACVwD,YAAS;AAAA,qBAAE7D,IAAI,GAAGgB,UAChBqD,SAASxB,KACV,CAAA,mBAAoB7B,UAAUqD,SAASxB,KAAK,CAAA;;aAAG,IAAAI,WAAA;AAAA,qBAC/CjD,IAAI,4DACHqE,SAASxB,KAAI;;aACa,CAAA;;WAAA,IAAAI,WAAA;AAAA,mBAAAP,gBAG/BrC,aAAW;aAAA,IACVwD,YAAS;AAAA,qBAAE7D,IAAI,GAAGgB,UAAUqD,SAASxB,KAAK,CAAA;;aAAqC,IAAAI,WAAA;AAAA,qBAC9EjD,IAAI,2DACHqE,SAASxB,KAAI;;aACmB,CAAA;;WAAA,CAAA;;SAAA,CAAA,CAAA;QAK3C,CAAA;OAAAH,gBAEFrC,aAAW;QAACwD,WAAW7D,IAAI;QAAqBiD,UAC9CjD,IAAI;;QACiB,CAAA;OAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,EAAA0C,gBAI3BxC,KAAG;EAAA,IAACmD,OAAI;AAAA,UAAEC,OAAOC,OAAOhC,QAAQ0B,SAAS;;EAAAA,WACvCqB,UAAK5B,gBACHvC,MAAI;GAAA,IACHwD,OAAI;AAAA,WAAEW,MAAMC;;GAAS,IACrBJ,WAAQ;AAAA,WAAAzB,gBAAGrB,cAAY,EAACE,SAAS+C,OAAK,CAAA;;GAAA,IAAArB,WAAA;AAAA,WAAAP,gBACrCtB,qBAAmB,EAACG,SAAS+C,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
|
|
@@ -19,7 +19,7 @@ let __shell_shock_preset_script_components_virtual_command_entry = require("@she
|
|
|
19
19
|
function VirtualCommandEntry(props) {
|
|
20
20
|
const { command, imports, builtinImports, ...rest } = props;
|
|
21
21
|
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
22
|
-
const filePath = (0, __alloy_js_core.computed)(() => (0, __stryke_path_join.joinPaths)(context.entryPath, command.
|
|
22
|
+
const filePath = (0, __alloy_js_core.computed)(() => (0, __stryke_path_join.joinPaths)(context.entryPath, command.segments.filter((segment) => !(0, __shell_shock_core_plugin_utils_context_helpers.isDynamicPathSegment)(segment)).join("/"), "index.ts"));
|
|
23
23
|
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_typescript_file.TypescriptFile, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
24
24
|
get path() {
|
|
25
25
|
return filePath.value;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core1 from "@alloy-js/core";
|
|
2
2
|
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
3
3
|
import { CommandTree } from "@shell-shock/core/types/command";
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ interface VirtualCommandEntryProps extends Omit<EntryFileProps, "path" | "typeDe
|
|
|
9
9
|
/**
|
|
10
10
|
* The virtual command entry point for the Shell Shock project.
|
|
11
11
|
*/
|
|
12
|
-
declare function VirtualCommandEntry(props: VirtualCommandEntryProps):
|
|
12
|
+
declare function VirtualCommandEntry(props: VirtualCommandEntryProps): _alloy_js_core1.Children;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { VirtualCommandEntry, VirtualCommandEntryProps };
|
|
15
15
|
//# sourceMappingURL=virtual-command-entry.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
2
|
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
3
3
|
import { CommandTree } from "@shell-shock/core/types/command";
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ interface VirtualCommandEntryProps extends Omit<EntryFileProps, "path" | "typeDe
|
|
|
9
9
|
/**
|
|
10
10
|
* The virtual command entry point for the Shell Shock project.
|
|
11
11
|
*/
|
|
12
|
-
declare function VirtualCommandEntry(props: VirtualCommandEntryProps):
|
|
12
|
+
declare function VirtualCommandEntry(props: VirtualCommandEntryProps): _alloy_js_core0.Children;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { VirtualCommandEntry, VirtualCommandEntryProps };
|
|
15
15
|
//# sourceMappingURL=virtual-command-entry.d.mts.map
|
|
@@ -17,7 +17,7 @@ import { VirtualCommandHandlerDeclaration } from "@shell-shock/preset-script/com
|
|
|
17
17
|
function VirtualCommandEntry(props) {
|
|
18
18
|
const { command, imports, builtinImports, ...rest } = props;
|
|
19
19
|
const context = usePowerlines();
|
|
20
|
-
const filePath = computed(() => joinPaths(context.entryPath, command.
|
|
20
|
+
const filePath = computed(() => joinPaths(context.entryPath, command.segments.filter((segment) => !isDynamicPathSegment(segment)).join("/"), "index.ts"));
|
|
21
21
|
return [createComponent(TypescriptFile, mergeProps(rest, {
|
|
22
22
|
get path() {
|
|
23
23
|
return filePath.value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-command-entry.mjs","names":["computed","For","Show","usePowerlines","TypescriptFile","isDynamicPathSegment","VirtualCommandHandlerDeclaration","joinPaths","pascalCase","defu","BannerFunctionDeclaration","CommandEntry","VirtualCommandEntry","props","command","imports","builtinImports","rest","context","filePath","entryPath","
|
|
1
|
+
{"version":3,"file":"virtual-command-entry.mjs","names":["computed","For","Show","usePowerlines","TypescriptFile","isDynamicPathSegment","VirtualCommandHandlerDeclaration","joinPaths","pascalCase","defu","BannerFunctionDeclaration","CommandEntry","VirtualCommandEntry","props","command","imports","builtinImports","rest","context","filePath","entryPath","segments","filter","segment","join","_$createComponent","_$mergeProps","path","value","didyoumean2","name","default","Object","entries","children","child","isVirtual","reduce","ret","alias","console","utils","_$createIntrinsic","each","values","when","fallback"],"sources":["../../src/components/virtual-command-entry.tsx"],"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 { computed, For, Show } from \"@alloy-js/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { TypescriptFileImports } from \"@powerlines/plugin-alloy/types/components\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport { isDynamicPathSegment } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { VirtualCommandHandlerDeclaration } from \"@shell-shock/preset-script/components/virtual-command-entry\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { CommandEntry } from \"./command-entry\";\n\nexport interface VirtualCommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The virtual command entry point for the Shell Shock project.\n */\nexport function VirtualCommandEntry(props: VirtualCommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n {\n didyoumean2: [\n { name: \"didYouMean\", default: true },\n { name: \"ReturnTypeEnums\" },\n { name: \"ThresholdTypeEnums\" }\n ]\n },\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n console: [\"warn\", \"error\", \"table\", \"colors\", \"writeLine\"],\n utils: [\"getArgs\", \"hasFlag\", \"isMinimal\", \"isUnicodeSupported\"]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <VirtualCommandHandlerDeclaration command={command} />\n </TypescriptFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA2CA,SAAgBY,oBAAoBC,OAAiC;CACnE,MAAM,EAAEC,SAASC,SAASC,gBAAgB,GAAGC,SAASJ;CAEtD,MAAMK,UAAUf,eAAiC;CACjD,MAAMgB,WAAWnB,eACfO,UACEW,QAAQE,WACRN,QAAQO,SACLC,QAAOC,YAAW,CAAClB,qBAAqBkB,QAAQ,CAAC,CACjDC,KAAK,IAAI,EACZ,WAEJ,CAAC;AAED,QAAA,CAAAC,gBAEKrB,gBAAcsB,WACTT,MAAI;EAAA,IACRU,OAAI;AAAA,UAAER,SAASS;;EAAK,IACpBb,UAAO;AAAA,UAAEN,KACP,EACEoB,aAAa;IACX;KAAEC,MAAM;KAAcC,SAAS;KAAM;IACrC,EAAED,MAAM,mBAAmB;IAC3B,EAAEA,MAAM,sBAAsB;IAAA,EAEjC,EACDf,WAAW,EAAE,EACbiB,OAAOC,QAAQnB,QAAQoB,SAAS,CAC7BZ,QAAQ,GAAGa,WAAWA,MAAMC,UAAU,CACtCC,QAAQC,KAAK,CAACR,MAAMK,WAAW;AAC9BG,QAAI,KAAKH,MAAML,UAAU,CACvB;KAAEA,MAAM;KAAWS,OAAO,SAAS/B,WAAWsB,KAAK;KAAI,CACxD;AAED,WAAOQ;MACN,EAA2B,CAClC,CAAC;;EAAA,IACDtB,iBAAc;AAAA,UAAEP,KAAKO,kBAAkB,EAAE,EAAE;IACzCwB,SAAS;KAAC;KAAQ;KAAS;KAAS;KAAU;KAAY;IAC1DC,OAAO;KAAC;KAAW;KAAW;KAAa;KAAoB;IAChE,CAAC;;EAAA,IAAAP,WAAA;AAAA,UAAA;IAAAT,gBACDf,2BAAyB,EAAUI,SAAO,CAAA;IAAA4B,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAjB,gBAG1CnB,kCAAgC,EAAUQ,SAAO,CAAA;IAAA;;EAAA,CAAA,CAAA,EAAAW,gBAEnDxB,KAAG;EAAA,IAAC0C,OAAI;AAAA,UAAEX,OAAOY,OAAO9B,QAAQoB,SAAS;;EAAAA,WACvCC,UAAKV,gBACHvB,MAAI;GAAA,IACH2C,OAAI;AAAA,WAAEV,MAAMC;;GAAS,IACrBU,WAAQ;AAAA,WAAArB,gBAAGd,cAAY,EAACG,SAASqB,OAAK,CAAA;;GAAA,IAAAD,WAAA;AAAA,WAAAT,gBACrCb,qBAAmB,EAACE,SAASqB,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -84,7 +84,7 @@ const plugin = (options = {}) => {
|
|
|
84
84
|
}),
|
|
85
85
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
86
86
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_router.CommandRouter, {
|
|
87
|
-
|
|
87
|
+
segments: [],
|
|
88
88
|
get commands() {
|
|
89
89
|
return _self$.commands ?? {};
|
|
90
90
|
}
|
package/dist/index.mjs
CHANGED
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","theme","BinEntry","CommandRouter","ConsoleBuiltin","VirtualHelp","UtilsBuiltin","BannerFunctionDeclaration","CommandEntry","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","builtinImports","console","utils","env","prefix","_$createIntrinsic","children","when","Object","keys","commands","length","type","initializer","
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","theme","BinEntry","CommandRouter","ConsoleBuiltin","VirtualHelp","UtilsBuiltin","BannerFunctionDeclaration","CommandEntry","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","builtinImports","console","utils","env","prefix","_$createIntrinsic","children","when","Object","keys","commands","length","type","initializer","segments","values","each","doubleHardline","child","isVirtual","fallback","command"],"sources":["../src/index.tsx"],"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 { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport { BinEntry } from \"@shell-shock/preset-script/components/bin-entry\";\nimport { CommandRouter } from \"@shell-shock/preset-script/components/command-router\";\nimport { ConsoleBuiltin } from \"@shell-shock/preset-script/components/console-builtin\";\nimport { VirtualHelp } from \"@shell-shock/preset-script/components/help\";\nimport { UtilsBuiltin } from \"@shell-shock/preset-script/components/utils-builtin\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BannerFunctionDeclaration } from \"./components/banner-function-declaration\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { CLIPresetContext, CLIPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <TContext extends CLIPresetContext = CLIPresetContext>(\n options: CLIPresetOptions = {}\n) => {\n return [\n theme({\n theme: options.theme\n }),\n {\n name: \"shell-shock:cli-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `cli` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n },\n configResolved() {\n this.dependencies.didyoumean2 = \"^7.0.4\";\n },\n async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `cli` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\n );\n }\n },\n {\n name: \"shell-shock:cli-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `cli` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\",\n \"help\"\n ],\n utils: [\"getArgs\", \"isMinimal\"],\n env: [\"isCI\"]\n }}\n prefix={\n <>\n <BannerFunctionDeclaration />\n <hbr />\n <hbr />\n </>\n }>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`getArgs();`}\n />\n <hbr />\n <CommandRouter segments={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <hbr />\n {code`writeLine(\"\");\n banner();`}\n <hbr />\n <hbr />\n <VirtualHelp\n options={this.options}\n commands={this.commands ?? {}}\n />\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqCA,MAAae,UACXC,UAA4B,EAAE,KAC3B;AACH,QAAO;EACLX,MAAM,EACJA,OAAOW,QAAQX,OAChB,CAAC;EACF;GACEY,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,oEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEHM,iBAAiB;AACf,SAAKC,aAAaC,cAAc;;GAElC,MAAMC,UAAU;AACd,SAAKN,MACH,+DACD;AAED,WAAOf,OACL,MAAI,CAAAsB,gBAEDhB,cAAY,EAAA,CAAA,EAAAgB,gBACZlB,gBAAc,EAAA,CAAA,CAEnB,CAAC;;GAEJ;EACD;GACES,MAAM;GACNQ,SAAS;IACPE,OAAO;IACP,MAAMC,UAAU;KAAA,MAAAC,SAAA;AACd,UAAKV,MACH,iEACD;AAED,YAAOf,OACL,MAAI,CAAAsB,gBAEDpB,UAAQ;MACPwB,gBAAgB;OACdC,SAAS;QACP;QACA;QACA;QACA;QACA;QACA;QACD;OACDC,OAAO,CAAC,WAAW,YAAY;OAC/BC,KAAK,CAAC,OAAM;OACb;MAAA,IACDC,SAAM;AAAA,cAAA;QAAAR,gBAEDf,2BAAyB,EAAA,CAAA;QAAAwB,gBAAA,OAAA,EAAA,CAA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AA;QAEtC,CAAA;;MAAA,CAAA,CAIT,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAejC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/preset-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Shell Shock plugin to generate source code given a list design tokens.",
|
|
6
6
|
"repository": {
|
|
@@ -153,17 +153,17 @@
|
|
|
153
153
|
"dependencies": {
|
|
154
154
|
"@alloy-js/core": "^0.22.0",
|
|
155
155
|
"@alloy-js/typescript": "^0.22.0",
|
|
156
|
-
"@powerlines/deepkit": "^0.6.
|
|
157
|
-
"@powerlines/plugin-alloy": "^0.20.
|
|
158
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
159
|
-
"@shell-shock/core": "^0.
|
|
160
|
-
"@shell-shock/plugin-theme": "^0.0.
|
|
161
|
-
"@shell-shock/preset-script": "^0.
|
|
156
|
+
"@powerlines/deepkit": "^0.6.51",
|
|
157
|
+
"@powerlines/plugin-alloy": "^0.20.15",
|
|
158
|
+
"@powerlines/plugin-plugin": "^0.12.222",
|
|
159
|
+
"@shell-shock/core": "^0.8.1",
|
|
160
|
+
"@shell-shock/plugin-theme": "^0.0.18",
|
|
161
|
+
"@shell-shock/preset-script": "^0.6.0",
|
|
162
162
|
"@stryke/path": "0.26.4",
|
|
163
163
|
"@stryke/string-format": "0.13.7",
|
|
164
164
|
"cfonts": "^3.3.1",
|
|
165
165
|
"defu": "6.1.4",
|
|
166
|
-
"powerlines": "^0.38.
|
|
166
|
+
"powerlines": "^0.38.38"
|
|
167
167
|
},
|
|
168
168
|
"devDependencies": {
|
|
169
169
|
"@babel/core": "^7.29.0",
|
|
@@ -193,5 +193,5 @@
|
|
|
193
193
|
"./package.json": "./package.json"
|
|
194
194
|
}
|
|
195
195
|
},
|
|
196
|
-
"gitHead": "
|
|
196
|
+
"gitHead": "2d179aff07a4c04d5ff4a96ceed082077a51a7e6"
|
|
197
197
|
}
|