@shell-shock/preset-script 0.6.6 → 0.6.8

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.
Files changed (32) hide show
  1. package/README.md +1 -1
  2. package/dist/components/banner-function-declaration.cjs.map +1 -1
  3. package/dist/components/banner-function-declaration.d.cts.map +1 -1
  4. package/dist/components/banner-function-declaration.d.mts.map +1 -1
  5. package/dist/components/banner-function-declaration.mjs.map +1 -1
  6. package/dist/components/bin-entry.cjs.map +1 -1
  7. package/dist/components/bin-entry.d.cts.map +1 -1
  8. package/dist/components/bin-entry.d.mts.map +1 -1
  9. package/dist/components/bin-entry.mjs.map +1 -1
  10. package/dist/components/command-entry.cjs.map +1 -1
  11. package/dist/components/command-entry.d.cts.map +1 -1
  12. package/dist/components/command-entry.d.mts.map +1 -1
  13. package/dist/components/command-entry.mjs.map +1 -1
  14. package/dist/components/console-builtin.cjs +10 -5
  15. package/dist/components/console-builtin.cjs.map +1 -1
  16. package/dist/components/console-builtin.mjs +10 -5
  17. package/dist/components/console-builtin.mjs.map +1 -1
  18. package/dist/components/help.d.mts +7 -7
  19. package/dist/components/helpers.d.mts +5 -5
  20. package/dist/components/helpers.d.mts.map +1 -1
  21. package/dist/components/utils-builtin.cjs +1 -1
  22. package/dist/components/utils-builtin.cjs.map +1 -1
  23. package/dist/components/utils-builtin.d.cts.map +1 -1
  24. package/dist/components/utils-builtin.d.mts +8 -8
  25. package/dist/components/utils-builtin.d.mts.map +1 -1
  26. package/dist/components/utils-builtin.mjs +1 -1
  27. package/dist/components/utils-builtin.mjs.map +1 -1
  28. package/dist/components/virtual-command-entry.cjs.map +1 -1
  29. package/dist/components/virtual-command-entry.d.cts.map +1 -1
  30. package/dist/components/virtual-command-entry.d.mts.map +1 -1
  31. package/dist/components/virtual-command-entry.mjs.map +1 -1
  32. package/package.json +9 -9
package/README.md CHANGED
@@ -27,7 +27,7 @@ This package is part of the ⚡<b>Shell Shock</b> monorepo. The Shell Shock pack
27
27
 
28
28
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
29
29
 
30
- [![Version](https://img.shields.io/badge/version-0.6.4-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://stormsoftware.com/projects/shell-shock/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/shell-shock/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
30
+ [![Version](https://img.shields.io/badge/version-0.6.6-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://stormsoftware.com/projects/shell-shock/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/shell-shock/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
31
31
 
32
32
  <!-- prettier-ignore-start -->
33
33
  <!-- markdownlint-disable -->
@@ -1 +1 @@
1
- {"version":3,"file":"banner-function-declaration.cjs","names":["code","computed","Show","FunctionDeclaration","Spacing","usePowerlines","getAppDescription","getAppTitle","useTheme","BannerFunctionDeclaration","props","consoleFnName","variant","command","children","insertNewlineBeforeBanner","theme","context","header","labels","banner","packageJson","version","description","footer","title","test","value","toLowerCase","replace","trim","_$createComponent","name","doc","BannerFunctionBodyDeclaration","insertNewlineBeforeCommand","bannerPadding","Math","max","padding","app","borderStyles","outline","left","length","right","totalPadding","when","_$memo","topLeft","icons","top","topRight","icon","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 type { Children } from \"@alloy-js/core\";\nimport { code, computed, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport type { ThemeColorVariant } from \"@shell-shock/plugin-theme/types/theme\";\nimport { useTheme } from \"../contexts\";\nimport type { ScriptPresetContext } from \"../types\";\n\nexport interface BannerFunctionDeclarationProps {\n variant?: ThemeColorVariant;\n consoleFnName?: \"log\" | \"info\" | \"warn\" | \"error\" | \"debug\";\n insertNewlineBeforeBanner?: boolean;\n command?: CommandTree;\n children?: Children;\n}\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 */\nexport function BannerFunctionDeclaration(\n props: BannerFunctionDeclarationProps\n) {\n const {\n consoleFnName = \"log\",\n variant = \"primary\",\n command,\n children,\n insertNewlineBeforeBanner = true\n } = props;\n\n const theme = useTheme();\n const context = usePowerlines<ScriptPresetContext>();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context)} v${context.packageJson.version || \"1.0.0\"}`\n );\n const description = computed(\n () => command?.description || getAppDescription(context)\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n\n const title = computed(() =>\n getAppTitle(context) ||\n /(?:cli|command line|command-line)\\s+(?:application|app)?$/.test(\n header.value.toLowerCase()\n )\n ? header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()\n : `${header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()} Command Line Application`\n );\n\n return (\n <>\n <FunctionDeclaration\n name=\"banner\"\n doc={`Write the ${getAppTitle(context)} application banner ${\n command ? `for the ${command.title} command ` : \"\"\n }to the console.`}>\n <BannerFunctionBodyDeclaration\n title={title.value}\n header={header.value}\n description={description.value}\n footer={footer.value}\n variant={variant}\n consoleFnName={consoleFnName}\n command={command}\n insertNewlineBeforeCommand\n insertNewlineBeforeBanner={insertNewlineBeforeBanner}>\n {children}\n </BannerFunctionBodyDeclaration>\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface BannerFunctionBodyDeclarationProps\n extends BannerFunctionDeclarationProps {\n title?: string;\n header?: string;\n footer?: string;\n description: string;\n insertNewlineBeforeCommand?: boolean;\n insertNewlineBeforeBanner?: boolean;\n}\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 */\nexport function BannerFunctionBodyDeclaration(\n props: BannerFunctionBodyDeclarationProps\n) {\n const {\n consoleFnName = \"log\",\n variant = \"primary\",\n title,\n header,\n footer,\n description,\n command,\n children,\n insertNewlineBeforeCommand = false,\n insertNewlineBeforeBanner = true\n } = props;\n\n const theme = useTheme();\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 {code`\n if (useApp().get(\"banner\") || hasFlag(\"no-banner\") || hasFlag(\"hide-banner\") || isMinimal) {\n return;\n }\n\n useApp().set(\"banner\", true); `}\n <Spacing />\n {children}\n <Spacing />\n <Show when={insertNewlineBeforeBanner}>{code`writeLine(\"\"); `}</Show>\n <Spacing />\n {code`\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(6)) + \" \" + ${\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\n }\")) + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\".repeat(Math.max(process.stdout.columns - ${\n 6 +\n (theme.icons.banner.header[variant]\n ? theme.icons.banner.header[variant].length + 3\n : 0) +\n (header ? header.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 splitText(\n ${title ? `\"${title}\"` : \"title\"},\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.bold(colors.text.banner.title.${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 ${\n command?.title\n ? `${\n insertNewlineBeforeCommand\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 ${`writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(\"${\n command.title\n }\").length ${command.icon ? \" + 3\" : \"\"} + ${\n bannerPadding.value\n })) / 2), 0)) + colors.bold(colors.text.banner.command.${\n variant\n }(\"${command.icon ? `${command.icon} ` : \"\"}${command.title}\")) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(\"${command.title}\").length ${\n command.icon ? \" + 3\" : \"\"\n } + ${\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 colors.bold(${\n command?.title\n ? \"colors.text.banner.description\"\n : \"colors.text.banner.command\"\n }.${variant}(\"${description.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\n ? `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(Math.max(process.stdout.columns - ${\n 8 + (footer ? footer.length : 0) + bannerPadding.value\n }, 0))) + \" \" + ${\n footer\n ? `colors.bold(colors.text.banner.footer.${variant}(\"${footer}\"))`\n : \"\"\n } + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(6))`\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 writeLine(\"\"); `}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA8CA,SAAgBS,0BACdC,OACA;CACA,MAAM,EACJC,gBAAgB,OAChBC,UAAU,WACVC,SACAC,UACAC,4BAA4B,SAC1BL;CAEJ,MAAMM,QAAQR,iCAAU;CACxB,MAAMS,8EAA8C;CAEpD,MAAMC,6CAEF,GAAGF,MAAMG,OAAOC,OAAOF,OAAON,6EAAwBK,QAAQ,CAAA,IAAKA,QAAQI,YAAYC,WAAW,UACrG;CACD,MAAMC,kDACEV,SAASU,sFAAiCN,QAClD,CAAC;CACD,MAAMO,6CAAwBR,MAAMG,OAAOC,OAAOI,OAAOZ,SAAS;CAElE,MAAMa,6GACQR,QAAQ,IACpB,4DAA4DS,K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CACiCZ,QAAO,IAC9CI,MAAMyB,aAAarB,OAAOsB,QAAQ9B,SAAS2C,OAAM,gBAEnD,gCAAgC3C,QAAO,IACrCI,MAAMyB,aAAarB,OAAOsB,QAAQ9B,SAAS2C,OAAM,6CAEjDnB,cAAcT,MAAK,QACb,kCACqBf,QAAO,IACxCI,MAAMyB,aAAarB,OAAOsB,QAAQ9B,SAAS4C,YAAW,2BAC5B7C,cAAa;;yBAEzB;EAAA"}
1
+ {"version":3,"file":"banner-function-declaration.cjs","names":["code","computed","Show","FunctionDeclaration","Spacing","usePowerlines","getAppDescription","getAppTitle","useTheme","BannerFunctionDeclaration","props","consoleFnName","variant","command","children","insertNewlineBeforeBanner","theme","context","header","labels","banner","packageJson","version","description","footer","title","test","value","toLowerCase","replace","trim","_$createComponent","name","doc","BannerFunctionBodyDeclaration","insertNewlineBeforeCommand","bannerPadding","Math","max","padding","app","borderStyles","outline","left","length","right","totalPadding","when","_$memo","topLeft","icons","top","topRight","icon","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 type { Children } from \"@alloy-js/core\";\nimport { code, computed, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport type { ThemeColorVariant } from \"@shell-shock/plugin-theme/types/theme\";\nimport { useTheme } from \"../contexts\";\nimport type { ScriptPresetContext } from \"../types\";\n\nexport interface BannerFunctionDeclarationProps {\n variant?: ThemeColorVariant;\n consoleFnName?: \"log\" | \"info\" | \"warn\" | \"error\" | \"debug\";\n insertNewlineBeforeBanner?: boolean;\n command?: CommandTree;\n children?: Children;\n}\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 */\nexport function BannerFunctionDeclaration(\n props: BannerFunctionDeclarationProps\n) {\n const {\n consoleFnName = \"log\",\n variant = \"primary\",\n command,\n children,\n insertNewlineBeforeBanner = true\n } = props;\n\n const theme = useTheme();\n const context = usePowerlines<ScriptPresetContext>();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context)} v${context.packageJson.version || \"1.0.0\"}`\n );\n const description = computed(\n () => command?.description || getAppDescription(context)\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n\n const title = computed(() =>\n getAppTitle(context) ||\n /(?:cli|command line|command-line)\\s+(?:application|app)?$/.test(\n header.value.toLowerCase()\n )\n ? header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()\n : `${header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()} Command Line Application`\n );\n\n return (\n <>\n <FunctionDeclaration\n name=\"banner\"\n doc={`Write the ${getAppTitle(context)} application banner ${\n command ? `for the ${command.title} command ` : \"\"\n }to the console.`}>\n <BannerFunctionBodyDeclaration\n title={title.value}\n header={header.value}\n description={description.value}\n footer={footer.value}\n variant={variant}\n consoleFnName={consoleFnName}\n command={command}\n insertNewlineBeforeCommand\n insertNewlineBeforeBanner={insertNewlineBeforeBanner}>\n {children}\n </BannerFunctionBodyDeclaration>\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface BannerFunctionBodyDeclarationProps extends BannerFunctionDeclarationProps {\n title?: string;\n header?: string;\n footer?: string;\n description: string;\n insertNewlineBeforeCommand?: boolean;\n insertNewlineBeforeBanner?: boolean;\n}\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 */\nexport function BannerFunctionBodyDeclaration(\n props: BannerFunctionBodyDeclarationProps\n) {\n const {\n consoleFnName = \"log\",\n variant = \"primary\",\n title,\n header,\n footer,\n description,\n command,\n children,\n insertNewlineBeforeCommand = false,\n insertNewlineBeforeBanner = true\n } = props;\n\n const theme = useTheme();\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 {code`\n if (useApp().get(\"banner\") || hasFlag(\"no-banner\") || hasFlag(\"hide-banner\") || isMinimal) {\n return;\n }\n\n useApp().set(\"banner\", true); `}\n <Spacing />\n {children}\n <Spacing />\n <Show when={insertNewlineBeforeBanner}>{code`writeLine(\"\"); `}</Show>\n <Spacing />\n {code`\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(6)) + \" \" + ${\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\n }\")) + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\".repeat(Math.max(process.stdout.columns - ${\n 6 +\n (theme.icons.banner.header[variant]\n ? theme.icons.banner.header[variant].length + 3\n : 0) +\n (header ? header.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 splitText(\n ${title ? `\"${title}\"` : \"title\"},\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.bold(colors.text.banner.title.${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 ${\n command?.title\n ? `${\n insertNewlineBeforeCommand\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 ${`writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(\"${\n command.title\n }\").length ${command.icon ? \" + 3\" : \"\"} + ${\n bannerPadding.value\n })) / 2), 0)) + colors.bold(colors.text.banner.command.${\n variant\n }(\"${command.icon ? `${command.icon} ` : \"\"}${command.title}\")) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(\"${command.title}\").length ${\n command.icon ? \" + 3\" : \"\"\n } + ${\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 colors.bold(${\n command?.title\n ? \"colors.text.banner.description\"\n : \"colors.text.banner.command\"\n }.${variant}(\"${description.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\n ? `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(Math.max(process.stdout.columns - ${\n 8 + (footer ? footer.length : 0) + bannerPadding.value\n }, 0))) + \" \" + ${\n footer\n ? `colors.bold(colors.text.banner.footer.${variant}(\"${footer}\"))`\n : \"\"\n } + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(6))`\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.borderSt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,CAAA;8CACZiB,aAAanB,MAAK;;mDAEbf,QAAO,IAC9CI,MAAMyB,aAAarB,OAAOsB,QAAQ9B,SAAS+B,KAAI,0FAE/CP,cAAcT,MAAK,gDAC4Bf,QAAO,6FACtDwB,cAAcT,MAAK,8CAC0Bf,QAAO,IACpDI,MAAMyB,aAAarB,OAAOsB,QAAQ9B,SAASiC,MAAK,2BACtBlC,cAAa;;;iDAGFC,QAAO,IAC9CI,MAAMyB,aAAarB,OAAOsB,QAAQ9B,SAAS0C,WAAU,OAErD9B,SACI,gCAAgCZ,QAAO,IACrCI,MAAMyB,aAAarB,OAAOsB,QAAQ9B,SAAS2C,OAAM,6CAEjD,KAAK/B,SAASA,OAAOoB,SAAS,KAAKR,cAAcT,MAAK,iBAEtDH,SACI,yCAAyCZ,QAAO,IAAKY,OAAM,OAC3D,GAAE,wCACiCZ,QAAO,IAC9CI,MAAMyB,aAAarB,OAAOsB,QAAQ9B,SAAS2C,OAAM,gBAEnD,gCAAgC3C,QAAO,IACrCI,MAAMyB,aAAarB,OAAOsB,QAAQ9B,SAAS2C,OAAM,6CAEjDnB,cAAcT,MAAK,QACb,kCACqBf,QAAO,IACxCI,MAAMyB,aAAarB,OAAOsB,QAAQ9B,SAAS4C,YAAW,2BAC5B7C,cAAa;;yBAEzB;EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"banner-function-declaration.d.cts","names":[],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":[],"mappings":";;;;;UAgCiB,8BAAA;YACL;EADK,aAAA,CAAA,EAAA,KAAA,GAAA,MAAA,GAA8B,MAAA,GAAA,OAAA,GAAA,OAAA;EACnC,yBAAA,CAAA,EAAA,OAAA;EAGA,OAAA,CAAA,EAAA,WAAA;EACC,QAAA,CAAA,EAAA,QAAA;;AASb;AA4DA;AAgBA;;;;iBA5EgB,yBAAA,QACP,iCAA8B;UA2DtB,kCAAA,SACP;;;;;;;;;;;;;;iBAeM,6BAAA,QACP,qCAAkC"}
1
+ {"version":3,"file":"banner-function-declaration.d.cts","names":[],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":[],"mappings":";;;;;UAgCiB,8BAAA;YACL;EADK,aAAA,CAAA,EAAA,KAAA,GAAA,MAAA,GAA8B,MAAA,GAAA,OAAA,GAAA,OAAA;EACnC,yBAAA,CAAA,EAAA,OAAA;EAGA,OAAA,CAAA,EAAA,WAAA;EACC,QAAA,CAAA,EAAA,QAAA;;AASb;AA4DA;AAeA;;;;iBA3EgB,yBAAA,QACP,iCAA8B;UA2DtB,kCAAA,SAA2C;;;;;;;;;;;;;;iBAe5C,6BAAA,QACP,qCAAkC"}
@@ -1 +1 @@
1
- {"version":3,"file":"banner-function-declaration.d.mts","names":[],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":[],"mappings":";;;;;UAgCiB,8BAAA;YACL;EADK,aAAA,CAAA,EAAA,KAAA,GAAA,MAAA,GAA8B,MAAA,GAAA,OAAA,GAAA,OAAA;EACnC,yBAAA,CAAA,EAAA,OAAA;EAGA,OAAA,CAAA,EAAA,WAAA;EACC,QAAA,CAAA,EAAA,QAAA;;AASb;AA4DA;AAgBA;;;;iBA5EgB,yBAAA,QACP,iCAA8B;UA2DtB,kCAAA,SACP;;;;;;;;;;;;;;iBAeM,6BAAA,QACP,qCAAkC"}
1
+ {"version":3,"file":"banner-function-declaration.d.mts","names":[],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":[],"mappings":";;;;;UAgCiB,8BAAA;YACL;EADK,aAAA,CAAA,EAAA,KAAA,GAAA,MAAA,GAA8B,MAAA,GAAA,OAAA,GAAA,OAAA;EACnC,yBAAA,CAAA,EAAA,OAAA;EAGA,OAAA,CAAA,EAAA,WAAA;EACC,QAAA,CAAA,EAAA,QAAA;;AASb;AA4DA;AAeA;;;;iBA3EgB,yBAAA,QACP,iCAA8B;UA2DtB,kCAAA,SAA2C;;;;;;;;;;;;;;iBAe5C,6BAAA,QACP,qCAAkC"}
@@ -1 +1 @@
1
- {"version":3,"file":"banner-function-declaration.mjs","names":["code","computed","Show","FunctionDeclaration","Spacing","usePowerlines","getAppDescription","getAppTitle","useTheme","BannerFunctionDeclaration","props","consoleFnName","variant","command","children","insertNewlineBeforeBanner","theme","context","header","labels","banner","packageJson","version","description","footer","title","test","value","toLowerCase","replace","trim","_$createComponent","name","doc","BannerFunctionBodyDeclaration","insertNewlineBeforeCommand","bannerPadding","Math","max","padding","app","borderStyles","outline","left","length","right","totalPadding","when","_$memo","topLeft","icons","top","topRight","icon","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 type { Children } from \"@alloy-js/core\";\nimport { code, computed, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport type { ThemeColorVariant } from \"@shell-shock/plugin-theme/types/theme\";\nimport { useTheme } from \"../contexts\";\nimport type { ScriptPresetContext } from \"../types\";\n\nexport interface BannerFunctionDeclarationProps {\n variant?: ThemeColorVariant;\n consoleFnName?: \"log\" | \"info\" | \"warn\" | \"error\" | \"debug\";\n insertNewlineBeforeBanner?: boolean;\n command?: CommandTree;\n children?: Children;\n}\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 */\nexport function BannerFunctionDeclaration(\n props: BannerFunctionDeclarationProps\n) {\n const {\n consoleFnName = \"log\",\n variant = \"primary\",\n command,\n children,\n insertNewlineBeforeBanner = true\n } = props;\n\n const theme = useTheme();\n const context = usePowerlines<ScriptPresetContext>();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context)} v${context.packageJson.version || \"1.0.0\"}`\n );\n const description = computed(\n () => command?.description || getAppDescription(context)\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n\n const title = computed(() =>\n getAppTitle(context) ||\n /(?:cli|command line|command-line)\\s+(?:application|app)?$/.test(\n header.value.toLowerCase()\n )\n ? header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()\n : `${header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()} Command Line Application`\n );\n\n return (\n <>\n <FunctionDeclaration\n name=\"banner\"\n doc={`Write the ${getAppTitle(context)} application banner ${\n command ? `for the ${command.title} command ` : \"\"\n }to the console.`}>\n <BannerFunctionBodyDeclaration\n title={title.value}\n header={header.value}\n description={description.value}\n footer={footer.value}\n variant={variant}\n consoleFnName={consoleFnName}\n command={command}\n insertNewlineBeforeCommand\n insertNewlineBeforeBanner={insertNewlineBeforeBanner}>\n {children}\n </BannerFunctionBodyDeclaration>\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface BannerFunctionBodyDeclarationProps\n extends BannerFunctionDeclarationProps {\n title?: string;\n header?: string;\n footer?: string;\n description: string;\n insertNewlineBeforeCommand?: boolean;\n insertNewlineBeforeBanner?: boolean;\n}\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 */\nexport function BannerFunctionBodyDeclaration(\n props: BannerFunctionBodyDeclarationProps\n) {\n const {\n consoleFnName = \"log\",\n variant = \"primary\",\n title,\n header,\n footer,\n description,\n command,\n children,\n insertNewlineBeforeCommand = false,\n insertNewlineBeforeBanner = true\n } = props;\n\n const theme = useTheme();\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 {code`\n if (useApp().get(\"banner\") || hasFlag(\"no-banner\") || hasFlag(\"hide-banner\") || isMinimal) {\n return;\n }\n\n useApp().set(\"banner\", true); `}\n <Spacing />\n {children}\n <Spacing />\n <Show when={insertNewlineBeforeBanner}>{code`writeLine(\"\"); `}</Show>\n <Spacing />\n {code`\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(6)) + \" \" + ${\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\n }\")) + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\".repeat(Math.max(process.stdout.columns - ${\n 6 +\n (theme.icons.banner.header[variant]\n ? theme.icons.banner.header[variant].length + 3\n : 0) +\n (header ? header.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 splitText(\n ${title ? `\"${title}\"` : \"title\"},\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.bold(colors.text.banner.title.${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 ${\n command?.title\n ? `${\n insertNewlineBeforeCommand\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 ${`writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(\"${\n command.title\n }\").length ${command.icon ? \" + 3\" : \"\"} + ${\n bannerPadding.value\n })) / 2), 0)) + colors.bold(colors.text.banner.command.${\n variant\n }(\"${command.icon ? `${command.icon} ` : \"\"}${command.title}\")) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(\"${command.title}\").length ${\n command.icon ? \" + 3\" : \"\"\n } + ${\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 colors.bold(${\n command?.title\n ? \"colors.text.banner.description\"\n : \"colors.text.banner.command\"\n }.${variant}(\"${description.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\n ? `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(Math.max(process.stdout.columns - ${\n 8 + (footer ? footer.length : 0) + bannerPadding.value\n }, 0))) + \" \" + ${\n footer\n ? `colors.bold(colors.text.banner.footer.${variant}(\"${footer}\"))`\n : \"\"\n } + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(6))`\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 writeLine(\"\"); `}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA8CA,SAAgBS,0BACdC,OACA;CACA,MAAM,EACJC,gBAAgB,OAChBC,UAAU,WACVC,SACAC,UACAC,4BAA4B,SAC1BL;CAEJ,MAAMM,QAAQR,UAAU;CACxB,MAAMS,UAAUZ,eAAoC;CAEpD,MAAMa,S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,8CAC0Bf,QAAO,IACpDI,MAAMyB,aAAarB,OAAOsB,QAAQ9B,SAASiC,MAAK,2BACtBlC,cAAa;;;iDAGFC,QAAO,IAC9CI,MAAMyB,aAAarB,OAAOsB,QAAQ9B,SAAS0C,WAAU,OAErD9B,SACI,gCAAgCZ,QAAO,IACrCI,MAAMyB,aAAarB,OAAOsB,QAAQ9B,SAAS2C,OAAM,6CAEjD,KAAK/B,SAASA,OAAOoB,SAAS,KAAKR,cAAcT,MAAK,iBAEtDH,SACI,yCAAyCZ,QAAO,IAAKY,OAAM,OAC3D,GAAE,wCACiCZ,QAAO,IAC9CI,MAAMyB,aAAarB,OAAOsB,QAAQ9B,SAAS2C,OAAM,gBAEnD,gCAAgC3C,QAAO,IACrCI,MAAMyB,aAAarB,OAAOsB,QAAQ9B,SAAS2C,OAAM,6CAEjDnB,cAAcT,MAAK,QACb,kCACqBf,QAAO,IACxCI,MAAMyB,aAAarB,OAAOsB,QAAQ9B,SAAS4C,YAAW,2BAC5B7C,cAAa;;yBAEzB;EAAA"}
1
+ {"version":3,"file":"banner-function-declaration.mjs","names":["code","computed","Show","FunctionDeclaration","Spacing","usePowerlines","getAppDescription","getAppTitle","useTheme","BannerFunctionDeclaration","props","consoleFnName","variant","command","children","insertNewlineBeforeBanner","theme","context","header","labels","banner","packageJson","version","description","footer","title","test","value","toLowerCase","replace","trim","_$createComponent","name","doc","BannerFunctionBodyDeclaration","insertNewlineBeforeCommand","bannerPadding","Math","max","padding","app","borderStyles","outline","left","length","right","totalPadding","when","_$memo","topLeft","icons","top","topRight","icon","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 type { Children } from \"@alloy-js/core\";\nimport { code, computed, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport type { ThemeColorVariant } from \"@shell-shock/plugin-theme/types/theme\";\nimport { useTheme } from \"../contexts\";\nimport type { ScriptPresetContext } from \"../types\";\n\nexport interface BannerFunctionDeclarationProps {\n variant?: ThemeColorVariant;\n consoleFnName?: \"log\" | \"info\" | \"warn\" | \"error\" | \"debug\";\n insertNewlineBeforeBanner?: boolean;\n command?: CommandTree;\n children?: Children;\n}\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 */\nexport function BannerFunctionDeclaration(\n props: BannerFunctionDeclarationProps\n) {\n const {\n consoleFnName = \"log\",\n variant = \"primary\",\n command,\n children,\n insertNewlineBeforeBanner = true\n } = props;\n\n const theme = useTheme();\n const context = usePowerlines<ScriptPresetContext>();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context)} v${context.packageJson.version || \"1.0.0\"}`\n );\n const description = computed(\n () => command?.description || getAppDescription(context)\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n\n const title = computed(() =>\n getAppTitle(context) ||\n /(?:cli|command line|command-line)\\s+(?:application|app)?$/.test(\n header.value.toLowerCase()\n )\n ? header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()\n : `${header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()} Command Line Application`\n );\n\n return (\n <>\n <FunctionDeclaration\n name=\"banner\"\n doc={`Write the ${getAppTitle(context)} application banner ${\n command ? `for the ${command.title} command ` : \"\"\n }to the console.`}>\n <BannerFunctionBodyDeclaration\n title={title.value}\n header={header.value}\n description={description.value}\n footer={footer.value}\n variant={variant}\n consoleFnName={consoleFnName}\n command={command}\n insertNewlineBeforeCommand\n insertNewlineBeforeBanner={insertNewlineBeforeBanner}>\n {children}\n </BannerFunctionBodyDeclaration>\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface BannerFunctionBodyDeclarationProps extends BannerFunctionDeclarationProps {\n title?: string;\n header?: string;\n footer?: string;\n description: string;\n insertNewlineBeforeCommand?: boolean;\n insertNewlineBeforeBanner?: boolean;\n}\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 */\nexport function BannerFunctionBodyDeclaration(\n props: BannerFunctionBodyDeclarationProps\n) {\n const {\n consoleFnName = \"log\",\n variant = \"primary\",\n title,\n header,\n footer,\n description,\n command,\n children,\n insertNewlineBeforeCommand = false,\n insertNewlineBeforeBanner = true\n } = props;\n\n const theme = useTheme();\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 {code`\n if (useApp().get(\"banner\") || hasFlag(\"no-banner\") || hasFlag(\"hide-banner\") || isMinimal) {\n return;\n }\n\n useApp().set(\"banner\", true); `}\n <Spacing />\n {children}\n <Spacing />\n <Show when={insertNewlineBeforeBanner}>{code`writeLine(\"\"); `}</Show>\n <Spacing />\n {code`\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(6)) + \" \" + ${\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\n }\")) + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\".repeat(Math.max(process.stdout.columns - ${\n 6 +\n (theme.icons.banner.header[variant]\n ? theme.icons.banner.header[variant].length + 3\n : 0) +\n (header ? header.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 splitText(\n ${title ? `\"${title}\"` : \"title\"},\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.bold(colors.text.banner.title.${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 ${\n command?.title\n ? `${\n insertNewlineBeforeCommand\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 ${`writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(\"${\n command.title\n }\").length ${command.icon ? \" + 3\" : \"\"} + ${\n bannerPadding.value\n })) / 2), 0)) + colors.bold(colors.text.banner.command.${\n variant\n }(\"${command.icon ? `${command.icon} ` : \"\"}${command.title}\")) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(\"${command.title}\").length ${\n command.icon ? \" + 3\" : \"\"\n } + ${\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 colors.bold(${\n command?.title\n ? \"colors.text.banner.description\"\n : \"colors.text.banner.command\"\n }.${variant}(\"${description.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\n ? `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(Math.max(process.stdout.columns - ${\n 8 + (footer ? footer.length : 0) + bannerPadding.value\n }, 0))) + \" \" + ${\n footer\n ? `colors.bold(colors.text.banner.footer.${variant}(\"${footer}\"))`\n : \"\"\n } + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(6))`\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 writeLine(\"\"); `}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA8CA,SAAgBS,0BACdC,OACA;CACA,MAAM,EACJC,gBAAgB,OAChBC,UAAU,WACVC,SACAC,UACAC,4BAA4B,SAC1BL;CAEJ,MAAMM,QAAQR,UAAU;CACxB,MAAMS,UAAUZ,eAAoC;CAEpD,MAAMa,SAASjB,eAEX,GAAGe,MAAMG,OAAOC,OAAOF,OAAON,YAAYL,YAAYU,QAAQ,CAAA,IAAKA,QAAQI,YAAYC,WAAW,UACrG;CACD,MAAMC,cAActB,eACZY,SAASU,eAAejB,kBAAkBW,QAClD,CAAC;CACD,MAAMO,SAASvB,eAAee,MAAMG,OAAOC,OAAOI,OAAOZ,SAAS;CAElE,MAAMa,QAAQxB,eACZM,YAAYU,QAAQ,IACpB,4DAA4DS,KAC1DR,OAAOS,MAAMC,aACf,CAAC,GACGV,OAAOS,MACJE,QAAQ,IAAIZ,QAAQI,YAAYC,WAAW,WAAW,GAAG,CACzDQ,MAAM,GACT,GAAGZ,OAAOS,MACPE,QAAQ,IAAIZ,QAAQI,YAAYC,WAAW,WAAW,GAAG,CACzDQ,MAAM,CAAA,2BACd;AAED,QAAA,CAAAC,gBAEK5B,qBAAmB;EAClB6B,MAAI;EAAA,IACJC,MAAG;AAAA,UAAE,a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OsB,QAAQ9B,SAAS4C,YAAW,2BAC5B7C,cAAa;;yBAEzB;EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"bin-entry.cjs","names":["code","computed","For","Show","FunctionDeclaration","IfStatement","Spacing","usePowerlines","EntryFile","TSDoc","getAppTitle","getUnique","findFileName","replaceExtension","pascalCase","defu","RunApplication","_$createComponent","_$createIntrinsic","BinEntry","props","prefix","postfix","builtinImports","imports","children","rest","context","bins","Object","values","config","bin","each","value","_$mergeProps","path","typeDefinition","file","output","didyoumean2","name","default","entries","commands","filter","command","isVirtual","reduce","ret","alias","console","utils","when","Boolean","heading","async","returnType","condition","packageJson","version","fallback"],"sources":["../../src/components/bin-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration, IfStatement } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { TypescriptFileImports } from \"@powerlines/plugin-alloy/types/components\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { TSDoc } from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\n/**\n * Runs the application main logic with proper exit handling.\n */\nexport function RunApplication() {\n return (\n <>\n <Spacing />\n {code`// Run the application main logic inside an asynchronous IIFE\n (async () => {\n const startDate = new Date();\n try {\n process.on(\"exit\", () => exit({\n startDate,\n skipExit: true,\n isSynchronous: true,\n signal: 0\n }));\n process.on(\"beforeExit\", () => exit({\n startDate,\n signal: 0\n }));\n process.on(\"message\", message => {\n if (message === 'shutdown') {\n exit({\n startDate,\n isSynchronous: true,\n signal: -128\n });\n }\n });\n\n process.once(\"SIGTERM\", () => exit({\n startDate,\n signal: 15\n }));\n process.once(\"SIGINT\", () => exit({\n startDate,\n signal: 2\n }));\n process.once(\"SIGUSR2\", () => {\n verbose(\"The application was terminated by the user\");\n return exit({\n startDate,\n signal: 12\n });\n });\n process.once(\"SIGQUIT\", () => {\n verbose(\"The application was terminated by the user\");\n return exit({\n startDate,\n signal: 12\n });\n });\n\n for (const type of [\"unhandledRejection\", \"uncaughtException\"]) {\n process.on(type, err => exit({\n startDate,\n exception: err || new Error(\\`An \\${type === \"unhandledRejection\" ? \"unhandled promise rejection\" : \"uncaught exception\"} occurred during processing - the application is shutting down.\\`)\n }));\n }\n\n await internal_appContext.run(new Map([[\"args\", getArgs()]]), async () => {\n const result = await main();\n if (result?.error) {\n error(result.error);\n }\n });\n\n exit({ startDate });\n } catch (err) {\n exit({ startDate, exception: err as Error });\n }\n })();\n `}\n <hbr />\n </>\n );\n}\n\nexport interface BinEntryProps\n extends Omit<EntryFileProps, \"path\" | \"hashbang\"> {\n prefix?: Children;\n postfix?: Children;\n children: Children;\n}\n\n/**\n * The binary entry point for the Shell Shock project.\n */\nexport function BinEntry(props: BinEntryProps) {\n const { prefix, postfix, builtinImports, imports, children, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const bins = computed(() => getUnique(Object.values(context.config.bin)));\n\n return (\n <For each={bins.value}>\n {bin => (\n <EntryFile\n {...rest}\n path={findFileName(replaceExtension(bin))}\n typeDefinition={{\n file: bin,\n output: \"bin\"\n }}\n imports={defu(\n {\n didyoumean2: [\n { name: \"didYouMean\", default: true },\n { name: \"ReturnTypeEnums\" },\n { name: \"ThresholdTypeEnums\" }\n ]\n },\n imports ?? {},\n Object.entries(context.commands)\n .filter(([, command]) => command.isVirtual)\n .reduce((ret, [name, command]) => {\n ret[`./${command.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n console: [\"error\", \"verbose\", \"table\", \"writeLine\"],\n utils: [\n \"hasFlag\",\n \"exit\",\n \"isUnicodeSupported\",\n \"internal_appContext\",\n \"getArgs\"\n ]\n })}>\n <Show when={Boolean(prefix)}>\n {prefix}\n <Spacing />\n </Show>\n <TSDoc\n heading={`Binary entry point for the ${getAppTitle(\n context\n )} CLI application.`}></TSDoc>\n <FunctionDeclaration async returnType=\"any\" name=\"main\">\n <IfStatement condition={code`hasFlag([\"version\", \"v\"])`}>\n {code`console.log(${\n context?.packageJson.version\n ? `\"${context?.packageJson.version}\"`\n : \"0.0.1\"\n });\n return;`}\n </IfStatement>\n <Spacing />\n {children}\n <hbr />\n </FunctionDeclaration>\n <hbr />\n <hbr />\n <hbr />\n <Show when={Boolean(postfix)} fallback={<RunApplication />}>\n {postfix}\n </Show>\n <hbr />\n </EntryFile>\n )}\n </For>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsCA,SAAgBgB,iBAAiB;AAC/B,QAAA;mDAEKV,2DAAO,EAAA,CAAA;EACPN,oBAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mDAkEJ,OAAA,EAAA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AAmB,CAAA;sDACrBvB,2CAAmB;MAACoD,OAAK;MAACC,YAAU;MAAOhB,MAAI;MAAA,IAAAhB,WAAA;AAAA,cAAA;yDAC7CpB,mCAAW;SAACqD,WAAW1D,oBAAI;SAA2B,IAAAyB,WAAA;AAAA,iBACpDzB,oBAAI,eACH2B,SAASgC,YAAYC,UACjB,IAAIjC,SAASgC,YAAYC,QAAO,KAChC,QAAO;;;SAET,CAAA;yDAELtD,2DAAO,EAAA,CAAA;QACPmB;yDAAQ,OAAA,EAAA,CAAA;QAAA;;MAAA,CAAA;sDAAA,OAAA,EAAA,CAAA;sDAAA,OAAA,EAAA,CAAA;sDAAA,OAAA,EAAA,CAAA;sDAMVtB,sBAAI;MAAA,IAACkD,OAAI;AAAA,cAAEC,QAAQhC,QAAQ;;MAAA,IAAEuC,WAAQ;AAAA,+DAAG7C,gBAAc,EAAA,CAAA;;MAAAS,UACpDH;MAAO,CAAA;sDAAA,OAAA,EAAA,CAAA;KAAA;;GAAA,CAAA,CAAA;EAIb,CAAA"}
1
+ {"version":3,"file":"bin-entry.cjs","names":["code","computed","For","Show","FunctionDeclaration","IfStatement","Spacing","usePowerlines","EntryFile","TSDoc","getAppTitle","getUnique","findFileName","replaceExtension","pascalCase","defu","RunApplication","_$createComponent","_$createIntrinsic","BinEntry","props","prefix","postfix","builtinImports","imports","children","rest","context","bins","Object","values","config","bin","each","value","_$mergeProps","path","typeDefinition","file","output","didyoumean2","name","default","entries","commands","filter","command","isVirtual","reduce","ret","alias","console","utils","when","Boolean","heading","async","returnType","condition","packageJson","version","fallback"],"sources":["../../src/components/bin-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration, IfStatement } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { TypescriptFileImports } from \"@powerlines/plugin-alloy/types/components\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { TSDoc } from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\n/**\n * Runs the application main logic with proper exit handling.\n */\nexport function RunApplication() {\n return (\n <>\n <Spacing />\n {code`// Run the application main logic inside an asynchronous IIFE\n (async () => {\n const startDate = new Date();\n try {\n process.on(\"exit\", () => exit({\n startDate,\n skipExit: true,\n isSynchronous: true,\n signal: 0\n }));\n process.on(\"beforeExit\", () => exit({\n startDate,\n signal: 0\n }));\n process.on(\"message\", message => {\n if (message === 'shutdown') {\n exit({\n startDate,\n isSynchronous: true,\n signal: -128\n });\n }\n });\n\n process.once(\"SIGTERM\", () => exit({\n startDate,\n signal: 15\n }));\n process.once(\"SIGINT\", () => exit({\n startDate,\n signal: 2\n }));\n process.once(\"SIGUSR2\", () => {\n verbose(\"The application was terminated by the user\");\n return exit({\n startDate,\n signal: 12\n });\n });\n process.once(\"SIGQUIT\", () => {\n verbose(\"The application was terminated by the user\");\n return exit({\n startDate,\n signal: 12\n });\n });\n\n for (const type of [\"unhandledRejection\", \"uncaughtException\"]) {\n process.on(type, err => exit({\n startDate,\n exception: err || new Error(\\`An \\${type === \"unhandledRejection\" ? \"unhandled promise rejection\" : \"uncaught exception\"} occurred during processing - the application is shutting down.\\`)\n }));\n }\n\n await internal_appContext.run(new Map([[\"args\", getArgs()]]), async () => {\n const result = await main();\n if (result?.error) {\n error(result.error);\n }\n });\n\n exit({ startDate });\n } catch (err) {\n exit({ startDate, exception: err as Error });\n }\n })();\n `}\n <hbr />\n </>\n );\n}\n\nexport interface BinEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"hashbang\"\n> {\n prefix?: Children;\n postfix?: Children;\n children: Children;\n}\n\n/**\n * The binary entry point for the Shell Shock project.\n */\nexport function BinEntry(props: BinEntryProps) {\n const { prefix, postfix, builtinImports, imports, children, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const bins = computed(() => getUnique(Object.values(context.config.bin)));\n\n return (\n <For each={bins.value}>\n {bin => (\n <EntryFile\n {...rest}\n path={findFileName(replaceExtension(bin))}\n typeDefinition={{\n file: bin,\n output: \"bin\"\n }}\n imports={defu(\n {\n didyoumean2: [\n { name: \"didYouMean\", default: true },\n { name: \"ReturnTypeEnums\" },\n { name: \"ThresholdTypeEnums\" }\n ]\n },\n imports ?? {},\n Object.entries(context.commands)\n .filter(([, command]) => command.isVirtual)\n .reduce((ret, [name, command]) => {\n ret[`./${command.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n console: [\"error\", \"verbose\", \"table\", \"writeLine\"],\n utils: [\n \"hasFlag\",\n \"exit\",\n \"isUnicodeSupported\",\n \"internal_appContext\",\n \"getArgs\"\n ]\n })}>\n <Show when={Boolean(prefix)}>\n {prefix}\n <Spacing />\n </Show>\n <TSDoc\n heading={`Binary entry point for the ${getAppTitle(\n context\n )} CLI application.`}></TSDoc>\n <FunctionDeclaration async returnType=\"any\" name=\"main\">\n <IfStatement condition={code`hasFlag([\"version\", \"v\"])`}>\n {code`console.log(${\n context?.packageJson.version\n ? `\"${context?.packageJson.version}\"`\n : \"0.0.1\"\n });\n return;`}\n </IfStatement>\n <Spacing />\n {children}\n <hbr />\n </FunctionDeclaration>\n <hbr />\n <hbr />\n <hbr />\n <Show when={Boolean(postfix)} fallback={<RunApplication />}>\n {postfix}\n </Show>\n <hbr />\n </EntryFile>\n )}\n </For>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsCA,SAAgBgB,iBAAiB;AAC/B,QAAA;mDAEKV,2DAAO,EAAA,CAAA;EACPN,oBAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mDAkEJ,OAAA,EAAA,CAAA;EAAA;;;;;AAkBP,SAAgBmB,SAASC,OAAsB;CAC7C,MAAM,EAAEC,QAAQC,SAASC,gBAAgBC,SAASC,UAAU,GAAGC,SAASN;CAExE,MAAMO,8EAA8C;CACpD,MAAMC,sFAAgCC,OAAOC,OAAOH,QAAQI,OAAOC,IAAI,CAAC,CAAC;AAEzE,yDACG9B,qBAAG;EAAA,IAAC+B,OAAI;AAAA,UAAEL,KAAKM;;EAAKT,WAClBO,yDACExB,kHACKkB,MAAI;GAAA,IACRU,OAAI;AAAA,qGAAgCJ,IAAI,CAAC;;GACzCK,gBAAgB;IACdC,MAAMN;IACNO,QAAQ;IACT;GAAA,IACDf,UAAO;AAAA,6BACL,EACEgB,aAAa;KACX;MAAEC,MAAM;MAAcC,SAAS;MAAM;KACrC,EAAED,MAAM,mBAAmB;KAC3B,EAAEA,MAAM,sBAAsB;KAAA,EAEjC,EACDjB,WAAW,EAAE,EACbK,OAAOc,QAAQhB,QAAQiB,SAAS,CAC7BC,QAAQ,GAAGC,aAAaA,QAAQC,UAAU,CAC1CC,QA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":3,"file":"bin-entry.d.cts","names":[],"sources":["../../src/components/bin-entry.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAsCA;AA4EiB,iBA5ED,cAAA,CAAA,CA6Ed,EA7E4B,QA6E5B;AAAa,UADE,aAAA,SACP,IAAK,CAAA,cAAA,EAAA,MAAA,GAAA,UAAA,CAAA,CAAA;EACJ,MAAA,CAAA,EAAA,QAAA;EACC,OAAA,CAAA,EAAA,QAAA;EACA,QAAA,EAAA,QAAA;;;AAMZ;;iBAAgB,QAAA,QAAgB,gBAAa"}
1
+ {"version":3,"file":"bin-entry.d.cts","names":[],"sources":["../../src/components/bin-entry.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAsCA;AA4EiB,iBA5ED,cAAA,CAAA,CA4Ee,EA5ED,QA4EC;AAC7B,UADe,aAAA,SAAsB,IACrC,CAAA,cAAA,EAAA,MAAA,GAAA,UAAA,CAAA,CAAA;EAGS,MAAA,CAAA,EAAA,QAAA;EACC,OAAA,CAAA,EAAA,QAAA;EACA,QAAA,EAAA,QAAA;;;AAMZ;;iBAAgB,QAAA,QAAgB,gBAAa"}
@@ -1 +1 @@
1
- {"version":3,"file":"bin-entry.d.mts","names":[],"sources":["../../src/components/bin-entry.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAsCA;AA4EiB,iBA5ED,cAAA,CAAA,CA6Ed,EA7E4B,QA6E5B;AAAa,UADE,aAAA,SACP,IAAK,CAAA,cAAA,EAAA,MAAA,GAAA,UAAA,CAAA,CAAA;EACJ,MAAA,CAAA,EAAA,QAAA;EACC,OAAA,CAAA,EAAA,QAAA;EACA,QAAA,EAAA,QAAA;;;AAMZ;;iBAAgB,QAAA,QAAgB,gBAAa"}
1
+ {"version":3,"file":"bin-entry.d.mts","names":[],"sources":["../../src/components/bin-entry.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAsCA;AA4EiB,iBA5ED,cAAA,CAAA,CA4Ee,EA5ED,QA4EC;AAC7B,UADe,aAAA,SAAsB,IACrC,CAAA,cAAA,EAAA,MAAA,GAAA,UAAA,CAAA,CAAA;EAGS,MAAA,CAAA,EAAA,QAAA;EACC,OAAA,CAAA,EAAA,QAAA;EACA,QAAA,EAAA,QAAA;;;AAMZ;;iBAAgB,QAAA,QAAgB,gBAAa"}
@@ -1 +1 @@
1
- {"version":3,"file":"bin-entry.mjs","names":["code","computed","For","Show","FunctionDeclaration","IfStatement","Spacing","usePowerlines","EntryFile","TSDoc","getAppTitle","getUnique","findFileName","replaceExtension","pascalCase","defu","RunApplication","_$createComponent","_$createIntrinsic","BinEntry","props","prefix","postfix","builtinImports","imports","children","rest","context","bins","Object","values","config","bin","each","value","_$mergeProps","path","typeDefinition","file","output","didyoumean2","name","default","entries","commands","filter","command","isVirtual","reduce","ret","alias","console","utils","when","Boolean","heading","async","returnType","condition","packageJson","version","fallback"],"sources":["../../src/components/bin-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration, IfStatement } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { TypescriptFileImports } from \"@powerlines/plugin-alloy/types/components\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { TSDoc } from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\n/**\n * Runs the application main logic with proper exit handling.\n */\nexport function RunApplication() {\n return (\n <>\n <Spacing />\n {code`// Run the application main logic inside an asynchronous IIFE\n (async () => {\n const startDate = new Date();\n try {\n process.on(\"exit\", () => exit({\n startDate,\n skipExit: true,\n isSynchronous: true,\n signal: 0\n }));\n process.on(\"beforeExit\", () => exit({\n startDate,\n signal: 0\n }));\n process.on(\"message\", message => {\n if (message === 'shutdown') {\n exit({\n startDate,\n isSynchronous: true,\n signal: -128\n });\n }\n });\n\n process.once(\"SIGTERM\", () => exit({\n startDate,\n signal: 15\n }));\n process.once(\"SIGINT\", () => exit({\n startDate,\n signal: 2\n }));\n process.once(\"SIGUSR2\", () => {\n verbose(\"The application was terminated by the user\");\n return exit({\n startDate,\n signal: 12\n });\n });\n process.once(\"SIGQUIT\", () => {\n verbose(\"The application was terminated by the user\");\n return exit({\n startDate,\n signal: 12\n });\n });\n\n for (const type of [\"unhandledRejection\", \"uncaughtException\"]) {\n process.on(type, err => exit({\n startDate,\n exception: err || new Error(\\`An \\${type === \"unhandledRejection\" ? \"unhandled promise rejection\" : \"uncaught exception\"} occurred during processing - the application is shutting down.\\`)\n }));\n }\n\n await internal_appContext.run(new Map([[\"args\", getArgs()]]), async () => {\n const result = await main();\n if (result?.error) {\n error(result.error);\n }\n });\n\n exit({ startDate });\n } catch (err) {\n exit({ startDate, exception: err as Error });\n }\n })();\n `}\n <hbr />\n </>\n );\n}\n\nexport interface BinEntryProps\n extends Omit<EntryFileProps, \"path\" | \"hashbang\"> {\n prefix?: Children;\n postfix?: Children;\n children: Children;\n}\n\n/**\n * The binary entry point for the Shell Shock project.\n */\nexport function BinEntry(props: BinEntryProps) {\n const { prefix, postfix, builtinImports, imports, children, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const bins = computed(() => getUnique(Object.values(context.config.bin)));\n\n return (\n <For each={bins.value}>\n {bin => (\n <EntryFile\n {...rest}\n path={findFileName(replaceExtension(bin))}\n typeDefinition={{\n file: bin,\n output: \"bin\"\n }}\n imports={defu(\n {\n didyoumean2: [\n { name: \"didYouMean\", default: true },\n { name: \"ReturnTypeEnums\" },\n { name: \"ThresholdTypeEnums\" }\n ]\n },\n imports ?? {},\n Object.entries(context.commands)\n .filter(([, command]) => command.isVirtual)\n .reduce((ret, [name, command]) => {\n ret[`./${command.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n console: [\"error\", \"verbose\", \"table\", \"writeLine\"],\n utils: [\n \"hasFlag\",\n \"exit\",\n \"isUnicodeSupported\",\n \"internal_appContext\",\n \"getArgs\"\n ]\n })}>\n <Show when={Boolean(prefix)}>\n {prefix}\n <Spacing />\n </Show>\n <TSDoc\n heading={`Binary entry point for the ${getAppTitle(\n context\n )} CLI application.`}></TSDoc>\n <FunctionDeclaration async returnType=\"any\" name=\"main\">\n <IfStatement condition={code`hasFlag([\"version\", \"v\"])`}>\n {code`console.log(${\n context?.packageJson.version\n ? `\"${context?.packageJson.version}\"`\n : \"0.0.1\"\n });\n return;`}\n </IfStatement>\n <Spacing />\n {children}\n <hbr />\n </FunctionDeclaration>\n <hbr />\n <hbr />\n <hbr />\n <Show when={Boolean(postfix)} fallback={<RunApplication />}>\n {postfix}\n </Show>\n <hbr />\n </EntryFile>\n )}\n </For>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsCA,SAAgBgB,iBAAiB;AAC/B,QAAA;EAAAC,gBAEKX,SAAO,EAAA,CAAA;EAC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ACkD,OAAI;AAAA,cAAEC,QAAQjC,OAAO;;MAAA,IAAAI,WAAA;AAAA,cAAA,CACxBJ,QAAMJ,gBACNX,SAAO,EAAA,CAAA,CAAA;;MAAA,CAAA;KAAAW,gBAETR,OAAK,EAAA,IACJ8C,UAAO;AAAA,aAAE,8BAA8B7C,YACrCiB,QACD,CAAA;QAAmB,CAAA;KAAAV,gBACrBb,qBAAmB;MAACoD,OAAK;MAACC,YAAU;MAAOhB,MAAI;MAAA,IAAAhB,WAAA;AAAA,cAAA;QAAAR,gBAC7CZ,aAAW;SAACqD,WAAW1D,IAAI;SAA2B,IAAAyB,WAAA;AAAA,iBACpDzB,IAAI,eACH2B,SAASgC,YAAYC,UACjB,IAAIjC,SAASgC,YAAYC,QAAO,KAChC,QAAO;;;SAET,CAAA;QAAA3C,gBAELX,SAAO,EAAA,CAAA;QACPmB;QAAQP,gBAAA,OAAA,EAAA,CAAA;QAAA;;MAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAAD,gBAMVd,MAAI;MAAA,IAACkD,OAAI;AAAA,cAAEC,QAAQhC,QAAQ;;MAAA,IAAEuC,WAAQ;AAAA,cAAA5C,gBAAGD,gBAAc,EAAA,CAAA;;MAAAS,UACpDH;MAAO,CAAA;KAAAJ,gBAAA,OAAA,EAAA,CAAA;KAAA;;GAAA,CAAA,CAAA;EAIb,CAAA"}
1
+ {"version":3,"file":"bin-entry.mjs","names":["code","computed","For","Show","FunctionDeclaration","IfStatement","Spacing","usePowerlines","EntryFile","TSDoc","getAppTitle","getUnique","findFileName","replaceExtension","pascalCase","defu","RunApplication","_$createComponent","_$createIntrinsic","BinEntry","props","prefix","postfix","builtinImports","imports","children","rest","context","bins","Object","values","config","bin","each","value","_$mergeProps","path","typeDefinition","file","output","didyoumean2","name","default","entries","commands","filter","command","isVirtual","reduce","ret","alias","console","utils","when","Boolean","heading","async","returnType","condition","packageJson","version","fallback"],"sources":["../../src/components/bin-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration, IfStatement } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { TypescriptFileImports } from \"@powerlines/plugin-alloy/types/components\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { TSDoc } from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\n/**\n * Runs the application main logic with proper exit handling.\n */\nexport function RunApplication() {\n return (\n <>\n <Spacing />\n {code`// Run the application main logic inside an asynchronous IIFE\n (async () => {\n const startDate = new Date();\n try {\n process.on(\"exit\", () => exit({\n startDate,\n skipExit: true,\n isSynchronous: true,\n signal: 0\n }));\n process.on(\"beforeExit\", () => exit({\n startDate,\n signal: 0\n }));\n process.on(\"message\", message => {\n if (message === 'shutdown') {\n exit({\n startDate,\n isSynchronous: true,\n signal: -128\n });\n }\n });\n\n process.once(\"SIGTERM\", () => exit({\n startDate,\n signal: 15\n }));\n process.once(\"SIGINT\", () => exit({\n startDate,\n signal: 2\n }));\n process.once(\"SIGUSR2\", () => {\n verbose(\"The application was terminated by the user\");\n return exit({\n startDate,\n signal: 12\n });\n });\n process.once(\"SIGQUIT\", () => {\n verbose(\"The application was terminated by the user\");\n return exit({\n startDate,\n signal: 12\n });\n });\n\n for (const type of [\"unhandledRejection\", \"uncaughtException\"]) {\n process.on(type, err => exit({\n startDate,\n exception: err || new Error(\\`An \\${type === \"unhandledRejection\" ? \"unhandled promise rejection\" : \"uncaught exception\"} occurred during processing - the application is shutting down.\\`)\n }));\n }\n\n await internal_appContext.run(new Map([[\"args\", getArgs()]]), async () => {\n const result = await main();\n if (result?.error) {\n error(result.error);\n }\n });\n\n exit({ startDate });\n } catch (err) {\n exit({ startDate, exception: err as Error });\n }\n })();\n `}\n <hbr />\n </>\n );\n}\n\nexport interface BinEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"hashbang\"\n> {\n prefix?: Children;\n postfix?: Children;\n children: Children;\n}\n\n/**\n * The binary entry point for the Shell Shock project.\n */\nexport function BinEntry(props: BinEntryProps) {\n const { prefix, postfix, builtinImports, imports, children, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const bins = computed(() => getUnique(Object.values(context.config.bin)));\n\n return (\n <For each={bins.value}>\n {bin => (\n <EntryFile\n {...rest}\n path={findFileName(replaceExtension(bin))}\n typeDefinition={{\n file: bin,\n output: \"bin\"\n }}\n imports={defu(\n {\n didyoumean2: [\n { name: \"didYouMean\", default: true },\n { name: \"ReturnTypeEnums\" },\n { name: \"ThresholdTypeEnums\" }\n ]\n },\n imports ?? {},\n Object.entries(context.commands)\n .filter(([, command]) => command.isVirtual)\n .reduce((ret, [name, command]) => {\n ret[`./${command.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n console: [\"error\", \"verbose\", \"table\", \"writeLine\"],\n utils: [\n \"hasFlag\",\n \"exit\",\n \"isUnicodeSupported\",\n \"internal_appContext\",\n \"getArgs\"\n ]\n })}>\n <Show when={Boolean(prefix)}>\n {prefix}\n <Spacing />\n </Show>\n <TSDoc\n heading={`Binary entry point for the ${getAppTitle(\n context\n )} CLI application.`}></TSDoc>\n <FunctionDeclaration async returnType=\"any\" name=\"main\">\n <IfStatement condition={code`hasFlag([\"version\", \"v\"])`}>\n {code`console.log(${\n context?.packageJson.version\n ? `\"${context?.packageJson.version}\"`\n : \"0.0.1\"\n });\n return;`}\n </IfStatement>\n <Spacing />\n {children}\n <hbr />\n </FunctionDeclaration>\n <hbr />\n <hbr />\n <hbr />\n <Show when={Boolean(postfix)} fallback={<RunApplication />}>\n {postfix}\n </Show>\n <hbr />\n </EntryFile>\n )}\n </For>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsCA,SAAgBgB,iBAAiB;AAC/B,QAAA;EAAAC,gBAEKX,SAAO,EAAA,CAAA;EACPN,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkEJkB,gBAAA,OAAA,EAAA,CAAA;EAAA;;;;;AAkBP,SAAgBC,SAASC,OAAsB;CAC7C,MAAM,EAAEC,QAAQC,SAASC,gBAAgBC,SAASC,UAAU,GAAGC,SAASN;CAExE,MAAMO,UAAUpB,eAAoC;CACpD,MAAMqB,OAAO3B,eAAeU,UAAUkB,OAAOC,OAAOH,QAAQI,OAAOC,IAAI,CAAC,CAAC;AAEzE,QAAAf,gBACGf,KAAG;EAAA,IAAC+B,OAAI;AAAA,UAAEL,KAAKM;;EAAKT,WAClBO,QAAGf,gBACDT,WAAS2B,WACJT,MAAI;GAAA,IACRU,OAAI;AAAA,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CAAA;QAAA3C,gBAELX,SAAO,EAAA,CAAA;QACPmB;QAAQP,gBAAA,OAAA,EAAA,CAAA;QAAA;;MAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAAD,gBAMVd,MAAI;MAAA,IAACkD,OAAI;AAAA,cAAEC,QAAQhC,QAAQ;;MAAA,IAAEuC,WAAQ;AAAA,cAAA5C,gBAAGD,gBAAc,EAAA,CAAA;;MAAAS,UACpDH;MAAO,CAAA;KAAAJ,gBAAA,OAAA,EAAA,CAAA;KAAA;;GAAA,CAAA,CAAA;EAIb,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"command-entry.cjs","names":["code","computed","For","Show","ElseClause","ElseIfClause","FunctionDeclaration","IfStatement","VarDeclaration","ReflectionKind","Spacing","usePowerlines","EntryFile","TSDoc","TSDocParam","TSDocRemarks","TSDocTitle","CommandParserLogic","OptionsInterfaceDeclaration","getAppBin","getDynamicPathSegmentName","isDynamicPathSegment","findFilePath","relativePath","joinPaths","replaceExtension","camelCase","constantCase","kebabCase","pascalCase","defu","BannerFunctionDeclaration","CommandHelp","IsDebug","VirtualCommandEntry","CommandInvocation","props","command","_$createComponent","name","initializer","segments","map","segment","join","_$memo","arguments","length","argument","_$createIntrinsic","CommandHandlerDeclaration","banner","children","context","heading","title","description","replace","async","parameters","type","default","envPrefix","config","isCaseSensitive","when","Boolean","condition","Object","values","options","option","CommandValidationLogic","each","doubleHardline","optional","includes","kind","string","number","variadic","fallback","CommandEntry","imports","builtinImports","rest","filePath","filter","commandSourcePath","entryPath","value","entry","input","file","typeDefinition","output","id","_$mergeProps","path","env","console","utils","child","isVirtual"],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport {\n ElseClause,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport {\n CommandParserLogic,\n OptionsInterfaceDeclaration\n} from \"@shell-shock/core/components/options-parser-logic\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type {\n CommandTree,\n NumberCommandArgument,\n NumberCommandOption\n} from \"@shell-shock/core/types/command\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { CommandHelp } from \"./help\";\nimport { IsDebug } from \"./helpers\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport function CommandInvocation(props: { command: CommandTree }) {\n const { command } = props;\n\n return (\n <>\n <VarDeclaration\n name=\"__context\"\n initializer={code`{ path: \\`${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `\\${${camelCase(getDynamicPathSegmentName(segment))}}`\n : segment\n )\n .join(\"/\")}\\`, segments: [${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? camelCase(getDynamicPathSegmentName(segment))\n : `\"${segment}\"`\n )\n .join(\", \")}] }`}\n />\n <Spacing />\n {code`\n\n return internal_commandContext.run(__context, () => {\n return Promise.resolve(Reflect.apply(handle${pascalCase(\n command.name\n )}, __context, [options${\n command.arguments.length > 0\n ? `, ${command.arguments\n .map(argument => camelCase(argument.name))\n .join(\", \")}`\n : \"\"\n }]));\n });\n\n `}\n <hbr />\n </>\n );\n}\n\nexport interface CommandHandlerDeclarationProps {\n command: CommandTree;\n banner?: Children;\n children?: Children;\n}\n\n/**\n * A component that generates the `handler` function declaration for a command.\n */\nexport function CommandHandlerDeclaration(\n props: CommandHandlerDeclarationProps\n) {\n const { command, banner, children } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <OptionsInterfaceDeclaration command={command} />\n <Spacing />\n <TSDoc\n heading={`The ${command.title} (${getAppBin(context)} ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `[${constantCase(getDynamicPathSegmentName(segment))}]`\n : segment\n )\n .join(\" \")}) command.`}>\n <TSDocRemarks>{`${command.description.replace(/\\.+$/, \"\")}.`}</TSDocRemarks>\n <hbr />\n <TSDocTitle>{command.title}</TSDocTitle>\n <TSDocParam name=\"args\">{`The command-line arguments passed to the command.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"handler\"\n parameters={[{ name: \"args\", type: \"string[]\", default: \"useArgs()\" }]}>\n <CommandParserLogic\n command={command}\n envPrefix={context.config.envPrefix}\n isCaseSensitive={context.config.isCaseSensitive}\n />\n <hbr />\n <hbr />\n <Show when={Boolean(banner)}>{banner}</Show>\n <hbr />\n <hbr />\n <IfStatement condition={<IsDebug />}>\n {code`writeLine(\"\");\n writeLine(colors.text.body.tertiary(\"Debug mode is enabled. Additional debug information may be logged to the console.\"));\n debug(\\`Command path: ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `\\${${camelCase(getDynamicPathSegmentName(segment))}}`\n : segment\n )\n .join(\" / \")} \\\\n\\\\nOptions: \\\\n${Object.values(command.options)\n .map(\n option =>\n ` - ${kebabCase(option.name)}: \\${options.${camelCase(\n option.name\n )} === undefined ? \"\" : JSON.stringify(options.${camelCase(\n option.name\n )})}`\n )\n .join(\"\\\\n\")}${\n command.arguments.length > 0\n ? ` \\\\n\\\\nArguments: \\\\n${command.arguments\n .map(\n argument =>\n ` - ${kebabCase(argument.name)}: \\${${camelCase(\n argument.name\n )} === undefined ? \"\" : JSON.stringify(${camelCase(\n argument.name\n )})}`\n )\n .join(\"\\\\n\")}`\n : \"\"\n }\\`);\n writeLine(\"\"); `}\n </IfStatement>\n <hbr />\n <hbr />\n {children}\n <hbr />\n <hbr />\n <IfStatement condition={code`options.help`}>\n <CommandHelp command={command} />\n </IfStatement>\n <ElseClause>\n <hbr />\n <CommandInvocation command={command} />\n </ElseClause>\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface CommandValidationLogicProps {\n command: CommandTree;\n}\n\n/**\n * A component that generates command validation logic for required options and arguments.\n */\nexport function CommandValidationLogic(props: CommandValidationLogicProps) {\n const { command } = props;\n\n return (\n <>\n <VarDeclaration name=\"failures\" type=\"string[]\" initializer={code`[];`} />\n <hbr />\n <For each={Object.values(command.options ?? {})} doubleHardline>\n {option => (\n <>\n <Show when={!option.optional}>\n <IfStatement\n condition={code`!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }`}>\n {code`failures.push(\"Missing required \\\\\"${option.name}\\\\\" option\");`}\n </IfStatement>\n <Show\n when={\n (option.kind === ReflectionKind.string ||\n option.kind === ReflectionKind.number) &&\n option.variadic\n }>\n <ElseIfClause\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0`}>\n {code`failures.push(\"No values were provided to the required \\\\\"${\n option.name\n }\\\\\" array option\");`}\n </ElseIfClause>\n </Show>\n </Show>\n <Show when={option.kind === ReflectionKind.number}>\n <Show\n when={(option as NumberCommandOption).variadic}\n fallback={\n <IfStatement\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } && Number.isNaN(options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n })`}>\n {code`failures.push(\"Invalid numeric value provided for the \\\\\"${\n option.name\n }\\\\\" option\");`}\n </IfStatement>\n }>\n <IfStatement\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.some(value => Number.isNaN(value))`}>\n {code`failures.push(\"Invalid numeric value provided in the \\\\\"${\n option.name\n }\\\\\" array option\");`}\n </IfStatement>\n </Show>\n </Show>\n </>\n )}\n </For>\n <Spacing />\n <For each={command.arguments} doubleHardline>\n {argument => (\n <>\n <Show when={!argument.optional}>\n <IfStatement condition={code`!${camelCase(argument.name)}`}>\n {code`failures.push(\"Missing required \\\\\"${\n argument.name\n }\\\\\" positional argument\");`}\n </IfStatement>\n <Show\n when={\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n }>\n <ElseIfClause\n condition={code`${camelCase(argument.name)}.length === 0`}>\n {code`failures.push(\"No values were provided to the required \\\\\"${\n argument.name\n }\\\\\" array positional argument\");`}\n </ElseIfClause>\n </Show>\n </Show>\n <Show when={argument.kind === ReflectionKind.number}>\n <Show\n when={(argument as NumberCommandArgument).variadic}\n fallback={\n <IfStatement\n condition={code`${camelCase(\n argument.name\n )} && Number.isNaN(${camelCase(argument.name)})`}>\n {code`failures.push(\"Invalid numeric value provided for the \\\\\"${\n argument.name\n }\\\\\" positional argument\");`}\n </IfStatement>\n }>\n <IfStatement\n condition={code`${camelCase(argument.name)}.some(value => Number.isNaN(value))`}>\n {code`failures.push(\"Invalid numeric value provided in the \\\\\"${\n argument.name\n }\\\\\" array positional argument\");`}\n </IfStatement>\n </Show>\n </Show>\n </>\n )}\n </For>\n <IfStatement condition={code`failures.length > 0`}>\n {code`error(\"The following validation failures were found while processing the user provided input, and must be corrected before the command line process can be executed: \\\\n\\\\n\" + failures.map(failure => \" - \" + failure).join(\"\\\\n\"));\n options.help = true; `}\n </IfStatement>\n </>\n );\n}\n\nexport interface CommandEntryProps\n extends Omit<EntryFileProps, \"path\" | \"typeDefinition\"> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n const commandSourcePath = computed(() =>\n replaceExtension(\n relativePath(\n joinPaths(context.entryPath, findFilePath(filePath.value)),\n command.entry.input?.file || command.entry.file\n )\n )\n );\n const typeDefinition = computed(() => ({\n ...command.entry,\n output: command.id\n }));\n\n return (\n <>\n <EntryFile\n {...rest}\n path={filePath.value}\n typeDefinition={typeDefinition.value}\n imports={defu(imports ?? {}, {\n [commandSourcePath.value]: `handle${pascalCase(command.name)}`\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isDevelopment\", \"isDebug\"],\n console: [\n \"debug\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\"\n ],\n utils: [\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <OptionsInterfaceDeclaration command={command} />\n <hbr />\n <hbr />\n <CommandHandlerDeclaration command={command} banner={code`banner(); `}>\n <CommandValidationLogic command={command} />\n </CommandHandlerDeclaration>\n </EntryFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,SAAgBmC,kBAAkBC,OAAiC;CACjE,MAAM,EAAEC,YAAYD;AAEpB,QAAA;mDAEK5B,sCAAc;GACb+B,MAAI;GAAA,IACJC,cAAW;AAAA,WAAExC,oBAAI,aAAaqC,QAAQI,SACnCC,KAAIC,sFACkBA,QAAQ,GACzB,sIAA0CA,QAAQ,CAAC,CAAA,KACnDA,QACL,CACAC,KAAK,IAAI,CAAA,iBAAkBP,QAAQI,SACnCC,KAAIC,sFACkBA,QAAQ,mIACWA,QAAQ,CAAC,GAC7C,IAAIA,QAAO,GAChB,CACAC,KAAK,KAAK,CAAA;;GAAK,CAAA;mDAEnBlC,2DAAO,EAAA,CAAA;8CACPV,oBAAI;;;wGAIDqC,QAAQE,KACT,CAAA,uBACCF,QAAQS,UAAUC,SAAS,IACvB,KAAKV,QAAQS,UACVJ,KAAIM,8DAAsBA,SAAST,KAAK,CAAC,CACzCK,KAAK,KAAK,KACb,GAAE;;;QAIT;mDAAA,OAAA,EAAA,CAAA;EAAA;;;;;AAeP,SAAgBM,0BACdd,OACA;CACA,MAAM,EAAEC,SAASc,QAAQC,aAAahB;CAEtC,MAAMiB,8EAA8C;AAEpD,QAAA;mDAEKnC,gFAA2B,EAAUmB,SAAO,CAAA;mDAC5C3B,2DAAO,EAAA,CAAA;mDACPG,6DAAK;GAAA,IACJyC,UAAO;AAAA,WA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;KACA;KACA;KACA;KACA;KAAyB;IAE5B,CAAC;;EAAA,IAAAjD,WAAA;AAAA,UAAA;qDACDrB,0EAAyB,EAAUM,SAAO,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAG1CnB,gFAA2B,EAAUmB,SAAO,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAG5Ca,2BAAyB;KAAUb;KAASc,QAAQnD,oBAAI;KAAY,IAAAoD,WAAA;AAAA,8DAClEoB,wBAAsB,EAAUnC,SAAO,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,mDAG3CnC,qBAAG;EAAA,IAACuE,OAAI;AAAA,UAAEL,OAAOC,OAAOhC,QAAQe,SAAS;;EAAAA,WACvCkD,2DACEnG,sBAAI;GAAA,IACH8D,OAAI;AAAA,WAAEqC,MAAMC;;GAAS,IACrBtB,WAAQ;AAAA,4DAAGC,cAAY,EAAC7C,SAASiE,OAAK,CAAA;;GAAA,IAAAlD,WAAA;AAAA,4DACrClB,8DAAmB,EAACG,SAASiE,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
1
+ {"version":3,"file":"command-entry.cjs","names":["code","computed","For","Show","ElseClause","ElseIfClause","FunctionDeclaration","IfStatement","VarDeclaration","ReflectionKind","Spacing","usePowerlines","EntryFile","TSDoc","TSDocParam","TSDocRemarks","TSDocTitle","CommandParserLogic","OptionsInterfaceDeclaration","getAppBin","getDynamicPathSegmentName","isDynamicPathSegment","findFilePath","relativePath","joinPaths","replaceExtension","camelCase","constantCase","kebabCase","pascalCase","defu","BannerFunctionDeclaration","CommandHelp","IsDebug","VirtualCommandEntry","CommandInvocation","props","command","_$createComponent","name","initializer","segments","map","segment","join","_$memo","arguments","length","argument","_$createIntrinsic","CommandHandlerDeclaration","banner","children","context","heading","title","description","replace","async","parameters","type","default","envPrefix","config","isCaseSensitive","when","Boolean","condition","Object","values","options","option","CommandValidationLogic","each","doubleHardline","optional","includes","kind","string","number","variadic","fallback","CommandEntry","imports","builtinImports","rest","filePath","filter","commandSourcePath","entryPath","value","entry","input","file","typeDefinition","output","id","_$mergeProps","path","env","console","utils","child","isVirtual"],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport {\n ElseClause,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport {\n CommandParserLogic,\n OptionsInterfaceDeclaration\n} from \"@shell-shock/core/components/options-parser-logic\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type {\n CommandTree,\n NumberCommandArgument,\n NumberCommandOption\n} from \"@shell-shock/core/types/command\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { CommandHelp } from \"./help\";\nimport { IsDebug } from \"./helpers\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport function CommandInvocation(props: { command: CommandTree }) {\n const { command } = props;\n\n return (\n <>\n <VarDeclaration\n name=\"__context\"\n initializer={code`{ path: \\`${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `\\${${camelCase(getDynamicPathSegmentName(segment))}}`\n : segment\n )\n .join(\"/\")}\\`, segments: [${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? camelCase(getDynamicPathSegmentName(segment))\n : `\"${segment}\"`\n )\n .join(\", \")}] }`}\n />\n <Spacing />\n {code`\n\n return internal_commandContext.run(__context, () => {\n return Promise.resolve(Reflect.apply(handle${pascalCase(\n command.name\n )}, __context, [options${\n command.arguments.length > 0\n ? `, ${command.arguments\n .map(argument => camelCase(argument.name))\n .join(\", \")}`\n : \"\"\n }]));\n });\n\n `}\n <hbr />\n </>\n );\n}\n\nexport interface CommandHandlerDeclarationProps {\n command: CommandTree;\n banner?: Children;\n children?: Children;\n}\n\n/**\n * A component that generates the `handler` function declaration for a command.\n */\nexport function CommandHandlerDeclaration(\n props: CommandHandlerDeclarationProps\n) {\n const { command, banner, children } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <OptionsInterfaceDeclaration command={command} />\n <Spacing />\n <TSDoc\n heading={`The ${command.title} (${getAppBin(context)} ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `[${constantCase(getDynamicPathSegmentName(segment))}]`\n : segment\n )\n .join(\" \")}) command.`}>\n <TSDocRemarks>{`${command.description.replace(/\\.+$/, \"\")}.`}</TSDocRemarks>\n <hbr />\n <TSDocTitle>{command.title}</TSDocTitle>\n <TSDocParam name=\"args\">{`The command-line arguments passed to the command.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"handler\"\n parameters={[{ name: \"args\", type: \"string[]\", default: \"useArgs()\" }]}>\n <CommandParserLogic\n command={command}\n envPrefix={context.config.envPrefix}\n isCaseSensitive={context.config.isCaseSensitive}\n />\n <hbr />\n <hbr />\n <Show when={Boolean(banner)}>{banner}</Show>\n <hbr />\n <hbr />\n <IfStatement condition={<IsDebug />}>\n {code`writeLine(\"\");\n writeLine(colors.text.body.tertiary(\"Debug mode is enabled. Additional debug information may be logged to the console.\"));\n debug(\\`Command path: ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `\\${${camelCase(getDynamicPathSegmentName(segment))}}`\n : segment\n )\n .join(\" / \")} \\\\n\\\\nOptions: \\\\n${Object.values(command.options)\n .map(\n option =>\n ` - ${kebabCase(option.name)}: \\${options.${camelCase(\n option.name\n )} === undefined ? \"\" : JSON.stringify(options.${camelCase(\n option.name\n )})}`\n )\n .join(\"\\\\n\")}${\n command.arguments.length > 0\n ? ` \\\\n\\\\nArguments: \\\\n${command.arguments\n .map(\n argument =>\n ` - ${kebabCase(argument.name)}: \\${${camelCase(\n argument.name\n )} === undefined ? \"\" : JSON.stringify(${camelCase(\n argument.name\n )})}`\n )\n .join(\"\\\\n\")}`\n : \"\"\n }\\`);\n writeLine(\"\"); `}\n </IfStatement>\n <hbr />\n <hbr />\n {children}\n <hbr />\n <hbr />\n <IfStatement condition={code`options.help`}>\n <CommandHelp command={command} />\n </IfStatement>\n <ElseClause>\n <hbr />\n <CommandInvocation command={command} />\n </ElseClause>\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface CommandValidationLogicProps {\n command: CommandTree;\n}\n\n/**\n * A component that generates command validation logic for required options and arguments.\n */\nexport function CommandValidationLogic(props: CommandValidationLogicProps) {\n const { command } = props;\n\n return (\n <>\n <VarDeclaration name=\"failures\" type=\"string[]\" initializer={code`[];`} />\n <hbr />\n <For each={Object.values(command.options ?? {})} doubleHardline>\n {option => (\n <>\n <Show when={!option.optional}>\n <IfStatement\n condition={code`!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }`}>\n {code`failures.push(\"Missing required \\\\\"${option.name}\\\\\" option\");`}\n </IfStatement>\n <Show\n when={\n (option.kind === ReflectionKind.string ||\n option.kind === ReflectionKind.number) &&\n option.variadic\n }>\n <ElseIfClause\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0`}>\n {code`failures.push(\"No values were provided to the required \\\\\"${\n option.name\n }\\\\\" array option\");`}\n </ElseIfClause>\n </Show>\n </Show>\n <Show when={option.kind === ReflectionKind.number}>\n <Show\n when={(option as NumberCommandOption).variadic}\n fallback={\n <IfStatement\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } && Number.isNaN(options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n })`}>\n {code`failures.push(\"Invalid numeric value provided for the \\\\\"${\n option.name\n }\\\\\" option\");`}\n </IfStatement>\n }>\n <IfStatement\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.some(value => Number.isNaN(value))`}>\n {code`failures.push(\"Invalid numeric value provided in the \\\\\"${\n option.name\n }\\\\\" array option\");`}\n </IfStatement>\n </Show>\n </Show>\n </>\n )}\n </For>\n <Spacing />\n <For each={command.arguments} doubleHardline>\n {argument => (\n <>\n <Show when={!argument.optional}>\n <IfStatement condition={code`!${camelCase(argument.name)}`}>\n {code`failures.push(\"Missing required \\\\\"${\n argument.name\n }\\\\\" positional argument\");`}\n </IfStatement>\n <Show\n when={\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n }>\n <ElseIfClause\n condition={code`${camelCase(argument.name)}.length === 0`}>\n {code`failures.push(\"No values were provided to the required \\\\\"${\n argument.name\n }\\\\\" array positional argument\");`}\n </ElseIfClause>\n </Show>\n </Show>\n <Show when={argument.kind === ReflectionKind.number}>\n <Show\n when={(argument as NumberCommandArgument).variadic}\n fallback={\n <IfStatement\n condition={code`${camelCase(\n argument.name\n )} && Number.isNaN(${camelCase(argument.name)})`}>\n {code`failures.push(\"Invalid numeric value provided for the \\\\\"${\n argument.name\n }\\\\\" positional argument\");`}\n </IfStatement>\n }>\n <IfStatement\n condition={code`${camelCase(argument.name)}.some(value => Number.isNaN(value))`}>\n {code`failures.push(\"Invalid numeric value provided in the \\\\\"${\n argument.name\n }\\\\\" array positional argument\");`}\n </IfStatement>\n </Show>\n </Show>\n </>\n )}\n </For>\n <IfStatement condition={code`failures.length > 0`}>\n {code`error(\"The following validation failures were found while processing the user provided input, and must be corrected before the command line process can be executed: \\\\n\\\\n\" + failures.map(failure => \" - \" + failure).join(\"\\\\n\"));\n options.help = true; `}\n </IfStatement>\n </>\n );\n}\n\nexport interface CommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n const commandSourcePath = computed(() =>\n replaceExtension(\n relativePath(\n joinPaths(context.entryPath, findFilePath(filePath.value)),\n command.entry.input?.file || command.entry.file\n )\n )\n );\n const typeDefinition = computed(() => ({\n ...command.entry,\n output: command.id\n }));\n\n return (\n <>\n <EntryFile\n {...rest}\n path={filePath.value}\n typeDefinition={typeDefinition.value}\n imports={defu(imports ?? {}, {\n [commandSourcePath.value]: `handle${pascalCase(command.name)}`\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isDevelopment\", \"isDebug\"],\n console: [\n \"debug\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\"\n ],\n utils: [\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <OptionsInterfaceDeclaration command={command} />\n <hbr />\n <hbr />\n <CommandHandlerDeclaration command={command} banner={code`banner(); `}>\n <CommandValidationLogic command={command} />\n </CommandHandlerDeclaration>\n </EntryFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,SAAgBmC,kBAAkBC,OAAiC;CACjE,MAAM,EAAEC,YAAYD;AAEpB,QAAA;mDAEK5B,sCAAc;GACb+B,MAAI;GAAA,IACJC,cAAW;AAAA,WAAExC,oBAAI,aAAaqC,QAAQI,SACnCC,KAAIC,sFACkBA,QAAQ,GACzB,sIAA0CA,QAAQ,CAAC,CAAA,KACnDA,QACL,CACAC,KAAK,IAAI,CAAA,iBAAkBP,QAAQI,SACnCC,KAAIC,sFACkBA,QAAQ,mIACWA,QAAQ,CAAC,GAC7C,IAAIA,QAAO,GAChB,CACAC,KAAK,KAAK,CAAA;;GAAK,CAAA;mDAEnBlC,2DAAO,EAAA,CAAA;8CACPV,oBAAI;;;wGAIDqC,QAAQE,KACT,CAAA,uBACCF,QAAQS,UAAUC,SAAS,IACvB,KAAKV,QAAQS,UACVJ,KAAIM,8DAAsBA,SAAST,KAAK,CA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,eAAeJ;;EAAK,IACpCP,UAAO;AAAA,4BAAOA,WAAW,EAAE,EAAE,GAC1BK,kBAAkBE,QAAQ,4DAAoBrD,QAAQE,KAAK,IAC7D,CAAC;;EAAA,IACF6C,iBAAc;AAAA,4BAAOA,kBAAkB,EAAE,EAAE;IACzCe,KAAK;KAAC;KAAO;KAAiB;KAAU;IACxCC,SAAS;KACP;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACD;IACDC,OAAO;KACL;KACA;KACA;KACA;KACA;KAAyB;IAE5B,CAAC;;EAAA,IAAAjD,WAAA;AAAA,UAAA;qDACDrB,0EAAyB,EAAUM,SAAO,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAG1CnB,gFAA2B,EAAUmB,SAAO,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAG5Ca,2BAAyB;KAAUb;KAASc,QAAQnD,oBAAI;KAAY,IAAAoD,WAAA;AAAA,8DAClEoB,wBAAsB,EAAUnC,SAAO,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,mDAG3CnC,qBAAG;EAAA,IAACuE,OAAI;AAAA,UAAEL,OAAOC,OAAOhC,QAAQe,SAAS;;EAAAA,WACvCkD,2DACEnG,sBAAI;GAAA,IACH8D,OAAI;AAAA,WAAEqC,MAAMC;;GAAS,IACrBtB,WAAQ;AAAA,4DAAGC,cAAY,EAAC7C,SAASiE,OAAK,CAAA;;GAAA,IAAAlD,WAAA;AAAA,4DACrClB,8DAAmB,EAACG,SAASiE,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;iBAkEgB,iBAAA;WAAoC;AAApD,CAAA,CAAA,EAAiE,QAAjD;AA0CC,UAAA,8BAAA,CAA8B;EACpC,OAAA,EAAA,WAAA;EACA,MAAA,CAAA,EAAA,QAAA;EACE,QAAA,CAAA,EAAA,QAAA;;AAMb;AA0FA;AAOA;AA+HiB,iBAhOD,yBAAA,CAiOd,KAAA,EAhOO,8BAgOP,CAAA,EAhOqC,QAgOrC;AAAa,UAvIE,2BAAA,CAuIF;EACJ,OAAA,EAvIA,WAuIA;;;AAMX;;iBAvIgB,sBAAA,QAA8B,8BAA2B;UA+HxD,iBAAA,SACP,KAAK;WACJ;;;;;iBAMK,YAAA,QAAoB,oBAAiB"}
1
+ {"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;iBAkEgB,iBAAA;WAAoC;AAApD,CAAA,CAAA,EAAiE,QAAjD;AA0CC,UAAA,8BAAA,CAA8B;EACpC,OAAA,EAAA,WAAA;EACA,MAAA,CAAA,EAAA,QAAA;EACE,QAAA,CAAA,EAAA,QAAA;;AAMb;AA0FA;AAOA;AA+HiB,iBAhOD,yBAAA,CAgOmB,KAAA,EA/N1B,8BA+N0B,CAAA,EA/NI,QA+NJ;AACjC,UAvIe,2BAAA,CAuIf;EAGS,OAAA,EAzIA,WAyIA;;;AAMX;;iBAzIgB,sBAAA,QAA8B,8BAA2B;UA+HxD,iBAAA,SAA0B,KACzC;WAGS;;;;;iBAMK,YAAA,QAAoB,oBAAiB"}
@@ -1 +1 @@
1
- {"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;iBAkEgB,iBAAA;WAAoC;AAApD,CAAA,CAAA,EAAiE,QAAjD;AA0CC,UAAA,8BAAA,CAA8B;EACpC,OAAA,EAAA,WAAA;EACA,MAAA,CAAA,EAAA,QAAA;EACE,QAAA,CAAA,EAAA,QAAA;;AAMb;AA0FA;AAOA;AA+HiB,iBAhOD,yBAAA,CAiOd,KAAA,EAhOO,8BAgOP,CAAA,EAhOqC,QAgOrC;AAAa,UAvIE,2BAAA,CAuIF;EACJ,OAAA,EAvIA,WAuIA;;;AAMX;;iBAvIgB,sBAAA,QAA8B,8BAA2B;UA+HxD,iBAAA,SACP,KAAK;WACJ;;;;;iBAMK,YAAA,QAAoB,oBAAiB"}
1
+ {"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;iBAkEgB,iBAAA;WAAoC;AAApD,CAAA,CAAA,EAAiE,QAAjD;AA0CC,UAAA,8BAAA,CAA8B;EACpC,OAAA,EAAA,WAAA;EACA,MAAA,CAAA,EAAA,QAAA;EACE,QAAA,CAAA,EAAA,QAAA;;AAMb;AA0FA;AAOA;AA+HiB,iBAhOD,yBAAA,CAgOmB,KAAA,EA/N1B,8BA+N0B,CAAA,EA/NI,QA+NJ;AACjC,UAvIe,2BAAA,CAuIf;EAGS,OAAA,EAzIA,WAyIA;;;AAMX;;iBAzIgB,sBAAA,QAA8B,8BAA2B;UA+HxD,iBAAA,SAA0B,KACzC;WAGS;;;;;iBAMK,YAAA,QAAoB,oBAAiB"}