@shell-shock/preset-cli 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/banner-function-declaration.cjs +68 -0
- package/dist/components/banner-function-declaration.d.cts +11 -0
- package/dist/components/banner-function-declaration.d.cts.map +1 -0
- package/dist/components/banner-function-declaration.d.mts +11 -0
- package/dist/components/banner-function-declaration.d.mts.map +1 -0
- package/dist/components/banner-function-declaration.mjs +68 -0
- package/dist/components/banner-function-declaration.mjs.map +1 -0
- package/dist/components/command-entry.cjs +90 -0
- package/dist/components/command-entry.d.cts +15 -0
- package/dist/components/command-entry.d.cts.map +1 -0
- package/dist/components/command-entry.d.mts +15 -0
- package/dist/components/command-entry.d.mts.map +1 -0
- package/dist/components/command-entry.mjs +89 -0
- package/dist/components/command-entry.mjs.map +1 -0
- package/dist/components/index.cjs +6 -2
- package/dist/components/index.d.cts +4 -2
- package/dist/components/index.d.mts +4 -2
- package/dist/components/index.mjs +4 -2
- package/dist/components/virtual-command-entry.cjs +86 -0
- package/dist/components/virtual-command-entry.d.cts +15 -0
- package/dist/components/virtual-command-entry.d.cts.map +1 -0
- package/dist/components/virtual-command-entry.d.mts +15 -0
- package/dist/components/virtual-command-entry.d.mts.map +1 -0
- package/dist/components/virtual-command-entry.mjs +85 -0
- package/dist/components/virtual-command-entry.mjs.map +1 -0
- package/dist/helpers/get-default-options.cjs +2 -2
- package/dist/helpers/get-default-options.mjs +2 -2
- package/dist/helpers/get-default-options.mjs.map +1 -1
- package/dist/index.cjs +24 -58
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +24 -58
- package/dist/index.mjs.map +1 -1
- package/package.json +49 -19
- package/dist/components/banner.cjs +0 -82
- package/dist/components/banner.d.cts +0 -16
- package/dist/components/banner.d.cts.map +0 -1
- package/dist/components/banner.d.mts +0 -16
- package/dist/components/banner.d.mts.map +0 -1
- package/dist/components/banner.mjs +0 -82
- package/dist/components/banner.mjs.map +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
4
|
+
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
5
|
+
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
6
|
+
let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
|
|
7
|
+
let __shell_shock_preset_script_components_banner_function_declaration = require("@shell-shock/preset-script/components/banner-function-declaration");
|
|
8
|
+
let __shell_shock_preset_script_contexts_theme = require("@shell-shock/preset-script/contexts/theme");
|
|
9
|
+
let cfonts = require("cfonts");
|
|
10
|
+
|
|
11
|
+
//#region src/components/banner-function-declaration.tsx
|
|
12
|
+
/**
|
|
13
|
+
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
14
|
+
*/
|
|
15
|
+
function BannerFunctionDeclaration(props) {
|
|
16
|
+
const { consoleFnName = "log", variant = "primary", command } = props;
|
|
17
|
+
const theme = (0, __shell_shock_preset_script_contexts_theme.useTheme)();
|
|
18
|
+
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
19
|
+
const header = (0, __alloy_js_core.computed)(() => `${theme.labels.banner.header[variant] || (0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context)} v${context.packageJson.version || "1.0.0"}`);
|
|
20
|
+
const description = (0, __alloy_js_core.computed)(() => command?.description || (0, __shell_shock_core_plugin_utils_context_helpers.getAppDescription)(context));
|
|
21
|
+
const footer = (0, __alloy_js_core.computed)(() => theme.labels.banner.footer[variant]);
|
|
22
|
+
const title = (0, __alloy_js_core.computed)(() => (0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context) || /(?:cli|command-line|command line)\s+(?:application|app)?$/.test(header.value.toLowerCase()) ? header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim() : `${header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim()} Command-Line Application`);
|
|
23
|
+
const titleLines = (0, __alloy_js_core.computed)(() => {
|
|
24
|
+
const result = (0, cfonts.render)((0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context), {
|
|
25
|
+
font: "tiny",
|
|
26
|
+
align: "left",
|
|
27
|
+
background: "transparent",
|
|
28
|
+
letterSpacing: 1,
|
|
29
|
+
lineHeight: 1,
|
|
30
|
+
gradient: false,
|
|
31
|
+
transitionGradient: false,
|
|
32
|
+
env: "node"
|
|
33
|
+
});
|
|
34
|
+
if (!result) return [(0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context)];
|
|
35
|
+
return result.array;
|
|
36
|
+
});
|
|
37
|
+
const bannerPadding = (0, __alloy_js_core.computed)(() => Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.banner.outline[variant].left.length + theme.borderStyles.banner.outline[variant].right.length);
|
|
38
|
+
const totalPadding = (0, __alloy_js_core.computed)(() => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value);
|
|
39
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
|
|
40
|
+
name: "banner",
|
|
41
|
+
get doc() {
|
|
42
|
+
return `Write the ${(0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context)} application banner ${command ? `for the ${command.title} command ` : ""}to the console.`;
|
|
43
|
+
},
|
|
44
|
+
get children() {
|
|
45
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_banner_function_declaration.BannerFunctionBodyDeclaration, {
|
|
46
|
+
get header() {
|
|
47
|
+
return header.value;
|
|
48
|
+
},
|
|
49
|
+
get description() {
|
|
50
|
+
return description.value;
|
|
51
|
+
},
|
|
52
|
+
get footer() {
|
|
53
|
+
return footer.value;
|
|
54
|
+
},
|
|
55
|
+
variant,
|
|
56
|
+
consoleFnName,
|
|
57
|
+
command,
|
|
58
|
+
get children() {
|
|
59
|
+
return __alloy_js_core.code`const titleLines = [${titleLines.value.map((line) => JSON.stringify(line.trim())).join(", ")}];
|
|
60
|
+
const title = Math.max(...titleLines.map(line => stripAnsi(line).length)) > Math.max(process.stdout.columns - ${totalPadding.value}, 0) ? "${title.value}" : \`\\n\${titleLines.join("\\n")}\\n\`; `;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
})];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
exports.BannerFunctionDeclaration = BannerFunctionDeclaration;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as _alloy_js_core1 from "@alloy-js/core";
|
|
2
|
+
import { BannerFunctionDeclarationProps } from "@shell-shock/preset-script/components/banner-function-declaration";
|
|
3
|
+
|
|
4
|
+
//#region src/components/banner-function-declaration.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
7
|
+
*/
|
|
8
|
+
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core1.Children;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { BannerFunctionDeclaration };
|
|
11
|
+
//# sourceMappingURL=banner-function-declaration.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner-function-declaration.d.cts","names":[],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAkCgB,iBAAA,yBAAA,CACP,KAAA,EAAA,8BAA8B,CAAA,EAAA,eAAA,CAAA,QAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as _alloy_js_core1 from "@alloy-js/core";
|
|
2
|
+
import { BannerFunctionDeclarationProps } from "@shell-shock/preset-script/components/banner-function-declaration";
|
|
3
|
+
|
|
4
|
+
//#region src/components/banner-function-declaration.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
7
|
+
*/
|
|
8
|
+
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core1.Children;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { BannerFunctionDeclaration };
|
|
11
|
+
//# sourceMappingURL=banner-function-declaration.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner-function-declaration.d.mts","names":[],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAkCgB,iBAAA,yBAAA,CACP,KAAA,EAAA,8BAA8B,CAAA,EAAA,eAAA,CAAA,QAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { code, computed } from "@alloy-js/core";
|
|
3
|
+
import { FunctionDeclaration } from "@alloy-js/typescript";
|
|
4
|
+
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
5
|
+
import { getAppDescription, getAppTitle } from "@shell-shock/core/plugin-utils/context-helpers";
|
|
6
|
+
import { BannerFunctionBodyDeclaration } from "@shell-shock/preset-script/components/banner-function-declaration";
|
|
7
|
+
import { useTheme } from "@shell-shock/preset-script/contexts/theme";
|
|
8
|
+
import { render } from "cfonts";
|
|
9
|
+
|
|
10
|
+
//#region src/components/banner-function-declaration.tsx
|
|
11
|
+
/**
|
|
12
|
+
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
13
|
+
*/
|
|
14
|
+
function BannerFunctionDeclaration(props) {
|
|
15
|
+
const { consoleFnName = "log", variant = "primary", command } = props;
|
|
16
|
+
const theme = useTheme();
|
|
17
|
+
const context = usePowerlines();
|
|
18
|
+
const header = computed(() => `${theme.labels.banner.header[variant] || getAppTitle(context)} v${context.packageJson.version || "1.0.0"}`);
|
|
19
|
+
const description = computed(() => command?.description || getAppDescription(context));
|
|
20
|
+
const footer = computed(() => theme.labels.banner.footer[variant]);
|
|
21
|
+
const title = computed(() => getAppTitle(context) || /(?:cli|command-line|command line)\s+(?:application|app)?$/.test(header.value.toLowerCase()) ? header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim() : `${header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim()} Command-Line Application`);
|
|
22
|
+
const titleLines = computed(() => {
|
|
23
|
+
const result = render(getAppTitle(context), {
|
|
24
|
+
font: "tiny",
|
|
25
|
+
align: "left",
|
|
26
|
+
background: "transparent",
|
|
27
|
+
letterSpacing: 1,
|
|
28
|
+
lineHeight: 1,
|
|
29
|
+
gradient: false,
|
|
30
|
+
transitionGradient: false,
|
|
31
|
+
env: "node"
|
|
32
|
+
});
|
|
33
|
+
if (!result) return [getAppTitle(context)];
|
|
34
|
+
return result.array;
|
|
35
|
+
});
|
|
36
|
+
const bannerPadding = computed(() => Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.banner.outline[variant].left.length + theme.borderStyles.banner.outline[variant].right.length);
|
|
37
|
+
const totalPadding = computed(() => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value);
|
|
38
|
+
return [createComponent(FunctionDeclaration, {
|
|
39
|
+
name: "banner",
|
|
40
|
+
get doc() {
|
|
41
|
+
return `Write the ${getAppTitle(context)} application banner ${command ? `for the ${command.title} command ` : ""}to the console.`;
|
|
42
|
+
},
|
|
43
|
+
get children() {
|
|
44
|
+
return createComponent(BannerFunctionBodyDeclaration, {
|
|
45
|
+
get header() {
|
|
46
|
+
return header.value;
|
|
47
|
+
},
|
|
48
|
+
get description() {
|
|
49
|
+
return description.value;
|
|
50
|
+
},
|
|
51
|
+
get footer() {
|
|
52
|
+
return footer.value;
|
|
53
|
+
},
|
|
54
|
+
variant,
|
|
55
|
+
consoleFnName,
|
|
56
|
+
command,
|
|
57
|
+
get children() {
|
|
58
|
+
return code`const titleLines = [${titleLines.value.map((line) => JSON.stringify(line.trim())).join(", ")}];
|
|
59
|
+
const title = Math.max(...titleLines.map(line => stripAnsi(line).length)) > Math.max(process.stdout.columns - ${totalPadding.value}, 0) ? "${title.value}" : \`\\n\${titleLines.join("\\n")}\\n\`; `;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
})];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
export { BannerFunctionDeclaration };
|
|
68
|
+
//# sourceMappingURL=banner-function-declaration.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner-function-declaration.mjs","names":["code","computed","FunctionDeclaration","usePowerlines","getAppDescription","getAppTitle","BannerFunctionBodyDeclaration","useTheme","render","BannerFunctionDeclaration","props","consoleFnName","variant","command","theme","context","header","labels","banner","packageJson","version","description","footer","title","test","value","toLowerCase","replace","trim","titleLines","result","font","align","background","letterSpacing","lineHeight","gradient","transitionGradient","env","array","bannerPadding","Math","max","padding","app","borderStyles","outline","left","length","right","totalPadding","_$createComponent","name","doc","children","map","line","JSON","stringify","join"],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { BannerFunctionDeclarationProps } from \"@shell-shock/preset-script/components/banner-function-declaration\";\nimport { BannerFunctionBodyDeclaration } from \"@shell-shock/preset-script/components/banner-function-declaration\";\nimport { useTheme } from \"@shell-shock/preset-script/contexts/theme\";\nimport { render } from \"cfonts\";\nimport type { CLIPresetContext } from \"../types/plugin\";\n\n/**\n * A component to generate the `banner` function in the `shell-shock:console` builtin module.\n */\nexport function BannerFunctionDeclaration(\n props: BannerFunctionDeclarationProps\n) {\n const { consoleFnName = \"log\", variant = \"primary\", command } = props;\n\n const theme = useTheme();\n\n const context = usePowerlines<CLIPresetContext>();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context)} v${context.packageJson.version || \"1.0.0\"}`\n );\n const description = computed(\n () => command?.description || getAppDescription(context)\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n\n const title = computed(() =>\n getAppTitle(context) ||\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n header.value.toLowerCase()\n )\n ? header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()\n : `${header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()} Command-Line Application`\n );\n\n const titleLines = computed(() => {\n const result = render(getAppTitle(context), {\n font: \"tiny\",\n align: \"left\",\n background: \"transparent\",\n letterSpacing: 1,\n lineHeight: 1,\n gradient: false,\n transitionGradient: false,\n env: \"node\"\n });\n if (!result) {\n return [getAppTitle(context)];\n }\n\n return result.array;\n });\n\n const bannerPadding = computed(\n () =>\n Math.max(theme.padding.app, 0) * 2 +\n theme.borderStyles.banner.outline[variant].left.length +\n theme.borderStyles.banner.outline[variant].right.length\n );\n const totalPadding = computed(\n () => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value\n );\n\n return (\n <>\n <FunctionDeclaration\n name=\"banner\"\n doc={`Write the ${getAppTitle(context)} application banner ${\n command ? `for the ${command.title} command ` : \"\"\n }to the console.`}>\n <BannerFunctionBodyDeclaration\n header={header.value}\n description={description.value}\n footer={footer.value}\n variant={variant}\n consoleFnName={consoleFnName}\n command={command}>\n {code`const titleLines = [${titleLines.value\n .map(line => JSON.stringify(line.trim()))\n .join(\", \")}];\n const title = Math.max(...titleLines.map(line => stripAnsi(line).length)) > Math.max(process.stdout.columns - ${\n totalPadding.value\n }, 0) ? \"${title.value}\" : \\`\\\\n\\${titleLines.join(\"\\\\n\")}\\\\n\\`; `}\n </BannerFunctionBodyDeclaration>\n </FunctionDeclaration>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAkCA,SAAgBS,0BACdC,OACA;CACA,MAAM,EAAEC,gBAAgB,OAAOC,UAAU,WAAWC,YAAYH;CAEhE,MAAMI,QAAQP,UAAU;CAExB,MAAMQ,UAAUZ,eAAiC;CAEjD,MAAMa,SAASf,eAEX,GAAGa,MAAMG,OAAOC,OAAOF,OAAOJ,YAAYP,YAAYU,QAAQ,CAAA,IAAKA,QAAQI,YAAYC,WAAW,UACrG;CACD,MAAMC,cAAcpB,eACZY,SAASQ,eAAejB,kBAAkBW,QAClD,CAAC;CACD,MAAMO,SAASrB,eAAea,MAAMG,OAAOC,OAAOI,OAAOV,SAAS;CAElE,MAAMW,QAAQtB,eACZI,YAAYU,QAAQ,IACpB,4DAA4DS,KAC1DR,OAAOS,MAAMC,aACf,CAAC,GACGV,OAAOS,MACJE,QAAQ,IAAIZ,QAAQI,YAAYC,WAAW,WAAW,GAAG,CACzDQ,MAAM,GACT,GAAGZ,OAAOS,MACPE,QAAQ,IAAIZ,QAAQI,YAAYC,WAAW,WAAW,GAAG,CACzDQ,MAAM,CAAA,2BACd;CAED,MAAMC,aAAa5B,eAAe;EAChC,MAAM6B,SAAStB,OAAOH,YAAYU,QAAQ,EAAE;GAC1CgB,MAAM;GACNC,OAAO;GACPC,YAAY;GACZC,eAAe;GACfC,YAAY;GACZC,UAAU;GACVC,oBAAoB;GACpBC,KAAK;GACN,CAAC;AACF,MAAI,CAACR,OACH,QAAO,CAACzB,YAAYU,QAAQ,CAAC;AAG/B,SAAOe,OAAOS;GACd;CAEF,MAAMC,gBAAgBvC,eAElBwC,KAAKC,IAAI5B,MAAM6B,QAAQC,KAAK,EAAE,GAAG,IACjC9B,MAAM+B,aAAa3B,OAAO4B,QAAQlC,SAASmC,KAAKC,SAChDlC,MAAM+B,aAAa3B,OAAO4B,QAAQlC,SAASqC,MAAMD,OACpD;CACD,MAAME,eAAejD,eACbwC,KAAKC,IAAI5B,MAAM6B,QAAQzB,QAAQ,EAAE,GAAG,IAAIsB,cAAcf,MAC7D;AAED,QAAA,CAAA0B,gBAEKjD,qBAAmB;EAClBkD,MAAI;EAAA,IACJC,MAAG;AAAA,UAAE,aAAahD,YAAYU,QAAQ,CAAA,sBACpCF,UAAU,WAAWA,QAAQU,MAAK,aAAc,GAAE;;EACnC,IAAA+B,WAAA;AAAA,UAAAH,gBAChB7C,+BAA6B;IAAA,IAC5BU,SAAM;AAAA,YAAEA,OAAOS;;IAAK,IACpBJ,cAAW;AAAA,YAAEA,YAAYI;;IAAK,IAC9BH,SAAM;AAAA,YAAEA,OAAOG;;IACNb;IACMD;IACNE;IAAO,IAAAyC,WAAA;AAAA,YACftD,IAAI,uBAAuB6B,WAAWJ,MACpC8B,KAAIC,SAAQC,KAAKC,UAAUF,KAAK5B,MAAM,CAAC,CAAC,CACxC+B,KAAK,KAAK,CAAA;wHAEbT,aAAazB,MAAK,UACTF,MAAME,MAAK;;IAA4C,CAAA;;EAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_components_banner_function_declaration = require('./banner-function-declaration.cjs');
|
|
3
|
+
const require_components_virtual_command_entry = require('./virtual-command-entry.cjs');
|
|
4
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
6
|
+
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
7
|
+
let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
|
|
8
|
+
let __powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
|
|
9
|
+
let __shell_shock_core_components_options_parser_logic = require("@shell-shock/core/components/options-parser-logic");
|
|
10
|
+
let __shell_shock_preset_script_components_command_entry = require("@shell-shock/preset-script/components/command-entry");
|
|
11
|
+
let __stryke_path_find = require("@stryke/path/find");
|
|
12
|
+
let __stryke_path_join = require("@stryke/path/join");
|
|
13
|
+
let __stryke_path_replace = require("@stryke/path/replace");
|
|
14
|
+
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
15
|
+
let defu = require("defu");
|
|
16
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
17
|
+
|
|
18
|
+
//#region src/components/command-entry.tsx
|
|
19
|
+
/**
|
|
20
|
+
* The command entry point for the Shell Shock project.
|
|
21
|
+
*/
|
|
22
|
+
function CommandEntry(props) {
|
|
23
|
+
const { command, imports, builtinImports, ...rest } = props;
|
|
24
|
+
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
25
|
+
const filePath = (0, __alloy_js_core.computed)(() => (0, __stryke_path_join.joinPaths)(command.path.segments.filter((segment) => !(0, __shell_shock_core_plugin_utils_context_helpers.isPositionalCommandOption)(segment)).join("/"), "index.ts"));
|
|
26
|
+
const commandSourcePath = (0, __alloy_js_core.computed)(() => (0, __stryke_path_replace.replaceExtension)((0, __stryke_path_find.relativePath)((0, __stryke_path_join.joinPaths)(context.entryPath, (0, __stryke_path_find.findFilePath)(filePath.value)), command.entry.input?.file || command.entry.file)));
|
|
27
|
+
const typeDefinition = (0, __alloy_js_core.computed)(() => ({
|
|
28
|
+
...command.entry,
|
|
29
|
+
output: command.id
|
|
30
|
+
}));
|
|
31
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_entry_file.EntryFile, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
32
|
+
get path() {
|
|
33
|
+
return filePath.value;
|
|
34
|
+
},
|
|
35
|
+
get typeDefinition() {
|
|
36
|
+
return typeDefinition.value;
|
|
37
|
+
},
|
|
38
|
+
get imports() {
|
|
39
|
+
return (0, defu.default)(imports ?? {}, { [commandSourcePath.value]: `handle${(0, __stryke_string_format_pascal_case.pascalCase)(command.name)}` });
|
|
40
|
+
},
|
|
41
|
+
get builtinImports() {
|
|
42
|
+
return (0, defu.default)(builtinImports ?? {}, {
|
|
43
|
+
env: ["env", "isCI"],
|
|
44
|
+
console: [
|
|
45
|
+
"warn",
|
|
46
|
+
"error",
|
|
47
|
+
"table",
|
|
48
|
+
"colors",
|
|
49
|
+
"stripAnsi",
|
|
50
|
+
"writeLine",
|
|
51
|
+
"splitText"
|
|
52
|
+
],
|
|
53
|
+
utils: [
|
|
54
|
+
"getArgs",
|
|
55
|
+
"hasFlag",
|
|
56
|
+
"isMinimal"
|
|
57
|
+
]
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
get children() {
|
|
61
|
+
return [
|
|
62
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_components_banner_function_declaration.BannerFunctionDeclaration, { command }),
|
|
63
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
64
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
65
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_core_components_options_parser_logic.OptionsInterfaceDeclaration, { command }),
|
|
66
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
67
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
68
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_entry.CommandHandlerDeclaration, { command })
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
})), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
72
|
+
get each() {
|
|
73
|
+
return Object.values(command.children);
|
|
74
|
+
},
|
|
75
|
+
children: (child) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
76
|
+
get when() {
|
|
77
|
+
return child.isVirtual;
|
|
78
|
+
},
|
|
79
|
+
get fallback() {
|
|
80
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(CommandEntry, { command: child });
|
|
81
|
+
},
|
|
82
|
+
get children() {
|
|
83
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_virtual_command_entry.VirtualCommandEntry, { command: child });
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
})];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
//#endregion
|
|
90
|
+
exports.CommandEntry = CommandEntry;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
3
|
+
import { CommandTree } from "@shell-shock/core/types/command";
|
|
4
|
+
|
|
5
|
+
//#region src/components/command-entry.d.ts
|
|
6
|
+
interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
|
|
7
|
+
command: CommandTree;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The command entry point for the Shell Shock project.
|
|
11
|
+
*/
|
|
12
|
+
declare function CommandEntry(props: CommandEntryProps): _alloy_js_core0.Children;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { CommandEntry, CommandEntryProps };
|
|
15
|
+
//# sourceMappingURL=command-entry.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UAmCiB,iBAAA,SAA0B,KACzC;WAGS;;AAJX;;;AAA2C,iBAU3B,YAAA,CAV2B,KAAA,EAUP,iBAVO,CAAA,EAUU,eAAA,CAAA,QAVV"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
3
|
+
import { CommandTree } from "@shell-shock/core/types/command";
|
|
4
|
+
|
|
5
|
+
//#region src/components/command-entry.d.ts
|
|
6
|
+
interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
|
|
7
|
+
command: CommandTree;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The command entry point for the Shell Shock project.
|
|
11
|
+
*/
|
|
12
|
+
declare function CommandEntry(props: CommandEntryProps): _alloy_js_core0.Children;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { CommandEntry, CommandEntryProps };
|
|
15
|
+
//# sourceMappingURL=command-entry.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UAmCiB,iBAAA,SAA0B,KACzC;WAGS;;AAJX;;;AAA2C,iBAU3B,YAAA,CAV2B,KAAA,EAUP,iBAVO,CAAA,EAUU,eAAA,CAAA,QAVV"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { BannerFunctionDeclaration } from "./banner-function-declaration.mjs";
|
|
2
|
+
import { VirtualCommandEntry } from "./virtual-command-entry.mjs";
|
|
3
|
+
import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
4
|
+
import { For, Show, computed } from "@alloy-js/core";
|
|
5
|
+
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
6
|
+
import { isPositionalCommandOption } from "@shell-shock/core/plugin-utils/context-helpers";
|
|
7
|
+
import { EntryFile } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
8
|
+
import { OptionsInterfaceDeclaration } from "@shell-shock/core/components/options-parser-logic";
|
|
9
|
+
import { CommandHandlerDeclaration } from "@shell-shock/preset-script/components/command-entry";
|
|
10
|
+
import { findFilePath, relativePath } from "@stryke/path/find";
|
|
11
|
+
import { joinPaths } from "@stryke/path/join";
|
|
12
|
+
import { replaceExtension } from "@stryke/path/replace";
|
|
13
|
+
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
14
|
+
import defu from "defu";
|
|
15
|
+
|
|
16
|
+
//#region src/components/command-entry.tsx
|
|
17
|
+
/**
|
|
18
|
+
* The command entry point for the Shell Shock project.
|
|
19
|
+
*/
|
|
20
|
+
function CommandEntry(props) {
|
|
21
|
+
const { command, imports, builtinImports, ...rest } = props;
|
|
22
|
+
const context = usePowerlines();
|
|
23
|
+
const filePath = computed(() => joinPaths(command.path.segments.filter((segment) => !isPositionalCommandOption(segment)).join("/"), "index.ts"));
|
|
24
|
+
const commandSourcePath = computed(() => replaceExtension(relativePath(joinPaths(context.entryPath, findFilePath(filePath.value)), command.entry.input?.file || command.entry.file)));
|
|
25
|
+
const typeDefinition = computed(() => ({
|
|
26
|
+
...command.entry,
|
|
27
|
+
output: command.id
|
|
28
|
+
}));
|
|
29
|
+
return [createComponent(EntryFile, mergeProps(rest, {
|
|
30
|
+
get path() {
|
|
31
|
+
return filePath.value;
|
|
32
|
+
},
|
|
33
|
+
get typeDefinition() {
|
|
34
|
+
return typeDefinition.value;
|
|
35
|
+
},
|
|
36
|
+
get imports() {
|
|
37
|
+
return defu(imports ?? {}, { [commandSourcePath.value]: `handle${pascalCase(command.name)}` });
|
|
38
|
+
},
|
|
39
|
+
get builtinImports() {
|
|
40
|
+
return defu(builtinImports ?? {}, {
|
|
41
|
+
env: ["env", "isCI"],
|
|
42
|
+
console: [
|
|
43
|
+
"warn",
|
|
44
|
+
"error",
|
|
45
|
+
"table",
|
|
46
|
+
"colors",
|
|
47
|
+
"stripAnsi",
|
|
48
|
+
"writeLine",
|
|
49
|
+
"splitText"
|
|
50
|
+
],
|
|
51
|
+
utils: [
|
|
52
|
+
"getArgs",
|
|
53
|
+
"hasFlag",
|
|
54
|
+
"isMinimal"
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
get children() {
|
|
59
|
+
return [
|
|
60
|
+
createComponent(BannerFunctionDeclaration, { command }),
|
|
61
|
+
createIntrinsic("hbr", {}),
|
|
62
|
+
createIntrinsic("hbr", {}),
|
|
63
|
+
createComponent(OptionsInterfaceDeclaration, { command }),
|
|
64
|
+
createIntrinsic("hbr", {}),
|
|
65
|
+
createIntrinsic("hbr", {}),
|
|
66
|
+
createComponent(CommandHandlerDeclaration, { command })
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
})), createComponent(For, {
|
|
70
|
+
get each() {
|
|
71
|
+
return Object.values(command.children);
|
|
72
|
+
},
|
|
73
|
+
children: (child) => createComponent(Show, {
|
|
74
|
+
get when() {
|
|
75
|
+
return child.isVirtual;
|
|
76
|
+
},
|
|
77
|
+
get fallback() {
|
|
78
|
+
return createComponent(CommandEntry, { command: child });
|
|
79
|
+
},
|
|
80
|
+
get children() {
|
|
81
|
+
return createComponent(VirtualCommandEntry, { command: child });
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
})];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
export { CommandEntry };
|
|
89
|
+
//# sourceMappingURL=command-entry.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-entry.mjs","names":["computed","For","Show","usePowerlines","EntryFile","OptionsInterfaceDeclaration","isPositionalCommandOption","CommandHandlerDeclaration","findFilePath","relativePath","joinPaths","replaceExtension","pascalCase","defu","BannerFunctionDeclaration","VirtualCommandEntry","CommandEntry","props","command","imports","builtinImports","rest","context","filePath","path","segments","filter","segment","join","commandSourcePath","entryPath","value","entry","input","file","typeDefinition","output","id","_$createComponent","_$mergeProps","name","env","console","utils","children","_$createIntrinsic","each","Object","values","child","when","isVirtual","fallback"],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { computed, For, Show } from \"@alloy-js/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { OptionsInterfaceDeclaration } from \"@shell-shock/core/components/options-parser-logic\";\nimport { isPositionalCommandOption } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { CommandHandlerDeclaration } from \"@shell-shock/preset-script/components/command-entry\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport interface CommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.path.segments\n .filter(segment => !isPositionalCommandOption(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n const commandSourcePath = computed(() =>\n replaceExtension(\n relativePath(\n joinPaths(context.entryPath, findFilePath(filePath.value)),\n command.entry.input?.file || command.entry.file\n )\n )\n );\n const typeDefinition = computed(() => ({\n ...command.entry,\n output: command.id\n }));\n\n return (\n <>\n <EntryFile\n {...rest}\n path={filePath.value}\n typeDefinition={typeDefinition.value}\n imports={defu(imports ?? {}, {\n [commandSourcePath.value]: `handle${pascalCase(command.name)}`\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isCI\"],\n console: [\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\"\n ],\n utils: [\"getArgs\", \"hasFlag\", \"isMinimal\"]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <OptionsInterfaceDeclaration command={command} />\n <hbr />\n <hbr />\n <CommandHandlerDeclaration command={command} />\n </EntryFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA6CA,SAAgBgB,aAAaC,OAA0B;CACrD,MAAM,EAAEC,SAASC,SAASC,gBAAgB,GAAGC,SAASJ;CAEtD,MAAMK,UAAUnB,eAAiC;CACjD,MAAMoB,WAAWvB,eACfU,UACEQ,QAAQM,KAAKC,SACVC,QAAOC,YAAW,CAACrB,0BAA0BqB,QAAQ,CAAC,CACtDC,KAAK,IAAI,EACZ,WAEJ,CAAC;CACD,MAAMC,oBAAoB7B,eACxBW,iBACEF,aACEC,UAAUY,QAAQQ,WAAWtB,aAAae,SAASQ,MAAM,CAAC,EAC1Db,QAAQc,MAAMC,OAAOC,QAAQhB,QAAQc,MAAME,KAE/C,CACF,CAAC;CACD,MAAMC,iBAAiBnC,gBAAgB;EACrC,GAAGkB,QAAQc;EACXI,QAAQlB,QAAQmB;EACjB,EAAE;AAEH,QAAA,CAAAC,gBAEKlC,WAASmC,WACJlB,MAAI;EAAA,IACRG,OAAI;AAAA,UAAED,SAASQ;;EAAK,IACpBI,iBAAc;AAAA,UAAEA,eAAeJ;;EAAK,IACpCZ,UAAO;AAAA,UAAEN,KAAKM,WAAW,EAAE,EAAE,GAC1BU,kBAAkBE,QAAQ,SAASnB,WAAWM,QAAQsB,KAAK,IAC7D,CAAC;;EAAA,IACFpB,iBAAc;AAAA,UAAEP,KAAKO,kBAAkB,EAAE,EAAE;IACzCqB,KAAK,CAAC,OAAO,OAAO;IACpBC,SAAS;KACP;KACA;KACA;KACA;KACA;KACA;KACA;KACD;IACDC,OAAO;KAAC;KAAW;KAAW;KAAW;IAC1C,CAAC;;EAAA,IAAAC,WAAA;AAAA,UAAA;IAAAN,gBACDxB,2BAAyB,EAAUI,SAAO,CAAA;IAAA2B,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAP,gBAG1CjC,6BAA2B,EAAUa,SAAO,CAAA;IAAA2B,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAP,gBAG5C/B,2BAAyB,EAAUW,SAAO,CAAA;IAAA;;EAAA,CAAA,CAAA,EAAAoB,gBAE5CrC,KAAG;EAAA,IAAC6C,OAAI;AAAA,UAAEC,OAAOC,OAAO9B,QAAQ0B,SAAS;;EAAAA,WACvCK,UAAKX,gBACHpC,MAAI;GAAA,IACHgD,OAAI;AAAA,WAAED,MAAME;;GAAS,IACrBC,WAAQ;AAAA,WAAAd,gBAAGtB,cAAY,EAACE,SAAS+B,OAAK,CAAA;;GAAA,IAAAL,WAAA;AAAA,WAAAN,gBACrCvB,qBAAmB,EAACG,SAAS+B,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_components_banner_function_declaration = require('./banner-function-declaration.cjs');
|
|
2
|
+
const require_components_virtual_command_entry = require('./virtual-command-entry.cjs');
|
|
3
|
+
const require_components_command_entry = require('./command-entry.cjs');
|
|
2
4
|
|
|
3
|
-
exports.BannerFunctionDeclaration =
|
|
5
|
+
exports.BannerFunctionDeclaration = require_components_banner_function_declaration.BannerFunctionDeclaration;
|
|
6
|
+
exports.CommandEntry = require_components_command_entry.CommandEntry;
|
|
7
|
+
exports.VirtualCommandEntry = require_components_virtual_command_entry.VirtualCommandEntry;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import { BannerFunctionDeclaration
|
|
2
|
-
|
|
1
|
+
import { BannerFunctionDeclaration } from "./banner-function-declaration.cjs";
|
|
2
|
+
import { CommandEntry, CommandEntryProps } from "./command-entry.cjs";
|
|
3
|
+
import { VirtualCommandEntry, VirtualCommandEntryProps } from "./virtual-command-entry.cjs";
|
|
4
|
+
export { BannerFunctionDeclaration, CommandEntry, CommandEntryProps, VirtualCommandEntry, VirtualCommandEntryProps };
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import { BannerFunctionDeclaration
|
|
2
|
-
|
|
1
|
+
import { BannerFunctionDeclaration } from "./banner-function-declaration.mjs";
|
|
2
|
+
import { CommandEntry, CommandEntryProps } from "./command-entry.mjs";
|
|
3
|
+
import { VirtualCommandEntry, VirtualCommandEntryProps } from "./virtual-command-entry.mjs";
|
|
4
|
+
export { BannerFunctionDeclaration, CommandEntry, CommandEntryProps, VirtualCommandEntry, VirtualCommandEntryProps };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import { BannerFunctionDeclaration } from "./banner.mjs";
|
|
1
|
+
import { BannerFunctionDeclaration } from "./banner-function-declaration.mjs";
|
|
2
|
+
import { VirtualCommandEntry } from "./virtual-command-entry.mjs";
|
|
3
|
+
import { CommandEntry } from "./command-entry.mjs";
|
|
2
4
|
|
|
3
|
-
export { BannerFunctionDeclaration };
|
|
5
|
+
export { BannerFunctionDeclaration, CommandEntry, VirtualCommandEntry };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_components_banner_function_declaration = require('./banner-function-declaration.cjs');
|
|
3
|
+
const require_components_command_entry = require('./command-entry.cjs');
|
|
4
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
6
|
+
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
7
|
+
let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
|
|
8
|
+
let __stryke_path_join = require("@stryke/path/join");
|
|
9
|
+
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
10
|
+
let defu = require("defu");
|
|
11
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
12
|
+
let __powerlines_plugin_alloy_typescript_components_typescript_file = require("@powerlines/plugin-alloy/typescript/components/typescript-file");
|
|
13
|
+
let __shell_shock_preset_script_components_virtual_command_entry = require("@shell-shock/preset-script/components/virtual-command-entry");
|
|
14
|
+
|
|
15
|
+
//#region src/components/virtual-command-entry.tsx
|
|
16
|
+
/**
|
|
17
|
+
* The virtual command entry point for the Shell Shock project.
|
|
18
|
+
*/
|
|
19
|
+
function VirtualCommandEntry(props) {
|
|
20
|
+
const { command, imports, builtinImports, ...rest } = props;
|
|
21
|
+
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
22
|
+
const filePath = (0, __alloy_js_core.computed)(() => (0, __stryke_path_join.joinPaths)(context.entryPath, command.path.segments.filter((segment) => !(0, __shell_shock_core_plugin_utils_context_helpers.isPositionalCommandOption)(segment)).join("/"), "index.ts"));
|
|
23
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_typescript_file.TypescriptFile, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
24
|
+
get path() {
|
|
25
|
+
return filePath.value;
|
|
26
|
+
},
|
|
27
|
+
get imports() {
|
|
28
|
+
return (0, defu.default)({ didyoumean2: [
|
|
29
|
+
{
|
|
30
|
+
name: "didYouMean",
|
|
31
|
+
default: true
|
|
32
|
+
},
|
|
33
|
+
{ name: "ReturnTypeEnums" },
|
|
34
|
+
{ name: "ThresholdTypeEnums" }
|
|
35
|
+
] }, imports ?? {}, Object.entries(command.children).filter(([, child]) => child.isVirtual).reduce((ret, [name, child]) => {
|
|
36
|
+
ret[`./${child.name}`] = [{
|
|
37
|
+
name: "handler",
|
|
38
|
+
alias: `handle${(0, __stryke_string_format_pascal_case.pascalCase)(name)}`
|
|
39
|
+
}];
|
|
40
|
+
return ret;
|
|
41
|
+
}, {}));
|
|
42
|
+
},
|
|
43
|
+
get builtinImports() {
|
|
44
|
+
return (0, defu.default)(builtinImports ?? {}, {
|
|
45
|
+
console: [
|
|
46
|
+
"warn",
|
|
47
|
+
"error",
|
|
48
|
+
"table",
|
|
49
|
+
"colors",
|
|
50
|
+
"writeLine"
|
|
51
|
+
],
|
|
52
|
+
utils: [
|
|
53
|
+
"getArgs",
|
|
54
|
+
"hasFlag",
|
|
55
|
+
"isMinimal"
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
get children() {
|
|
60
|
+
return [
|
|
61
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_components_banner_function_declaration.BannerFunctionDeclaration, { command }),
|
|
62
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
63
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
64
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_virtual_command_entry.VirtualCommandHandlerDeclaration, { command })
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
})), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
68
|
+
get each() {
|
|
69
|
+
return Object.values(command.children);
|
|
70
|
+
},
|
|
71
|
+
children: (child) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
72
|
+
get when() {
|
|
73
|
+
return child.isVirtual;
|
|
74
|
+
},
|
|
75
|
+
get fallback() {
|
|
76
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
|
|
77
|
+
},
|
|
78
|
+
get children() {
|
|
79
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(VirtualCommandEntry, { command: child });
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
})];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
//#endregion
|
|
86
|
+
exports.VirtualCommandEntry = VirtualCommandEntry;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
3
|
+
import { CommandTree } from "@shell-shock/core/types/command";
|
|
4
|
+
|
|
5
|
+
//#region src/components/virtual-command-entry.d.ts
|
|
6
|
+
interface VirtualCommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
|
|
7
|
+
command: CommandTree;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The virtual command entry point for the Shell Shock project.
|
|
11
|
+
*/
|
|
12
|
+
declare function VirtualCommandEntry(props: VirtualCommandEntryProps): _alloy_js_core0.Children;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { VirtualCommandEntry, VirtualCommandEntryProps };
|
|
15
|
+
//# sourceMappingURL=virtual-command-entry.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual-command-entry.d.cts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UAiCiB,wBAAA,SAAiC,KAChD;WAGS;;AAJX;;;AAAkD,iBAUlC,mBAAA,CAVkC,KAAA,EAUP,wBAVO,CAAA,EAUiB,eAAA,CAAA,QAVjB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
3
|
+
import { CommandTree } from "@shell-shock/core/types/command";
|
|
4
|
+
|
|
5
|
+
//#region src/components/virtual-command-entry.d.ts
|
|
6
|
+
interface VirtualCommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
|
|
7
|
+
command: CommandTree;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The virtual command entry point for the Shell Shock project.
|
|
11
|
+
*/
|
|
12
|
+
declare function VirtualCommandEntry(props: VirtualCommandEntryProps): _alloy_js_core0.Children;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { VirtualCommandEntry, VirtualCommandEntryProps };
|
|
15
|
+
//# sourceMappingURL=virtual-command-entry.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual-command-entry.d.mts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UAiCiB,wBAAA,SAAiC,KAChD;WAGS;;AAJX;;;AAAkD,iBAUlC,mBAAA,CAVkC,KAAA,EAUP,wBAVO,CAAA,EAUiB,eAAA,CAAA,QAVjB"}
|