@shell-shock/preset-script 0.6.0 → 0.6.1
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/command-entry.cjs +159 -150
- package/dist/components/command-entry.cjs.map +1 -1
- package/dist/components/command-entry.d.cts +8 -1
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts +8 -1
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +159 -151
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/console-builtin.cjs +28 -19
- package/dist/components/console-builtin.cjs.map +1 -1
- package/dist/components/console-builtin.d.cts +4 -2
- package/dist/components/console-builtin.d.cts.map +1 -1
- package/dist/components/console-builtin.d.mts +4 -2
- package/dist/components/console-builtin.d.mts.map +1 -1
- package/dist/components/console-builtin.mjs +28 -19
- package/dist/components/console-builtin.mjs.map +1 -1
- package/dist/components/help.d.mts +7 -7
- package/dist/components/help.d.mts.map +1 -1
- package/dist/components/helpers.d.mts +5 -5
- package/dist/components/index.cjs +1 -0
- package/dist/components/index.d.cts +3 -3
- package/dist/components/index.d.mts +3 -3
- package/dist/components/index.mjs +2 -2
- package/dist/components/utils-builtin.cjs +10 -87
- package/dist/components/utils-builtin.cjs.map +1 -1
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts +8 -8
- package/dist/components/utils-builtin.d.mts.map +1 -1
- package/dist/components/utils-builtin.mjs +10 -87
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/types/plugin.d.cts.map +1 -1
- package/package.json +8 -8
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 -->
|
|
@@ -37,7 +37,7 @@ function CommandInvocation(props) {
|
|
|
37
37
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
38
38
|
(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
internal_commandContextStore.run(__context, () => {
|
|
41
41
|
return Promise.resolve(Reflect.apply(handle${(0, __stryke_string_format_pascal_case.pascalCase)(command.name)}, __context, [options${command.arguments.length > 0 ? `, ${command.arguments.map((argument) => (0, __stryke_string_format_camel_case.camelCase)(argument.name)).join(", ")}` : ""}]));
|
|
42
42
|
});
|
|
43
43
|
|
|
@@ -111,7 +111,8 @@ function CommandHandlerDeclaration(props) {
|
|
|
111
111
|
writeLine(colors.text.body.tertiary("Debug mode is enabled. Additional debug information may be logged to the console."));
|
|
112
112
|
|
|
113
113
|
writeLine("");
|
|
114
|
-
debug(\`Command path: ${command.segments.map((segment) => (0, __shell_shock_core_plugin_utils_context_helpers.isDynamicPathSegment)(segment) ? `\${${(0, __stryke_string_format_camel_case.camelCase)((0, __shell_shock_core_plugin_utils_context_helpers.getDynamicPathSegmentName)(segment))}}` : segment).join(" / ")} \\n\\nOptions: \\n${Object.values(command.options).map((option) => ` - ${(0, __stryke_string_format_kebab_case.kebabCase)(option.name)}: \${options.${(0, __stryke_string_format_camel_case.camelCase)(option.name)} === undefined ? "" : JSON.stringify(options.${(0, __stryke_string_format_camel_case.camelCase)(option.name)})}`).join("\\n")}${command.arguments.length > 0 ? ` \\n\\nArguments: \\n${command.arguments.map((argument) => ` - ${(0, __stryke_string_format_kebab_case.kebabCase)(argument.name)}: \${${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} === undefined ? "" : JSON.stringify(${(0, __stryke_string_format_camel_case.camelCase)(argument.name)})}`).join("\\n")}` : ""}\`);
|
|
114
|
+
debug(\`Command path: ${command.segments.map((segment) => (0, __shell_shock_core_plugin_utils_context_helpers.isDynamicPathSegment)(segment) ? `\${${(0, __stryke_string_format_camel_case.camelCase)((0, __shell_shock_core_plugin_utils_context_helpers.getDynamicPathSegmentName)(segment))}}` : segment).join(" / ")} \\n\\nOptions: \\n${Object.values(command.options).map((option) => ` - ${(0, __stryke_string_format_kebab_case.kebabCase)(option.name)}: \${options.${(0, __stryke_string_format_camel_case.camelCase)(option.name)} === undefined ? "" : JSON.stringify(options.${(0, __stryke_string_format_camel_case.camelCase)(option.name)})}`).join("\\n")}${command.arguments.length > 0 ? ` \\n\\nArguments: \\n${command.arguments.map((argument) => ` - ${(0, __stryke_string_format_kebab_case.kebabCase)(argument.name)}: \${${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} === undefined ? "" : JSON.stringify(${(0, __stryke_string_format_camel_case.camelCase)(argument.name)})}`).join("\\n")}` : ""}\`);
|
|
115
|
+
writeLine(""); `;
|
|
115
116
|
}
|
|
116
117
|
}),
|
|
117
118
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
@@ -134,6 +135,159 @@ function CommandHandlerDeclaration(props) {
|
|
|
134
135
|
];
|
|
135
136
|
}
|
|
136
137
|
/**
|
|
138
|
+
* A component that generates command validation logic for required options and arguments.
|
|
139
|
+
*/
|
|
140
|
+
function CommandValidationLogic(props) {
|
|
141
|
+
const { command } = props;
|
|
142
|
+
return [
|
|
143
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
144
|
+
name: "failures",
|
|
145
|
+
type: "string[]",
|
|
146
|
+
initializer: __alloy_js_core.code`[];`
|
|
147
|
+
}),
|
|
148
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
149
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
150
|
+
get each() {
|
|
151
|
+
return Object.values(command.options ?? {});
|
|
152
|
+
},
|
|
153
|
+
doubleHardline: true,
|
|
154
|
+
children: (option) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
155
|
+
get when() {
|
|
156
|
+
return !option.optional;
|
|
157
|
+
},
|
|
158
|
+
get children() {
|
|
159
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
160
|
+
get condition() {
|
|
161
|
+
return __alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}`;
|
|
162
|
+
},
|
|
163
|
+
get children() {
|
|
164
|
+
return __alloy_js_core.code`failures.push("Missing required \\"${option.name}\\" option");`;
|
|
165
|
+
}
|
|
166
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
167
|
+
get when() {
|
|
168
|
+
return (option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && option.variadic;
|
|
169
|
+
},
|
|
170
|
+
get children() {
|
|
171
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
172
|
+
get condition() {
|
|
173
|
+
return __alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0`;
|
|
174
|
+
},
|
|
175
|
+
get children() {
|
|
176
|
+
return __alloy_js_core.code`failures.push("No values were provided to the required \\"${option.name}\\" array option");`;
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
})];
|
|
181
|
+
}
|
|
182
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
183
|
+
get when() {
|
|
184
|
+
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
185
|
+
},
|
|
186
|
+
get children() {
|
|
187
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
188
|
+
get when() {
|
|
189
|
+
return option.variadic;
|
|
190
|
+
},
|
|
191
|
+
get fallback() {
|
|
192
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
193
|
+
get condition() {
|
|
194
|
+
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)}`})`;
|
|
195
|
+
},
|
|
196
|
+
get children() {
|
|
197
|
+
return __alloy_js_core.code`failures.push("Invalid numeric value provided for the \\"${option.name}\\" option");`;
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
},
|
|
201
|
+
get children() {
|
|
202
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
203
|
+
get condition() {
|
|
204
|
+
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))`;
|
|
205
|
+
},
|
|
206
|
+
get children() {
|
|
207
|
+
return __alloy_js_core.code`failures.push("Invalid numeric value provided in the \\"${option.name}\\" array option");`;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
})]
|
|
214
|
+
}),
|
|
215
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
216
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
217
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
218
|
+
get each() {
|
|
219
|
+
return command.arguments;
|
|
220
|
+
},
|
|
221
|
+
doubleHardline: true,
|
|
222
|
+
children: (argument) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
223
|
+
get when() {
|
|
224
|
+
return !argument.optional;
|
|
225
|
+
},
|
|
226
|
+
get children() {
|
|
227
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
228
|
+
get condition() {
|
|
229
|
+
return __alloy_js_core.code`!${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}`;
|
|
230
|
+
},
|
|
231
|
+
get children() {
|
|
232
|
+
return __alloy_js_core.code`failures.push("Missing required \\"${argument.name}\\" positional argument");`;
|
|
233
|
+
}
|
|
234
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
235
|
+
get when() {
|
|
236
|
+
return (argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && argument.variadic;
|
|
237
|
+
},
|
|
238
|
+
get children() {
|
|
239
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
240
|
+
get condition() {
|
|
241
|
+
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}.length === 0`;
|
|
242
|
+
},
|
|
243
|
+
get children() {
|
|
244
|
+
return __alloy_js_core.code`failures.push("No values were provided to the required \\"${argument.name}\\" array positional argument");`;
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
})];
|
|
249
|
+
}
|
|
250
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
251
|
+
get when() {
|
|
252
|
+
return argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
253
|
+
},
|
|
254
|
+
get children() {
|
|
255
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
256
|
+
get when() {
|
|
257
|
+
return argument.variadic;
|
|
258
|
+
},
|
|
259
|
+
get fallback() {
|
|
260
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
261
|
+
get condition() {
|
|
262
|
+
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)})`;
|
|
263
|
+
},
|
|
264
|
+
get children() {
|
|
265
|
+
return __alloy_js_core.code`failures.push("Invalid numeric value provided for the \\"${argument.name}\\" positional argument");`;
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
},
|
|
269
|
+
get children() {
|
|
270
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
271
|
+
get condition() {
|
|
272
|
+
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}.some(value => Number.isNaN(value))`;
|
|
273
|
+
},
|
|
274
|
+
get children() {
|
|
275
|
+
return __alloy_js_core.code`failures.push("Invalid numeric value provided in the \\"${argument.name}\\" array positional argument");`;
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
})]
|
|
282
|
+
}),
|
|
283
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
284
|
+
condition: __alloy_js_core.code`failures.length > 0`,
|
|
285
|
+
children: __alloy_js_core.code`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 => " - " + failure).join("\\n"));
|
|
286
|
+
options.help = true; `
|
|
287
|
+
})
|
|
288
|
+
];
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
137
291
|
* The command entry point for the Shell Shock project.
|
|
138
292
|
*/
|
|
139
293
|
function CommandEntry(props) {
|
|
@@ -178,7 +332,7 @@ function CommandEntry(props) {
|
|
|
178
332
|
"hasFlag",
|
|
179
333
|
"isMinimal",
|
|
180
334
|
"isUnicodeSupported",
|
|
181
|
-
"
|
|
335
|
+
"internal_commandContextStore"
|
|
182
336
|
]
|
|
183
337
|
});
|
|
184
338
|
},
|
|
@@ -195,153 +349,7 @@ function CommandEntry(props) {
|
|
|
195
349
|
(0, __alloy_js_core_jsx_runtime.createComponent)(CommandHandlerDeclaration, {
|
|
196
350
|
command,
|
|
197
351
|
get children() {
|
|
198
|
-
return
|
|
199
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
200
|
-
name: "failures",
|
|
201
|
-
type: "string[]",
|
|
202
|
-
initializer: __alloy_js_core.code`[];`
|
|
203
|
-
}),
|
|
204
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
205
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
206
|
-
get each() {
|
|
207
|
-
return Object.values(command.options ?? {});
|
|
208
|
-
},
|
|
209
|
-
doubleHardline: true,
|
|
210
|
-
children: (option) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
211
|
-
get when() {
|
|
212
|
-
return !option.optional;
|
|
213
|
-
},
|
|
214
|
-
get children() {
|
|
215
|
-
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
216
|
-
get condition() {
|
|
217
|
-
return __alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}`;
|
|
218
|
-
},
|
|
219
|
-
get children() {
|
|
220
|
-
return __alloy_js_core.code`failures.push("Missing required \\"${option.name}\\" option");`;
|
|
221
|
-
}
|
|
222
|
-
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
223
|
-
get when() {
|
|
224
|
-
return (option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && option.variadic;
|
|
225
|
-
},
|
|
226
|
-
get children() {
|
|
227
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
228
|
-
get condition() {
|
|
229
|
-
return __alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0`;
|
|
230
|
-
},
|
|
231
|
-
get children() {
|
|
232
|
-
return __alloy_js_core.code`failures.push("No values were provided to the required \\"${option.name}\\" array option");`;
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
})];
|
|
237
|
-
}
|
|
238
|
-
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
239
|
-
get when() {
|
|
240
|
-
return option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
241
|
-
},
|
|
242
|
-
get children() {
|
|
243
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
244
|
-
get when() {
|
|
245
|
-
return option.variadic;
|
|
246
|
-
},
|
|
247
|
-
get fallback() {
|
|
248
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
249
|
-
get condition() {
|
|
250
|
-
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)}`})`;
|
|
251
|
-
},
|
|
252
|
-
get children() {
|
|
253
|
-
return __alloy_js_core.code`failures.push("Invalid numeric value provided for the \\"${option.name}\\" option");`;
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
},
|
|
257
|
-
get children() {
|
|
258
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
259
|
-
get condition() {
|
|
260
|
-
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))`;
|
|
261
|
-
},
|
|
262
|
-
get children() {
|
|
263
|
-
return __alloy_js_core.code`failures.push("Invalid numeric value provided in the \\"${option.name}\\" array option");`;
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
})]
|
|
270
|
-
}),
|
|
271
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
272
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
273
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
274
|
-
get each() {
|
|
275
|
-
return command.arguments;
|
|
276
|
-
},
|
|
277
|
-
doubleHardline: true,
|
|
278
|
-
children: (argument) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
279
|
-
get when() {
|
|
280
|
-
return !argument.optional;
|
|
281
|
-
},
|
|
282
|
-
get children() {
|
|
283
|
-
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
284
|
-
get condition() {
|
|
285
|
-
return __alloy_js_core.code`!${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}`;
|
|
286
|
-
},
|
|
287
|
-
get children() {
|
|
288
|
-
return __alloy_js_core.code`failures.push("Missing required \\"${argument.name}\\" positional argument");`;
|
|
289
|
-
}
|
|
290
|
-
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
291
|
-
get when() {
|
|
292
|
-
return (argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && argument.variadic;
|
|
293
|
-
},
|
|
294
|
-
get children() {
|
|
295
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
296
|
-
get condition() {
|
|
297
|
-
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}.length === 0`;
|
|
298
|
-
},
|
|
299
|
-
get children() {
|
|
300
|
-
return __alloy_js_core.code`failures.push("No values were provided to the required \\"${argument.name}\\" array positional argument");`;
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
})];
|
|
305
|
-
}
|
|
306
|
-
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
307
|
-
get when() {
|
|
308
|
-
return argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number;
|
|
309
|
-
},
|
|
310
|
-
get children() {
|
|
311
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
312
|
-
get when() {
|
|
313
|
-
return argument.variadic;
|
|
314
|
-
},
|
|
315
|
-
get fallback() {
|
|
316
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
317
|
-
get condition() {
|
|
318
|
-
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)})`;
|
|
319
|
-
},
|
|
320
|
-
get children() {
|
|
321
|
-
return __alloy_js_core.code`failures.push("Invalid numeric value provided for the \\"${argument.name}\\" positional argument");`;
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
},
|
|
325
|
-
get children() {
|
|
326
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
327
|
-
get condition() {
|
|
328
|
-
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}.some(value => Number.isNaN(value))`;
|
|
329
|
-
},
|
|
330
|
-
get children() {
|
|
331
|
-
return __alloy_js_core.code`failures.push("Invalid numeric value provided in the \\"${argument.name}\\" array positional argument");`;
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
})]
|
|
338
|
-
}),
|
|
339
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
340
|
-
condition: __alloy_js_core.code`failures.length > 0`,
|
|
341
|
-
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"));
|
|
342
|
-
options.help = true; `
|
|
343
|
-
})
|
|
344
|
-
];
|
|
352
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(CommandValidationLogic, { command });
|
|
345
353
|
}
|
|
346
354
|
})
|
|
347
355
|
];
|
|
@@ -368,4 +376,5 @@ function CommandEntry(props) {
|
|
|
368
376
|
exports.CommandEntry = CommandEntry;
|
|
369
377
|
exports.CommandHandlerDeclaration = CommandHandlerDeclaration;
|
|
370
378
|
exports.CommandInvocation = CommandInvocation;
|
|
379
|
+
exports.CommandValidationLogic = CommandValidationLogic;
|
|
371
380
|
//# sourceMappingURL=command-entry.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.cjs","names":["code","computed","For","Show","ElseClause","ElseIfClause","FunctionDeclaration","IfStatement","VarDeclaration","ReflectionKind","SingleLineComment","usePowerlines","EntryFile","TSDoc","TSDocParam","TSDocRemarks","TSDocTitle","CommandParserLogic","OptionsInterfaceDeclaration","getAppBin","getDynamicPathSegmentName","isDynamicPathSegment","findFilePath","relativePath","joinPaths","replaceExtension","camelCase","constantCase","kebabCase","pascalCase","defu","BannerFunctionDeclaration","CommandHelp","IsDebug","VirtualCommandEntry","CommandInvocation","props","command","_$createComponent","name","initializer","segments","map","segment","join","_$createIntrinsic","_$memo","arguments","length","argument","CommandHandlerDeclaration","children","context","heading","title","description","replace","async","parameters","type","default","envPrefix","config","isCaseSensitive","condition","Object","values","options","option","CommandEntry","imports","builtinImports","rest","filePath","filter","commandSourcePath","entryPath","value","entry","input","file","typeDefinition","output","id","_$mergeProps","path","env","console","utils","each","doubleHardline","when","optional","includes","kind","string","number","variadic","fallback","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 type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport {\n ElseClause,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { SingleLineComment } from \"@powerlines/plugin-alloy/core/components/single-line-comment\";\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 {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport {\n CommandParserLogic,\n OptionsInterfaceDeclaration\n} from \"@shell-shock/core/components/options-parser-logic\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type {\n CommandTree,\n NumberCommandArgument,\n NumberCommandOption\n} from \"@shell-shock/core/types/command\";\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 { constantCase } from \"@stryke/string-format/constant-case\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { CommandHelp } from \"./help\";\nimport { IsDebug } from \"./helpers\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport function CommandInvocation(props: { command: CommandTree }) {\n const { command } = props;\n\n return (\n <>\n <VarDeclaration\n name=\"__context\"\n initializer={code`{ path: \\`${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `\\${${camelCase(getDynamicPathSegmentName(segment))}}`\n : segment\n )\n .join(\"/\")}\\`, segments: [${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? camelCase(getDynamicPathSegmentName(segment))\n : `\"${segment}\"`\n )\n .join(\", \")}] }`}\n />\n <hbr />\n <hbr />\n {code`\n\n internal_commandContext.call(__context, () => {\n return Promise.resolve(Reflect.apply(handle${pascalCase(\n command.name\n )}, __context, [options${\n command.arguments.length > 0\n ? `, ${command.arguments\n .map(argument => camelCase(argument.name))\n .join(\", \")}`\n : \"\"\n }]));\n });\n\n `}\n <hbr />\n </>\n );\n}\n\nexport interface CommandHandlerDeclarationProps {\n command: CommandTree;\n children?: Children;\n}\n\n/**\n * A component that generates the `handler` function declaration for a command.\n */\nexport function CommandHandlerDeclaration(\n props: CommandHandlerDeclarationProps\n) {\n const { command, children } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <OptionsInterfaceDeclaration command={command} />\n <hbr />\n <hbr />\n <TSDoc\n heading={`The ${command.title} (${getAppBin(context)} ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `[${constantCase(getDynamicPathSegmentName(segment))}]`\n : segment\n )\n .join(\" \")}) command.`}>\n <TSDocRemarks>{`${command.description.replace(/\\.+$/, \"\")}.`}</TSDocRemarks>\n <hbr />\n <TSDocTitle>{command.title}</TSDocTitle>\n <TSDocParam name=\"args\">{`The command-line arguments passed to the command.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"handler\"\n parameters={[{ name: \"args\", type: \"string[]\", default: \"getArgs()\" }]}>\n <CommandParserLogic\n command={command}\n envPrefix={context.config.envPrefix}\n isCaseSensitive={context.config.isCaseSensitive}\n />\n <hbr />\n <hbr />\n {code`writeLine(\"\");\n banner(); `}\n <hbr />\n <hbr />\n <IfStatement condition={<IsDebug />}>\n {code`\n writeLine(\"\");\n writeLine(colors.text.body.tertiary(\"Debug mode is enabled. Additional debug information may be logged to the console.\"));\n\n writeLine(\"\");\n debug(\\`Command path: ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `\\${${camelCase(getDynamicPathSegmentName(segment))}}`\n : segment\n )\n .join(\" / \")} \\\\n\\\\nOptions: \\\\n${Object.values(command.options)\n .map(\n option =>\n ` - ${kebabCase(option.name)}: \\${options.${camelCase(\n option.name\n )} === undefined ? \"\" : JSON.stringify(options.${camelCase(\n option.name\n )})}`\n )\n .join(\"\\\\n\")}${\n command.arguments.length > 0\n ? ` \\\\n\\\\nArguments: \\\\n${command.arguments\n .map(\n argument =>\n ` - ${kebabCase(argument.name)}: \\${${camelCase(\n argument.name\n )} === undefined ? \"\" : JSON.stringify(${camelCase(\n argument.name\n )})}`\n )\n .join(\"\\\\n\")}`\n : \"\"\n }\\`); `}\n </IfStatement>\n <hbr />\n <hbr />\n {children}\n <hbr />\n <hbr />\n <IfStatement condition={code`options.help`}>\n <CommandHelp command={command} />\n </IfStatement>\n <ElseClause>\n <hbr />\n <CommandInvocation command={command} />\n </ElseClause>\n </FunctionDeclaration>\n </>\n );\n}\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<ScriptPresetContext>();\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 <OptionsInterfaceDeclaration command={command} />\n <hbr />\n <hbr />\n <SingleLineComment>{code`Validate required options and arguments`}</SingleLineComment>\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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,SAAgBmC,kBAAkBC,OAAiC;CACjE,MAAM,EAAEC,YAAYD;AAEpB,QAAA;mDAEK5B,sCAAc;GACb+B,MAAI;GAAA,IACJC,cAAW;AAAA,WAAExC,oBAAI,aAAaqC,QAAQI,SACnCC,KAAIC,sFACkBA,QAAQ,GACzB,sIAA0CA,QAAQ,CAAC,CAAA,KACnDA,QACL,CACAC,KAAK,IAAI,CAAA,iBAAkBP,QAAQI,SACnCC,KAAIC,sFACkBA,QAAQ,mIACWA,QAAQ,CAAC,GAC7C,IAAIA,QAAO,GAChB,CACAC,KAAK,KAAK,CAAA;;GAAK,CAAA;mDAAA,OAAA,EAAA,CAAA;mDAAA,OAAA,EAAA,CAAA;8CAInB5C,oBAAI;;;wGAIDqC,QAAQE,KACT,CAAA,uBACCF,QAAQU,UAAUC,SAAS,IACvB,KAAKX,QAAQU,UACVL,KAAIO,8DAAsBA,SAASV,KAAK,CAAC,CACzCK,KAAK,KAAK,KACb,GAAE;;;QAIT;mD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,SAAmCgD;;WAAQ,IAClDC,WAAQ;AAAA,oEACL3F,mCAAW;aAAA,IACVyD,YAAS;AAAA,qBAAEhE,oBAAI,oDACbiD,SAASV,KACV,CAAA,oEAA8BU,SAASV,KAAK,CAAA;;aAAG,IAAAY,WAAA;AAAA,qBAC/CnD,oBAAI,4DACHiD,SAASV,KAAI;;aACa,CAAA;;WAAA,IAAAY,WAAA;AAAA,oEAG/B5C,mCAAW;aAAA,IACVyD,YAAS;AAAA,qBAAEhE,oBAAI,oDAAaiD,SAASV,KAAK,CAAA;;aAAqC,IAAAY,WAAA;AAAA,qBAC9EnD,oBAAI,2DACHiD,SAASV,KAAI;;aACmB,CAAA;;WAAA,CAAA;;SAAA,CAAA,CAAA;QAK3C,CAAA;wDAEFhC,mCAAW;QAACyD,WAAWhE,oBAAI;QAAqBmD,UAC9CnD,oBAAI;;QACiB,CAAA;OAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,mDAI3BE,qBAAG;EAAA,IAACuF,OAAI;AAAA,UAAExB,OAAOC,OAAO7B,QAAQc,SAAS;;EAAAA,WACvCgD,2DACEhG,sBAAI;GAAA,IACHwF,OAAI;AAAA,WAAEQ,MAAMC;;GAAS,IACrBF,WAAQ;AAAA,4DAAG7B,cAAY,EAAChC,SAAS8D,OAAK,CAAA;;GAAA,IAAAhD,WAAA;AAAA,4DACrCjB,8DAAmB,EAACG,SAAS8D,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"command-entry.cjs","names":["code","computed","For","Show","ElseClause","ElseIfClause","FunctionDeclaration","IfStatement","VarDeclaration","ReflectionKind","SingleLineComment","usePowerlines","EntryFile","TSDoc","TSDocParam","TSDocRemarks","TSDocTitle","CommandParserLogic","OptionsInterfaceDeclaration","getAppBin","getDynamicPathSegmentName","isDynamicPathSegment","findFilePath","relativePath","joinPaths","replaceExtension","camelCase","constantCase","kebabCase","pascalCase","defu","BannerFunctionDeclaration","CommandHelp","IsDebug","VirtualCommandEntry","CommandInvocation","props","command","_$createComponent","name","initializer","segments","map","segment","join","_$createIntrinsic","_$memo","arguments","length","argument","CommandHandlerDeclaration","children","context","heading","title","description","replace","async","parameters","type","default","envPrefix","config","isCaseSensitive","condition","Object","values","options","option","CommandValidationLogic","each","doubleHardline","when","optional","includes","kind","string","number","variadic","fallback","CommandEntry","imports","builtinImports","rest","filePath","filter","commandSourcePath","entryPath","value","entry","input","file","typeDefinition","output","id","_$mergeProps","path","env","console","utils","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 type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport {\n ElseClause,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { SingleLineComment } from \"@powerlines/plugin-alloy/core/components/single-line-comment\";\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 {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport {\n CommandParserLogic,\n OptionsInterfaceDeclaration\n} from \"@shell-shock/core/components/options-parser-logic\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type {\n CommandTree,\n NumberCommandArgument,\n NumberCommandOption\n} from \"@shell-shock/core/types/command\";\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 { constantCase } from \"@stryke/string-format/constant-case\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { CommandHelp } from \"./help\";\nimport { IsDebug } from \"./helpers\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport function CommandInvocation(props: { command: CommandTree }) {\n const { command } = props;\n\n return (\n <>\n <VarDeclaration\n name=\"__context\"\n initializer={code`{ path: \\`${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `\\${${camelCase(getDynamicPathSegmentName(segment))}}`\n : segment\n )\n .join(\"/\")}\\`, segments: [${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? camelCase(getDynamicPathSegmentName(segment))\n : `\"${segment}\"`\n )\n .join(\", \")}] }`}\n />\n <hbr />\n <hbr />\n {code`\n\n internal_commandContextStore.run(__context, () => {\n return Promise.resolve(Reflect.apply(handle${pascalCase(\n command.name\n )}, __context, [options${\n command.arguments.length > 0\n ? `, ${command.arguments\n .map(argument => camelCase(argument.name))\n .join(\", \")}`\n : \"\"\n }]));\n });\n\n `}\n <hbr />\n </>\n );\n}\n\nexport interface CommandHandlerDeclarationProps {\n command: CommandTree;\n children?: Children;\n}\n\n/**\n * A component that generates the `handler` function declaration for a command.\n */\nexport function CommandHandlerDeclaration(\n props: CommandHandlerDeclarationProps\n) {\n const { command, children } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <OptionsInterfaceDeclaration command={command} />\n <hbr />\n <hbr />\n <TSDoc\n heading={`The ${command.title} (${getAppBin(context)} ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `[${constantCase(getDynamicPathSegmentName(segment))}]`\n : segment\n )\n .join(\" \")}) command.`}>\n <TSDocRemarks>{`${command.description.replace(/\\.+$/, \"\")}.`}</TSDocRemarks>\n <hbr />\n <TSDocTitle>{command.title}</TSDocTitle>\n <TSDocParam name=\"args\">{`The command-line arguments passed to the command.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"handler\"\n parameters={[{ name: \"args\", type: \"string[]\", default: \"getArgs()\" }]}>\n <CommandParserLogic\n command={command}\n envPrefix={context.config.envPrefix}\n isCaseSensitive={context.config.isCaseSensitive}\n />\n <hbr />\n <hbr />\n {code`writeLine(\"\");\n banner(); `}\n <hbr />\n <hbr />\n <IfStatement condition={<IsDebug />}>\n {code`\n writeLine(\"\");\n writeLine(colors.text.body.tertiary(\"Debug mode is enabled. Additional debug information may be logged to the console.\"));\n\n writeLine(\"\");\n debug(\\`Command path: ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `\\${${camelCase(getDynamicPathSegmentName(segment))}}`\n : segment\n )\n .join(\" / \")} \\\\n\\\\nOptions: \\\\n${Object.values(command.options)\n .map(\n option =>\n ` - ${kebabCase(option.name)}: \\${options.${camelCase(\n option.name\n )} === undefined ? \"\" : JSON.stringify(options.${camelCase(\n option.name\n )})}`\n )\n .join(\"\\\\n\")}${\n command.arguments.length > 0\n ? ` \\\\n\\\\nArguments: \\\\n${command.arguments\n .map(\n argument =>\n ` - ${kebabCase(argument.name)}: \\${${camelCase(\n argument.name\n )} === undefined ? \"\" : JSON.stringify(${camelCase(\n argument.name\n )})}`\n )\n .join(\"\\\\n\")}`\n : \"\"\n }\\`);\n writeLine(\"\"); `}\n </IfStatement>\n <hbr />\n <hbr />\n {children}\n <hbr />\n <hbr />\n <IfStatement condition={code`options.help`}>\n <CommandHelp command={command} />\n </IfStatement>\n <ElseClause>\n <hbr />\n <CommandInvocation command={command} />\n </ElseClause>\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface CommandValidationLogicProps {\n command: CommandTree;\n}\n\n/**\n * A component that generates command validation logic for required options and arguments.\n */\nexport function CommandValidationLogic(props: CommandValidationLogicProps) {\n const { command } = props;\n\n return (\n <>\n <VarDeclaration name=\"failures\" type=\"string[]\" initializer={code`[];`} />\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(\"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 => \" - \" + failure).join(\"\\\\n\"));\n options.help = true; `}\n </IfStatement>\n </>\n );\n}\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<ScriptPresetContext>();\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_commandContextStore\"\n ]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <OptionsInterfaceDeclaration command={command} />\n <hbr />\n <hbr />\n <SingleLineComment>{code`Validate required options and arguments`}</SingleLineComment>\n <hbr />\n <CommandHandlerDeclaration command={command}>\n <CommandValidationLogic command={command} />\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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,SAAgBmC,kBAAkBC,OAAiC;CACjE,MAAM,EAAEC,YAAYD;AAEpB,QAAA;mDAEK5B,sCAAc;GACb+B,MAAI;GAAA,IACJC,cAAW;AAAA,WAAExC,oBAAI,aAAaqC,QAAQI,SACnCC,KAAIC,sFACkBA,QAAQ,GACzB,sIAA0CA,QAAQ,CAAC,CAAA,KACnDA,QACL,CACAC,KAAK,IAAI,CAAA,iBAAkBP,QAAQI,SACnCC,K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AAA,IAAAjD,WAAA;AAAA,4DACrCjB,8DAAmB,EAACG,SAAS+D,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
|
|
@@ -14,6 +14,13 @@ interface CommandHandlerDeclarationProps {
|
|
|
14
14
|
* A component that generates the `handler` function declaration for a command.
|
|
15
15
|
*/
|
|
16
16
|
declare function CommandHandlerDeclaration(props: CommandHandlerDeclarationProps): Children;
|
|
17
|
+
interface CommandValidationLogicProps {
|
|
18
|
+
command: CommandTree;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A component that generates command validation logic for required options and arguments.
|
|
22
|
+
*/
|
|
23
|
+
declare function CommandValidationLogic(props: CommandValidationLogicProps): Children;
|
|
17
24
|
interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
|
|
18
25
|
command: CommandTree;
|
|
19
26
|
}
|
|
@@ -22,5 +29,5 @@ interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinitio
|
|
|
22
29
|
*/
|
|
23
30
|
declare function CommandEntry(props: CommandEntryProps): Children;
|
|
24
31
|
//#endregion
|
|
25
|
-
export { CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandHandlerDeclarationProps, CommandInvocation };
|
|
32
|
+
export { CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandHandlerDeclarationProps, CommandInvocation, CommandValidationLogic, CommandValidationLogicProps };
|
|
26
33
|
//# sourceMappingURL=command-entry.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;iBAkEgB,iBAAA;WAAoC;AAApD,CAAA,CAAA,EAAiE,QAAjD;AA2CC,UAAA,8BAAA,CAA8B;EAQ/B,OAAA,EAPL,WAOK;
|
|
1
|
+
{"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;iBAkEgB,iBAAA;WAAoC;AAApD,CAAA,CAAA,EAAiE,QAAjD;AA2CC,UAAA,8BAAA,CAA8B;EAQ/B,OAAA,EAPL,WAOK;EA+FC,QAAA,CAAA,EArGJ,QAqGI;AAOjB;AAgIA;;;AAA2C,iBAtO3B,yBAAA,CAsO2B,KAAA,EArOlC,8BAqOkC,CAAA,EArOJ,QAqOI;AAAI,UAvI9B,2BAAA,CAuI8B;EAU/B,OAAA,EAhJL,WAgJiB;;;;;iBA1IZ,sBAAA,QAA8B,8BAA2B;UAgIxD,iBAAA,SAA0B,KACzC;WAGS;;;;;iBAMK,YAAA,QAAoB,oBAAiB"}
|
|
@@ -14,6 +14,13 @@ interface CommandHandlerDeclarationProps {
|
|
|
14
14
|
* A component that generates the `handler` function declaration for a command.
|
|
15
15
|
*/
|
|
16
16
|
declare function CommandHandlerDeclaration(props: CommandHandlerDeclarationProps): Children;
|
|
17
|
+
interface CommandValidationLogicProps {
|
|
18
|
+
command: CommandTree;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A component that generates command validation logic for required options and arguments.
|
|
22
|
+
*/
|
|
23
|
+
declare function CommandValidationLogic(props: CommandValidationLogicProps): Children;
|
|
17
24
|
interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
|
|
18
25
|
command: CommandTree;
|
|
19
26
|
}
|
|
@@ -22,5 +29,5 @@ interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinitio
|
|
|
22
29
|
*/
|
|
23
30
|
declare function CommandEntry(props: CommandEntryProps): Children;
|
|
24
31
|
//#endregion
|
|
25
|
-
export { CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandHandlerDeclarationProps, CommandInvocation };
|
|
32
|
+
export { CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandHandlerDeclarationProps, CommandInvocation, CommandValidationLogic, CommandValidationLogicProps };
|
|
26
33
|
//# 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":";;;;;iBAkEgB,iBAAA;WAAoC;AAApD,CAAA,CAAA,EAAiE,QAAjD;AA2CC,UAAA,8BAAA,CAA8B;EAQ/B,OAAA,EAPL,WAOK;
|
|
1
|
+
{"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;iBAkEgB,iBAAA;WAAoC;AAApD,CAAA,CAAA,EAAiE,QAAjD;AA2CC,UAAA,8BAAA,CAA8B;EAQ/B,OAAA,EAPL,WAOK;EA+FC,QAAA,CAAA,EArGJ,QAqGI;AAOjB;AAgIA;;;AAA2C,iBAtO3B,yBAAA,CAsO2B,KAAA,EArOlC,8BAqOkC,CAAA,EArOJ,QAqOI;AAAI,UAvI9B,2BAAA,CAuI8B;EAU/B,OAAA,EAhJL,WAgJiB;;;;;iBA1IZ,sBAAA,QAA8B,8BAA2B;UAgIxD,iBAAA,SAA0B,KACzC;WAGS;;;;;iBAMK,YAAA,QAAoB,oBAAiB"}
|