@shell-shock/preset-cli 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,13 +2,13 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  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
- let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
6
5
  let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
7
6
  let __shell_shock_core_contexts_command = require("@shell-shock/core/contexts/command");
7
+ let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
8
8
  let __shell_shock_preset_script_contexts_theme = require("@shell-shock/preset-script/contexts/theme");
9
9
  let cfonts = require("cfonts");
10
10
 
11
- //#region src/components/banner.tsx
11
+ //#region src/components/banner-function-declaration.tsx
12
12
  /**
13
13
  * A component to generate the `banner` function in the `shell-shock:console` builtin module.
14
14
  */
@@ -39,9 +39,10 @@ function BannerFunctionDeclaration(props) {
39
39
  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);
40
40
  const totalPadding = (0, __alloy_js_core.computed)(() => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value);
41
41
  return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
42
- "export": true,
43
42
  name: "banner",
44
- doc: "Write the application banner to the console.",
43
+ get doc() {
44
+ return `Write the ${(0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context)} application banner ${command ? `for the ${command.title} command ` : ""}to the console.`;
45
+ },
45
46
  get children() {
46
47
  return __alloy_js_core.code`
47
48
  if (hasFlag("no-banner") || hasFlag("hide-banner") || isCI || isMinimal) {
@@ -1,7 +1,7 @@
1
1
  import * as _alloy_js_core0 from "@alloy-js/core";
2
2
  import { ThemeColorVariant } from "@shell-shock/plugin-theme/types/theme";
3
3
 
4
- //#region src/components/banner.d.ts
4
+ //#region src/components/banner-function-declaration.d.ts
5
5
  interface BannerFunctionDeclarationProps {
6
6
  variant?: ThemeColorVariant;
7
7
  consoleFnName?: "log" | "info" | "warn" | "error" | "debug";
@@ -13,4 +13,4 @@ interface BannerFunctionDeclarationProps {
13
13
  declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core0.Children;
14
14
  //#endregion
15
15
  export { BannerFunctionDeclaration, BannerFunctionDeclarationProps };
16
- //# sourceMappingURL=banner.d.cts.map
16
+ //# 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":";;;;UA+BiB,8BAAA;YACL;;EADK,KAAA,CAAA,EAAA,MAAA;AASjB;;;;iBAAgB,yBAAA,QACP,iCAA8B,eAAA,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import * as _alloy_js_core0 from "@alloy-js/core";
2
2
  import { ThemeColorVariant } from "@shell-shock/plugin-theme/types/theme";
3
3
 
4
- //#region src/components/banner.d.ts
4
+ //#region src/components/banner-function-declaration.d.ts
5
5
  interface BannerFunctionDeclarationProps {
6
6
  variant?: ThemeColorVariant;
7
7
  consoleFnName?: "log" | "info" | "warn" | "error" | "debug";
@@ -13,4 +13,4 @@ interface BannerFunctionDeclarationProps {
13
13
  declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core0.Children;
14
14
  //#endregion
15
15
  export { BannerFunctionDeclaration, BannerFunctionDeclarationProps };
16
- //# sourceMappingURL=banner.d.mts.map
16
+ //# 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":";;;;UA+BiB,8BAAA;YACL;;EADK,KAAA,CAAA,EAAA,MAAA;AASjB;;;;iBAAgB,yBAAA,QACP,iCAA8B,eAAA,CAAA"}
@@ -1,13 +1,13 @@
1
- import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
1
+ import { createComponent } from "@alloy-js/core/jsx-runtime";
2
2
  import { code, computed } from "@alloy-js/core";
3
3
  import { FunctionDeclaration } from "@alloy-js/typescript";
4
- import { getAppDescription, getAppTitle } from "@shell-shock/core/plugin-utils/context-helpers";
5
4
  import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
6
5
  import { useCommand } from "@shell-shock/core/contexts/command";
6
+ import { getAppDescription, getAppTitle } from "@shell-shock/core/plugin-utils/context-helpers";
7
7
  import { useTheme } from "@shell-shock/preset-script/contexts/theme";
8
8
  import { render } from "cfonts";
9
9
 
10
- //#region src/components/banner.tsx
10
+ //#region src/components/banner-function-declaration.tsx
11
11
  /**
12
12
  * A component to generate the `banner` function in the `shell-shock:console` builtin module.
13
13
  */
@@ -38,9 +38,10 @@ function BannerFunctionDeclaration(props) {
38
38
  const bannerPadding = computed(() => Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.banner.outline[variant].left.length + theme.borderStyles.banner.outline[variant].right.length);
39
39
  const totalPadding = computed(() => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value);
40
40
  return [createComponent(FunctionDeclaration, {
41
- "export": true,
42
41
  name: "banner",
43
- doc: "Write the application banner to the console.",
42
+ get doc() {
43
+ return `Write the ${getAppTitle(context)} application banner ${command ? `for the ${command.title} command ` : ""}to the console.`;
44
+ },
44
45
  get children() {
45
46
  return code`
46
47
  if (hasFlag("no-banner") || hasFlag("hide-banner") || isCI || isMinimal) {
@@ -79,4 +80,4 @@ function BannerFunctionDeclaration(props) {
79
80
 
80
81
  //#endregion
81
82
  export { BannerFunctionDeclaration };
82
- //# sourceMappingURL=banner.mjs.map
83
+ //# sourceMappingURL=banner-function-declaration.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"banner-function-declaration.mjs","names":["code","computed","FunctionDeclaration","usePowerlines","useCommand","getAppDescription","getAppTitle","useTheme","render","BannerFunctionDeclaration","props","consoleFnName","variant","title","titleProp","theme","context","command","header","labels","banner","packageJson","version","description","footer","test","value","toLowerCase","replace","trim","titleLines","result","font","align","colors","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","topLeft","icons","top","topRight","bottomLeft","bottom","bottomRight"],"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 { useCommand } from \"@shell-shock/core/contexts/command\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { ThemeColorVariant } from \"@shell-shock/plugin-theme/types/theme\";\nimport { useTheme } from \"@shell-shock/preset-script/contexts/theme\";\nimport { render } from \"cfonts\";\nimport type { CLIPresetContext } from \"../types/plugin\";\n\nexport interface BannerFunctionDeclarationProps {\n variant?: ThemeColorVariant;\n consoleFnName?: \"log\" | \"info\" | \"warn\" | \"error\" | \"debug\";\n title?: string;\n}\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 {\n consoleFnName = \"log\",\n variant = \"primary\",\n title: titleProp\n } = props;\n\n const theme = useTheme();\n\n const context = usePowerlines<CLIPresetContext>();\n const command = useCommand();\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 titleProp ||\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 colors: [\"system\"],\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 {code`\n if (hasFlag(\"no-banner\") || hasFlag(\"hide-banner\") || isCI || isMinimal) {\n return;\n }\n\n const titleLines = [${titleLines.value\n .map(line => JSON.stringify(line))\n .join(\", \")}];\n const title = Math.max(...titleLines.map(line => stripAnsi(line).trim().length)) > Math.max(process.stdout.columns - ${\n totalPadding.value\n }, 0)\n ? [\"${title.value}\"]\n : titleLines;\n\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].topLeft\n }\") + ${\n theme.icons.banner.header[variant]\n ? `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\".repeat(4)) + \" \" + ${\n theme.icons.banner.header[variant]\n ? `colors.text.banner.header.${variant}(\"${\n theme.icons.banner.header[variant]\n }\") + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\") + \" \" +`\n : \"\"\n } colors.bold(colors.text.banner.header.${variant}(\"${\n header.value\n }\")) + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\".repeat(Math.max(process.stdout.columns - ${\n 4 +\n (theme.icons.banner.header[variant]\n ? theme.icons.banner.header[variant].length + 3\n : 0) +\n (header.value ? header.value.length + 2 : 0) +\n bannerPadding.value\n }, 0)))`\n : `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\".repeat(Math.max(process.stdout.columns - ${\n bannerPadding.value\n }, 0)))`\n } + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].topRight\n }\"), { consoleFn: console.${consoleFnName} });\n\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(process.stdout.columns - ${\n bannerPadding.value\n })) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n\n title.map(line => line.trim()).forEach((line) => {\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.text.banner.title.${\n variant\n }(line) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n });\n\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(process.stdout.columns - ${\n bannerPadding.value\n })) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n\n ${\n command?.title\n ? `writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.bold(colors.text.banner.command.${\n variant\n }(\"${command.title}\")) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} }); `\n : \"\"\n }\n\n splitText(\n ${\n command?.title\n ? \"colors.text.banner.description\"\n : \"colors.text.banner.command\"\n }.${variant}(\"${description.value.replace(/\"/g, '\\\\\"')}\"),\n Math.max(process.stdout.columns - ${totalPadding.value}, 0)\n ).forEach((line) => {\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.text.banner.description.${variant}(line) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n });\n\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottomLeft\n }\") + ${\n footer.value\n ? `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(Math.max(process.stdout.columns - ${\n 6 +\n (footer.value ? footer.value.length : 0) +\n bannerPadding.value\n }, 0))) + \" \" + ${\n footer.value\n ? `colors.bold(colors.text.banner.footer.${variant}(\"${footer.value}\"))`\n : \"\"\n } + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(4))`\n : `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(Math.max(process.stdout.columns - ${\n bannerPadding.value\n }, 0)))`\n } + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottomRight\n }\"), { consoleFn: console.${consoleFnName} });\n`}\n </FunctionDeclaration>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAwCA,SAAgBS,0BACdC,OACA;CACA,MAAM,EACJC,gBAAgB,OAChBC,UAAU,WACVC,OAAOC,cACLJ;CAEJ,MAAMK,QAAQR,UAAU;CAExB,MAAMS,UAAUb,eAAiC;CACjD,MAAMc,UAAUb,YAAY;CAE5B,MAAMc,SAASjB,eAEX,GAAGc,MAAMI,OAAOC,OAAOF,OAAON,YAAYN,YAAYU,QAAQ,CAAA,IAAKA,QAAQK,YAAYC,WAAW,UACrG;CACD,MAAMC,cAActB,eACZgB,SAASM,eAAelB,kBAAkBW,QAClD,CAAC;CACD,MAAMQ,SAASvB,eAAec,MAAMI,OAAOC,OAAOI,OAAOZ,SAAS;CAElE,MAAMC,QAAQZ,eACZa,aACA,4DAA4DW,KAC1DP,OAAOQ,MAAMC,aACf,CAAC,GACGT,OAAOQ,MACJE,QAAQ,IAAIZ,QAAQK,YAAYC,WAAW,WAAW,GAAG,CACzDO,MAAM,GACT,GAAGX,OAAOQ,MACPE,QAAQ,IAAIZ,QAAQK,YAAYC,WAAW,WAAW,GA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B,OAAO4B,QAAQpC,SAASqC,KAAI,0FAE/CP,cAAchB,MAAK,wDAEnBd,QAAO,IACJK,QAAQJ,MAAK,0FAChB6B,cAAchB,MAAK,8CAC0Bd,QAAO,IACpDG,MAAMgC,aAAa3B,OAAO4B,QAAQpC,SAASuC,MAAK,2BACtBxC,cAAa,SACzC,GAAE;;;YAKJM,SAASJ,QACL,mCACA,6BAA4B,GAC9BD,QAAO,IAAKW,YAAYG,MAAME,QAAQ,MAAM,OAAM,CAAA;8CAClBwB,aAAa1B,MAAK;;mDAEbd,QAAO,IAC9CG,MAAMgC,aAAa3B,OAAO4B,QAAQpC,SAASqC,KAAI,0FAE/CP,cAAchB,MAAK,gDAC4Bd,QAAO,6FACtD8B,cAAchB,MAAK,8CAC0Bd,QAAO,IACpDG,MAAMgC,aAAa3B,OAAO4B,QAAQpC,SAASuC,MAAK,2BACtBxC,cAAa;;;iDAGFC,QAAO,IAC9CG,MAAMgC,aAAa3B,OAAO4B,QAAQpC,SAASsD,WAAU,OAErD1C,OAAOE,QACH,gCAAgCd,QAAO,IACrCG,MAAMgC,aAAa3B,OAAO4B,QAAQpC,SAASuD,OAAM,6CAEjD,KACC3C,OAAOE,QAAQF,OAAOE,MAAMwB,SAAS,KACtCR,cAAchB,MAAK,iBAEnBF,OAAOE,QACH,yCAAyCd,QAAO,IAAKY,OAAOE,MAAK,OACjE,GAAE,wCACiCd,QAAO,IAC9CG,MAAMgC,aAAa3B,OAAO4B,QAAQpC,SAASuD,OAAM,gBAEnD,gCAAgCvD,QAAO,IACrCG,MAAMgC,aAAa3B,OAAO4B,QAAQpC,SAASuD,OAAM,6CAEjDzB,cAAchB,MAAK,QACb,kCACqBd,QAAO,IACxCG,MAAMgC,aAAa3B,OAAO4B,QAAQpC,SAASwD,YAAW,2BAC5BzD,cAAa;;;EAChD,CAAA,CAAA"}
@@ -1,3 +1,3 @@
1
- const require_components_banner = require('./banner.cjs');
1
+ const require_components_banner_function_declaration = require('./banner-function-declaration.cjs');
2
2
 
3
- exports.BannerFunctionDeclaration = require_components_banner.BannerFunctionDeclaration;
3
+ exports.BannerFunctionDeclaration = require_components_banner_function_declaration.BannerFunctionDeclaration;
@@ -1,2 +1,2 @@
1
- import { BannerFunctionDeclaration, BannerFunctionDeclarationProps } from "./banner.cjs";
1
+ import { BannerFunctionDeclaration, BannerFunctionDeclarationProps } from "./banner-function-declaration.cjs";
2
2
  export { BannerFunctionDeclaration, BannerFunctionDeclarationProps };
@@ -1,2 +1,2 @@
1
- import { BannerFunctionDeclaration, BannerFunctionDeclarationProps } from "./banner.mjs";
1
+ import { BannerFunctionDeclaration, BannerFunctionDeclarationProps } from "./banner-function-declaration.mjs";
2
2
  export { BannerFunctionDeclaration, BannerFunctionDeclarationProps };
@@ -1,3 +1,3 @@
1
- import { BannerFunctionDeclaration } from "./banner.mjs";
1
+ import { BannerFunctionDeclaration } from "./banner-function-declaration.mjs";
2
2
 
3
3
  export { BannerFunctionDeclaration };
@@ -16,7 +16,7 @@ function getDefaultOptions(context, _) {
16
16
  context.config.interactive !== "never" && context.config.interactive !== true && {
17
17
  name: "interactive",
18
18
  title: "Interactive",
19
- description: "Enable interactive mode (will be set to false if running in a CI pipeline).",
19
+ description: "Enable interactive mode - will be set to false if running in a CI pipeline.",
20
20
  alias: ["i", "interact"],
21
21
  kind: __powerlines_deepkit_vendor_type.ReflectionKind.boolean,
22
22
  optional: true,
@@ -25,7 +25,7 @@ function getDefaultOptions(context, _) {
25
25
  context.config.interactive !== "never" && context.config.interactive !== false && {
26
26
  name: "no-interactive",
27
27
  title: "Non-Interactive",
28
- description: "Disable interactive mode (will be set to true if running in a CI pipeline).",
28
+ description: "Disable interactive mode - will be set to true if running in a CI pipeline.",
29
29
  alias: ["no-interact"],
30
30
  kind: __powerlines_deepkit_vendor_type.ReflectionKind.boolean,
31
31
  optional: true,
@@ -15,7 +15,7 @@ function getDefaultOptions$1(context, _) {
15
15
  context.config.interactive !== "never" && context.config.interactive !== true && {
16
16
  name: "interactive",
17
17
  title: "Interactive",
18
- description: "Enable interactive mode (will be set to false if running in a CI pipeline).",
18
+ description: "Enable interactive mode - will be set to false if running in a CI pipeline.",
19
19
  alias: ["i", "interact"],
20
20
  kind: ReflectionKind.boolean,
21
21
  optional: true,
@@ -24,7 +24,7 @@ function getDefaultOptions$1(context, _) {
24
24
  context.config.interactive !== "never" && context.config.interactive !== false && {
25
25
  name: "no-interactive",
26
26
  title: "Non-Interactive",
27
- description: "Disable interactive mode (will be set to true if running in a CI pipeline).",
27
+ description: "Disable interactive mode - will be set to true if running in a CI pipeline.",
28
28
  alias: ["no-interact"],
29
29
  kind: ReflectionKind.boolean,
30
30
  optional: true,
@@ -1 +1 @@
1
- {"version":3,"file":"get-default-options.mjs","names":["ReflectionKind","getDefaultOptions","getDefaultOptionsBase","context","_","config","interactive","name","title","description","alias","kind","boolean","optional","default","isNegativeOf","filter","Boolean"],"sources":["../../src/helpers/get-default-options.ts"],"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 { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport type { CommandBase, CommandOption } from \"@shell-shock/core\";\nimport { getDefaultOptions as getDefaultOptionsBase } from \"@shell-shock/preset-script/helpers/get-default-options\";\nimport type { CLIPresetContext } from \"../types\";\n\n/**\n * Get the default command options.\n *\n * @param context - The build context.\n * @param _ - The command input.\n * @returns The default command options.\n */\nexport function getDefaultOptions(\n context: CLIPresetContext,\n _: CommandBase\n): CommandOption[] {\n return [\n ...getDefaultOptionsBase(),\n context.config.interactive !== \"never\" &&\n context.config.interactive !== true && {\n name: \"interactive\",\n title: \"Interactive\",\n description:\n \"Enable interactive mode (will be set to false if running in a CI pipeline).\",\n alias: [\"i\", \"interact\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: context.config.interactive !== false\n },\n context.config.interactive !== \"never\" &&\n context.config.interactive !== false && {\n name: \"no-interactive\",\n title: \"Non-Interactive\",\n description:\n \"Disable interactive mode (will be set to true if running in a CI pipeline).\",\n alias: [\"no-interact\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n isNegativeOf: \"interactive\"\n }\n ].filter(Boolean) as CommandOption[];\n}\n"],"mappings":";;;;;;;;;;;AA8BA,SAAgBC,oBACdE,SACAC,GACiB;AACjB,QAAO;EACL,GAAGF,mBAAuB;EAC1BC,QAAQE,OAAOC,gBAAgB,WAC7BH,QAAQE,OAAOC,gBAAgB,QAAQ;GACrCC,MAAM;GACNC,OAAO;GACPC,aACE;GACFC,OAAO,CAAC,KAAK,WAAW;GACxBC,MAAMX,eAAeY;GACrBC,UAAU;GACVC,SAASX,QAAQE,OAAOC,gBAAgB;GACzC;EACHH,QAAQE,OAAOC,gBAAgB,WAC7BH,QAAQE,OAAOC,gBAAgB,SAAS;GACtCC,MAAM;GACNC,OAAO;GACPC,aACE;GACFC,OAAO,CAAC,cAAc;GACtBC,MAAMX,eAAeY;GACrBC,UAAU;GACVC,SAAS;GACTC,cAAc;GACf;EACJ,CAACC,OAAOC,QAAQ"}
1
+ {"version":3,"file":"get-default-options.mjs","names":["ReflectionKind","getDefaultOptions","getDefaultOptionsBase","context","_","config","interactive","name","title","description","alias","kind","boolean","optional","default","isNegativeOf","filter","Boolean"],"sources":["../../src/helpers/get-default-options.ts"],"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 { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport type { CommandBase, CommandOption } from \"@shell-shock/core\";\nimport { getDefaultOptions as getDefaultOptionsBase } from \"@shell-shock/preset-script/helpers/get-default-options\";\nimport type { CLIPresetContext } from \"../types\";\n\n/**\n * Get the default command options.\n *\n * @param context - The build context.\n * @param _ - The command input.\n * @returns The default command options.\n */\nexport function getDefaultOptions(\n context: CLIPresetContext,\n _: CommandBase\n): CommandOption[] {\n return [\n ...getDefaultOptionsBase(),\n context.config.interactive !== \"never\" &&\n context.config.interactive !== true && {\n name: \"interactive\",\n title: \"Interactive\",\n description:\n \"Enable interactive mode - will be set to false if running in a CI pipeline.\",\n alias: [\"i\", \"interact\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: context.config.interactive !== false\n },\n context.config.interactive !== \"never\" &&\n context.config.interactive !== false && {\n name: \"no-interactive\",\n title: \"Non-Interactive\",\n description:\n \"Disable interactive mode - will be set to true if running in a CI pipeline.\",\n alias: [\"no-interact\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n isNegativeOf: \"interactive\"\n }\n ].filter(Boolean) as CommandOption[];\n}\n"],"mappings":";;;;;;;;;;;AA8BA,SAAgBC,oBACdE,SACAC,GACiB;AACjB,QAAO;EACL,GAAGF,mBAAuB;EAC1BC,QAAQE,OAAOC,gBAAgB,WAC7BH,QAAQE,OAAOC,gBAAgB,QAAQ;GACrCC,MAAM;GACNC,OAAO;GACPC,aACE;GACFC,OAAO,CAAC,KAAK,WAAW;GACxBC,MAAMX,eAAeY;GACrBC,UAAU;GACVC,SAASX,QAAQE,OAAOC,gBAAgB;GACzC;EACHH,QAAQE,OAAOC,gBAAgB,WAC7BH,QAAQE,OAAOC,gBAAgB,SAAS;GACtCC,MAAM;GACNC,OAAO;GACPC,aACE;GACFC,OAAO,CAAC,cAAc;GACtBC,MAAMX,eAAeY;GACrBC,UAAU;GACVC,SAAS;GACTC,cAAc;GACf;EACJ,CAACC,OAAOC,QAAQ"}
package/dist/index.cjs CHANGED
@@ -1,13 +1,12 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
2
  const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
- const require_components_banner = require('./components/banner.cjs');
3
+ const require_components_banner_function_declaration = require('./components/banner-function-declaration.cjs');
4
4
  require('./components/index.cjs');
5
5
  const require_get_default_options = require('./helpers/get-default-options.cjs');
6
6
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
7
7
  let __alloy_js_core = require("@alloy-js/core");
8
8
  let __alloy_js_typescript = require("@alloy-js/typescript");
9
9
  let __powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
10
- let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
11
10
  let __shell_shock_plugin_theme = require("@shell-shock/plugin-theme");
12
11
  __shell_shock_plugin_theme = require_rolldown_runtime.__toESM(__shell_shock_plugin_theme);
13
12
  let __shell_shock_preset_script_components_bin_entry = require("@shell-shock/preset-script/components/bin-entry");
@@ -40,9 +39,7 @@ const plugin = (options = {}) => {
40
39
  },
41
40
  async prepare() {
42
41
  this.debug("Rendering built-in modules for the Shell Shock `cli` preset.");
43
- return (0, __powerlines_plugin_alloy_render.render)(this, [(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_utils_builtin.UtilsBuiltin, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_console_builtin.ConsoleBuiltin, { get banner() {
44
- return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_banner.BannerFunctionDeclaration, {});
45
- } })]);
42
+ return (0, __powerlines_plugin_alloy_render.render)(this, [(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_utils_builtin.UtilsBuiltin, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_console_builtin.ConsoleBuiltin, {})]);
46
43
  }
47
44
  },
48
45
  {
@@ -56,12 +53,21 @@ const plugin = (options = {}) => {
56
53
  builtinImports: {
57
54
  console: [
58
55
  "divider",
56
+ "stripAnsi",
59
57
  "writeLine",
58
+ "splitText",
60
59
  "colors",
61
- "banner",
62
60
  "help"
63
61
  ],
64
- utils: ["getArgs"]
62
+ utils: ["getArgs", "isMinimal"],
63
+ env: ["isCI"]
64
+ },
65
+ get prefix() {
66
+ return [
67
+ (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_banner_function_declaration.BannerFunctionDeclaration, {}),
68
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
69
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
70
+ ];
65
71
  },
66
72
  get children() {
67
73
  return [
@@ -89,55 +95,12 @@ const plugin = (options = {}) => {
89
95
  }
90
96
  }),
91
97
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
92
- __alloy_js_core.code`
93
- writeLine("");
94
- banner();
95
- writeLine(""); `,
96
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
97
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
98
- __alloy_js_core.code`writeLine(colors.text.heading.secondary("Global Options:"));`,
99
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
100
- (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_help.HelpOptions, { get options() {
101
- return _self$.options;
102
- } }),
103
- __alloy_js_core.code`writeLine(""); `,
104
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
105
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
106
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
107
- get when() {
108
- return Object.keys(_self$.commands).length > 0;
98
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_help.HelpInvoke, {
99
+ get options() {
100
+ return _self$.options;
109
101
  },
110
- get children() {
111
- return [
112
- __alloy_js_core.code`writeLine(colors.text.body.secondary("The following commands are available:"));
113
- writeLine(""); `,
114
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
115
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
116
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
117
- get each() {
118
- return Object.values(_self$.commands);
119
- },
120
- doubleHardline: true,
121
- joiner: __alloy_js_core.code`writeLine(""); `,
122
- ender: __alloy_js_core.code`writeLine(""); `,
123
- children: (child) => [
124
- (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`
125
- writeLine(colors.text.heading.primary("${child.title} ${child.isVirtual ? "" : "Command"}"));
126
- writeLine("");
127
- writeLine(colors.text.body.secondary("${child.description}"));
128
- writeLine("");
129
- `),
130
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
131
- (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_help.Help, {
132
- command: child,
133
- indent: 2
134
- }),
135
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
136
- ]
137
- }),
138
- (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`help("Running a specific command with the help flag (via: '${(0, __shell_shock_core_plugin_utils_context_helpers.getAppBin)(_self$)} <specific command> --help') will provide additional information that is specific to that command.");
139
- writeLine("");`)
140
- ];
102
+ get commands() {
103
+ return _self$.commands ?? {};
141
104
  }
142
105
  })
143
106
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAsCA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,gBAAA,GAAmB,gBAAnB,CAAA,CAAA,OAAA,CAAA,EAC7B,gBAD6B,EAAA,GA4HjC,MA5HiC,CA4H1B,QA5H0B,CAAA,EAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAqCA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,gBAAA,GAAmB,gBAAnB,CAAA,CAAA,OAAA,CAAA,EAC7B,gBAD6B,EAAA,GAsGjC,MAtGiC,CAsG1B,QAtG0B,CAAA,EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAsCA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,gBAAA,GAAmB,gBAAnB,CAAA,CAAA,OAAA,CAAA,EAC7B,gBAD6B,EAAA,GA4HjC,MA5HiC,CA4H1B,QA5H0B,CAAA,EAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAqCA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,gBAAA,GAAmB,gBAAnB,CAAA,CAAA,OAAA,CAAA,EAC7B,gBAD6B,EAAA,GAsGjC,MAtGiC,CAsG1B,QAtG0B,CAAA,EAAA"}
package/dist/index.mjs CHANGED
@@ -1,17 +1,16 @@
1
- import { BannerFunctionDeclaration } from "./components/banner.mjs";
1
+ import { BannerFunctionDeclaration } from "./components/banner-function-declaration.mjs";
2
2
  import "./components/index.mjs";
3
3
  import { getDefaultOptions } from "./helpers/get-default-options.mjs";
4
- import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
4
+ import { createComponent, createIntrinsic } from "@alloy-js/core/jsx-runtime";
5
5
  import { For, Show, code } from "@alloy-js/core";
6
6
  import { VarDeclaration } from "@alloy-js/typescript";
7
7
  import { render } from "@powerlines/plugin-alloy/render";
8
- import { getAppBin } from "@shell-shock/core/plugin-utils/context-helpers";
9
8
  import theme from "@shell-shock/plugin-theme";
10
9
  import { BinEntry } from "@shell-shock/preset-script/components/bin-entry";
11
10
  import { CommandEntry } from "@shell-shock/preset-script/components/command-entry";
12
11
  import { CommandRouter } from "@shell-shock/preset-script/components/command-router";
13
12
  import { ConsoleBuiltin } from "@shell-shock/preset-script/components/console-builtin";
14
- import { Help, HelpOptions } from "@shell-shock/preset-script/components/help";
13
+ import { HelpInvoke } from "@shell-shock/preset-script/components/help";
15
14
  import { UtilsBuiltin } from "@shell-shock/preset-script/components/utils-builtin";
16
15
  import { VirtualCommandEntry } from "@shell-shock/preset-script/components/virtual-command-entry";
17
16
 
@@ -37,9 +36,7 @@ const plugin = (options = {}) => {
37
36
  },
38
37
  async prepare() {
39
38
  this.debug("Rendering built-in modules for the Shell Shock `cli` preset.");
40
- return render(this, [createComponent(UtilsBuiltin, {}), createComponent(ConsoleBuiltin, { get banner() {
41
- return createComponent(BannerFunctionDeclaration, {});
42
- } })]);
39
+ return render(this, [createComponent(UtilsBuiltin, {}), createComponent(ConsoleBuiltin, {})]);
43
40
  }
44
41
  },
45
42
  {
@@ -53,12 +50,21 @@ const plugin = (options = {}) => {
53
50
  builtinImports: {
54
51
  console: [
55
52
  "divider",
53
+ "stripAnsi",
56
54
  "writeLine",
55
+ "splitText",
57
56
  "colors",
58
- "banner",
59
57
  "help"
60
58
  ],
61
- utils: ["getArgs"]
59
+ utils: ["getArgs", "isMinimal"],
60
+ env: ["isCI"]
61
+ },
62
+ get prefix() {
63
+ return [
64
+ createComponent(BannerFunctionDeclaration, {}),
65
+ createIntrinsic("hbr", {}),
66
+ createIntrinsic("hbr", {})
67
+ ];
62
68
  },
63
69
  get children() {
64
70
  return [
@@ -86,55 +92,12 @@ const plugin = (options = {}) => {
86
92
  }
87
93
  }),
88
94
  createIntrinsic("hbr", {}),
89
- code`
90
- writeLine("");
91
- banner();
92
- writeLine(""); `,
93
- createIntrinsic("hbr", {}),
94
- createIntrinsic("hbr", {}),
95
- code`writeLine(colors.text.heading.secondary("Global Options:"));`,
96
- createIntrinsic("hbr", {}),
97
- createComponent(HelpOptions, { get options() {
98
- return _self$.options;
99
- } }),
100
- code`writeLine(""); `,
101
- createIntrinsic("hbr", {}),
102
- createIntrinsic("hbr", {}),
103
- createComponent(Show, {
104
- get when() {
105
- return Object.keys(_self$.commands).length > 0;
95
+ createComponent(HelpInvoke, {
96
+ get options() {
97
+ return _self$.options;
106
98
  },
107
- get children() {
108
- return [
109
- code`writeLine(colors.text.body.secondary("The following commands are available:"));
110
- writeLine(""); `,
111
- createIntrinsic("hbr", {}),
112
- createIntrinsic("hbr", {}),
113
- createComponent(For, {
114
- get each() {
115
- return Object.values(_self$.commands);
116
- },
117
- doubleHardline: true,
118
- joiner: code`writeLine(""); `,
119
- ender: code`writeLine(""); `,
120
- children: (child) => [
121
- memo(() => code`
122
- writeLine(colors.text.heading.primary("${child.title} ${child.isVirtual ? "" : "Command"}"));
123
- writeLine("");
124
- writeLine(colors.text.body.secondary("${child.description}"));
125
- writeLine("");
126
- `),
127
- createIntrinsic("hbr", {}),
128
- createComponent(Help, {
129
- command: child,
130
- indent: 2
131
- }),
132
- createIntrinsic("hbr", {})
133
- ]
134
- }),
135
- memo(() => code`help("Running a specific command with the help flag (via: '${getAppBin(_self$)} <specific command> --help') will provide additional information that is specific to that command.");
136
- writeLine("");`)
137
- ];
99
+ get commands() {
100
+ return _self$.commands ?? {};
138
101
  }
139
102
  })
140
103
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","getAppBin","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","Help","HelpOptions","UtilsBuiltin","VirtualCommandEntry","BannerFunctionDeclaration","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","banner","order","handler","_self$","builtinImports","console","utils","children","when","Object","keys","commands","length","type","initializer","_$createIntrinsic","path","each","values","doubleHardline","joiner","ender","child","_$memo","title","isVirtual","description","command","indent","fallback"],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport { getAppBin } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport { BinEntry } from \"@shell-shock/preset-script/components/bin-entry\";\nimport { CommandEntry } from \"@shell-shock/preset-script/components/command-entry\";\nimport { CommandRouter } from \"@shell-shock/preset-script/components/command-router\";\nimport { ConsoleBuiltin } from \"@shell-shock/preset-script/components/console-builtin\";\nimport { Help, HelpOptions } from \"@shell-shock/preset-script/components/help\";\nimport { UtilsBuiltin } from \"@shell-shock/preset-script/components/utils-builtin\";\nimport { VirtualCommandEntry } from \"@shell-shock/preset-script/components/virtual-command-entry\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BannerFunctionDeclaration } from \"./components\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { CLIPresetContext, CLIPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <TContext extends CLIPresetContext = CLIPresetContext>(\n options: CLIPresetOptions = {}\n) => {\n return [\n theme({\n theme: options.theme\n }),\n {\n name: \"shell-shock:cli-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `cli` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n },\n configResolved() {\n this.dependencies.didyoumean2 = \"^7.0.4\";\n },\n async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `cli` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin banner={<BannerFunctionDeclaration />} />\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: [\"divider\", \"writeLine\", \"colors\", \"banner\", \"help\"],\n utils: [\"getArgs\"]\n }}>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`getArgs();`}\n />\n <hbr />\n <CommandRouter path={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <hbr />\n {code`\n writeLine(\"\");\n banner();\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n {code`writeLine(colors.text.heading.secondary(\"Global Options:\"));`}\n <hbr />\n <HelpOptions options={this.options} />\n {code`writeLine(\"\"); `}\n <hbr />\n <hbr />\n <Show when={Object.keys(this.commands).length > 0}>\n {code`writeLine(colors.text.body.secondary(\"The following commands are available:\"));\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n <For\n each={Object.values(this.commands)}\n doubleHardline\n joiner={code`writeLine(\"\"); `}\n ender={code`writeLine(\"\"); `}>\n {child => (\n <>\n {code`\n writeLine(colors.text.heading.primary(\"${child.title} ${child.isVirtual ? \"\" : \"Command\"}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n `}\n <hbr />\n <Help command={child} indent={2} />\n <hbr />\n </>\n )}\n </For>\n {code`help(\"Running a specific command with the help flag (via: '${getAppBin(\n this\n )} <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`}\n </Show>\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsCA,MAAaiB,UACXC,UAA4B,EAAE,KAC3B;AACH,QAAO;EACLZ,MAAM,EACJA,OAAOY,QAAQZ,OAChB,CAAC;EACF;GACEa,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,oEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEHM,iBAAiB;AACf,SAAKC,aAAaC,cAAc;;GAElC,MAAMC,UAAU;AACd,SAAKN,MACH,+DACD;AAED,WAAOjB,OACL,MAAI,CAAAwB,gBAEDf,cAAY,EAAA,CAAA,EAAAe,gBACZlB,gBAAc,EAAA,IAACmB,SAAM;AAAA,YAAAD,gBAAGb,2BAAyB,EAAA,CAAA;OAAA,CAAA,CAEtD,CAAC;;GAEJ;EACD;GACEI,MAAM;GACNQ,SAAS;IACPG,OAAO;IACP,MAAMC,UAAU;KAAA,MAAAC,SAAA;AACd,UAAKX,MACH,iEACD;AAED,YAAOjB,OACL,MAAI,CAAAwB,gBAEDrB,UAAQ;MACP0B,gBAAgB;OACdC,SAAS;QAAC;QAAW;QAAa;QAAU;QAAU;QAAO;OAC7DC,OAAO,CAAC,UAAS;OAClB;MAAA,IAAAC,WAAA;AAAA,cAAA;QAAAR,gBACA1B,MAAI;SAAA,IAACmC,OAAI;AAAA,iBAAEC,OAAOC,KAAKP,OAAKQ,SAAS,CAACC,SAAS;;SAAC,IAAAL,WAAA;AAAA,iBAAA;WAAAR,gBAC9CzB,gBAAc;YAAA,SAAA;YAEb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pD,IAAI,8DAA8DK,UAAS2B,OAE3E,CAAA;kCACc;WAAA;;SAAA,CAAA;QAAA;;MAAA,CAAA,EAAAJ,gBAGlB1B,MAAI;MAAA,IAACmC,OAAI;AAAA,cAAEC,OAAOS,OAAOf,OAAKQ,SAAS,CAACC,SAAS;;MAAC,IAAAL,WAAA;AAAA,cAAAR,gBAChD3B,KAAG;QAAA,IAAC6C,OAAI;AAAA,gBAAER,OAAOS,OAAOf,OAAKQ,SAAS;;QAAEQ,gBAAc;QAAAZ,WACpDe,UAAKvB,gBACH1B,MAAI;SAAA,IACHmC,OAAI;AAAA,iBAAEc,MAAMG;;SAAS,IACrBI,WAAQ;AAAA,iBAAA9B,gBAAGpB,cAAY,EAACgD,SAASL,OAAK,CAAA;;SAAA,IAAAf,WAAA;AAAA,iBAAAR,gBACrCd,qBAAmB,EAAC0C,SAASL,OAAK,CAAA;;SAAA,CAAA;QAEtC,CAAA;;MAAA,CAAA,CAIT,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAelC"}
1
+ {"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","HelpInvoke","UtilsBuiltin","VirtualCommandEntry","BannerFunctionDeclaration","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","builtinImports","console","utils","env","prefix","_$createIntrinsic","children","when","Object","keys","commands","length","type","initializer","path","values","each","doubleHardline","child","isVirtual","fallback","command"],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport { BinEntry } from \"@shell-shock/preset-script/components/bin-entry\";\nimport { CommandEntry } from \"@shell-shock/preset-script/components/command-entry\";\nimport { CommandRouter } from \"@shell-shock/preset-script/components/command-router\";\nimport { ConsoleBuiltin } from \"@shell-shock/preset-script/components/console-builtin\";\nimport { HelpInvoke } from \"@shell-shock/preset-script/components/help\";\nimport { UtilsBuiltin } from \"@shell-shock/preset-script/components/utils-builtin\";\nimport { VirtualCommandEntry } from \"@shell-shock/preset-script/components/virtual-command-entry\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BannerFunctionDeclaration } from \"./components\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { CLIPresetContext, CLIPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <TContext extends CLIPresetContext = CLIPresetContext>(\n options: CLIPresetOptions = {}\n) => {\n return [\n theme({\n theme: options.theme\n }),\n {\n name: \"shell-shock:cli-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `cli` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n },\n configResolved() {\n this.dependencies.didyoumean2 = \"^7.0.4\";\n },\n async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `cli` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\n );\n }\n },\n {\n name: \"shell-shock:cli-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `cli` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\",\n \"help\"\n ],\n utils: [\"getArgs\", \"isMinimal\"],\n env: [\"isCI\"]\n }}\n prefix={\n <>\n <BannerFunctionDeclaration />\n <hbr />\n <hbr />\n </>\n }>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`getArgs();`}\n />\n <hbr />\n <CommandRouter path={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <hbr />\n <HelpInvoke\n options={this.options}\n commands={this.commands ?? {}}\n />\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqCA,MAAae,UACXC,UAA4B,EAAE,KAC3B;AACH,QAAO;EACLX,MAAM,EACJA,OAAOW,QAAQX,OAChB,CAAC;EACF;GACEY,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,oEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEHM,iBAAiB;AACf,SAAKC,aAAaC,cAAc;;GAElC,MAAMC,UAAU;AACd,SAAKN,MACH,+DACD;AAED,WAAOf,OACL,MAAI,CAAAsB,gBAEDf,cAAY,EAAA,CAAA,EAAAe,gBACZjB,gBAAc,EAAA,CAAA,CAEnB,CAAC;;GAEJ;EACD;GACEQ,MAAM;GACNQ,SAAS;IACPE,OAAO;IACP,MAAMC,UAAU;KAAA,MAAAC,SAAA;AACd,UAAKV,MACH,iEACD;AAED,YAAOf,OACL,MAAI,CAAAsB,gBAEDpB,UAAQ;MACPwB,gBAAgB;OACdC,SAAS;QACP;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4C,SAASH,OAAK,CAAA;;SAAA,IAAAZ,WAAA;AAAA,iBAAAV,gBACrCd,qBAAmB,EAACuC,SAASH,OAAK,CAAA;;SAAA,CAAA;QAEtC,CAAA;;MAAA,CAAA,CAIT,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAejC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/preset-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "description": "A package containing a Shell Shock plugin to generate source code given a list design tokens.",
6
6
  "repository": {
@@ -69,18 +69,18 @@
69
69
  "default": "./dist/components/index.mjs"
70
70
  }
71
71
  },
72
- "./components/banner": {
72
+ "./components/banner-function-declaration": {
73
73
  "require": {
74
- "types": "./dist/components/banner.d.cts",
75
- "default": "./dist/components/banner.cjs"
74
+ "types": "./dist/components/banner-function-declaration.d.cts",
75
+ "default": "./dist/components/banner-function-declaration.cjs"
76
76
  },
77
77
  "import": {
78
- "types": "./dist/components/banner.d.mts",
79
- "default": "./dist/components/banner.mjs"
78
+ "types": "./dist/components/banner-function-declaration.d.mts",
79
+ "default": "./dist/components/banner-function-declaration.mjs"
80
80
  },
81
81
  "default": {
82
- "types": "./dist/components/banner.d.mts",
83
- "default": "./dist/components/banner.mjs"
82
+ "types": "./dist/components/banner-function-declaration.d.mts",
83
+ "default": "./dist/components/banner-function-declaration.mjs"
84
84
  }
85
85
  },
86
86
  "./package.json": "./package.json",
@@ -122,17 +122,16 @@
122
122
  "storm-software"
123
123
  ],
124
124
  "dependencies": {
125
- "@alloy-js/core": "0.22.0",
125
+ "@alloy-js/core": "^0.22.0",
126
126
  "@alloy-js/typescript": "^0.22.0",
127
- "@powerlines/deepkit": "^0.6.47",
128
- "@powerlines/plugin-alloy": "^0.20.10",
129
- "@powerlines/plugin-plugin": "^0.12.218",
130
- "@shell-shock/core": "^0.4.4",
131
- "@shell-shock/plugin-theme": "^0.0.12",
132
- "@shell-shock/preset-script": "^0.3.2",
133
- "@stryke/string-format": "^0.13.7",
127
+ "@powerlines/deepkit": "^0.6.50",
128
+ "@powerlines/plugin-alloy": "^0.20.14",
129
+ "@powerlines/plugin-plugin": "^0.12.221",
130
+ "@shell-shock/core": "^0.5.0",
131
+ "@shell-shock/plugin-theme": "^0.0.13",
132
+ "@shell-shock/preset-script": "^0.3.3",
134
133
  "cfonts": "^3.3.1",
135
- "powerlines": "^0.38.34"
134
+ "powerlines": "^0.38.37"
136
135
  },
137
136
  "devDependencies": {
138
137
  "@babel/core": "^7.29.0",
@@ -163,5 +162,5 @@
163
162
  }
164
163
  },
165
164
  "types": "./dist/index.d.cts",
166
- "gitHead": "2905cdd0c86c5c4f8b4205e82fd180ee0b97351e"
165
+ "gitHead": "533bcb80b1bcd7b3419e062287bedf4afed8a449"
167
166
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"banner.d.cts","names":[],"sources":["../../src/components/banner.tsx"],"sourcesContent":[],"mappings":";;;;UA+BiB,8BAAA;YACL;;EADK,KAAA,CAAA,EAAA,MAAA;AASjB;;;;iBAAgB,yBAAA,QACP,iCAA8B,eAAA,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"banner.d.mts","names":[],"sources":["../../src/components/banner.tsx"],"sourcesContent":[],"mappings":";;;;UA+BiB,8BAAA;YACL;;EADK,KAAA,CAAA,EAAA,MAAA;AASjB;;;;iBAAgB,yBAAA,QACP,iCAA8B,eAAA,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"banner.mjs","names":["code","computed","FunctionDeclaration","usePowerlines","useCommand","getAppDescription","getAppTitle","useTheme","render","BannerFunctionDeclaration","props","consoleFnName","variant","title","titleProp","theme","context","command","header","labels","banner","packageJson","version","description","footer","test","value","toLowerCase","replace","trim","titleLines","result","font","align","colors","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","topLeft","icons","top","topRight","bottomLeft","bottom","bottomRight"],"sources":["../../src/components/banner.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 { useCommand } from \"@shell-shock/core/contexts/command\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { ThemeColorVariant } from \"@shell-shock/plugin-theme/types/theme\";\nimport { useTheme } from \"@shell-shock/preset-script/contexts/theme\";\nimport type { ScriptPresetContext } from \"@shell-shock/preset-script/types/plugin\";\nimport { render } from \"cfonts\";\n\nexport interface BannerFunctionDeclarationProps {\n variant?: ThemeColorVariant;\n consoleFnName?: \"log\" | \"info\" | \"warn\" | \"error\" | \"debug\";\n title?: string;\n}\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 {\n consoleFnName = \"log\",\n variant = \"primary\",\n title: titleProp\n } = props;\n\n const theme = useTheme();\n\n const context = usePowerlines<ScriptPresetContext>();\n const command = useCommand();\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 titleProp ||\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 colors: [\"system\"],\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 export\n name=\"banner\"\n doc=\"Write the application banner to the console.\">\n {code`\n if (hasFlag(\"no-banner\") || hasFlag(\"hide-banner\") || isCI || isMinimal) {\n return;\n }\n\n const titleLines = [${titleLines.value\n .map(line => JSON.stringify(line))\n .join(\", \")}];\n const title = Math.max(...titleLines.map(line => stripAnsi(line).trim().length)) > Math.max(process.stdout.columns - ${\n totalPadding.value\n }, 0)\n ? [\"${title.value}\"]\n : titleLines;\n\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].topLeft\n }\") + ${\n theme.icons.banner.header[variant]\n ? `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\".repeat(4)) + \" \" + ${\n theme.icons.banner.header[variant]\n ? `colors.text.banner.header.${variant}(\"${\n theme.icons.banner.header[variant]\n }\") + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\") + \" \" +`\n : \"\"\n } colors.bold(colors.text.banner.header.${variant}(\"${\n header.value\n }\")) + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\".repeat(Math.max(process.stdout.columns - ${\n 4 +\n (theme.icons.banner.header[variant]\n ? theme.icons.banner.header[variant].length + 3\n : 0) +\n (header.value ? header.value.length + 2 : 0) +\n bannerPadding.value\n }, 0)))`\n : `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\".repeat(Math.max(process.stdout.columns - ${\n bannerPadding.value\n }, 0)))`\n } + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].topRight\n }\"), { consoleFn: console.${consoleFnName} });\n\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(process.stdout.columns - ${\n bannerPadding.value\n })) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n\n title.map(line => line.trim()).forEach((line) => {\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.text.banner.title.${\n variant\n }(line) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n });\n\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(process.stdout.columns - ${\n bannerPadding.value\n })) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n\n ${\n command?.title\n ? `writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.bold(colors.text.banner.command.${\n variant\n }(\"${command.title}\")) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} }); `\n : \"\"\n }\n\n splitText(\n ${\n command?.title\n ? \"colors.text.banner.description\"\n : \"colors.text.banner.command\"\n }.${variant}(\"${description.value.replace(/\"/g, '\\\\\"')}\"),\n Math.max(process.stdout.columns - ${totalPadding.value}, 0)\n ).forEach((line) => {\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.text.banner.description.${variant}(line) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n });\n\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottomLeft\n }\") + ${\n footer.value\n ? `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(Math.max(process.stdout.columns - ${\n 6 +\n (footer.value ? footer.value.length : 0) +\n bannerPadding.value\n }, 0))) + \" \" + ${\n footer.value\n ? `colors.bold(colors.text.banner.footer.${variant}(\"${footer.value}\"))`\n : \"\"\n } + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(4))`\n : `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(Math.max(process.stdout.columns - ${\n bannerPadding.value\n }, 0)))`\n } + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottomRight\n }\"), { consoleFn: console.${consoleFnName} });\n`}\n </FunctionDeclaration>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAwCA,SAAgBS,0BACdC,OACA;CACA,MAAM,EACJC,gBAAgB,OAChBC,UAAU,WACVC,OAAOC,cACLJ;CAEJ,MAAMK,QAAQR,UAAU;CAExB,MAAMS,UAAUb,eAAoC;CACpD,MAAMc,UAAUb,YAAY;CAE5B,MAAMc,SAASjB,eAEX,GAAGc,MAAMI,OAAOC,OAAOF,OAAON,YAAYN,YAAYU,QAAQ,CAAA,IAAKA,QAAQK,YAAYC,WAAW,UACrG;CACD,MAAMC,cAActB,eACZgB,SAASM,eAAelB,kBAAkBW,QAClD,CAAC;CACD,MAAMQ,SAASvB,eAAec,MAAMI,OAAOC,OAAOI,OAAOZ,SAAS;CAElE,MAAMC,QAAQZ,eACZa,aACA,4DAA4DW,KAC1DP,OAAOQ,MAAMC,aACf,CAAC,GACGT,OAAOQ,MACJE,QAAQ,IAAIZ,QAAQK,YAAYC,WAAW,WAAW,GAAG,CACzDO,MAAM,GACT,GAAGX,OAAOQ,MACPE,QAAQ,IAAIZ,QAAQK,YAAYC,WAAW,WAAW,GAAG,CACzDO,MAAM,CAAA,2BACd;CAED,MAAMC,aAAa7B,eAAe;EAChC,MAAM8B,SAASvB,OAAOF,YAAYU,QAAQ,EAAE;GAC1CgB,MAAM;GACNC,OAAO;GACPC,QAAQ,CAAC,SAAS;GAClBC,YAAY;GACZC,eAAe;GACfC,YAAY;GACZC,UAAU;GACVC,oBAAoB;GACpBC,KAAK;GACN,CAAC;AACF,MAAI,CAACT,OACH,QAAO,CAACzB,YAAYU,QAAQ,CAAC;AAG/B,SAAOe,OAAOU;GACd;CAEF,MAAMC,gBAAgBzC,eAElB0C,KAAKC,IAAI7B,MAAM8B,QAAQC,KAAK,EAAE,GAAG,IACjC/B,MAAMgC,aAAa3B,OAAO4B,QAAQpC,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