@shell-shock/preset-script 0.6.49 → 0.6.51

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.
@@ -106,7 +106,7 @@ function CommandHandlerDeclaration(props) {
106
106
  },
107
107
  get children() {
108
108
  return _alloy_js_core.code`writeLine("");
109
- writeLine(colors.text.body.tertiary("Debug mode is enabled. Additional debug information may be logged to the console."));
109
+ writeLine(textColors.body.tertiary("Debug mode is enabled. Additional debug information may be logged to the console."));
110
110
  writeLine("");
111
111
  debug(\`Command path: ${command.segments.map((segment) => (0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment) ? `\${${(0, _stryke_string_format_camel_case.camelCase)((0, _shell_shock_core_plugin_utils.getDynamicPathSegmentName)(segment))}}` : segment).join(" / ")} \\n\\nOptions: \\n${Object.values(command.options).map((option) => ` - ${(0, _stryke_string_format_kebab_case.kebabCase)(option.name)}: \${options.${(0, _stryke_string_format_camel_case.camelCase)(option.name)} === undefined ? "" : JSON.stringify(options.${(0, _stryke_string_format_camel_case.camelCase)(option.name)})}`).join("\\n")}${command.args.length > 0 ? ` \\n\\nArguments: \\n${command.args.map((arg) => ` - ${(0, _stryke_string_format_kebab_case.kebabCase)(arg.name)}: \${${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} === undefined ? "" : JSON.stringify(${(0, _stryke_string_format_camel_case.camelCase)(arg.name)})}`).join("\\n")}` : ""}\`);
112
112
  writeLine(""); `;
@@ -160,7 +160,6 @@ function CommandEntry(props) {
160
160
  "debug",
161
161
  "warn",
162
162
  "error",
163
- "colors",
164
163
  "writeLine"
165
164
  ],
166
165
  utils: [
@@ -1 +1 @@
1
- {"version":3,"file":"command-entry.cjs","names":[],"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 FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\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 type { CommandTree } from \"@shell-shock/core\";\nimport { CommandValidationLogic } from \"@shell-shock/core/components/command-validation-logic\";\nimport { IsDebug } from \"@shell-shock/core/components/helpers\";\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\";\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 { 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.args.length > 0\n ? `, ${command.args.map(arg => camelCase(arg.name)).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 appSpecificEnvPrefix={context.config.appSpecificEnvPrefix}\n isCaseSensitive={context.config.isCaseSensitive}\n />\n <Spacing />\n <Show when={Boolean(banner)}>{banner}</Show>\n <Spacing />\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 writeLine(\"\");\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.args.length > 0\n ? ` \\\\n\\\\nArguments: \\\\n${command.args\n .map(\n arg =>\n ` - ${kebabCase(arg.name)}: \\${${camelCase(\n arg.name\n )} === undefined ? \"\" : JSON.stringify(${camelCase(\n arg.name\n )})}`\n )\n .join(\"\\\\n\")}`\n : \"\"\n }\\`);\n writeLine(\"\"); `}\n </IfStatement>\n <Spacing />\n {children}\n <Spacing />\n <IfStatement condition={code`options.help`}>\n {code`return showHelp(); `}\n </IfStatement>\n <ElseClause>\n <hbr />\n <CommandInvocation command={command} />\n </ElseClause>\n </FunctionDeclaration>\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.startsWith(\".\")\n ? commandSourcePath.value\n : `./${commandSourcePath.value}`]:\n `handle${pascalCase(command.name)}`\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isDevelopment\", \"isDebug\"],\n console: [\"debug\", \"warn\", \"error\", \"colors\", \"writeLine\"],\n utils: [\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ],\n [joinPaths(\n \"help\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showHelp\"],\n [joinPaths(\n \"banner\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showBanner\"]\n })}>\n <Spacing />\n <OptionsInterfaceDeclaration command={command} />\n <Spacing />\n <CommandHandlerDeclaration\n command={command}\n banner={code`await showBanner(); `}>\n <CommandValidationLogic command={command} />\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 </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":";;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAe,kBAAW,OAExB;CACA,MAAA,EACA,YACI;AACN,QAAS;kDAAc,qCAAqB;GAC5C,MAAS;GACT,IAAQ,cAAC;AACH,WAAG,mBAAA,aAAmB,QAAO,SAAO,KAAO,qEAAW,QAAA,GAAA,oHAAA,QAAA,CAAA,CAAA,KAAA,QAAA,CAAA,KAAA,IAAA,CAAA,iBAAA,QAAA,SAAA,KAAA,qEAAA,QAAA,iHAAA,QAA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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 FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\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 type { CommandTree } from \"@shell-shock/core\";\nimport { CommandValidationLogic } from \"@shell-shock/core/components/command-validation-logic\";\nimport { IsDebug } from \"@shell-shock/core/components/helpers\";\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\";\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 { 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.args.length > 0\n ? `, ${command.args.map(arg => camelCase(arg.name)).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 appSpecificEnvPrefix={context.config.appSpecificEnvPrefix}\n isCaseSensitive={context.config.isCaseSensitive}\n />\n <Spacing />\n <Show when={Boolean(banner)}>{banner}</Show>\n <Spacing />\n <IfStatement condition={<IsDebug />}>\n {code`writeLine(\"\");\n writeLine(textColors.body.tertiary(\"Debug mode is enabled. Additional debug information may be logged to the console.\"));\n writeLine(\"\");\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.args.length > 0\n ? ` \\\\n\\\\nArguments: \\\\n${command.args\n .map(\n arg =>\n ` - ${kebabCase(arg.name)}: \\${${camelCase(\n arg.name\n )} === undefined ? \"\" : JSON.stringify(${camelCase(\n arg.name\n )})}`\n )\n .join(\"\\\\n\")}`\n : \"\"\n }\\`);\n writeLine(\"\"); `}\n </IfStatement>\n <Spacing />\n {children}\n <Spacing />\n <IfStatement condition={code`options.help`}>\n {code`return showHelp(); `}\n </IfStatement>\n <ElseClause>\n <hbr />\n <CommandInvocation command={command} />\n </ElseClause>\n </FunctionDeclaration>\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.startsWith(\".\")\n ? commandSourcePath.value\n : `./${commandSourcePath.value}`]:\n `handle${pascalCase(command.name)}`\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isDevelopment\", \"isDebug\"],\n console: [\"debug\", \"warn\", \"error\", \"writeLine\"],\n utils: [\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ],\n [joinPaths(\n \"help\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showHelp\"],\n [joinPaths(\n \"banner\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showBanner\"]\n })}>\n <Spacing />\n <OptionsInterfaceDeclaration command={command} />\n <Spacing />\n <CommandHandlerDeclaration\n command={command}\n banner={code`await showBanner(); `}>\n <CommandValidationLogic command={command} />\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 </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":";;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAe,kBAAW,OAExB;CACA,MAAA,EACA,YACI;AACN,QAAS;kDAAc,qCAAqB;GAC5C,MAAS;GACT,IAAQ,cAAC;AACH,WAAG,mBAAA,aAAmB,QAAO,SAAO,K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A;AACK,2DAAoB,8DAAa,EACrC,SAAA,OACE,CAAA;;GAED,CAAC;EACH,CAAC,CAAC"}
@@ -103,7 +103,7 @@ function CommandHandlerDeclaration(props) {
103
103
  },
104
104
  get children() {
105
105
  return code`writeLine("");
106
- writeLine(colors.text.body.tertiary("Debug mode is enabled. Additional debug information may be logged to the console."));
106
+ writeLine(textColors.body.tertiary("Debug mode is enabled. Additional debug information may be logged to the console."));
107
107
  writeLine("");
108
108
  debug(\`Command path: ${command.segments.map((segment) => isDynamicPathSegment(segment) ? `\${${camelCase(getDynamicPathSegmentName(segment))}}` : segment).join(" / ")} \\n\\nOptions: \\n${Object.values(command.options).map((option) => ` - ${kebabCase(option.name)}: \${options.${camelCase(option.name)} === undefined ? "" : JSON.stringify(options.${camelCase(option.name)})}`).join("\\n")}${command.args.length > 0 ? ` \\n\\nArguments: \\n${command.args.map((arg) => ` - ${kebabCase(arg.name)}: \${${camelCase(arg.name)} === undefined ? "" : JSON.stringify(${camelCase(arg.name)})}`).join("\\n")}` : ""}\`);
109
109
  writeLine(""); `;
@@ -157,7 +157,6 @@ function CommandEntry(props) {
157
157
  "debug",
158
158
  "warn",
159
159
  "error",
160
- "colors",
161
160
  "writeLine"
162
161
  ],
163
162
  utils: [
@@ -1 +1 @@
1
- {"version":3,"file":"command-entry.mjs","names":[],"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 FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\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 type { CommandTree } from \"@shell-shock/core\";\nimport { CommandValidationLogic } from \"@shell-shock/core/components/command-validation-logic\";\nimport { IsDebug } from \"@shell-shock/core/components/helpers\";\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\";\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 { 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.args.length > 0\n ? `, ${command.args.map(arg => camelCase(arg.name)).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 appSpecificEnvPrefix={context.config.appSpecificEnvPrefix}\n isCaseSensitive={context.config.isCaseSensitive}\n />\n <Spacing />\n <Show when={Boolean(banner)}>{banner}</Show>\n <Spacing />\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 writeLine(\"\");\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.args.length > 0\n ? ` \\\\n\\\\nArguments: \\\\n${command.args\n .map(\n arg =>\n ` - ${kebabCase(arg.name)}: \\${${camelCase(\n arg.name\n )} === undefined ? \"\" : JSON.stringify(${camelCase(\n arg.name\n )})}`\n )\n .join(\"\\\\n\")}`\n : \"\"\n }\\`);\n writeLine(\"\"); `}\n </IfStatement>\n <Spacing />\n {children}\n <Spacing />\n <IfStatement condition={code`options.help`}>\n {code`return showHelp(); `}\n </IfStatement>\n <ElseClause>\n <hbr />\n <CommandInvocation command={command} />\n </ElseClause>\n </FunctionDeclaration>\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.startsWith(\".\")\n ? commandSourcePath.value\n : `./${commandSourcePath.value}`]:\n `handle${pascalCase(command.name)}`\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isDevelopment\", \"isDebug\"],\n console: [\"debug\", \"warn\", \"error\", \"colors\", \"writeLine\"],\n utils: [\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ],\n [joinPaths(\n \"help\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showHelp\"],\n [joinPaths(\n \"banner\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showBanner\"]\n })}>\n <Spacing />\n <OptionsInterfaceDeclaration command={command} />\n <Spacing />\n <CommandHandlerDeclaration\n command={command}\n banner={code`await showBanner(); `}>\n <CommandValidationLogic command={command} />\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 </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":";;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAe,kBAAW,OAExB;CACA,MAAA,EACA,YACI;AACN,QAAS;EAAA,gBAAc,gBAAqB;GAC5C,MAAS;GACT,IAAQ,cAAC;AACH,WAAG,IAAA,aAAmB,QAAO,SAAO,KAAO,YAAW,qBAAA,QAAA,GAAA,MAAA,UAAA,0BAAA,QAAA,CAAA,CAAA,KAAA,QAAA,CAAA,KAAA,IAAA,CAAA,iBAAA,QAAA,SAAA,KAAA,YAAA,qBAAA,QAAA,GAAA,UAAA,0BAAA,QAAA,CAAA,GAAA,IAAA,QAAA,GAAA,CAAA,KAAA,KAAA,CAAA;;GAE5D,CAAA;EAAM,gBAAe,SAAO,EAAO,CAAA;EAAA,WAAc,IAAM;;;qDAGJ,WAAO,QAAA,KAAA,CAAA,uBAAA,QAAA,KAAA,SAAA,IAAA,KAAA,QAAA,KAAA,KAAA,Q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ACK,WAAA,gBAAoB,qBAAa,EACrC,SAAA,OACE,CAAA;;GAED,CAAC;EACH,CAAC,CAAC"}
1
+ {"version":3,"file":"command-entry.mjs","names":[],"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 FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\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 type { CommandTree } from \"@shell-shock/core\";\nimport { CommandValidationLogic } from \"@shell-shock/core/components/command-validation-logic\";\nimport { IsDebug } from \"@shell-shock/core/components/helpers\";\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\";\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 { 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.args.length > 0\n ? `, ${command.args.map(arg => camelCase(arg.name)).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 appSpecificEnvPrefix={context.config.appSpecificEnvPrefix}\n isCaseSensitive={context.config.isCaseSensitive}\n />\n <Spacing />\n <Show when={Boolean(banner)}>{banner}</Show>\n <Spacing />\n <IfStatement condition={<IsDebug />}>\n {code`writeLine(\"\");\n writeLine(textColors.body.tertiary(\"Debug mode is enabled. Additional debug information may be logged to the console.\"));\n writeLine(\"\");\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.args.length > 0\n ? ` \\\\n\\\\nArguments: \\\\n${command.args\n .map(\n arg =>\n ` - ${kebabCase(arg.name)}: \\${${camelCase(\n arg.name\n )} === undefined ? \"\" : JSON.stringify(${camelCase(\n arg.name\n )})}`\n )\n .join(\"\\\\n\")}`\n : \"\"\n }\\`);\n writeLine(\"\"); `}\n </IfStatement>\n <Spacing />\n {children}\n <Spacing />\n <IfStatement condition={code`options.help`}>\n {code`return showHelp(); `}\n </IfStatement>\n <ElseClause>\n <hbr />\n <CommandInvocation command={command} />\n </ElseClause>\n </FunctionDeclaration>\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.startsWith(\".\")\n ? commandSourcePath.value\n : `./${commandSourcePath.value}`]:\n `handle${pascalCase(command.name)}`\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isDevelopment\", \"isDebug\"],\n console: [\"debug\", \"warn\", \"error\", \"writeLine\"],\n utils: [\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"internal_commandContext\"\n ],\n [joinPaths(\n \"help\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showHelp\"],\n [joinPaths(\n \"banner\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showBanner\"]\n })}>\n <Spacing />\n <OptionsInterfaceDeclaration command={command} />\n <Spacing />\n <CommandHandlerDeclaration\n command={command}\n banner={code`await showBanner(); `}>\n <CommandValidationLogic command={command} />\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 </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":";;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAe,kB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AAK;IAAG,gBAAE,SAAA,EAAA,CAAA;IAAA,gBAAA,6BAAA,EACL,SACJ,CAAC;IAAE,gBAAU,SAAA,EAAA,CAAA;IAAA,gBAAA,2BAAA;KACZ;KACF,QAAA,IAAA;KACH,IAAA,WAAA;AACH,aAAA,CAAA,gBAAA,wBAAA,WAEO,CAAA,EAAA,gBAAU,aAA0B;OACzC,WAAc,IAAA;OACJ,UAAA,IAAc;;OAEf,CAAA,CAAA;;;;;EAIR,CAAA,CAAA,EAAI,gBAAc,KAAS;EAC5B,IAAA,OAAA;AACI,UAAC,OAAS,OAAA,QAAmB,SAAC;;;GAGlC,IAAM,OAAS;AACT,WAAA,MAAW;;GAEb,IAAA,WAAQ;AACN,WAAO,gBAAa,cAAA,EACnB,SAAS,OACX,CAAA;;GAEJ,IAAA,WAAA;AACK,WAAA,gBAAoB,qBAAa,EACrC,SAAA,OACE,CAAA;;GAED,CAAC;EACH,CAAC,CAAC"}
@@ -94,7 +94,6 @@ function VirtualCommandEntry(props) {
94
94
  console: [
95
95
  "warn",
96
96
  "error",
97
- "colors",
98
97
  "writeLine"
99
98
  ],
100
99
  utils: [
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-command-entry.cjs","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\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 {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\n\nexport interface VirtualCommandHandlerDeclarationProps {\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 VirtualCommandHandlerDeclaration(\n props: VirtualCommandHandlerDeclarationProps\n) {\n const { command, children, banner } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\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(\" \")}) virtual 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 <Spacing />\n {children}\n <Spacing />\n <Show when={Boolean(banner)}>{banner}</Show>\n <Spacing />\n {code`return showHelp(); `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface VirtualCommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The virtual command entry point for the Shell Shock project.\n */\nexport function VirtualCommandEntry(props: VirtualCommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"isDevelopment\", \"isDebug\"],\n console: [\"warn\", \"error\", \"colors\", \"writeLine\"],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"findSuggestions\"\n ],\n [joinPaths(\n \"help\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showHelp\"],\n [joinPaths(\n \"banner\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showBanner\"]\n })}>\n <Spacing />\n <VirtualCommandHandlerDeclaration\n command={command}\n banner={code`await showBanner(); `}>\n <CommandRouter\n segments={command.segments}\n commands={command.children}\n />\n </VirtualCommandHandlerDeclaration>\n </TypescriptFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n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,KAAA,CAAA,MAAA,WAAA;AACjD,QAAC,KAAQ,MAAC,UAAA,CAAA;KACX,MAAQ;KACX,OAAA,2DAAA,KAAA;KACD,CAAA;;MAEM,EAAA,CAAA,CAAA;;EAEL,IAAG,iBAAA;AACD,4BAAU,kBAAA,EAAA,EAAA;IACR,KAAK,CAAC,iBAAc,UAAA;IACpB,SAAS;KAAA;KAAI;KAAA;KAAA;KAAA;IACb,OAAE;KAAA;KAAa;KAAA;KAAA;KAAA;KAAA;KAAA;sCACN,QAAQ,GAAA,QAAQ,SAAQ,QAAA,YAAA,0DAAA,QAAA,CAAA,CAAA,GAAA,CAAA,WAAA;sCACtB,UAAU,GAAG,QAAQ,SAAC,QAAS,YAAA,0DAAA,QAAA,CAAA,CAAA,GAAA,CAAA,aAAA;IAC3C,CAAC;;EAEJ,IAAI,WAAU;AACZ,UAAO,iDAAE,kDAAA,EAAA,CAAA,kDAAA,kCAAA;;IAEP,QAAM,mBAAM;IACZ,IAAI,WAAS;AACZ,4DAAA,iDAAA;MACD,IAAA,WAAgB;AACV,cAAG,QAAA;;MAEP,IAAM,WAAC;AACJ,cAAO,QAAA;;MAET,CAAC;;IAEL,CAAC,CAAC;;EAEN,CAAC,CAAC,kDAAM,oBAAA;EACP,IAAI,OAAG;AACL,UAAO,OAAK,OAAA,QAAA,SAAA;;EAEd,WAAU,0DAAY,qBAAqB;GACzC,IAAI,OAAE;AACJ,WAAO,MAAC;;GAEV,IAAI,WAAU;AACZ,2DAAwB,+CAAM,EAC5B,SAAI,OACL,CAAC;;GAEJ,IAAI,WAAC;AACH,2DAAU,qBAAA,EACT,SAAA,OACA,CAAC;;GAEL,CAAC;EACH,CAAC,CAAC"}
1
+ {"version":3,"file":"virtual-command-entry.cjs","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\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 {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\n\nexport interface VirtualCommandHandlerDeclarationProps {\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 VirtualCommandHandlerDeclaration(\n props: VirtualCommandHandlerDeclarationProps\n) {\n const { command, children, banner } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\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(\" \")}) virtual 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 <Spacing />\n {children}\n <Spacing />\n <Show when={Boolean(banner)}>{banner}</Show>\n <Spacing />\n {code`return showHelp(); `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface VirtualCommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The virtual command entry point for the Shell Shock project.\n */\nexport function VirtualCommandEntry(props: VirtualCommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"isDevelopment\", \"isDebug\"],\n console: [\"warn\", \"error\", \"writeLine\"],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"findSuggestions\"\n ],\n [joinPaths(\n \"help\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showHelp\"],\n [joinPaths(\n \"banner\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showBanner\"]\n })}>\n <Spacing />\n <VirtualCommandHandlerDeclaration\n command={command}\n banner={code`await showBanner(); `}>\n <CommandRouter\n segments={command.segments}\n commands={command.children}\n />\n </VirtualCommandHandlerDeclaration>\n </TypescriptFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8CA,SAAgB,iCAAC,OAAsC;CACrD,MAAA,EACA,SACA,UACF;CAEE,MAAA,6EAAA;AACA,QAAG,iDAAe,4DAAe;EACjC,IAAA,UAAA;AACI,UAAC,OAAS,QAAA,MAAA,kDAAgC,QAAA,CAAA,GAAA,QAAA,SAAA,KAAA,qEAAA,QAAA,GAAA,wHAAA,QAAA,CAAA,CAAA,KAAA,QAAA,CAAA,KAAA,IAAA,CAAA;;EAE9C,IAAA,WAAA;AACA,UAAQ;oDAAmB,mEAAgB;AAErC,YAAS,GAAC,QAAA,YAAc,QAAA,QAAsB,GAAA,CAAA;OAEpD,CAAM;oDAAC,OAAA,EAAA,CAAA;oDAAA,iEAAA,EACJ,IAAA,WAAA;AACE,YAAA,QAAA;OAEA,CAAC;oDAAgB,iEAAA;KAChB,MAAI;KACJ,UAAU;KACX,CAAC;IAAC;;EAEN,CAAC,kDAAmB,0CAAkB;EACrC,UAAK;EACL,OAAK;EACL,MAAK;EACL,YAAK,CAAA;GACH,MAAE;GACF,MAAC;GACD,SAAE;GACH,CAAC;EACF,IAAI,WAAM;AACR,UAAE;oDAAsB,kDAAW,EAAE,CAAC;IAAA;oDAA8B,kDAAK,EAAA,CAAA;oDAAA,qBAAA;KACvE,IAAC,OAAS;AACT,aAAQ,QAAA,OAAA;;KAET,UAAU;KACX,CAAC;oDAAU,kDAAA,EAAA,CAAA;IA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wB,+CAAM,EAC5B,SAAI,OACL,CAAC;;GAEJ,IAAI,WAAC;AACH,2DAAU,qBAAA,EACT,SAAA,OACA,CAAC;;GAEL,CAAC;EACH,CAAC,CAAC"}
@@ -91,7 +91,6 @@ function VirtualCommandEntry(props) {
91
91
  console: [
92
92
  "warn",
93
93
  "error",
94
- "colors",
95
94
  "writeLine"
96
95
  ],
97
96
  utils: [
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-command-entry.mjs","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\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 {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\n\nexport interface VirtualCommandHandlerDeclarationProps {\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 VirtualCommandHandlerDeclaration(\n props: VirtualCommandHandlerDeclarationProps\n) {\n const { command, children, banner } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\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(\" \")}) virtual 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 <Spacing />\n {children}\n <Spacing />\n <Show when={Boolean(banner)}>{banner}</Show>\n <Spacing />\n {code`return showHelp(); `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface VirtualCommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The virtual command entry point for the Shell Shock project.\n */\nexport function VirtualCommandEntry(props: VirtualCommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"isDevelopment\", \"isDebug\"],\n console: [\"warn\", \"error\", \"colors\", \"writeLine\"],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"findSuggestions\"\n ],\n [joinPaths(\n \"help\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showHelp\"],\n [joinPaths(\n \"banner\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showBanner\"]\n })}>\n <Spacing />\n <VirtualCommandHandlerDeclaration\n command={command}\n banner={code`await showBanner(); `}>\n <CommandRouter\n segments={command.segments}\n commands={command.children}\n />\n </VirtualCommandHandlerDeclaration>\n </TypescriptFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8CA,SAAgB,iCAAC,OAAsC;CACrD,MAAA,EACA,SACA,UACF;CAEE,MAAA,UAAA,eAAA;AACA,QAAG,CAAA,gBAAe,OAAe;EACjC,IAAA,UAAA;AACI,UAAC,OAAS,QAAA,MAAA,IAAA,UAAgC,QAAA,CAAA,GAAA,QAAA,SAAA,KAAA,YAAA,qBAAA,QAAA,GAAA,IAAA,aAAA,0BAAA,QAAA,CAAA,CAAA,KAAA,QAAA,CAAA,KAAA,IAAA,CAAA;;EAE9C,IAAA,WAAA;AACA,UAAQ;IAAA,gBAAmB,cAAgB;AAErC,YAAS,GAAC,QAAA,YAAc,QAAA,QAAsB,GAA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,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,GAAA,CAAA,WAAA;KAChC,UAAU,UAAU,GAAG,QAAQ,SAAC,QAAS,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,GAAA,CAAA,aAAA;IAC3C,CAAC;;EAEJ,IAAI,WAAU;AACZ,UAAO,CAAC,gBAAC,SAAA,EAAA,CAAA,EAAA,gBAAA,kCAAA;;IAEP,QAAM,IAAM;IACZ,IAAI,WAAS;AACZ,YAAA,gBAAA,eAAA;MACD,IAAA,WAAgB;AACV,cAAG,QAAA;;MAEP,IAAM,WAAC;AACJ,cAAO,QAAA;;MAET,CAAC;;IAEL,CAAC,CAAC;;EAEN,CAAC,CAAC,EAAE,gBAAI,KAAA;EACP,IAAI,OAAG;AACL,UAAO,OAAK,OAAA,QAAA,SAAA;;EAEd,WAAU,UAAS,gBAAG,MAAqB;GACzC,IAAI,OAAE;AACJ,WAAO,MAAC;;GAEV,IAAI,WAAU;AACZ,WAAO,gBAAiB,cAAM,EAC5B,SAAI,OACL,CAAC;;GAEJ,IAAI,WAAC;AACH,WAAC,gBAAS,qBAAA,EACT,SAAA,OACA,CAAC;;GAEL,CAAC;EACH,CAAC,CAAC"}
1
+ {"version":3,"file":"virtual-command-entry.mjs","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\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 {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\n\nexport interface VirtualCommandHandlerDeclarationProps {\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 VirtualCommandHandlerDeclaration(\n props: VirtualCommandHandlerDeclarationProps\n) {\n const { command, children, banner } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\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(\" \")}) virtual 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 <Spacing />\n {children}\n <Spacing />\n <Show when={Boolean(banner)}>{banner}</Show>\n <Spacing />\n {code`return showHelp(); `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface VirtualCommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The virtual command entry point for the Shell Shock project.\n */\nexport function VirtualCommandEntry(props: VirtualCommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"isDevelopment\", \"isDebug\"],\n console: [\"warn\", \"error\", \"writeLine\"],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"findSuggestions\"\n ],\n [joinPaths(\n \"help\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showHelp\"],\n [joinPaths(\n \"banner\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showBanner\"]\n })}>\n <Spacing />\n <VirtualCommandHandlerDeclaration\n command={command}\n banner={code`await showBanner(); `}>\n <CommandRouter\n segments={command.segments}\n commands={command.children}\n />\n </VirtualCommandHandlerDeclaration>\n </TypescriptFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualC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 +19,7 @@ function getDefaultOptions() {
19
19
  kind: _shell_shock_core.CommandParameterKinds.boolean,
20
20
  optional: true,
21
21
  default: false,
22
+ variadic: false,
22
23
  skipAddingNegative: true
23
24
  },
24
25
  {
@@ -30,6 +31,7 @@ function getDefaultOptions() {
30
31
  kind: _shell_shock_core.CommandParameterKinds.boolean,
31
32
  optional: true,
32
33
  default: false,
34
+ variadic: false,
33
35
  skipAddingNegative: true
34
36
  },
35
37
  {
@@ -41,6 +43,7 @@ function getDefaultOptions() {
41
43
  kind: _shell_shock_core.CommandParameterKinds.boolean,
42
44
  optional: true,
43
45
  default: false,
46
+ variadic: false,
44
47
  skipAddingNegative: true
45
48
  },
46
49
  {
@@ -51,6 +54,7 @@ function getDefaultOptions() {
51
54
  alias: ["colors"],
52
55
  kind: _shell_shock_core.CommandParameterKinds.boolean,
53
56
  optional: true,
57
+ variadic: false,
54
58
  skipAddingNegative: false
55
59
  },
56
60
  {
@@ -61,6 +65,7 @@ function getDefaultOptions() {
61
65
  alias: ["hide-banner"],
62
66
  kind: _shell_shock_core.CommandParameterKinds.boolean,
63
67
  optional: true,
68
+ variadic: false,
64
69
  default: false
65
70
  }
66
71
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"get-default-options.cjs","names":["CommandParameterKinds"],"sources":["../../src/helpers/get-default-options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandOption } from \"@shell-shock/core\";\nimport { CommandParameterKinds } from \"@shell-shock/core\";\n\n/**\n * Get the default command options.\n *\n * @returns The default command options.\n */\nexport function getDefaultOptions(): CommandOption[] {\n return [\n {\n name: \"help\",\n title: \"Help\",\n description: \"Show help information.\",\n env: false,\n alias: [\"h\", \"?\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"version\",\n title: \"Version\",\n description: \"Show the version of the application.\",\n env: false,\n alias: [\"v\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"verbose\",\n title: \"Verbose\",\n description: \"Enable verbose output.\",\n env: \"VERBOSE\",\n alias: [\"V\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"color\",\n title: \"Color\",\n description: \"Enable colored terminal output.\",\n env: \"COLOR\",\n alias: [\"colors\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n skipAddingNegative: false\n },\n {\n name: \"no-banner\",\n title: \"Hide Banner\",\n description:\n \"Do not display the application banner displayed while running the CLI - will be set to true if running in a CI pipeline.\",\n env: \"NO_BANNER\",\n alias: [\"hide-banner\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false\n }\n ];\n}\n"],"mappings":";;;;;;;;;;AA0BA,SAAgB,oBAAqC;AACnD,QAAO;EACL;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,KAAK,IAAI;GACjB,MAAMA,wCAAsB;GAC5B,UAAU;GACV,SAAS;GACT,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,IAAI;GACZ,MAAMA,wCAAsB;GAC5B,UAAU;GACV,SAAS;GACT,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,IAAI;GACZ,MAAMA,wCAAsB;GAC5B,UAAU;GACV,SAAS;GACT,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,SAAS;GACjB,MAAMA,wCAAsB;GAC5B,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aACE;GACF,KAAK;GACL,OAAO,CAAC,cAAc;GACtB,MAAMA,wCAAsB;GAC5B,UAAU;GACV,SAAS;GACV;EACF"}
1
+ {"version":3,"file":"get-default-options.cjs","names":["CommandParameterKinds"],"sources":["../../src/helpers/get-default-options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandOption } from \"@shell-shock/core\";\nimport { CommandParameterKinds } from \"@shell-shock/core\";\n\n/**\n * Get the default command options.\n *\n * @returns The default command options.\n */\nexport function getDefaultOptions(): CommandOption[] {\n return [\n {\n name: \"help\",\n title: \"Help\",\n description: \"Show help information.\",\n env: false,\n alias: [\"h\", \"?\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n variadic: false,\n skipAddingNegative: true\n },\n {\n name: \"version\",\n title: \"Version\",\n description: \"Show the version of the application.\",\n env: false,\n alias: [\"v\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n variadic: false,\n skipAddingNegative: true\n },\n {\n name: \"verbose\",\n title: \"Verbose\",\n description: \"Enable verbose output.\",\n env: \"VERBOSE\",\n alias: [\"V\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n variadic: false,\n skipAddingNegative: true\n },\n {\n name: \"color\",\n title: \"Color\",\n description: \"Enable colored terminal output.\",\n env: \"COLOR\",\n alias: [\"colors\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n variadic: false,\n skipAddingNegative: false\n },\n {\n name: \"no-banner\",\n title: \"Hide Banner\",\n description:\n \"Do not display the application banner displayed while running the CLI - will be set to true if running in a CI pipeline.\",\n env: \"NO_BANNER\",\n alias: [\"hide-banner\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n variadic: false,\n default: false\n }\n ];\n}\n"],"mappings":";;;;;;;;;;AA0BA,SAAgB,oBAAqC;AACnD,QAAO;EACL;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,KAAK,IAAI;GACjB,MAAMA,wCAAsB;GAC5B,UAAU;GACV,SAAS;GACT,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,IAAI;GACZ,MAAMA,wCAAsB;GAC5B,UAAU;GACV,SAAS;GACT,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,IAAI;GACZ,MAAMA,wCAAsB;GAC5B,UAAU;GACV,SAAS;GACT,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,SAAS;GACjB,MAAMA,wCAAsB;GAC5B,UAAU;GACV,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aACE;GACF,KAAK;GACL,OAAO,CAAC,cAAc;GACtB,MAAMA,wCAAsB;GAC5B,UAAU;GACV,UAAU;GACV,SAAS;GACV;EACF"}
@@ -17,6 +17,7 @@ function getDefaultOptions() {
17
17
  kind: CommandParameterKinds.boolean,
18
18
  optional: true,
19
19
  default: false,
20
+ variadic: false,
20
21
  skipAddingNegative: true
21
22
  },
22
23
  {
@@ -28,6 +29,7 @@ function getDefaultOptions() {
28
29
  kind: CommandParameterKinds.boolean,
29
30
  optional: true,
30
31
  default: false,
32
+ variadic: false,
31
33
  skipAddingNegative: true
32
34
  },
33
35
  {
@@ -39,6 +41,7 @@ function getDefaultOptions() {
39
41
  kind: CommandParameterKinds.boolean,
40
42
  optional: true,
41
43
  default: false,
44
+ variadic: false,
42
45
  skipAddingNegative: true
43
46
  },
44
47
  {
@@ -49,6 +52,7 @@ function getDefaultOptions() {
49
52
  alias: ["colors"],
50
53
  kind: CommandParameterKinds.boolean,
51
54
  optional: true,
55
+ variadic: false,
52
56
  skipAddingNegative: false
53
57
  },
54
58
  {
@@ -59,6 +63,7 @@ function getDefaultOptions() {
59
63
  alias: ["hide-banner"],
60
64
  kind: CommandParameterKinds.boolean,
61
65
  optional: true,
66
+ variadic: false,
62
67
  default: false
63
68
  }
64
69
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"get-default-options.mjs","names":[],"sources":["../../src/helpers/get-default-options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandOption } from \"@shell-shock/core\";\nimport { CommandParameterKinds } from \"@shell-shock/core\";\n\n/**\n * Get the default command options.\n *\n * @returns The default command options.\n */\nexport function getDefaultOptions(): CommandOption[] {\n return [\n {\n name: \"help\",\n title: \"Help\",\n description: \"Show help information.\",\n env: false,\n alias: [\"h\", \"?\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"version\",\n title: \"Version\",\n description: \"Show the version of the application.\",\n env: false,\n alias: [\"v\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"verbose\",\n title: \"Verbose\",\n description: \"Enable verbose output.\",\n env: \"VERBOSE\",\n alias: [\"V\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"color\",\n title: \"Color\",\n description: \"Enable colored terminal output.\",\n env: \"COLOR\",\n alias: [\"colors\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n skipAddingNegative: false\n },\n {\n name: \"no-banner\",\n title: \"Hide Banner\",\n description:\n \"Do not display the application banner displayed while running the CLI - will be set to true if running in a CI pipeline.\",\n env: \"NO_BANNER\",\n alias: [\"hide-banner\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false\n }\n ];\n}\n"],"mappings":";;;;;;;;AA0BA,SAAgB,oBAAqC;AACnD,QAAO;EACL;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,KAAK,IAAI;GACjB,MAAM,sBAAsB;GAC5B,UAAU;GACV,SAAS;GACT,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,IAAI;GACZ,MAAM,sBAAsB;GAC5B,UAAU;GACV,SAAS;GACT,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,IAAI;GACZ,MAAM,sBAAsB;GAC5B,UAAU;GACV,SAAS;GACT,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,SAAS;GACjB,MAAM,sBAAsB;GAC5B,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aACE;GACF,KAAK;GACL,OAAO,CAAC,cAAc;GACtB,MAAM,sBAAsB;GAC5B,UAAU;GACV,SAAS;GACV;EACF"}
1
+ {"version":3,"file":"get-default-options.mjs","names":[],"sources":["../../src/helpers/get-default-options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandOption } from \"@shell-shock/core\";\nimport { CommandParameterKinds } from \"@shell-shock/core\";\n\n/**\n * Get the default command options.\n *\n * @returns The default command options.\n */\nexport function getDefaultOptions(): CommandOption[] {\n return [\n {\n name: \"help\",\n title: \"Help\",\n description: \"Show help information.\",\n env: false,\n alias: [\"h\", \"?\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n variadic: false,\n skipAddingNegative: true\n },\n {\n name: \"version\",\n title: \"Version\",\n description: \"Show the version of the application.\",\n env: false,\n alias: [\"v\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n variadic: false,\n skipAddingNegative: true\n },\n {\n name: \"verbose\",\n title: \"Verbose\",\n description: \"Enable verbose output.\",\n env: \"VERBOSE\",\n alias: [\"V\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n variadic: false,\n skipAddingNegative: true\n },\n {\n name: \"color\",\n title: \"Color\",\n description: \"Enable colored terminal output.\",\n env: \"COLOR\",\n alias: [\"colors\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n variadic: false,\n skipAddingNegative: false\n },\n {\n name: \"no-banner\",\n title: \"Hide Banner\",\n description:\n \"Do not display the application banner displayed while running the CLI - will be set to true if running in a CI pipeline.\",\n env: \"NO_BANNER\",\n alias: [\"hide-banner\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n variadic: false,\n default: false\n }\n ];\n}\n"],"mappings":";;;;;;;;AA0BA,SAAgB,oBAAqC;AACnD,QAAO;EACL;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,KAAK,IAAI;GACjB,MAAM,sBAAsB;GAC5B,UAAU;GACV,SAAS;GACT,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,IAAI;GACZ,MAAM,sBAAsB;GAC5B,UAAU;GACV,SAAS;GACT,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,IAAI;GACZ,MAAM,sBAAsB;GAC5B,UAAU;GACV,SAAS;GACT,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,SAAS;GACjB,MAAM,sBAAsB;GAC5B,UAAU;GACV,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aACE;GACF,KAAK;GACL,OAAO,CAAC,cAAc;GACtB,MAAM,sBAAsB;GAC5B,UAAU;GACV,UAAU;GACV,SAAS;GACV;EACF"}
package/dist/index.cjs CHANGED
@@ -51,7 +51,6 @@ const plugin = (options = {}) => {
51
51
  "stripAnsi",
52
52
  "writeLine",
53
53
  "splitText",
54
- "colors",
55
54
  "help"
56
55
  ],
57
56
  utils: [
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport banner from \"@shell-shock/plugin-banner\";\nimport console from \"@shell-shock/plugin-console\";\nimport help from \"@shell-shock/plugin-help\";\nimport type { Plugin } from \"powerlines\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n ...console<TContext>(options),\n ...help<TContext>(options),\n ...banner<TContext>(options.banner),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\",\n \"help\"\n ],\n utils: [\"useApp\", \"useArgs\", \"isMinimal\"]\n }}>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`useArgs();`}\n />\n <hbr />\n <CommandRouter segments={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <Spacing />\n {code`await showBanner();`}\n <Spacing />\n {code`return showHelp();`}\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAW,UAA8B,UAAA,EAAA,KAAA;AACxC,QAAA;EAAA,4CAAA,QAAA;EAAA,yCAAA,QAAA;EAAA,2CAAA,QAAA,OAAA;EAAA;GACC,MAAQ;GACN,SAAC;AACH,SAAO,MAAA,uEAAA;AACH,WAAC;KACA,gBAAe;KACf,iBAAiB;KACpB,GAAA;KACE;;GAEH;EAAE;GACD,MAAM;GACN,SAAK;;IAEH,MAAE,UAAO;KACP,MAAE,SAAA;AACF,UAAE,MAAA,oEAAsB;AACxB,wDAAK,MAAA,iDAAA,uCAAA;MACJ,gBAAA;OACH,SAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;OACD,OAAA;QAAA;QAAA;QAAA;QAAA;OACD;MACM,IAAG,WAAY;AACnB,cAAS;wDAAA,qBAAA;SACD,IAAE,OAAK;AACP,iBAAS,OAAC,KAAA,OAAA,SAAA,CAAA,SAAA;;SAEX,IAAA,WAAU;AACZ,iBAAA;2DAAA,qCAAA;;YAEM,MAAM;YACP,MAAA;YACH,aAAA,mBAAA;YACE,CAAA;2DAAA,OAAA,EAAA,CAAA;2DAAA,iDAAA;YACC,UAAA,EAAc;YACZ,IAAA,WAAS;AACP,oBAAC,OAAQ,YAAA,EAAA;;YAEZ,CAAC;2DAAa,OAAA,EAAA,CAAA;WAAA;;SAElB,CAAC;wDAAc,kDAAA,EAAA,CAAA;QAAA,mBAAA;wDAAA,kDAAA,EAAA,CAAA;QAAA,mBAAA;QAAA;;MAEnB,CAAC,kDAAS,qBAAA;MACT,IAAI,OAAI;AACN,cAAM,OAAA,OAAA,OAAA,SAAA,CAAA,SAAA;;MAER,IAAI,WAAK;AACP,8DAAQ,oBAAA;QACN,IAAI,OAAO;AACT,gBAAI,OAAM,OAAQ,OAAA,SAAA;;QAEpB,gBAAK;QACL,WAAU,0DAAA,qBAAA;SACR,IAAG,OAAA;AACD,iBAAM,MAAA;;SAER,IAAC,WAAS;AACT,iEAAyB,+CAAA,EACzB,SAAS,OACT,CAAA;;SAEF,IAAK,WAAM;AACT,iEAAwB,8DAAgB,EACtC,SAAS,OACT,CAAC;;SAEL,CAAC;QACH,CAAC;;MAEL,CAAC,CAAC,CAAC;;IAEP;GACF;EAAC"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport banner from \"@shell-shock/plugin-banner\";\nimport console from \"@shell-shock/plugin-console\";\nimport help from \"@shell-shock/plugin-help\";\nimport type { Plugin } from \"powerlines\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n ...console<TContext>(options),\n ...help<TContext>(options),\n ...banner<TContext>(options.banner),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"help\"\n ],\n utils: [\"useApp\", \"useArgs\", \"isMinimal\"]\n }}>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`useArgs();`}\n />\n <hbr />\n <CommandRouter segments={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <Spacing />\n {code`await showBanner();`}\n <Spacing />\n {code`return showHelp();`}\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAW,UAA8B,UAAA,EAAA,KAAA;AACxC,QAAA;EAAA,4CAAA,QAAA;EAAA,yCAAA,QAAA;EAAA,2CAAA,QAAA,OAAA;EAAA;GACC,MA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;EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;AAoCA;cAAa,MAAA,oBACM,mBAAA,GAAsB,mBAAA,EAEvC,OAAA,GAAS,mBAAA,KA4EJ,MAAA,CAAO,QAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;AAoCA;cAAa,MAAA,oBACM,mBAAA,GAAsB,mBAAA,EAEvC,OAAA,GAAS,mBAAA,KA2EJ,MAAA,CAAO,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;AAoCA;cAAa,MAAA,oBACM,mBAAA,GAAsB,mBAAA,EAEvC,OAAA,GAAS,mBAAA,KA4EJ,MAAA,CAAO,QAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;AAoCA;cAAa,MAAA,oBACM,mBAAA,GAAsB,mBAAA,EAEvC,OAAA,GAAS,mBAAA,KA2EJ,MAAA,CAAO,QAAA"}
package/dist/index.mjs CHANGED
@@ -46,7 +46,6 @@ const plugin = (options = {}) => {
46
46
  "stripAnsi",
47
47
  "writeLine",
48
48
  "splitText",
49
- "colors",
50
49
  "help"
51
50
  ],
52
51
  utils: [
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport banner from \"@shell-shock/plugin-banner\";\nimport console from \"@shell-shock/plugin-console\";\nimport help from \"@shell-shock/plugin-help\";\nimport type { Plugin } from \"powerlines\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n ...console<TContext>(options),\n ...help<TContext>(options),\n ...banner<TContext>(options.banner),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\",\n \"help\"\n ],\n utils: [\"useApp\", \"useArgs\", \"isMinimal\"]\n }}>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`useArgs();`}\n />\n <hbr />\n <CommandRouter segments={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <Spacing />\n {code`await showBanner();`}\n <Spacing />\n {code`return showHelp();`}\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqCA,MAAW,UAA8B,UAAA,EAAA,KAAA;AACxC,QAAA;EAAA,GAAA,QAAA,QAAA;EAAA,GAAA,KAAA,QAAA;EAAA,GAAA,OAAA,QAAA,OAAA;EAAA;GACC,MAAQ;GACN,SAAC;AACH,SAAO,MAAA,uEAAA;AACH,WAAC;KACA,gBAAe;KACf,iBAAiB;KACpB,GAAA;KACE;;GAEH;EAAE;GACD,MAAM;GACN,SAAK;;IAEH,MAAE,UAAO;KACP,MAAE,SAAA;AACF,UAAE,MAAA,oEAAsB;AACxB,YAAK,OAAA,MAAA,CAAA,gBAAA,UAAA;MACJ,gBAAA;OACH,SAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;OACD,OAAA;QAAA;QAAA;QAAA;QAAA;OACD;MACM,IAAG,WAAY;AACnB,cAAS;QAAA,gBAAA,MAAA;SACD,IAAE,OAAK;AACP,iBAAS,OAAC,KAAA,OAAA,SAAA,CAAA,SAAA;;SAEX,IAAA,WAAU;AACZ,iBAAA;WAAA,gBAAA,gBAAA;;YAEM,MAAM;YACP,MAAA;YACH,aAAA,IAAA;YACE,CAAA;WAAA,gBAAA,OAAA,EAAA,CAAA;WAAA,gBAAA,eAAA;YACC,UAAA,EAAc;YACZ,IAAA,WAAS;AACP,oBAAC,OAAQ,YAAA,EAAA;;YAEZ,CAAC;WAAE,gBAAW,OAAA,EAAA,CAAA;WAAA;;SAElB,CAAC;QAAE,gBAAY,SAAA,EAAA,CAAA;QAAA,IAAA;QAAA,gBAAA,SAAA,EAAA,CAAA;QAAA,IAAA;QAAA;;MAEnB,CAAC,EAAE,gBAAO,MAAA;MACT,IAAI,OAAI;AACN,cAAM,OAAA,OAAA,OAAA,SAAA,CAAA,SAAA;;MAER,IAAI,WAAK;AACP,cAAO,gBAAC,KAAA;QACN,IAAI,OAAO;AACT,gBAAI,OAAM,OAAQ,OAAA,SAAA;;QAEpB,gBAAK;QACL,WAAU,UAAA,gBAAA,MAAA;SACR,IAAG,OAAA;AACD,iBAAM,MAAA;;SAER,IAAC,WAAS;AACT,iBAAK,gBAAoB,cAAA,EACzB,SAAS,OACT,CAAA;;SAEF,IAAK,WAAM;AACT,iBAAQ,gBAAgB,qBAAgB,EACtC,SAAS,OACT,CAAC;;SAEL,CAAC;QACH,CAAC;;MAEL,CAAC,CAAC,CAAC;;IAEP;GACF;EAAC"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport banner from \"@shell-shock/plugin-banner\";\nimport console from \"@shell-shock/plugin-console\";\nimport help from \"@shell-shock/plugin-help\";\nimport type { Plugin } from \"powerlines\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n ...console<TContext>(options),\n ...help<TContext>(options),\n ...banner<TContext>(options.banner),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"help\"\n ],\n utils: [\"useApp\", \"useArgs\", \"isMinimal\"]\n }}>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`useArgs();`}\n />\n <hbr />\n <CommandRouter segments={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <Spacing />\n {code`await showBanner();`}\n <Spacing />\n {code`return showHelp();`}\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqCA,MAAW,UAA8B,UAAA,EAAA,KAAA;AACxC,QAAA;EAAA,GAAA,QAAA,QAAA;EAAA,GAAA,KAAA,QAAA;EAAA,GAAA,OAAA,QAAA,OAAA;EAAA;GACC,MAAQ;GACN,SAAC;AACH,SAAO,MAAA,uE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AEL,CAAC,CAAC,CAAC;;IAEP;GACF;EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/preset-script",
3
- "version": "0.6.49",
3
+ "version": "0.6.51",
4
4
  "private": false,
5
5
  "description": "A Shell Shock preset that generates a fully-featured script application.",
6
6
  "keywords": [
@@ -195,25 +195,25 @@
195
195
  "dependencies": {
196
196
  "@alloy-js/core": "0.23.0-dev.8",
197
197
  "@alloy-js/typescript": "0.23.0-dev.4",
198
- "@powerlines/deepkit": "^0.6.164",
199
- "@powerlines/plugin-alloy": "^0.26.1",
200
- "@powerlines/plugin-plugin": "^0.12.336",
201
- "@shell-shock/core": "^0.15.0",
202
- "@shell-shock/plugin-banner": "^0.1.21",
203
- "@shell-shock/plugin-help": "^0.2.12",
204
- "@shell-shock/plugin-console": "^0.1.34",
205
- "@shell-shock/plugin-theme": "^0.4.7",
198
+ "@powerlines/deepkit": "^0.6.165",
199
+ "@powerlines/plugin-alloy": "^0.26.2",
200
+ "@powerlines/plugin-plugin": "^0.12.337",
201
+ "@shell-shock/core": "^0.15.2",
202
+ "@shell-shock/plugin-banner": "^0.1.23",
203
+ "@shell-shock/plugin-help": "^0.2.14",
204
+ "@shell-shock/plugin-console": "^0.2.0",
205
+ "@shell-shock/plugin-theme": "^0.4.9",
206
206
  "@stryke/helpers": "^0.10.7",
207
207
  "@stryke/path": "^0.27.3",
208
208
  "@stryke/string-format": "^0.17.7",
209
209
  "defu": "^6.1.6",
210
- "powerlines": "^0.42.26"
210
+ "powerlines": "^0.42.27"
211
211
  },
212
212
  "devDependencies": {
213
213
  "@babel/core": "^7.29.0",
214
- "@powerlines/plugin-alloy": "^0.26.1",
215
- "@types/node": "^25.5.0"
214
+ "@powerlines/plugin-alloy": "^0.26.2",
215
+ "@types/node": "^25.5.1"
216
216
  },
217
217
  "publishConfig": { "access": "public" },
218
- "gitHead": "bffe474833b0bb3ca1d4157afe0c1952e4148d81"
218
+ "gitHead": "ba74aaa8aaa2c911ce54df1fae944951af53a3ad"
219
219
  }