@shell-shock/preset-cli 0.8.17 → 0.8.19
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-builtin.cjs +2 -2
- package/dist/components/banner-builtin.d.cts.map +1 -1
- package/dist/components/banner-builtin.d.mts +1 -1
- package/dist/components/banner-builtin.d.mts.map +1 -1
- package/dist/components/banner-builtin.mjs +2 -2
- package/dist/components/banner-builtin.mjs.map +1 -1
- package/dist/components/command-entry.cjs +3 -3
- package/dist/components/command-entry.mjs +3 -3
- package/dist/components/command-router.cjs +1 -1
- package/dist/components/command-router.mjs +1 -1
- package/dist/components/upgrade-builtin.cjs +1 -1
- package/dist/components/upgrade-builtin.mjs +1 -1
- package/dist/index.cjs +5 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -2
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-banner/dist/components/banner-builtin.cjs +2 -2
- package/dist/plugin-banner/dist/components/banner-builtin.mjs +1 -1
- package/dist/plugin-banner/dist/components/banner-function-declaration.cjs +8 -5
- package/dist/plugin-banner/dist/components/banner-function-declaration.mjs +8 -5
- package/dist/plugin-banner/dist/components/banner-function-declaration.mjs.map +1 -1
- package/dist/plugin-banner/dist/components/index.cjs +2 -0
- package/dist/plugin-banner/dist/components/index.mjs +4 -0
- package/dist/plugin-banner/dist/index.cjs +70 -0
- package/dist/plugin-banner/dist/index.d.cts +2 -0
- package/dist/plugin-banner/dist/index.d.mts +2 -0
- package/dist/plugin-banner/dist/index.mjs +68 -0
- package/dist/plugin-banner/dist/index.mjs.map +1 -0
- package/dist/plugin-banner/dist/types/plugin.d.cts +31 -0
- package/dist/plugin-banner/dist/types/plugin.d.cts.map +1 -0
- package/dist/plugin-banner/dist/types/plugin.d.mts +31 -0
- package/dist/plugin-banner/dist/types/plugin.d.mts.map +1 -0
- package/dist/plugin-help/dist/components/display.cjs +20 -8
- package/dist/plugin-help/dist/components/display.mjs +20 -8
- package/dist/plugin-help/dist/components/display.mjs.map +1 -1
- package/dist/plugin-help/dist/components/help-builtin.cjs +3 -3
- package/dist/plugin-help/dist/components/help-builtin.mjs +3 -3
- package/dist/plugin-help/dist/components/help-command.cjs +1 -1
- package/dist/plugin-help/dist/components/help-command.mjs +1 -1
- package/dist/plugin-help/dist/index.cjs +6 -4
- package/dist/plugin-help/dist/index.mjs +5 -3
- package/dist/plugin-help/dist/index.mjs.map +1 -1
- package/dist/plugin-help/dist/types/plugin.d.cts +1 -1
- package/dist/plugin-help/dist/types/plugin.d.mts +1 -1
- package/dist/types/plugin.d.cts +5 -4
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +5 -4
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +8 -8
|
@@ -5,8 +5,8 @@ const require_banner_builtin = require('../plugin-banner/dist/components/banner-
|
|
|
5
5
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
6
|
let _alloy_js_core = require("@alloy-js/core");
|
|
7
7
|
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
8
|
-
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
9
8
|
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
9
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
10
10
|
let _shell_shock_plugin_theme_contexts_theme = require("@shell-shock/plugin-theme/contexts/theme");
|
|
11
11
|
let cfonts = require("cfonts");
|
|
12
12
|
|
|
@@ -23,7 +23,7 @@ function BannerFunctionBodyDeclaration(props) {
|
|
|
23
23
|
const title = (0, _alloy_js_core.computed)(() => (0, _shell_shock_core_plugin_utils.getAppTitle)(context, true).replace(`v${context.packageJson.version || "1.0.0"}`, ""));
|
|
24
24
|
const description = (0, _alloy_js_core.computed)(() => command?.description || (0, _shell_shock_core_plugin_utils.getAppDescription)(context));
|
|
25
25
|
const titleLines = (0, _alloy_js_core.computed)(() => {
|
|
26
|
-
const result = (0, cfonts.render)((0, _shell_shock_core_plugin_utils.getAppTitle)(context, true), {
|
|
26
|
+
const result = context.config.banner.title ? { array: context.config.banner.title.split("\n") } : (0, cfonts.render)((0, _shell_shock_core_plugin_utils.getAppTitle)(context, true), {
|
|
27
27
|
font: "tiny",
|
|
28
28
|
align: "left",
|
|
29
29
|
background: "transparent",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner-builtin.d.cts","names":[],"sources":["../../src/components/banner-builtin.tsx"],"mappings":";;;;;;;;;iBAqCgB,6BAAA,CACd,KAAA,EAAO,IAAA,CACL,kCAAA,yCADS,iBAAA,CAGV,QAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"banner-builtin.d.cts","names":[],"sources":["../../src/components/banner-builtin.tsx"],"mappings":";;;;;;;;;iBAqCgB,6BAAA,CACd,KAAA,EAAO,IAAA,CACL,kCAAA,yCADS,iBAAA,CAGV,QAAA;AAAA,KAyES,kBAAA,GAAqB,IAAA,CAC/B,gBAAA;;;;EAMA,OAAA,EAAS,WAAA;AAAA;;;;iBAMK,aAAA,CAAc,KAAA,EAAO,kBAAA,GAAkB,iBAAA,CAAA,QAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BannerFunctionBodyDeclarationProps } from "../plugin-banner/dist/components/banner-function-declaration.mjs";
|
|
2
2
|
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
|
-
import { CommandTree } from "@shell-shock/core";
|
|
4
3
|
import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
4
|
+
import { CommandTree } from "@shell-shock/core";
|
|
5
5
|
|
|
6
6
|
//#region src/components/banner-builtin.d.ts
|
|
7
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner-builtin.d.mts","names":[],"sources":["../../src/components/banner-builtin.tsx"],"mappings":";;;;;;;;;iBAqCgB,6BAAA,CACd,KAAA,EAAO,IAAA,CACL,kCAAA,yCADS,iBAAA,CAGV,QAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"banner-builtin.d.mts","names":[],"sources":["../../src/components/banner-builtin.tsx"],"mappings":";;;;;;;;;iBAqCgB,6BAAA,CACd,KAAA,EAAO,IAAA,CACL,kCAAA,yCADS,iBAAA,CAGV,QAAA;AAAA,KAyES,kBAAA,GAAqB,IAAA,CAC/B,gBAAA;;;;EAMA,OAAA,EAAS,WAAA;AAAA;;;;iBAMK,aAAA,CAAc,KAAA,EAAO,kBAAA,GAAkB,iBAAA,CAAA,QAAA"}
|
|
@@ -3,8 +3,8 @@ import { BannerBuiltin as BannerBuiltin$1 } from "../plugin-banner/dist/componen
|
|
|
3
3
|
import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
4
4
|
import { Show, code, computed, splitProps } from "@alloy-js/core";
|
|
5
5
|
import { getAppDescription, getAppTitle } from "@shell-shock/core/plugin-utils";
|
|
6
|
-
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
7
6
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
7
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
8
8
|
import { useTheme } from "@shell-shock/plugin-theme/contexts/theme";
|
|
9
9
|
import { render } from "cfonts";
|
|
10
10
|
|
|
@@ -21,7 +21,7 @@ function BannerFunctionBodyDeclaration(props) {
|
|
|
21
21
|
const title = computed(() => getAppTitle(context, true).replace(`v${context.packageJson.version || "1.0.0"}`, ""));
|
|
22
22
|
const description = computed(() => command?.description || getAppDescription(context));
|
|
23
23
|
const titleLines = computed(() => {
|
|
24
|
-
const result = render(getAppTitle(context, true), {
|
|
24
|
+
const result = context.config.banner.title ? { array: context.config.banner.title.split("\n") } : render(getAppTitle(context, true), {
|
|
25
25
|
font: "tiny",
|
|
26
26
|
align: "left",
|
|
27
27
|
background: "transparent",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner-builtin.mjs","names":[],"sources":["../../src/components/banner-builtin.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, Show, splitProps } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport type { CommandTree } from \"@shell-shock/core\";\nimport { getAppDescription, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { BannerBuiltin as BaseBannerBuiltin } from \"@shell-shock/plugin-banner/components/banner-builtin\";\nimport type { BannerFunctionBodyDeclarationProps } from \"@shell-shock/plugin-banner/components/banner-function-declaration\";\nimport {\n BannerFunctionDeclarationWrapper,\n BannerFunctionBodyDeclaration as BaseBannerFunctionBodyDeclaration\n} from \"@shell-shock/plugin-banner/components/banner-function-declaration\";\nimport { useTheme } from \"@shell-shock/plugin-theme/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 BannerFunctionBodyDeclaration(\n props: Omit<\n BannerFunctionBodyDeclarationProps,\n \"header\" | \"description\" | \"footer\"\n >\n) {\n const { consoleFnName = \"log\", variant = \"primary\", command } = props;\n\n const theme = useTheme();\n const context = usePowerlines<CLIPresetContext>();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context)} v${\n context.packageJson.version || \"1.0.0\"\n }`\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n const title = computed(() =>\n getAppTitle(context, true).replace(\n `v${context.packageJson.version || \"1.0.0\"}`,\n \"\"\n )\n );\n const description = computed(\n () => command?.description || getAppDescription(context)\n );\n\n const titleLines = computed(() => {\n const result = render(getAppTitle(context, true), {\n
|
|
1
|
+
{"version":3,"file":"banner-builtin.mjs","names":[],"sources":["../../src/components/banner-builtin.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, Show, splitProps } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport type { CommandTree } from \"@shell-shock/core\";\nimport { getAppDescription, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { BannerBuiltin as BaseBannerBuiltin } from \"@shell-shock/plugin-banner/components/banner-builtin\";\nimport type { BannerFunctionBodyDeclarationProps } from \"@shell-shock/plugin-banner/components/banner-function-declaration\";\nimport {\n BannerFunctionDeclarationWrapper,\n BannerFunctionBodyDeclaration as BaseBannerFunctionBodyDeclaration\n} from \"@shell-shock/plugin-banner/components/banner-function-declaration\";\nimport { useTheme } from \"@shell-shock/plugin-theme/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 BannerFunctionBodyDeclaration(\n props: Omit<\n BannerFunctionBodyDeclarationProps,\n \"header\" | \"description\" | \"footer\"\n >\n) {\n const { consoleFnName = \"log\", variant = \"primary\", command } = props;\n\n const theme = useTheme();\n const context = usePowerlines<CLIPresetContext>();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context)} v${\n context.packageJson.version || \"1.0.0\"\n }`\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n const title = computed(() =>\n getAppTitle(context, true).replace(\n `v${context.packageJson.version || \"1.0.0\"}`,\n \"\"\n )\n );\n const description = computed(\n () => command?.description || getAppDescription(context)\n );\n\n const titleLines = computed(() => {\n const result = context.config.banner.title\n ? { array: context.config.banner.title.split(\"\\n\") }\n : render(getAppTitle(context, true), {\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, true)} Command-Line Interface`];\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 ?? 0) +\n (theme.borderStyles.banner.outline[variant]?.right.length ?? 0)\n );\n const totalPadding = computed(\n () => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value\n );\n\n return (\n <BaseBannerFunctionBodyDeclaration\n header={header.value}\n description={description.value}\n footer={footer.value}\n variant={variant}\n consoleFnName={consoleFnName}\n command={command}\n insertNewlineAfterDescription>\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 </BaseBannerFunctionBodyDeclaration>\n );\n}\n\nexport type BannerBuiltinProps = Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> & {\n /**\n * The command to generate the `banner` function declaration for.\n */\n command: CommandTree;\n};\n\n/**\n * A built-in banner module for Shell Shock.\n */\nexport function BannerBuiltin(props: BannerBuiltinProps) {\n const [{ command, children }, rest] = splitProps(props, [\n \"command\",\n \"children\"\n ]);\n\n return (\n <BaseBannerBuiltin {...rest} command={command}>\n <BannerFunctionDeclarationWrapper command={command}>\n <BannerFunctionBodyDeclaration command={command} />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BannerFunctionDeclarationWrapper>\n </BaseBannerBuiltin>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAmCA,SAAe,8BAAyB,OAAoD;CAC1F,MAAA,EACF,gBAAgB,OACd,UAAW,WACT,YACC;CACH,MAAA,QAAA,UAAA;CACA,MAAA,UAAA,eAAA;CACA,MAAM,SAAE,eAAsB,GAAC,MAAQ,OAAG,OAAU,OAAQ,YAAS,YAAA,QAAA,CAAA,IAAA,QAAA,YAAA,WAAA,UAAA;;CAErE,MAAM,QAAQ,eAAU,YAAA,SAAA,KAAA,CAAA,QAAA,IAAA,QAAA,YAAA,WAAA,WAAA,GAAA,CAAA;CACxB,MAAM,cAAU,eAAc,SAAA,eAAmB,kBAAA,QAAA,CAAA;;EAEjD,MAAM,SAAS,QAAQ,OAAA,OAAA,QAAA,EACnB,OAAE,QAAA,OAAA,OAAA,MAAA,MAAA,KAAA,EACH,GAAG,OAAO,YAAO,SAAc,KAAA,EAAO;GACrC,MAAE;GACF,OAAC;GACJ,YAAA;GACD,eAAe;GACf,YAAc;GACZ,UAAY;GACV,oBAAY;GACZ,KAAC;GACH,CAAA;AACD,MAAA,CAAA,OACD,QAAM,CAAA,GAAA,YAAc,SAAQ,KAAA,CAAA,yBAAA;AAE3B,SAAA,OAAA;;CAED,MAAM,gBAAa,eAAe,KAAA,IAAA,MAAA,QAAA,KAAA,EAAA,GAAA,KAAA,MAAA,aAAA,OAAA,QAAA,UAAA,KAAA,UAAA,MAAA,MAAA,aAAA,OAAA,QAAA,UAAA,MAAA,UAAA,GAAA;CAClC,MAAE,eAAe,eAAe,KAAO,IAAA,MAAA,QAAA,QAAA,EAAA,GAAA,IAAA,cAAA,MAAA;AACvC,QAAO,gBAAgB,iCAAgC;EACrD,IAAI,SAAO;AACT,UAAI,OAAO;;EAEb,IAAI,cAAc;AAChB,UAAI,YAAe;;EAErB,IAAI,SAAE;AACJ,UAAI,OAAA;;EAEA;EACO;EACJ;EACT,+BAAA;;AAEA,UAAO,IAAM,uBAAM,WAAA,MAAA,KAAA,SAAA,KAAA,UAAA,KAAA,MAAA,CAAA,CAAA,CAAA,KAAA,KAAA,CAAA;wHACnB,aAAA,MAAA,UAAA,MAAA,MAAA;;EAEF,CAAA;;;;;AAYF,SAAc,cAAY,OAAA;CACxB,MAAI,CAAA,EACF,SACA,YACC,QAAC,WAAe,OAAA,CAAA,WAAa,WAAA,CAAA;AAChC,QAAI,gBAAgB,iBAAA,WAAA,MAAA;EAChB;EACF,IAAG,WAAW;AACZ,UAAO,gBAAa,kCAAsB;IAC/B;IACT,IAAA,WAAc;AACZ,YAAA;MAAA,gBAAa,+BAAA,EACJ,SACb,CAAA;MAAA,gBAAA,SAAiC,EAAA,CAAA;MAAA,gBAAA,MAAA;OACpC,IAAA,OAAA;AACH,eAAA,QAAA,SAAA;;OAEY;OACV,CAAA;MAAA;;IAEE,CAAA;;EAED,CAAC,CAAC"}
|
|
@@ -5,18 +5,18 @@ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
|
5
5
|
let _alloy_js_core = require("@alloy-js/core");
|
|
6
6
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
7
7
|
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
8
|
-
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
9
8
|
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
10
|
-
let
|
|
9
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
11
10
|
let defu = require("defu");
|
|
12
11
|
defu = require_runtime.__toESM(defu);
|
|
13
12
|
let _stryke_path_join = require("@stryke/path/join");
|
|
13
|
+
let _shell_shock_core = require("@shell-shock/core");
|
|
14
|
+
let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
14
15
|
let _powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
|
|
15
16
|
let _shell_shock_core_components_command_validation_logic = require("@shell-shock/core/components/command-validation-logic");
|
|
16
17
|
let _shell_shock_preset_script_components_command_entry = require("@shell-shock/preset-script/components/command-entry");
|
|
17
18
|
let _stryke_path_find = require("@stryke/path/find");
|
|
18
19
|
let _stryke_path_replace = require("@stryke/path/replace");
|
|
19
|
-
let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
20
20
|
let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
21
21
|
|
|
22
22
|
//#region src/components/command-entry.tsx
|
|
@@ -3,17 +3,17 @@ import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
|
3
3
|
import { For, Match, Show, Switch, code, computed } from "@alloy-js/core";
|
|
4
4
|
import { ElseIfClause, IfStatement } from "@alloy-js/typescript";
|
|
5
5
|
import { formatDescription, formatShortDescription, isDynamicPathSegment } from "@shell-shock/core/plugin-utils";
|
|
6
|
-
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
7
6
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
8
|
-
import {
|
|
7
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
9
8
|
import defu from "defu";
|
|
10
9
|
import { joinPaths } from "@stryke/path/join";
|
|
10
|
+
import { CommandParameterKinds } from "@shell-shock/core";
|
|
11
|
+
import { camelCase } from "@stryke/string-format/camel-case";
|
|
11
12
|
import { EntryFile } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
12
13
|
import { CommandValidationLogic } from "@shell-shock/core/components/command-validation-logic";
|
|
13
14
|
import { CommandHandlerDeclaration } from "@shell-shock/preset-script/components/command-entry";
|
|
14
15
|
import { findFilePath, relativePath } from "@stryke/path/find";
|
|
15
16
|
import { replaceExtension } from "@stryke/path/replace";
|
|
16
|
-
import { camelCase } from "@stryke/string-format/camel-case";
|
|
17
17
|
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
18
18
|
|
|
19
19
|
//#region src/components/command-entry.tsx
|
|
@@ -4,8 +4,8 @@ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
|
4
4
|
let _alloy_js_core = require("@alloy-js/core");
|
|
5
5
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
6
6
|
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
7
|
-
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
8
7
|
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
8
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
9
9
|
let _shell_shock_preset_script_components = require("@shell-shock/preset-script/components");
|
|
10
10
|
|
|
11
11
|
//#region src/components/command-router.tsx
|
|
@@ -2,8 +2,8 @@ import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
|
2
2
|
import { For, code } from "@alloy-js/core";
|
|
3
3
|
import { IfStatement } from "@alloy-js/typescript";
|
|
4
4
|
import { getAppBin } from "@shell-shock/core/plugin-utils";
|
|
5
|
-
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
6
5
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
6
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
7
7
|
import { CommandRouter as CommandRouter$1, CommandRouterBody } from "@shell-shock/preset-script/components";
|
|
8
8
|
|
|
9
9
|
//#region src/components/command-router.tsx
|
|
@@ -4,8 +4,8 @@ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
|
4
4
|
let _alloy_js_core = require("@alloy-js/core");
|
|
5
5
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
6
6
|
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
7
|
-
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
8
7
|
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
8
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
9
9
|
let defu = require("defu");
|
|
10
10
|
let _shell_shock_plugin_upgrade_components_upgrade_builtin = require("@shell-shock/plugin-upgrade/components/upgrade-builtin");
|
|
11
11
|
|
|
@@ -2,8 +2,8 @@ import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
|
2
2
|
import { Show, code, splitProps } from "@alloy-js/core";
|
|
3
3
|
import { ElseClause, ElseIfClause, FunctionDeclaration, IfStatement, VarDeclaration } from "@alloy-js/typescript";
|
|
4
4
|
import { getAppBin, getAppTitle } from "@shell-shock/core/plugin-utils";
|
|
5
|
-
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
6
5
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
6
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
7
7
|
import { defu as defu$1 } from "defu";
|
|
8
8
|
import { UpgradeBuiltin as UpgradeBuiltin$1 } from "@shell-shock/plugin-upgrade/components/upgrade-builtin";
|
|
9
9
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
2
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_index = require('./plugin-
|
|
3
|
+
const require_index = require('./plugin-banner/dist/index.cjs');
|
|
4
|
+
const require_index$1 = require('./plugin-help/dist/index.cjs');
|
|
4
5
|
const require_components_banner_builtin = require('./components/banner-builtin.cjs');
|
|
5
6
|
const require_components_command_router = require('./components/command-router.cjs');
|
|
6
7
|
const require_components_virtual_command_entry = require('./components/virtual-command-entry.cjs');
|
|
@@ -14,9 +15,9 @@ let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
|
14
15
|
let _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy/core/components");
|
|
15
16
|
let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
16
17
|
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
18
|
+
let _stryke_path = require("@stryke/path");
|
|
17
19
|
let _shell_shock_plugin_console = require("@shell-shock/plugin-console");
|
|
18
20
|
_shell_shock_plugin_console = require_runtime.__toESM(_shell_shock_plugin_console);
|
|
19
|
-
let _stryke_path = require("@stryke/path");
|
|
20
21
|
let _shell_shock_plugin_prompts = require("@shell-shock/plugin-prompts");
|
|
21
22
|
_shell_shock_plugin_prompts = require_runtime.__toESM(_shell_shock_plugin_prompts);
|
|
22
23
|
let _shell_shock_plugin_upgrade = require("@shell-shock/plugin-upgrade");
|
|
@@ -33,6 +34,7 @@ let _shell_shock_preset_script_components_bin_entry = require("@shell-shock/pres
|
|
|
33
34
|
const plugin = (options = {}) => {
|
|
34
35
|
return [
|
|
35
36
|
...(0, _shell_shock_plugin_console.default)(options),
|
|
37
|
+
...require_index$1.plugin(options),
|
|
36
38
|
...require_index.plugin(options),
|
|
37
39
|
...(0, _shell_shock_plugin_prompts.default)(options),
|
|
38
40
|
(0, _shell_shock_plugin_upgrade.default)(options),
|
|
@@ -61,6 +63,7 @@ const plugin = (options = {}) => {
|
|
|
61
63
|
path: null,
|
|
62
64
|
segments: [],
|
|
63
65
|
alias: [],
|
|
66
|
+
tags: [],
|
|
64
67
|
options: Object.fromEntries(this.options.map((option) => [option.name, option])),
|
|
65
68
|
entry: { file: (0, _stryke_path.joinPaths)(this.entryPath, "bin.ts") },
|
|
66
69
|
args: [],
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;AAkDA;;;;cAAa,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KACR,MAAA,CAAO,QAAA"}
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;AAkDA;;;;cAAa,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KACR,MAAA,CAAO,QAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { plugin as plugin$1 } from "./plugin-
|
|
1
|
+
import { plugin as plugin$1 } from "./plugin-banner/dist/index.mjs";
|
|
2
|
+
import { plugin as plugin$2 } from "./plugin-help/dist/index.mjs";
|
|
2
3
|
import { BannerBuiltin } from "./components/banner-builtin.mjs";
|
|
3
4
|
import { CommandRouter } from "./components/command-router.mjs";
|
|
4
5
|
import { VirtualCommandEntry } from "./components/virtual-command-entry.mjs";
|
|
@@ -12,8 +13,8 @@ import { VarDeclaration } from "@alloy-js/typescript";
|
|
|
12
13
|
import { Spacing } from "@powerlines/plugin-alloy/core/components";
|
|
13
14
|
import { render } from "@powerlines/plugin-alloy/render";
|
|
14
15
|
import { getAppDescription, getAppName, getAppTitle, getCommandList } from "@shell-shock/core/plugin-utils";
|
|
15
|
-
import console from "@shell-shock/plugin-console";
|
|
16
16
|
import { joinPaths } from "@stryke/path";
|
|
17
|
+
import console from "@shell-shock/plugin-console";
|
|
17
18
|
import prompts from "@shell-shock/plugin-prompts";
|
|
18
19
|
import upgrade from "@shell-shock/plugin-upgrade";
|
|
19
20
|
import { BinEntry } from "@shell-shock/preset-script/components/bin-entry";
|
|
@@ -28,6 +29,7 @@ import { BinEntry } from "@shell-shock/preset-script/components/bin-entry";
|
|
|
28
29
|
const plugin = (options = {}) => {
|
|
29
30
|
return [
|
|
30
31
|
...console(options),
|
|
32
|
+
...plugin$2(options),
|
|
31
33
|
...plugin$1(options),
|
|
32
34
|
...prompts(options),
|
|
33
35
|
upgrade(options),
|
|
@@ -56,6 +58,7 @@ const plugin = (options = {}) => {
|
|
|
56
58
|
path: null,
|
|
57
59
|
segments: [],
|
|
58
60
|
alias: [],
|
|
61
|
+
tags: [],
|
|
59
62
|
options: Object.fromEntries(this.options.map((option) => [option.name, option])),
|
|
60
63
|
entry: { file: joinPaths(this.entryPath, "bin.ts") },
|
|
61
64
|
args: [],
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"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, computed, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport {\n getAppDescription,\n getAppName,\n getAppTitle,\n getCommandList\n} from \"@shell-shock/core/plugin-utils\";\nimport console from \"@shell-shock/plugin-console\";\nimport help from \"@shell-shock/plugin-help\";\nimport prompts from \"@shell-shock/plugin-prompts\";\nimport upgrade from \"@shell-shock/plugin-upgrade\";\nimport { BinEntry } from \"@shell-shock/preset-script/components/bin-entry\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { Plugin } from \"powerlines\";\nimport { BannerBuiltin } from \"./components\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { UpgradeBuiltin } from \"./components/upgrade-builtin\";\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 CLI Preset plugin.\n *\n * @remarks\n * This preset includes a set of built-in modules and commands to create a CLI application, as well as configuration options to customize the generated code. It also includes the `prompts` plugin to provide interactive prompts in the CLI application, and the `upgrade` plugin to manage upgrading the local application's version.\n */\nexport const plugin = <TContext extends CLIPresetContext = CLIPresetContext>(\n options: CLIPresetOptions = {}\n): Plugin<TContext>[] => {\n return [\n ...console<TContext>(options),\n ...help<TContext>(options),\n ...prompts<TContext>(options),\n upgrade<TContext>(options),\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 prepare: {\n order: \"post\",\n async handler() {\n this.debug(\"Rendering built-in modules.\");\n\n const commands = await getCommandList(this);\n this.debug(\n `Rendering \\`banner\\` built-ins for each of the ${\n commands.length\n } command modules.`\n );\n\n const bin = computed(() => ({\n id: \"\",\n name: getAppName(this),\n title: getAppTitle(this),\n description: getAppDescription(this),\n isVirtual: true,\n path: null,\n segments: [],\n alias: [],\n options: Object.fromEntries(\n this.options.map(option => [option.name, option])\n ),\n entry: {\n file: joinPaths(this.entryPath, \"bin.ts\")\n },\n args: [],\n parent: null,\n children: this.commands\n }));\n\n return render(\n this,\n <>\n <UpgradeBuiltin />\n <BannerBuiltin command={bin.value} />\n <Spacing />\n <For\n each={commands.sort((a, b) => a.name.localeCompare(b.name))}\n doubleHardline>\n {command => <BannerBuiltin command={command} />}\n </For>\n </>\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 \"info\",\n \"debug\",\n \"warn\",\n \"help\",\n \"error\",\n \"cursor\",\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\"\n ],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"isMinimal\",\n \"isInteractive\",\n \"isHelp\"\n ],\n prompts: [\n \"text\",\n \"numeric\",\n \"toggle\",\n \"select\",\n \"confirm\",\n \"isCancel\"\n ],\n env: [\"env\", \"paths\"],\n upgrade: [\"executeUpgrade\"]\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`await showBanner(0);`}\n <Spacing />\n {code`return showHelp(); `}\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 ];\n};\n\nexport default plugin;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"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, computed, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport {\n getAppDescription,\n getAppName,\n getAppTitle,\n getCommandList\n} from \"@shell-shock/core/plugin-utils\";\nimport banner from \"@shell-shock/plugin-banner\";\nimport console from \"@shell-shock/plugin-console\";\nimport help from \"@shell-shock/plugin-help\";\nimport prompts from \"@shell-shock/plugin-prompts\";\nimport upgrade from \"@shell-shock/plugin-upgrade\";\nimport { BinEntry } from \"@shell-shock/preset-script/components/bin-entry\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { Plugin } from \"powerlines\";\nimport { BannerBuiltin } from \"./components\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { UpgradeBuiltin } from \"./components/upgrade-builtin\";\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 CLI Preset plugin.\n *\n * @remarks\n * This preset includes a set of built-in modules and commands to create a CLI application, as well as configuration options to customize the generated code. It also includes the `prompts` plugin to provide interactive prompts in the CLI application, and the `upgrade` plugin to manage upgrading the local application's version.\n */\nexport const plugin = <TContext extends CLIPresetContext = CLIPresetContext>(\n options: CLIPresetOptions = {}\n): Plugin<TContext>[] => {\n return [\n ...console<TContext>(options),\n ...help<TContext>(options),\n ...banner<TContext>(options),\n ...prompts<TContext>(options),\n upgrade<TContext>(options),\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 prepare: {\n order: \"post\",\n async handler() {\n this.debug(\"Rendering built-in modules.\");\n\n const commands = await getCommandList(this);\n this.debug(\n `Rendering \\`banner\\` built-ins for each of the ${\n commands.length\n } command modules.`\n );\n\n const bin = computed(() => ({\n id: \"\",\n name: getAppName(this),\n title: getAppTitle(this),\n description: getAppDescription(this),\n isVirtual: true,\n path: null,\n segments: [],\n alias: [],\n tags: [],\n options: Object.fromEntries(\n this.options.map(option => [option.name, option])\n ),\n entry: {\n file: joinPaths(this.entryPath, \"bin.ts\")\n },\n args: [],\n parent: null,\n children: this.commands\n }));\n\n return render(\n this,\n <>\n <UpgradeBuiltin />\n <BannerBuiltin command={bin.value} />\n <Spacing />\n <For\n each={commands.sort((a, b) => a.name.localeCompare(b.name))}\n doubleHardline>\n {command => <BannerBuiltin command={command} />}\n </For>\n </>\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 \"info\",\n \"debug\",\n \"warn\",\n \"help\",\n \"error\",\n \"cursor\",\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\"\n ],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"isMinimal\",\n \"isInteractive\",\n \"isHelp\"\n ],\n prompts: [\n \"text\",\n \"numeric\",\n \"toggle\",\n \"select\",\n \"confirm\",\n \"isCancel\"\n ],\n env: [\"env\", \"paths\"],\n upgrade: [\"executeUpgrade\"]\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`await showBanner(0);`}\n <Spacing />\n {code`return showHelp(); `}\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 ];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAC,UAAA,UAAA,EAAA,KAAA;AACC,QAAE;EAAA,GAAA,QAAA,QAAA;EAAA,GAAA,SAAA,QAAA;EAAA,GAAA,SAAA,QAAA;EAAA,GAAA,QAAA,QAAA;EAAA,QAAA,QAAA;EAAA;GACD,MAAK;GACN,SAAA;AACI,SAAC,MAAM,oEAA+D;AAC1E,WAAS;KACR,gBAAqB;KAChB,iBAAC;KACF,GAAA;KACA;;GAEH,SAAG;IACH,OAAQ;IACR,MAAA,UAAA;AACE,UAAO,MAAM,8BAAiB;KAC9B,MAAQ,WAAC,MAAA,eAAA,KAAA;AACP,UAAK,MAAK,kDAAA,SAAA,OAAA,mBAAA;KACV,MAAG,MAAS,gBAAS;MACpB,IAAA;;MAED,OAAO,YAAA,KAAA;MACL,aAAA,kBAAgB,KAAiB;MACjC,WAAA;MACA,MAAG;MACJ,UAAA,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A,gBAAW,eAAA;YACzC,UAAA,EAAA;YACC,IAAK,WAAA;AACP,oBAAU,OAAA,YAAA,EAAA;;YAEX,CAAA;WAAA,gBAAqB,OAAW,EAAC,CAAA;WAAG;;;;;;;;;MAIxC,CAAC,EAAE,gBAAI,MAAA;MACN,IAAG,OAAA;AACD,cAAG,OAAA,OAAA,OAAA,SAAA,CAAA,SAAA;;MAEL,IAAI,WAAW;AACb,cAAO,gBAAO,KAAA;QACZ,IAAI,OAAG;AACL,gBAAK,OAAK,OAAA,OAAA,SAAA;;QAEZ,gBAAa;QACb,WAAO,UAAO,gBAAA,MAAA;SACZ,IAAI,OAAC;AACH,iBAAG,MAAU;;SAEf,IAAI,WAAW;AACb,iBAAG,gBAAM,cAAA,EACR,SAAA,OACD,CAAA;;SAEF,IAAI,WAAS;AACX,iBAAG,gBAAU,qBAAA,EACX,SAAC,OACF,CAAC;;SAEL,CAAC;QACH,CAAC;;MAEL,CAAC,CAAC,CAAC;;IAEP;GACF;EAAC"}
|
|
@@ -4,10 +4,10 @@ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
|
4
4
|
let _alloy_js_core = require("@alloy-js/core");
|
|
5
5
|
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
6
6
|
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
7
|
-
let defu = require("defu");
|
|
8
|
-
defu = require_runtime.__toESM(defu);
|
|
9
7
|
let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
|
|
10
8
|
let _stryke_path = require("@stryke/path");
|
|
9
|
+
let defu = require("defu");
|
|
10
|
+
defu = require_runtime.__toESM(defu);
|
|
11
11
|
|
|
12
12
|
//#region ../plugin-banner/dist/components/banner-builtin.mjs
|
|
13
13
|
/**
|
|
@@ -3,9 +3,9 @@ import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
|
3
3
|
import { Show, splitProps } from "@alloy-js/core";
|
|
4
4
|
import { getAppTitle, isDynamicPathSegment } from "@shell-shock/core/plugin-utils";
|
|
5
5
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
6
|
-
import defu from "defu";
|
|
7
6
|
import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
8
7
|
import { joinPaths } from "@stryke/path";
|
|
8
|
+
import defu from "defu";
|
|
9
9
|
|
|
10
10
|
//#region ../plugin-banner/dist/components/banner-builtin.mjs
|
|
11
11
|
/**
|
|
@@ -3,8 +3,8 @@ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
|
3
3
|
let _alloy_js_core = require("@alloy-js/core");
|
|
4
4
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
5
5
|
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
6
|
-
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
7
6
|
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
7
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
8
8
|
let _shell_shock_plugin_theme_contexts_theme = require("@shell-shock/plugin-theme/contexts/theme");
|
|
9
9
|
|
|
10
10
|
//#region ../plugin-banner/dist/components/banner-function-declaration.mjs
|
|
@@ -66,12 +66,15 @@ function BannerFunctionBodyDeclaration(props) {
|
|
|
66
66
|
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
|
|
67
67
|
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].topLeft}") + ${theme.icons.banner.header[variant] ? `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(6)) + " " + ${theme.icons.banner.header[variant] ? `colors.text.banner.header.${variant}("${theme.icons.banner.header[variant]}") + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}") + " " +` : ""} colors.bold(colors.text.banner.header.${variant}("${header}")) + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${6 + (theme.icons.banner.header[variant] ? theme.icons.banner.header[variant].length + 3 : 0) + (header ? header.length + 2 : 0) + bannerPadding.value}, 0)))` : `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${bannerPadding.value}, 0)))`} + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].topRight}"), { consoleFn: console.${consoleFnName} });
|
|
68
68
|
|
|
69
|
-
splitText(
|
|
70
|
-
${title ? `"${title}"` : "title"},
|
|
69
|
+
${title ? title.split("\n").map((line) => `splitText("${line}",
|
|
71
70
|
Math.max(process.stdout.columns - ${totalPadding.value}, 0)
|
|
72
71
|
).forEach((line) => {
|
|
73
72
|
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.bold(colors.text.banner.title.${variant}(line)) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
|
|
74
|
-
});
|
|
73
|
+
}); `) : `splitText(title,
|
|
74
|
+
Math.max(process.stdout.columns - ${totalPadding.value}, 0)
|
|
75
|
+
).forEach((line) => {
|
|
76
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.bold(colors.text.banner.title.${variant}(line)) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
|
|
77
|
+
});`}
|
|
75
78
|
|
|
76
79
|
${command?.title ? `${insertNewlineBeforeCommand ? `writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(process.stdout.columns - ${bannerPadding.value})) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} }); ` : ""}
|
|
77
80
|
${`writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi("${command.title}").length ${command.icon ? " + 3" : ""} + ${bannerPadding.value})) / 2), 0)) + colors.bold(colors.text.banner.command.${variant}("${command.icon ? `${command.icon} ` : ""}${command.title}")) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi("${command.title}").length ${command.icon ? " + 3" : ""} + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} }); `} ` : ""}
|
|
@@ -100,7 +103,7 @@ function BannerFunctionDeclaration(props) {
|
|
|
100
103
|
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
101
104
|
const header = (0, _alloy_js_core.computed)(() => `${theme.labels.banner.header[variant] || (0, _shell_shock_core_plugin_utils.getAppTitle)(context, false)} v${context.packageJson.version || "1.0.0"}`);
|
|
102
105
|
const footer = (0, _alloy_js_core.computed)(() => theme.labels.banner.footer[variant]);
|
|
103
|
-
const title = (0, _alloy_js_core.computed)(() => (0, _shell_shock_core_plugin_utils.getAppTitle)(context, true).replace(`v${context.packageJson.version || "1.0.0"}`, ""));
|
|
106
|
+
const title = (0, _alloy_js_core.computed)(() => context.config.banner.title || (0, _shell_shock_core_plugin_utils.getAppTitle)(context, true).replace(`v${context.packageJson.version || "1.0.0"}`, ""));
|
|
104
107
|
const description = (0, _alloy_js_core.computed)(() => command?.description || (0, _shell_shock_core_plugin_utils.getAppDescription)(context));
|
|
105
108
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(BannerFunctionDeclarationWrapper, {
|
|
106
109
|
command,
|
|
@@ -2,8 +2,8 @@ import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
|
|
|
2
2
|
import { Show, code, computed } from "@alloy-js/core";
|
|
3
3
|
import { FunctionDeclaration, IfStatement } from "@alloy-js/typescript";
|
|
4
4
|
import { formatDescription, getAppDescription, getAppTitle } from "@shell-shock/core/plugin-utils";
|
|
5
|
-
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
6
5
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
6
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
7
7
|
import { useTheme } from "@shell-shock/plugin-theme/contexts/theme";
|
|
8
8
|
|
|
9
9
|
//#region ../plugin-banner/dist/components/banner-function-declaration.mjs
|
|
@@ -65,12 +65,15 @@ function BannerFunctionBodyDeclaration(props) {
|
|
|
65
65
|
memo(() => code`
|
|
66
66
|
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].topLeft}") + ${theme.icons.banner.header[variant] ? `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(6)) + " " + ${theme.icons.banner.header[variant] ? `colors.text.banner.header.${variant}("${theme.icons.banner.header[variant]}") + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}") + " " +` : ""} colors.bold(colors.text.banner.header.${variant}("${header}")) + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${6 + (theme.icons.banner.header[variant] ? theme.icons.banner.header[variant].length + 3 : 0) + (header ? header.length + 2 : 0) + bannerPadding.value}, 0)))` : `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${bannerPadding.value}, 0)))`} + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].topRight}"), { consoleFn: console.${consoleFnName} });
|
|
67
67
|
|
|
68
|
-
splitText(
|
|
69
|
-
${title ? `"${title}"` : "title"},
|
|
68
|
+
${title ? title.split("\n").map((line) => `splitText("${line}",
|
|
70
69
|
Math.max(process.stdout.columns - ${totalPadding.value}, 0)
|
|
71
70
|
).forEach((line) => {
|
|
72
71
|
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.bold(colors.text.banner.title.${variant}(line)) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
|
|
73
|
-
});
|
|
72
|
+
}); `) : `splitText(title,
|
|
73
|
+
Math.max(process.stdout.columns - ${totalPadding.value}, 0)
|
|
74
|
+
).forEach((line) => {
|
|
75
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.bold(colors.text.banner.title.${variant}(line)) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
|
|
76
|
+
});`}
|
|
74
77
|
|
|
75
78
|
${command?.title ? `${insertNewlineBeforeCommand ? `writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(process.stdout.columns - ${bannerPadding.value})) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} }); ` : ""}
|
|
76
79
|
${`writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi("${command.title}").length ${command.icon ? " + 3" : ""} + ${bannerPadding.value})) / 2), 0)) + colors.bold(colors.text.banner.command.${variant}("${command.icon ? `${command.icon} ` : ""}${command.title}")) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi("${command.title}").length ${command.icon ? " + 3" : ""} + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} }); `} ` : ""}
|
|
@@ -99,7 +102,7 @@ function BannerFunctionDeclaration(props) {
|
|
|
99
102
|
const context = usePowerlines();
|
|
100
103
|
const header = computed(() => `${theme.labels.banner.header[variant] || getAppTitle(context, false)} v${context.packageJson.version || "1.0.0"}`);
|
|
101
104
|
const footer = computed(() => theme.labels.banner.footer[variant]);
|
|
102
|
-
const title = computed(() => getAppTitle(context, true).replace(`v${context.packageJson.version || "1.0.0"}`, ""));
|
|
105
|
+
const title = computed(() => context.config.banner.title || getAppTitle(context, true).replace(`v${context.packageJson.version || "1.0.0"}`, ""));
|
|
103
106
|
const description = computed(() => command?.description || getAppDescription(context));
|
|
104
107
|
return createComponent(BannerFunctionDeclarationWrapper, {
|
|
105
108
|
command,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner-function-declaration.mjs","names":[],"sources":["../../../../../plugin-banner/dist/components/banner-function-declaration.mjs"],"sourcesContent":["import { createComponent, memo } from \"@alloy-js/core/jsx-runtime\";\nimport { Show, code, computed } from \"@alloy-js/core\";\nimport { formatDescription, getAppDescription, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { FunctionDeclaration, IfStatement } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { useTheme } from \"@shell-shock/plugin-theme/contexts/theme\";\n\n//#region src/components/banner-function-declaration.tsx\n/**\n* A component to generate the `banner` function for a specific command or application.\n*\n* @remarks\n* This function will display a banner in the console with the application's name, version, and description. It can be customized with different variants for styling and supports conditional rendering based on flags or environment variables.\n*/\nfunction BannerFunctionDeclarationWrapper(props) {\n\tconst { command, children } = props;\n\tconst context = usePowerlines();\n\treturn createComponent(FunctionDeclaration, {\n\t\t\"export\": true,\n\t\tasync: true,\n\t\tname: \"showBanner\",\n\t\tget doc() {\n\t\t\treturn `Write the ${getAppTitle(context, true)} command-line interface application banner ${command ? `for the ${command.title} command ` : \"\"}to the console.`;\n\t\t},\n\t\tparameters: [{\n\t\t\tname: \"sleepTimeoutMs\",\n\t\t\ttype: \"number\",\n\t\t\tdefault: 500\n\t\t}],\n\t\tget children() {\n\t\t\treturn [children, createComponent(IfStatement, {\n\t\t\t\tcondition: code`isInteractive && !isHelp`,\n\t\t\t\tchildren: code`await sleep(sleepTimeoutMs);`\n\t\t\t})];\n\t\t}\n\t});\n}\n/**\n* A component to generate the `banner` function's body for a specific command or application.\n*\n* @remarks\n* This function will display a banner in the console with the application's name, version, and description. It can be customized with different variants for styling and supports conditional rendering based on flags or environment variables.\n*/\nfunction BannerFunctionBodyDeclaration(props) {\n\tconst { consoleFnName = \"log\", variant = \"primary\", title, header, footer, description, command, children, insertNewlineBeforeCommand = false, insertNewlineBeforeBanner = true, insertNewlineAfterDescription = false } = props;\n\tconst theme = useTheme();\n\tconst bannerPadding = computed(() => Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.banner.outline[variant].left.length + theme.borderStyles.banner.outline[variant].right.length);\n\tconst totalPadding = computed(() => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value);\n\treturn [\n\t\tcode`\n if (useApp().get(\"banner\") || hasFlag(\"no-banner\") || hasFlag(\"hide-banner\") || isMinimal) {\n return;\n }\n\n useApp().set(\"banner\", true); `,\n\t\tcreateComponent(Spacing, {}),\n\t\tchildren,\n\t\tcreateComponent(Spacing, {}),\n\t\tcreateComponent(Show, {\n\t\t\twhen: insertNewlineBeforeBanner,\n\t\t\tchildren: code`writeLine(\"\"); `\n\t\t}),\n\t\tcreateComponent(Spacing, {}),\n\t\tmemo(() => code`\n writeLine(colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].topLeft}\") + ${theme.icons.banner.header[variant] ? `colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].top}\".repeat(6)) + \" \" + ${theme.icons.banner.header[variant] ? `colors.text.banner.header.${variant}(\"${theme.icons.banner.header[variant]}\") + \" \" + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].top}\") + \" \" +` : \"\"} colors.bold(colors.text.banner.header.${variant}(\"${header}\")) + \" \" + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].top}\".repeat(Math.max(process.stdout.columns - ${6 + (theme.icons.banner.header[variant] ? theme.icons.banner.header[variant].length + 3 : 0) + (header ? header.length + 2 : 0) + bannerPadding.value}, 0)))` : `colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].top}\".repeat(Math.max(process.stdout.columns - ${bannerPadding.value}, 0)))`} + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].topRight}\"), { consoleFn: console.${consoleFnName} });\n\n splitText(\n ${title ? `\"${title}\"` : \"title\"},\n Math.max(process.stdout.columns - ${totalPadding.value}, 0)\n ).forEach((line) => {\n writeLine(colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].left}\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.bold(colors.text.banner.title.${variant}(line)) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].right}\"), { consoleFn: console.${consoleFnName} });\n });\n\n ${command?.title ? `${insertNewlineBeforeCommand ? `writeLine(colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].left}\") + \" \".repeat(Math.max(process.stdout.columns - ${bannerPadding.value})) + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].right}\"), { consoleFn: console.${consoleFnName} }); ` : \"\"}\n ${`writeLine(colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].left}\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(\"${command.title}\").length ${command.icon ? \" + 3\" : \"\"} + ${bannerPadding.value})) / 2), 0)) + colors.bold(colors.text.banner.command.${variant}(\"${command.icon ? `${command.icon} ` : \"\"}${command.title}\")) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(\"${command.title}\").length ${command.icon ? \" + 3\" : \"\"} + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].right}\"), { consoleFn: console.${consoleFnName} }); `} ` : \"\"}\n\n splitText(\n colors.bold(${command?.title ? \"colors.text.banner.description\" : \"colors.text.banner.command\"}.${variant}(\\`${formatDescription(description)}\\`)),\n Math.max(${command?.title ? `${totalPadding.value} * 2 > process.stdout.columns / 2 ? process.stdout.columns - 6 : process.stdout.columns - ${totalPadding.value}` : `process.stdout.columns - ${totalPadding.value}`} , 0)\n ).forEach((line) => {\n writeLine(colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].left}\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.text.banner.description.${variant}(line) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].right}\"), { consoleFn: console.${consoleFnName} });\n });\n ${insertNewlineAfterDescription ? `writeLine(colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].left}\") + \" \".repeat(Math.max(process.stdout.columns - ${bannerPadding.value})) + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].right}\"), { consoleFn: console.${consoleFnName} });` : \"\"}\n writeLine(colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].bottomLeft}\") + ${footer ? `colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].bottom}\".repeat(Math.max(process.stdout.columns - ${8 + (footer ? footer.length : 0) + bannerPadding.value}, 0))) + \" \" + ${footer ? `colors.bold(colors.text.banner.footer.${variant}(\"${footer}\"))` : \"\"} + \" \" + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].bottom}\".repeat(6))` : `colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].bottom}\".repeat(Math.max(process.stdout.columns - ${bannerPadding.value}, 0)))`} + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].bottomRight}\"), { consoleFn: console.${consoleFnName} });\n\n writeLine(\"\"); `)\n\t];\n}\n/**\n* A component to generate the `banner` function for a specific command or application.\n*\n* @remarks\n* This function will display a banner in the console with the application's name, version, and description. It can be customized with different variants for styling and supports conditional rendering based on flags or environment variables.\n*/\nfunction BannerFunctionDeclaration(props) {\n\tconst { consoleFnName = \"log\", variant = \"primary\", command, children, insertNewlineBeforeBanner = true } = props;\n\tconst theme = useTheme();\n\tconst context = usePowerlines();\n\tconst header = computed(() => `${theme.labels.banner.header[variant] || getAppTitle(context, false)} v${context.packageJson.version || \"1.0.0\"}`);\n\tconst footer = computed(() => theme.labels.banner.footer[variant]);\n\tconst title = computed(() => getAppTitle(context, true).replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\"));\n\tconst description = computed(() => command?.description || getAppDescription(context));\n\treturn createComponent(BannerFunctionDeclarationWrapper, {\n\t\tcommand,\n\t\tget children() {\n\t\t\treturn createComponent(BannerFunctionBodyDeclaration, {\n\t\t\t\tget title() {\n\t\t\t\t\treturn title.value;\n\t\t\t\t},\n\t\t\t\tget header() {\n\t\t\t\t\treturn header.value;\n\t\t\t\t},\n\t\t\t\tget description() {\n\t\t\t\t\treturn description.value;\n\t\t\t\t},\n\t\t\t\tget footer() {\n\t\t\t\t\treturn footer.value;\n\t\t\t\t},\n\t\t\t\tvariant,\n\t\t\t\tconsoleFnName,\n\t\t\t\tcommand,\n\t\t\t\tinsertNewlineBeforeCommand: true,\n\t\t\t\tinsertNewlineBeforeBanner,\n\t\t\t\tchildren\n\t\t\t});\n\t\t}\n\t});\n}\n\n//#endregion\nexport { BannerFunctionBodyDeclaration, BannerFunctionDeclaration, BannerFunctionDeclarationWrapper };\n//# sourceMappingURL=banner-function-declaration.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,iCAAiC,OAAO;CAChD,MAAM,EAAE,SAAS,aAAa;CAC9B,MAAM,UAAU,eAAe;AAC/B,QAAO,gBAAgB,qBAAqB;EAC3C,UAAU;EACV,OAAO;EACP,MAAM;EACN,IAAI,MAAM;AACT,UAAO,aAAa,YAAY,SAAS,KAAK,CAAC,6CAA6C,UAAU,WAAW,QAAQ,MAAM,aAAa,GAAG;;EAEhJ,YAAY,CAAC;GACZ,MAAM;GACN,MAAM;GACN,SAAS;GACT,CAAC;EACF,IAAI,WAAW;AACd,UAAO,CAAC,UAAU,gBAAgB,aAAa;IAC9C,WAAW,IAAI;IACf,UAAU,IAAI;IACd,CAAC,CAAC;;EAEJ,CAAC;;;;;;;;AAQH,SAAS,8BAA8B,OAAO;CAC7C,MAAM,EAAE,gBAAgB,OAAO,UAAU,WAAW,OAAO,QAAQ,QAAQ,aAAa,SAAS,UAAU,6BAA6B,OAAO,4BAA4B,MAAM,gCAAgC,UAAU;CAC3N,MAAM,QAAQ,UAAU;CACxB,MAAM,gBAAgB,eAAe,KAAK,IAAI,MAAM,QAAQ,KAAK,EA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;IAC5B;IACA;IACA,CAAC;;EAEH,CAAC"}
|
|
1
|
+
{"version":3,"file":"banner-function-declaration.mjs","names":[],"sources":["../../../../../plugin-banner/dist/components/banner-function-declaration.mjs"],"sourcesContent":["import { createComponent, memo } from \"@alloy-js/core/jsx-runtime\";\nimport { Show, code, computed } from \"@alloy-js/core\";\nimport { formatDescription, getAppDescription, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { FunctionDeclaration, IfStatement } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { useTheme } from \"@shell-shock/plugin-theme/contexts/theme\";\n\n//#region src/components/banner-function-declaration.tsx\n/**\n* A component to generate the `banner` function for a specific command or application.\n*\n* @remarks\n* This function will display a banner in the console with the application's name, version, and description. It can be customized with different variants for styling and supports conditional rendering based on flags or environment variables.\n*/\nfunction BannerFunctionDeclarationWrapper(props) {\n\tconst { command, children } = props;\n\tconst context = usePowerlines();\n\treturn createComponent(FunctionDeclaration, {\n\t\t\"export\": true,\n\t\tasync: true,\n\t\tname: \"showBanner\",\n\t\tget doc() {\n\t\t\treturn `Write the ${getAppTitle(context, true)} command-line interface application banner ${command ? `for the ${command.title} command ` : \"\"}to the console.`;\n\t\t},\n\t\tparameters: [{\n\t\t\tname: \"sleepTimeoutMs\",\n\t\t\ttype: \"number\",\n\t\t\tdefault: 500\n\t\t}],\n\t\tget children() {\n\t\t\treturn [children, createComponent(IfStatement, {\n\t\t\t\tcondition: code`isInteractive && !isHelp`,\n\t\t\t\tchildren: code`await sleep(sleepTimeoutMs);`\n\t\t\t})];\n\t\t}\n\t});\n}\n/**\n* A component to generate the `banner` function's body for a specific command or application.\n*\n* @remarks\n* This function will display a banner in the console with the application's name, version, and description. It can be customized with different variants for styling and supports conditional rendering based on flags or environment variables.\n*/\nfunction BannerFunctionBodyDeclaration(props) {\n\tconst { consoleFnName = \"log\", variant = \"primary\", title, header, footer, description, command, children, insertNewlineBeforeCommand = false, insertNewlineBeforeBanner = true, insertNewlineAfterDescription = false } = props;\n\tconst theme = useTheme();\n\tconst bannerPadding = computed(() => Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.banner.outline[variant].left.length + theme.borderStyles.banner.outline[variant].right.length);\n\tconst totalPadding = computed(() => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value);\n\treturn [\n\t\tcode`\n if (useApp().get(\"banner\") || hasFlag(\"no-banner\") || hasFlag(\"hide-banner\") || isMinimal) {\n return;\n }\n\n useApp().set(\"banner\", true); `,\n\t\tcreateComponent(Spacing, {}),\n\t\tchildren,\n\t\tcreateComponent(Spacing, {}),\n\t\tcreateComponent(Show, {\n\t\t\twhen: insertNewlineBeforeBanner,\n\t\t\tchildren: code`writeLine(\"\"); `\n\t\t}),\n\t\tcreateComponent(Spacing, {}),\n\t\tmemo(() => code`\n writeLine(colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].topLeft}\") + ${theme.icons.banner.header[variant] ? `colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].top}\".repeat(6)) + \" \" + ${theme.icons.banner.header[variant] ? `colors.text.banner.header.${variant}(\"${theme.icons.banner.header[variant]}\") + \" \" + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].top}\") + \" \" +` : \"\"} colors.bold(colors.text.banner.header.${variant}(\"${header}\")) + \" \" + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].top}\".repeat(Math.max(process.stdout.columns - ${6 + (theme.icons.banner.header[variant] ? theme.icons.banner.header[variant].length + 3 : 0) + (header ? header.length + 2 : 0) + bannerPadding.value}, 0)))` : `colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].top}\".repeat(Math.max(process.stdout.columns - ${bannerPadding.value}, 0)))`} + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].topRight}\"), { consoleFn: console.${consoleFnName} });\n\n ${title ? title.split(\"\\n\").map((line) => `splitText(\"${line}\",\n Math.max(process.stdout.columns - ${totalPadding.value}, 0)\n ).forEach((line) => {\n writeLine(colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].left}\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.bold(colors.text.banner.title.${variant}(line)) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].right}\"), { consoleFn: console.${consoleFnName} });\n }); `) : `splitText(title,\n Math.max(process.stdout.columns - ${totalPadding.value}, 0)\n ).forEach((line) => {\n writeLine(colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].left}\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.bold(colors.text.banner.title.${variant}(line)) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].right}\"), { consoleFn: console.${consoleFnName} });\n });`}\n\n ${command?.title ? `${insertNewlineBeforeCommand ? `writeLine(colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].left}\") + \" \".repeat(Math.max(process.stdout.columns - ${bannerPadding.value})) + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].right}\"), { consoleFn: console.${consoleFnName} }); ` : \"\"}\n ${`writeLine(colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].left}\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(\"${command.title}\").length ${command.icon ? \" + 3\" : \"\"} + ${bannerPadding.value})) / 2), 0)) + colors.bold(colors.text.banner.command.${variant}(\"${command.icon ? `${command.icon} ` : \"\"}${command.title}\")) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(\"${command.title}\").length ${command.icon ? \" + 3\" : \"\"} + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].right}\"), { consoleFn: console.${consoleFnName} }); `} ` : \"\"}\n\n splitText(\n colors.bold(${command?.title ? \"colors.text.banner.description\" : \"colors.text.banner.command\"}.${variant}(\\`${formatDescription(description)}\\`)),\n Math.max(${command?.title ? `${totalPadding.value} * 2 > process.stdout.columns / 2 ? process.stdout.columns - 6 : process.stdout.columns - ${totalPadding.value}` : `process.stdout.columns - ${totalPadding.value}`} , 0)\n ).forEach((line) => {\n writeLine(colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].left}\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.text.banner.description.${variant}(line) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].right}\"), { consoleFn: console.${consoleFnName} });\n });\n ${insertNewlineAfterDescription ? `writeLine(colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].left}\") + \" \".repeat(Math.max(process.stdout.columns - ${bannerPadding.value})) + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].right}\"), { consoleFn: console.${consoleFnName} });` : \"\"}\n writeLine(colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].bottomLeft}\") + ${footer ? `colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].bottom}\".repeat(Math.max(process.stdout.columns - ${8 + (footer ? footer.length : 0) + bannerPadding.value}, 0))) + \" \" + ${footer ? `colors.bold(colors.text.banner.footer.${variant}(\"${footer}\"))` : \"\"} + \" \" + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].bottom}\".repeat(6))` : `colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].bottom}\".repeat(Math.max(process.stdout.columns - ${bannerPadding.value}, 0)))`} + colors.border.banner.outline.${variant}(\"${theme.borderStyles.banner.outline[variant].bottomRight}\"), { consoleFn: console.${consoleFnName} });\n\n writeLine(\"\"); `)\n\t];\n}\n/**\n* A component to generate the `banner` function for a specific command or application.\n*\n* @remarks\n* This function will display a banner in the console with the application's name, version, and description. It can be customized with different variants for styling and supports conditional rendering based on flags or environment variables.\n*/\nfunction BannerFunctionDeclaration(props) {\n\tconst { consoleFnName = \"log\", variant = \"primary\", command, children, insertNewlineBeforeBanner = true } = props;\n\tconst theme = useTheme();\n\tconst context = usePowerlines();\n\tconst header = computed(() => `${theme.labels.banner.header[variant] || getAppTitle(context, false)} v${context.packageJson.version || \"1.0.0\"}`);\n\tconst footer = computed(() => theme.labels.banner.footer[variant]);\n\tconst title = computed(() => context.config.banner.title || getAppTitle(context, true).replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\"));\n\tconst description = computed(() => command?.description || getAppDescription(context));\n\treturn createComponent(BannerFunctionDeclarationWrapper, {\n\t\tcommand,\n\t\tget children() {\n\t\t\treturn createComponent(BannerFunctionBodyDeclaration, {\n\t\t\t\tget title() {\n\t\t\t\t\treturn title.value;\n\t\t\t\t},\n\t\t\t\tget header() {\n\t\t\t\t\treturn header.value;\n\t\t\t\t},\n\t\t\t\tget description() {\n\t\t\t\t\treturn description.value;\n\t\t\t\t},\n\t\t\t\tget footer() {\n\t\t\t\t\treturn footer.value;\n\t\t\t\t},\n\t\t\t\tvariant,\n\t\t\t\tconsoleFnName,\n\t\t\t\tcommand,\n\t\t\t\tinsertNewlineBeforeCommand: true,\n\t\t\t\tinsertNewlineBeforeBanner,\n\t\t\t\tchildren\n\t\t\t});\n\t\t}\n\t});\n}\n\n//#endregion\nexport { BannerFunctionBodyDeclaration, BannerFunctionDeclaration, BannerFunctionDeclarationWrapper };\n//# sourceMapp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AwC,QAAQ,IAAI,MAAM,aAAa,OAAO,QAAQ,SAAS,OAAO,gBAAgB,gCAAgC,QAAQ,IAAI,MAAM,aAAa,OAAO,QAAQ,SAAS,OAAO,6CAA6C,cAAc,MAAM,QAAQ,kCAAkC,QAAQ,IAAI,MAAM,aAAa,OAAO,QAAQ,SAAS,YAAY,2BAA2B,cAAc;;yBAEvzB;EACvB;;;;;;;;AAQF,SAAS,0BAA0B,OAAO;CACzC,MAAM,EAAE,gBAAgB,OAAO,UAAU,WAAW,SAAS,UAAU,4BAA4B,SAAS;CAC5G,MAAM,QAAQ,UAAU;CACxB,MAAM,UAAU,eAAe;CAC/B,MAAM,SAAS,eAAe,GAAG,MAAM,OAAO,OAAO,OAAO,YAAY,YAAY,SAAS,MAAM,CAAC,IAAI,QAAQ,YAAY,WAAW,UAAU;CACjJ,MAAM,SAAS,eAAe,MAAM,OAAO,OAAO,OAAO,SAAS;CAClE,MAAM,QAAQ,eAAe,QAAQ,OAAO,OAAO,SAAS,YAAY,SAAS,KAAK,CAAC,QAAQ,IAAI,QAAQ,YAAY,WAAW,WAAW,GAAG,CAAC;CACjJ,MAAM,cAAc,eAAe,SAAS,eAAe,kBAAkB,QAAQ,CAAC;AACtF,QAAO,gBAAgB,kCAAkC;EACxD;EACA,IAAI,WAAW;AACd,UAAO,gBAAgB,+BAA+B;IACrD,IAAI,QAAQ;AACX,YAAO,MAAM;;IAEd,IAAI,SAAS;AACZ,YAAO,OAAO;;IAEf,IAAI,cAAc;AACjB,YAAO,YAAY;;IAEpB,IAAI,SAAS;AACZ,YAAO,OAAO;;IAEf;IACA;IACA;IACA,4BAA4B;IAC5B;IACA;IACA,CAAC;;EAEH,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_banner_builtin = require('./components/banner-builtin.cjs');
|
|
3
|
+
require('./components/index.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_components = require("@powerlines/plugin-alloy/core/components");
|
|
7
|
+
let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
8
|
+
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
9
|
+
let _shell_shock_plugin_console = require("@shell-shock/plugin-console");
|
|
10
|
+
_shell_shock_plugin_console = require_runtime.__toESM(_shell_shock_plugin_console);
|
|
11
|
+
let _shell_shock_plugin_theme = require("@shell-shock/plugin-theme");
|
|
12
|
+
_shell_shock_plugin_theme = require_runtime.__toESM(_shell_shock_plugin_theme);
|
|
13
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
14
|
+
|
|
15
|
+
//#region ../plugin-banner/dist/index.mjs
|
|
16
|
+
/**
|
|
17
|
+
* The Banner - Shell Shock plugin to add a banner command to the application.
|
|
18
|
+
*/
|
|
19
|
+
const plugin = (options = {}) => {
|
|
20
|
+
return [
|
|
21
|
+
...(0, _shell_shock_plugin_theme.default)(options.theme),
|
|
22
|
+
(0, _shell_shock_plugin_console.default)(options.console),
|
|
23
|
+
{
|
|
24
|
+
name: "shell-shock:banner",
|
|
25
|
+
enforce: "post",
|
|
26
|
+
config() {
|
|
27
|
+
return { banner: { title: options.title } };
|
|
28
|
+
},
|
|
29
|
+
prepare: {
|
|
30
|
+
order: "post",
|
|
31
|
+
async handler() {
|
|
32
|
+
const commands = await (0, _shell_shock_core_plugin_utils.getCommandList)(this);
|
|
33
|
+
this.debug(`Rendering \`banner\` built-ins for each of the ${commands.length} command modules.`);
|
|
34
|
+
const bin = (0, _alloy_js_core.computed)(() => ({
|
|
35
|
+
id: "",
|
|
36
|
+
name: (0, _shell_shock_core_plugin_utils.getAppName)(this),
|
|
37
|
+
title: (0, _shell_shock_core_plugin_utils.getAppTitle)(this),
|
|
38
|
+
description: (0, _shell_shock_core_plugin_utils.getAppDescription)(this),
|
|
39
|
+
isVirtual: true,
|
|
40
|
+
path: null,
|
|
41
|
+
segments: [],
|
|
42
|
+
alias: [],
|
|
43
|
+
tags: [],
|
|
44
|
+
options: Object.fromEntries(this.options.map((option) => [option.name, option])),
|
|
45
|
+
entry: { file: (0, _stryke_path_join.joinPaths)(this.entryPath, "bin.ts") },
|
|
46
|
+
args: [],
|
|
47
|
+
parent: null,
|
|
48
|
+
children: this.commands
|
|
49
|
+
}));
|
|
50
|
+
return (0, _powerlines_plugin_alloy_render.render)(this, [
|
|
51
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_banner_builtin.BannerBuiltin, { get command() {
|
|
52
|
+
return bin.value;
|
|
53
|
+
} }),
|
|
54
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
|
|
55
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
56
|
+
get each() {
|
|
57
|
+
return commands.sort((a, b) => a.name.localeCompare(b.name));
|
|
58
|
+
},
|
|
59
|
+
doubleHardline: true,
|
|
60
|
+
children: (command) => (0, _alloy_js_core_jsx_runtime.createComponent)(require_banner_builtin.BannerBuiltin, { command })
|
|
61
|
+
})
|
|
62
|
+
]);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
];
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
exports.plugin = plugin;
|