@shell-shock/preset-cli 0.2.0 → 0.3.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/banner-function-declaration.d.cts +2 -2
- package/dist/components/banner-function-declaration.d.mts +2 -2
- package/dist/components/banner-function-declaration.mjs +1 -1
- package/dist/components/command-entry.cjs +160 -142
- package/dist/components/command-entry.d.cts +2 -2
- 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 +162 -144
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +85 -0
- package/dist/components/command-router.d.cts +16 -0
- package/dist/components/command-router.d.cts.map +1 -0
- package/dist/components/command-router.d.mts +16 -0
- package/dist/components/command-router.d.mts.map +1 -0
- package/dist/components/command-router.mjs +84 -0
- package/dist/components/command-router.mjs.map +1 -0
- package/dist/components/virtual-command-entry.cjs +28 -4
- package/dist/components/virtual-command-entry.d.cts.map +1 -1
- package/dist/components/virtual-command-entry.d.mts.map +1 -1
- package/dist/components/virtual-command-entry.mjs +28 -4
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/index.cjs +22 -8
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +22 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -8
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as _alloy_js_core2 from "@alloy-js/core";
|
|
2
|
+
import { CommandTree } from "@shell-shock/core/types/command";
|
|
3
|
+
import { CommandRouterProps } from "@shell-shock/preset-script/components/command-router";
|
|
4
|
+
|
|
5
|
+
//#region src/components/command-router.d.ts
|
|
6
|
+
interface CommandRouterSelectOptionsProps {
|
|
7
|
+
commands?: Record<string, CommandTree>;
|
|
8
|
+
}
|
|
9
|
+
declare function CommandRouterSelectOptions(props: CommandRouterSelectOptionsProps): _alloy_js_core2.Children;
|
|
10
|
+
/**
|
|
11
|
+
* A component that renders a command router interface, allowing users to select and execute commands from a provided list of commands and segments. This component serves as a wrapper around the base CommandRouter, adding additional UI elements and logic for command selection.
|
|
12
|
+
*/
|
|
13
|
+
declare function CommandRouter(props: CommandRouterProps): _alloy_js_core2.Children;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { CommandRouter, CommandRouterSelectOptions, CommandRouterSelectOptionsProps };
|
|
16
|
+
//# sourceMappingURL=command-router.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-router.d.cts","names":[],"sources":["../../src/components/command-router.tsx"],"sourcesContent":[],"mappings":";;;;;UA2BiB,+BAAA;aACJ,eAAe;;AADX,iBAID,0BAAA,CAHY,KAAA,EAInB,+BAJU,CAAA,EAIqB,eAAA,CAAA,QAJrB;AAGnB;AA2BA;;iBAAgB,aAAA,QAAqB,qBAAkB,eAAA,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import { CommandRouterProps } from "@shell-shock/preset-script/components/command-router";
|
|
3
|
+
import { CommandTree } from "@shell-shock/core/types/command";
|
|
4
|
+
|
|
5
|
+
//#region src/components/command-router.d.ts
|
|
6
|
+
interface CommandRouterSelectOptionsProps {
|
|
7
|
+
commands?: Record<string, CommandTree>;
|
|
8
|
+
}
|
|
9
|
+
declare function CommandRouterSelectOptions(props: CommandRouterSelectOptionsProps): _alloy_js_core0.Children;
|
|
10
|
+
/**
|
|
11
|
+
* A component that renders a command router interface, allowing users to select and execute commands from a provided list of commands and segments. This component serves as a wrapper around the base CommandRouter, adding additional UI elements and logic for command selection.
|
|
12
|
+
*/
|
|
13
|
+
declare function CommandRouter(props: CommandRouterProps): _alloy_js_core0.Children;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { CommandRouter, CommandRouterSelectOptions, CommandRouterSelectOptionsProps };
|
|
16
|
+
//# sourceMappingURL=command-router.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-router.d.mts","names":[],"sources":["../../src/components/command-router.tsx"],"sourcesContent":[],"mappings":";;;;;UA2BiB,+BAAA;aACJ,eAAe;;AADX,iBAID,0BAAA,CAHY,KAAA,EAInB,+BAJU,CAAA,EAIqB,eAAA,CAAA,QAJrB;AAGnB;AA2BA;;iBAAgB,aAAA,QAAqB,qBAAkB,eAAA,CAAA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { For, code } from "@alloy-js/core";
|
|
3
|
+
import { IfStatement } from "@alloy-js/typescript";
|
|
4
|
+
import { CommandRouter as CommandRouter$1, CommandRouterBody } from "@shell-shock/preset-script/components/command-router";
|
|
5
|
+
|
|
6
|
+
//#region src/components/command-router.tsx
|
|
7
|
+
function CommandRouterSelectOptions(props) {
|
|
8
|
+
const { commands } = props;
|
|
9
|
+
return createComponent(For, {
|
|
10
|
+
get each() {
|
|
11
|
+
return Object.values(commands ?? {});
|
|
12
|
+
},
|
|
13
|
+
joiner: ",",
|
|
14
|
+
hardline: true,
|
|
15
|
+
children: (command) => command.isVirtual ? createComponent(CommandRouterSelectOptions, { get commands() {
|
|
16
|
+
return command.children ?? {};
|
|
17
|
+
} }) : code`{ value: [${command.segments.map((segment) => `"${segment}"`).join(", ")}], label: "${command.icon ? `${command.icon} ` : ""}${command.title}", hint: "${command.description}" }`
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A component that renders a command router interface, allowing users to select and execute commands from a provided list of commands and segments. This component serves as a wrapper around the base CommandRouter, adding additional UI elements and logic for command selection.
|
|
22
|
+
*/
|
|
23
|
+
function CommandRouter(props) {
|
|
24
|
+
const { segments, commands } = props;
|
|
25
|
+
return [
|
|
26
|
+
createComponent(CommandRouter$1, mergeProps(props, {
|
|
27
|
+
segments,
|
|
28
|
+
commands
|
|
29
|
+
})),
|
|
30
|
+
createIntrinsic("hbr", {}),
|
|
31
|
+
createIntrinsic("hbr", {}),
|
|
32
|
+
createComponent(IfStatement, {
|
|
33
|
+
condition: code`isInteractive && !isHelp`,
|
|
34
|
+
get children() {
|
|
35
|
+
return [
|
|
36
|
+
code`
|
|
37
|
+
banner();
|
|
38
|
+
|
|
39
|
+
intro("Command selection");
|
|
40
|
+
|
|
41
|
+
let segments = await select({
|
|
42
|
+
message: "Please select a command to execute:",
|
|
43
|
+
options: [ `,
|
|
44
|
+
createComponent(CommandRouterSelectOptions, { commands }),
|
|
45
|
+
memo(() => ` ],
|
|
46
|
+
});
|
|
47
|
+
if (isCancel(segments)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let dynamics = {} as Record<string, string>;
|
|
52
|
+
for (const dynamic of segments.filter(segment => segment.startsWith("[") && segment.endsWith("]"))) {
|
|
53
|
+
const value = await text({
|
|
54
|
+
message: \`Please provide a value for \${dynamic.replace(/^\[+/, "").replace(/\]+$/, "")}:\`,
|
|
55
|
+
});
|
|
56
|
+
if (isCancel(value)) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
dynamics[dynamic] = value;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
segments = segments.map(segment => dynamics[segment] || segment);
|
|
63
|
+
const context = useApp();
|
|
64
|
+
context.set("args", [args.length > 0 ? args[0] : undefined, args.length > 1 ? args[1] : undefined, ...segments, ...args.slice(${segments.length + 2})].filter(Boolean) as string[]);
|
|
65
|
+
|
|
66
|
+
outro(\`Executing \${segments.join(" ")} command\`);
|
|
67
|
+
|
|
68
|
+
command = segments[0];
|
|
69
|
+
args = context.get("args"); `),
|
|
70
|
+
createComponent(CommandRouterBody, mergeProps(props, {
|
|
71
|
+
segments,
|
|
72
|
+
commands
|
|
73
|
+
}))
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
}),
|
|
77
|
+
createIntrinsic("hbr", {}),
|
|
78
|
+
createIntrinsic("hbr", {})
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
//#endregion
|
|
83
|
+
export { CommandRouter, CommandRouterSelectOptions };
|
|
84
|
+
//# sourceMappingURL=command-router.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-router.mjs","names":["code","For","IfStatement","CommandRouter","BaseCommandRouter","CommandRouterBody","CommandRouterSelectOptions","props","commands","_$createComponent","each","Object","values","joiner","hardline","children","command","isVirtual","segments","map","segment","join","icon","title","description","_$mergeProps","_$createIntrinsic","condition","_$memo","length"],"sources":["../../src/components/command-router.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 } from \"@alloy-js/core\";\nimport { IfStatement } from \"@alloy-js/typescript\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport type { CommandRouterProps } from \"@shell-shock/preset-script/components/command-router\";\nimport {\n CommandRouter as BaseCommandRouter,\n CommandRouterBody\n} from \"@shell-shock/preset-script/components/command-router\";\n\nexport interface CommandRouterSelectOptionsProps {\n commands?: Record<string, CommandTree>;\n}\n\nexport function CommandRouterSelectOptions(\n props: CommandRouterSelectOptionsProps\n) {\n const { commands } = props;\n\n return (\n <For each={Object.values(commands ?? {})} joiner=\",\" hardline>\n {command =>\n command.isVirtual ? (\n <CommandRouterSelectOptions commands={command.children ?? {}} />\n ) : (\n code`{ value: [${command.segments\n .map(segment => `\"${segment}\"`)\n .join(\n \", \"\n )}], label: \"${command.icon ? `${command.icon} ` : \"\"}${command.title}\", hint: \"${\n command.description\n }\" }`\n )\n }\n </For>\n );\n}\n\n/**\n * A component that renders a command router interface, allowing users to select and execute commands from a provided list of commands and segments. This component serves as a wrapper around the base CommandRouter, adding additional UI elements and logic for command selection.\n */\nexport function CommandRouter(props: CommandRouterProps) {\n const { segments, commands } = props;\n\n return (\n <>\n <BaseCommandRouter {...props} segments={segments} commands={commands} />\n <hbr />\n <hbr />\n <IfStatement condition={code`isInteractive && !isHelp`}>\n {code`\n banner();\n\n intro(\"Command selection\");\n\n let segments = await select({\n message: \"Please select a command to execute:\",\n options: [ `}\n <CommandRouterSelectOptions commands={commands} />\n {` ],\n });\n if (isCancel(segments)) {\n return;\n }\n\n let dynamics = {} as Record<string, string>;\n for (const dynamic of segments.filter(segment => segment.startsWith(\"[\") && segment.endsWith(\"]\"))) {\n const value = await text({\n message: \\`Please provide a value for \\${dynamic.replace(/^\\[+/, \"\").replace(/\\]+$/, \"\")}:\\`,\n });\n if (isCancel(value)) {\n return;\n }\n dynamics[dynamic] = value;\n }\n\n segments = segments.map(segment => dynamics[segment] || segment);\n const context = useApp();\n context.set(\"args\", [args.length > 0 ? args[0] : undefined, args.length > 1 ? args[1] : undefined, ...segments, ...args.slice(${\n segments.length + 2\n })].filter(Boolean) as string[]);\n\n outro(\\`Executing \\${segments.join(\" \")} command\\`);\n\n command = segments[0];\n args = context.get(\"args\"); `}\n <CommandRouterBody {...props} segments={segments} commands={commands} />\n </IfStatement>\n <hbr />\n <hbr />\n </>\n );\n}\n"],"mappings":";;;;;;AA+BA,SAAgBM,2BACdC,OACA;CACA,MAAM,EAAEC,aAAaD;AAErB,QAAAE,gBACGR,KAAG;EAAA,IAACS,OAAI;AAAA,UAAEC,OAAOC,OAAOJ,YAAY,EAAE,CAAC;;EAAEK,QAAM;EAAKC,UAAQ;EAAAC,WAC1DC,YACCA,QAAQC,YAASR,gBACdH,4BAA0B,EAAA,IAACE,WAAQ;AAAA,UAAEQ,QAAQD,YAAY,EAAE;KAAA,CAAA,GAE5Df,IAAI,aAAagB,QAAQE,SACtBC,KAAIC,YAAW,IAAIA,QAAO,GAAI,CAC9BC,KACC,KACD,CAAA,aAAcL,QAAQM,OAAO,GAAGN,QAAQM,KAAI,MAAO,KAAKN,QAAQO,MAAK,YACtEP,QAAQQ,YAAW;EAEtB,CAAA;;;;;AAST,SAAgBrB,cAAcI,OAA2B;CACvD,MAAM,EAAEW,UAAUV,aAAaD;AAE/B,QAAA;EAAAE,gBAEKL,iBAAiBqB,WAAKlB,OAAK;GAAYW;GAAoBV;GAAQ,CAAA,CAAA;EAAAkB,gBAAA,OAAA,EAAA,CAAA;EAAAA,gBAAA,OAAA,EAAA,CAAA;EAAAjB,gBAGnEP,aAAW;GAACyB,WAAW3B,IAAI;GAA0B,IAAAe,WAAA;AAAA,WAAA;KACnDf,IAAI;;;;;;;;KAOSS,gBACbH,4BAA0B,EAAWE,UAAQ,CAAA;KAAAoB,WAC7C;;;;;;;;;;;;;;;;;;;wIAoBCV,SAASW,SAAS,EAAC;;;;;sCAMQ;KAAApB,gBAC5BJ,mBAAiBoB,WAAKlB,OAAK;MAAYW;MAAoBV;MAAQ,CAAA,CAAA;KAAA;;GAAA,CAAA;EAAAkB,gBAAA,OAAA,EAAA,CAAA;EAAAA,gBAAA,OAAA,EAAA,CAAA;EAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_components_banner_function_declaration = require('./banner-function-declaration.cjs');
|
|
3
|
+
const require_components_command_router = require('./command-router.cjs');
|
|
3
4
|
const require_components_command_entry = require('./command-entry.cjs');
|
|
4
5
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
6
|
let __alloy_js_core = require("@alloy-js/core");
|
|
@@ -45,15 +46,26 @@ function VirtualCommandEntry(props) {
|
|
|
45
46
|
console: [
|
|
46
47
|
"warn",
|
|
47
48
|
"error",
|
|
49
|
+
"help",
|
|
48
50
|
"table",
|
|
49
51
|
"colors",
|
|
50
|
-
"writeLine"
|
|
52
|
+
"writeLine",
|
|
53
|
+
"splitText",
|
|
54
|
+
"stripAnsi",
|
|
55
|
+
"intro",
|
|
56
|
+
"outro",
|
|
57
|
+
"text",
|
|
58
|
+
"select",
|
|
59
|
+
"isCancel"
|
|
51
60
|
],
|
|
52
61
|
utils: [
|
|
53
|
-
"
|
|
62
|
+
"useApp",
|
|
63
|
+
"useArgs",
|
|
54
64
|
"hasFlag",
|
|
55
65
|
"isMinimal",
|
|
56
|
-
"isUnicodeSupported"
|
|
66
|
+
"isUnicodeSupported",
|
|
67
|
+
"isInteractive",
|
|
68
|
+
"isHelp"
|
|
57
69
|
]
|
|
58
70
|
});
|
|
59
71
|
},
|
|
@@ -62,7 +74,19 @@ function VirtualCommandEntry(props) {
|
|
|
62
74
|
(0, __alloy_js_core_jsx_runtime.createComponent)(require_components_banner_function_declaration.BannerFunctionDeclaration, { command }),
|
|
63
75
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
64
76
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
65
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_virtual_command_entry.VirtualCommandHandlerDeclaration, {
|
|
77
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_virtual_command_entry.VirtualCommandHandlerDeclaration, {
|
|
78
|
+
command,
|
|
79
|
+
get children() {
|
|
80
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
|
|
81
|
+
get segments() {
|
|
82
|
+
return command.segments;
|
|
83
|
+
},
|
|
84
|
+
get commands() {
|
|
85
|
+
return command.children;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
})
|
|
66
90
|
];
|
|
67
91
|
}
|
|
68
92
|
})), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-command-entry.d.cts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"virtual-command-entry.d.cts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UAkCiB,wBAAA,SAAiC,KAChD;WAGS;;AAJX;;;AAAkD,iBAUlC,mBAAA,CAVkC,KAAA,EAUP,wBAVO,CAAA,EAUiB,eAAA,CAAA,QAVjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-command-entry.d.mts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"virtual-command-entry.d.mts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UAkCiB,wBAAA,SAAiC,KAChD;WAGS;;AAJX;;;AAAkD,iBAUlC,mBAAA,CAVkC,KAAA,EAUP,wBAVO,CAAA,EAUiB,eAAA,CAAA,QAVjB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BannerFunctionDeclaration } from "./banner-function-declaration.mjs";
|
|
2
|
+
import { CommandRouter } from "./command-router.mjs";
|
|
2
3
|
import { CommandEntry } from "./command-entry.mjs";
|
|
3
4
|
import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
4
5
|
import { For, Show, computed } from "@alloy-js/core";
|
|
@@ -43,15 +44,26 @@ function VirtualCommandEntry(props) {
|
|
|
43
44
|
console: [
|
|
44
45
|
"warn",
|
|
45
46
|
"error",
|
|
47
|
+
"help",
|
|
46
48
|
"table",
|
|
47
49
|
"colors",
|
|
48
|
-
"writeLine"
|
|
50
|
+
"writeLine",
|
|
51
|
+
"splitText",
|
|
52
|
+
"stripAnsi",
|
|
53
|
+
"intro",
|
|
54
|
+
"outro",
|
|
55
|
+
"text",
|
|
56
|
+
"select",
|
|
57
|
+
"isCancel"
|
|
49
58
|
],
|
|
50
59
|
utils: [
|
|
51
|
-
"
|
|
60
|
+
"useApp",
|
|
61
|
+
"useArgs",
|
|
52
62
|
"hasFlag",
|
|
53
63
|
"isMinimal",
|
|
54
|
-
"isUnicodeSupported"
|
|
64
|
+
"isUnicodeSupported",
|
|
65
|
+
"isInteractive",
|
|
66
|
+
"isHelp"
|
|
55
67
|
]
|
|
56
68
|
});
|
|
57
69
|
},
|
|
@@ -60,7 +72,19 @@ function VirtualCommandEntry(props) {
|
|
|
60
72
|
createComponent(BannerFunctionDeclaration, { command }),
|
|
61
73
|
createIntrinsic("hbr", {}),
|
|
62
74
|
createIntrinsic("hbr", {}),
|
|
63
|
-
createComponent(VirtualCommandHandlerDeclaration, {
|
|
75
|
+
createComponent(VirtualCommandHandlerDeclaration, {
|
|
76
|
+
command,
|
|
77
|
+
get children() {
|
|
78
|
+
return createComponent(CommandRouter, {
|
|
79
|
+
get segments() {
|
|
80
|
+
return command.segments;
|
|
81
|
+
},
|
|
82
|
+
get commands() {
|
|
83
|
+
return command.children;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
})
|
|
64
88
|
];
|
|
65
89
|
}
|
|
66
90
|
})), createComponent(For, {
|
|
@@ -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","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\"
|
|
1
|
+
{"version":3,"file":"virtual-command-entry.mjs","names":["computed","For","Show","usePowerlines","TypescriptFile","isDynamicPathSegment","VirtualCommandHandlerDeclaration","joinPaths","pascalCase","defu","BannerFunctionDeclaration","CommandEntry","CommandRouter","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","commands","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\";\nimport { CommandRouter } from \"./command-router\";\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: [\n \"warn\",\n \"error\",\n \"help\",\n \"table\",\n \"colors\",\n \"writeLine\",\n \"splitText\",\n \"stripAnsi\",\n \"intro\",\n \"outro\",\n \"text\",\n \"select\",\n \"isCancel\"\n ],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"isInteractive\",\n \"isHelp\"\n ]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <VirtualCommandHandlerDeclaration command={command}>\n <CommandRouter\n segments={command.segments}\n commands={command.children}\n />\n </VirtualCommandHandlerDeclaration>\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":";;;;;;;;;;;;;;;;;AA4CA,SAAgBa,oBAAoBC,OAAiC;CACnE,MAAM,EAAEC,SAASC,SAASC,gBAAgB,GAAGC,SAASJ;CAEtD,MAAMK,UAAUhB,eAAiC;CACjD,MAAMiB,WAAWpB,eACfO,UACEY,QAAQE,WACRN,QAAQO,SACLC,QAAOC,YAAW,CAACnB,qBAAqBmB,QAAQ,CAAC,CACjDC,KAAK,IAAI,EACZ,WAEJ,CAAC;AAED,QAAA,CAAAC,gBAEKtB,gBAAcuB,WACTT,MAAI;EAAA,IACRU,OAAI;AAAA,UAAER,SAASS;;EAAK,IACpBb,UAAO;AAAA,UAAEP,KACP,EACEqB,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,SAAShC,WAAWuB,KAAK;KAAI,CACxD;AAED,WAAOQ;MACN,EAA2B,CAClC,CAAC;;EAAA,IACDtB,iBAAc;AAAA,UAAER,KAAKQ,kBAAkB,EAAE,EAAE;IACzCwB,SAAS;KACP;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACD;IACDC,OAAO;KACL;KACA;KACA;KACA;KACA;KACA;KACA;KAAQ;IAEX,CAAC;;EAAA,IAAAP,WAAA;AAAA,UAAA;IAAAT,gBACDhB,2BAAyB,EAAUK,SAAO,CAAA;IAAA4B,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAjB,gBAG1CpB,kCAAgC;KAAUS;KAAO,IAAAoB,WAAA;AAAA,aAAAT,gBAC/Cd,eAAa;OAAA,IACZU,WAAQ;AAAA,eAAEP,QAAQO;;OAAQ,IAC1BsB,WAAQ;AAAA,eAAE7B,QAAQoB;;OAAQ,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,EAAAT,gBAI/BzB,KAAG;EAAA,IAAC4C,OAAI;AAAA,UAAEZ,OAAOa,OAAO/B,QAAQoB,SAAS;;EAAAA,WACvCC,UAAKV,gBACHxB,MAAI;GAAA,IACH6C,OAAI;AAAA,WAAEX,MAAMC;;GAAS,IACrBW,WAAQ;AAAA,WAAAtB,gBAAGf,cAAY,EAACI,SAASqB,OAAK,CAAA;;GAAA,IAAAD,WAAA;AAAA,WAAAT,gBACrCb,qBAAmB,EAACE,SAASqB,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
3
|
const require_components_banner_function_declaration = require('./components/banner-function-declaration.cjs');
|
|
4
|
+
const require_components_command_router = require('./components/command-router.cjs');
|
|
4
5
|
const require_components_virtual_command_entry = require('./components/virtual-command-entry.cjs');
|
|
5
6
|
const require_components_command_entry = require('./components/command-entry.cjs');
|
|
6
7
|
const require_get_default_options = require('./helpers/get-default-options.cjs');
|
|
@@ -11,7 +12,6 @@ let __powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render"
|
|
|
11
12
|
let __shell_shock_plugin_theme = require("@shell-shock/plugin-theme");
|
|
12
13
|
__shell_shock_plugin_theme = require_rolldown_runtime.__toESM(__shell_shock_plugin_theme);
|
|
13
14
|
let __shell_shock_preset_script_components_bin_entry = require("@shell-shock/preset-script/components/bin-entry");
|
|
14
|
-
let __shell_shock_preset_script_components_command_router = require("@shell-shock/preset-script/components/command-router");
|
|
15
15
|
let __shell_shock_preset_script_components_console_builtin = require("@shell-shock/preset-script/components/console-builtin");
|
|
16
16
|
let __shell_shock_preset_script_components_help = require("@shell-shock/preset-script/components/help");
|
|
17
17
|
let __shell_shock_preset_script_components_utils_builtin = require("@shell-shock/preset-script/components/utils-builtin");
|
|
@@ -50,7 +50,9 @@ export {
|
|
|
50
50
|
multiselect,
|
|
51
51
|
password,
|
|
52
52
|
progress,
|
|
53
|
-
spinner
|
|
53
|
+
spinner,
|
|
54
|
+
intro,
|
|
55
|
+
outro
|
|
54
56
|
} from "@clack/prompts";
|
|
55
57
|
|
|
56
58
|
` })]);
|
|
@@ -71,10 +73,22 @@ export {
|
|
|
71
73
|
"writeLine",
|
|
72
74
|
"splitText",
|
|
73
75
|
"colors",
|
|
74
|
-
"help"
|
|
76
|
+
"help",
|
|
77
|
+
"writeLine",
|
|
78
|
+
"splitText",
|
|
79
|
+
"stripAnsi",
|
|
80
|
+
"intro",
|
|
81
|
+
"outro",
|
|
82
|
+
"select",
|
|
83
|
+
"isCancel"
|
|
75
84
|
],
|
|
76
|
-
utils: [
|
|
77
|
-
|
|
85
|
+
utils: [
|
|
86
|
+
"useApp",
|
|
87
|
+
"useArgs",
|
|
88
|
+
"isMinimal",
|
|
89
|
+
"isInteractive",
|
|
90
|
+
"isHelp"
|
|
91
|
+
]
|
|
78
92
|
},
|
|
79
93
|
get prefix() {
|
|
80
94
|
return [
|
|
@@ -92,13 +106,13 @@ export {
|
|
|
92
106
|
get children() {
|
|
93
107
|
return [
|
|
94
108
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
95
|
-
"
|
|
109
|
+
"let": true,
|
|
96
110
|
name: "args",
|
|
97
111
|
type: "string[]",
|
|
98
|
-
initializer: __alloy_js_core.code`
|
|
112
|
+
initializer: __alloy_js_core.code`useArgs();`
|
|
99
113
|
}),
|
|
100
114
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
101
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(
|
|
115
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
|
|
102
116
|
segments: [],
|
|
103
117
|
get commands() {
|
|
104
118
|
return _self$.commands ?? {};
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAqCA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,gBAAA,GAAmB,gBAAnB,CAAA,CAAA,OAAA,CAAA,EAC7B,gBAD6B,EAAA,
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAqCA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,gBAAA,GAAmB,gBAAnB,CAAA,CAAA,OAAA,CAAA,EAC7B,gBAD6B,EAAA,GAyIjC,MAzIiC,CAyI1B,QAzI0B,CAAA,EAAA"}
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAqCA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,gBAAA,GAAmB,gBAAnB,CAAA,CAAA,OAAA,CAAA,EAC7B,gBAD6B,EAAA,
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAqCA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,gBAAA,GAAmB,gBAAnB,CAAA,CAAA,OAAA,CAAA,EAC7B,gBAD6B,EAAA,GAyIjC,MAzIiC,CAyI1B,QAzI0B,CAAA,EAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { BannerFunctionDeclaration } from "./components/banner-function-declaration.mjs";
|
|
2
|
+
import { CommandRouter } from "./components/command-router.mjs";
|
|
2
3
|
import { VirtualCommandEntry } from "./components/virtual-command-entry.mjs";
|
|
3
4
|
import { CommandEntry } from "./components/command-entry.mjs";
|
|
4
5
|
import { getDefaultOptions } from "./helpers/get-default-options.mjs";
|
|
5
|
-
import { createComponent, createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
6
|
+
import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
|
|
6
7
|
import { For, Show, code } from "@alloy-js/core";
|
|
7
8
|
import { VarDeclaration } from "@alloy-js/typescript";
|
|
8
9
|
import { render } from "@powerlines/plugin-alloy/render";
|
|
9
10
|
import theme from "@shell-shock/plugin-theme";
|
|
10
11
|
import { BinEntry } from "@shell-shock/preset-script/components/bin-entry";
|
|
11
|
-
import { CommandRouter } from "@shell-shock/preset-script/components/command-router";
|
|
12
12
|
import { ConsoleBuiltin } from "@shell-shock/preset-script/components/console-builtin";
|
|
13
13
|
import { VirtualHelp } from "@shell-shock/preset-script/components/help";
|
|
14
14
|
import { UtilsBuiltin } from "@shell-shock/preset-script/components/utils-builtin";
|
|
@@ -47,7 +47,9 @@ export {
|
|
|
47
47
|
multiselect,
|
|
48
48
|
password,
|
|
49
49
|
progress,
|
|
50
|
-
spinner
|
|
50
|
+
spinner,
|
|
51
|
+
intro,
|
|
52
|
+
outro
|
|
51
53
|
} from "@clack/prompts";
|
|
52
54
|
|
|
53
55
|
` })]);
|
|
@@ -68,10 +70,22 @@ export {
|
|
|
68
70
|
"writeLine",
|
|
69
71
|
"splitText",
|
|
70
72
|
"colors",
|
|
71
|
-
"help"
|
|
73
|
+
"help",
|
|
74
|
+
"writeLine",
|
|
75
|
+
"splitText",
|
|
76
|
+
"stripAnsi",
|
|
77
|
+
"intro",
|
|
78
|
+
"outro",
|
|
79
|
+
"select",
|
|
80
|
+
"isCancel"
|
|
72
81
|
],
|
|
73
|
-
utils: [
|
|
74
|
-
|
|
82
|
+
utils: [
|
|
83
|
+
"useApp",
|
|
84
|
+
"useArgs",
|
|
85
|
+
"isMinimal",
|
|
86
|
+
"isInteractive",
|
|
87
|
+
"isHelp"
|
|
88
|
+
]
|
|
75
89
|
},
|
|
76
90
|
get prefix() {
|
|
77
91
|
return [
|
|
@@ -89,10 +103,10 @@ export {
|
|
|
89
103
|
get children() {
|
|
90
104
|
return [
|
|
91
105
|
createComponent(VarDeclaration, {
|
|
92
|
-
"
|
|
106
|
+
"let": true,
|
|
93
107
|
name: "args",
|
|
94
108
|
type: "string[]",
|
|
95
|
-
initializer: code`
|
|
109
|
+
initializer: code`useArgs();`
|
|
96
110
|
}),
|
|
97
111
|
createIntrinsic("hbr", {}),
|
|
98
112
|
createComponent(CommandRouter, {
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","theme","BinEntry","
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","theme","BinEntry","ConsoleBuiltin","VirtualHelp","UtilsBuiltin","BannerFunctionDeclaration","CommandEntry","CommandRouter","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","children","order","handler","_self$","builtinImports","console","utils","prefix","_$createIntrinsic","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 { 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 { CommandRouter } from \"./components/command-router\";\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 this.dependencies[\"@clack/prompts\"] = \"^1.0.0\";\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 {code`\n\n// Re-export prompt functions from @clack/prompts\nexport {\n isCancel,\n confirm,\n select,\n text,\n multiselect,\n password,\n progress,\n spinner,\n intro,\n outro\n} from \"@clack/prompts\";\n\n `}\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 \"writeLine\",\n \"splitText\",\n \"stripAnsi\",\n \"intro\",\n \"outro\",\n \"select\",\n \"isCancel\"\n ],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"isMinimal\",\n \"isInteractive\",\n \"isHelp\"\n ]\n }}\n prefix={\n <>\n <BannerFunctionDeclaration />\n <hbr />\n <hbr />\n </>\n }>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n let\n name=\"args\"\n type=\"string[]\"\n initializer={code`useArgs();`}\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;AAChC,SAAKD,aAAa,oBAAoB;;GAExC,MAAME,UAAU;AACd,SAAKN,MACH,+DACD;AAED,WAAOf,OACL,MAAI,CAAAsB,gBAEDjB,cAAY,EAAA,CAAA,EAAAiB,gBACZnB,gBAAc,EAAAoB,UACZ3B,IAAI;;;;;;;;;;;;;;;;eAgBN,CAAA,CAGL,CAAC;;GAEJ;EACD;GACEiB,MAAM;GACNQ,SAAS;IACPG,OAAO;IACP,MAAMC,UAAU;KAAA,MAAAC,SAAA;AACd,UAAKX,MACH,iEACD;AAED,YAAOf,OACL,MAAI,CAAAsB,gBAEDpB,UAAQ;MACPyB,gBAAgB;OACdC,SAAS;QACP;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACD;OACDC,OAAO;QACL;QACA;QACA;QACA;QACA;QAAQ;OAEX;MAAA,IACDC,SAAM;AAAA,cAAA;QAAAR,gBAEDhB,2BAAyB,EAAA,CAAA;QAAAyB,gBAAA,OAAA,EAAA,CAAA;QAAAA,gBAAA,OAAA,EAAA,CAAA;QAAA;;MAAA,IAAAR,WAAA;AAAA,cAAA;QAAAD,gBAK7BxB,MAAI;SAAA,IAACkC,OAAI;AAAA,iBAAEC,OAAOC,KAAKR,OAAKS,SAAS,CAACC,SAAS;;SAAC,IAAAb,WAAA;AAAA,iBAAA;WAAAD,gBAC9CvB,gBAAc;YAAA,OAAA;YAEbc,MAAI;YACJwB,MAAI;YACJC,aAAa1C,IAAI;YAAY,CAAA;WAAAmC,gBAAA,OAAA,EAAA,CAAA;WAAAT,gBAG9Bd,eAAa;YAAC+B,UAAU,EAAE;YAAA,IAAEJ,WAAQ;AAAA,oBAAET,OAAKS,YAAY,EAAE;;YAAA,CAAA;WAAAJ,gBAAA,OAAA,EAAA,CAAA;WAAA;;SAAA,CAAA;QAAAA,gBAAA,OAAA,EAAA,CAAA;QAI3DnC,IAAI;;QACKmC,gBAAA,OAAA,EAAA,CAAA;QAAAA,gBAAA,OAAA,EAAA,CAAA;QAAAT,gBAGTlB,aAAW;SAAA,IACVQ,UAAO;AAAA,iBAAEc,OAAKd;;SAAO,IACrBuB,WAAQ;AAAA,iBAAET,OAAKS,YAAY,EAAE;;SAAA,CAAA;QAAA;;MAAA,CAAA,EAAAb,gBAGhCxB,MAAI;MAAA,IAACkC,OAAI;AAAA,cAAEC,OAAOO,OAAOd,OAAKS,SAAS,CAACC,SAAS;;MAAC,IAAAb,WAAA;AAAA,cAAAD,gBAChDzB,KAAG;QAAA,IAAC4C,OAAI;AAAA,gBAAER,OAAOO,OAAOd,OAAKS,SAAS;;QAAEO,gBAAc;QAAAnB,WACpDoB,UAAKrB,gBACHxB,MAAI;SAAA,IACHkC,OAAI;AAAA,iBAAEW,MAAMC;;SAAS,IACrBC,WAAQ;AAAA,iBAAAvB,gBAAGf,cAAY,EAACuC,SAASH,OAAK,CAAA;;SAAA,IAAApB,WAAA;AAAA,iBAAAD,gBACrCb,qBAAmB,EAACqC,SAASH,OAAK,CAAA;;SAAA,CAAA;QAEtC,CAAA;;MAAA,CAAA,CAIT,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAehC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/preset-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
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": {
|
|
@@ -97,6 +97,20 @@
|
|
|
97
97
|
"default": "./dist/components/command-entry.mjs"
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
|
+
"./components/command-router": {
|
|
101
|
+
"require": {
|
|
102
|
+
"types": "./dist/components/command-router.d.cts",
|
|
103
|
+
"default": "./dist/components/command-router.cjs"
|
|
104
|
+
},
|
|
105
|
+
"import": {
|
|
106
|
+
"types": "./dist/components/command-router.d.mts",
|
|
107
|
+
"default": "./dist/components/command-router.mjs"
|
|
108
|
+
},
|
|
109
|
+
"default": {
|
|
110
|
+
"types": "./dist/components/command-router.d.mts",
|
|
111
|
+
"default": "./dist/components/command-router.mjs"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
100
114
|
"./components/virtual-command-entry": {
|
|
101
115
|
"require": {
|
|
102
116
|
"types": "./dist/components/virtual-command-entry.d.cts",
|
|
@@ -156,18 +170,18 @@
|
|
|
156
170
|
"@powerlines/deepkit": "^0.6.51",
|
|
157
171
|
"@powerlines/plugin-alloy": "^0.20.15",
|
|
158
172
|
"@powerlines/plugin-plugin": "^0.12.222",
|
|
159
|
-
"@shell-shock/core": "^0.8.
|
|
160
|
-
"@shell-shock/plugin-theme": "^0.0.
|
|
161
|
-
"@shell-shock/preset-script": "^0.6.
|
|
162
|
-
"@stryke/path": "
|
|
163
|
-
"@stryke/string-format": "^0.
|
|
173
|
+
"@shell-shock/core": "^0.8.4",
|
|
174
|
+
"@shell-shock/plugin-theme": "^0.0.21",
|
|
175
|
+
"@shell-shock/preset-script": "^0.6.3",
|
|
176
|
+
"@stryke/path": "0.26.6",
|
|
177
|
+
"@stryke/string-format": "^0.14.2",
|
|
164
178
|
"cfonts": "^3.3.1",
|
|
165
179
|
"defu": "^6.1.4",
|
|
166
180
|
"powerlines": "^0.38.38"
|
|
167
181
|
},
|
|
168
182
|
"devDependencies": {
|
|
169
183
|
"@babel/core": "^7.29.0",
|
|
170
|
-
"@types/node": "^22.19.
|
|
184
|
+
"@types/node": "^22.19.11",
|
|
171
185
|
"@types/react": "^19.2.13"
|
|
172
186
|
},
|
|
173
187
|
"publishConfig": {
|
|
@@ -193,5 +207,5 @@
|
|
|
193
207
|
"./package.json": "./package.json"
|
|
194
208
|
}
|
|
195
209
|
},
|
|
196
|
-
"gitHead": "
|
|
210
|
+
"gitHead": "b748bcb948ef2c11eca8e4259c76afb65ce963f0"
|
|
197
211
|
}
|