@shell-shock/preset-cli 0.9.13 → 0.9.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/components/command-entry.cjs +2 -5
  2. package/dist/components/command-entry.mjs +2 -5
  3. package/dist/components/command-entry.mjs.map +1 -1
  4. package/dist/components/virtual-command-entry.cjs +2 -5
  5. package/dist/components/virtual-command-entry.mjs +2 -5
  6. package/dist/components/virtual-command-entry.mjs.map +1 -1
  7. package/dist/node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.cjs +8 -0
  8. package/dist/node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.mjs +8 -0
  9. package/dist/node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.mjs.map +1 -0
  10. package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/index.cjs +14 -0
  11. package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/index.mjs +15 -0
  12. package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/index.mjs.map +1 -0
  13. package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup-data.cjs +655 -0
  14. package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup-data.mjs +651 -0
  15. package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup-data.mjs.map +1 -0
  16. package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup.cjs +48 -0
  17. package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup.mjs +47 -0
  18. package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup.mjs.map +1 -0
  19. package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/utilities.cjs +24 -0
  20. package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/utilities.mjs +24 -0
  21. package/dist/node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/utilities.mjs.map +1 -0
  22. package/dist/node_modules/.pnpm/string-width@8.2.0/node_modules/string-width/index.cjs +65 -0
  23. package/dist/node_modules/.pnpm/string-width@8.2.0/node_modules/string-width/index.mjs +66 -0
  24. package/dist/node_modules/.pnpm/string-width@8.2.0/node_modules/string-width/index.mjs.map +1 -0
  25. package/dist/node_modules/.pnpm/strip-ansi@7.2.0/node_modules/strip-ansi/index.cjs +12 -0
  26. package/dist/node_modules/.pnpm/strip-ansi@7.2.0/node_modules/strip-ansi/index.mjs +13 -0
  27. package/dist/node_modules/.pnpm/strip-ansi@7.2.0/node_modules/strip-ansi/index.mjs.map +1 -0
  28. package/dist/node_modules/.pnpm/wrap-ansi@10.0.0/node_modules/wrap-ansi/index.cjs +290 -3
  29. package/dist/node_modules/.pnpm/wrap-ansi@10.0.0/node_modules/wrap-ansi/index.mjs +287 -1
  30. package/dist/node_modules/.pnpm/wrap-ansi@10.0.0/node_modules/wrap-ansi/index.mjs.map +1 -1
  31. package/dist/packages/plugin-changelog/dist/components/changelog-command.cjs +5 -5
  32. package/dist/packages/plugin-changelog/dist/components/changelog-command.mjs +5 -5
  33. package/dist/packages/plugin-changelog/dist/components/changelog-command.mjs.map +1 -1
  34. package/dist/packages/plugin-changelog/dist/helpers/resolve-changelog.cjs +51 -0
  35. package/dist/packages/plugin-changelog/dist/helpers/resolve-changelog.mjs +51 -0
  36. package/dist/packages/plugin-changelog/dist/helpers/resolve-changelog.mjs.map +1 -0
  37. package/dist/packages/plugin-changelog/dist/index.cjs +32 -20
  38. package/dist/packages/plugin-changelog/dist/index.mjs +32 -20
  39. package/dist/packages/plugin-changelog/dist/index.mjs.map +1 -1
  40. package/dist/packages/plugin-changelog/dist/types/plugin.d.cts +48 -0
  41. package/dist/packages/plugin-changelog/dist/types/plugin.d.cts.map +1 -1
  42. package/dist/packages/plugin-changelog/dist/types/plugin.d.mts +48 -0
  43. package/dist/packages/plugin-changelog/dist/types/plugin.d.mts.map +1 -1
  44. package/dist/packages/unified/dist/html-Dw6VvFHa.cjs +612 -0
  45. package/dist/packages/unified/dist/html-Dw6VvFHa.mjs +613 -0
  46. package/dist/packages/unified/dist/html-Dw6VvFHa.mjs.map +1 -0
  47. package/dist/packages/unified/dist/markdown/index.cjs +1 -1
  48. package/dist/packages/unified/dist/markdown/index.mjs +1 -1
  49. package/dist/packages/unified/dist/{markdown-BiaU4FQg.cjs → markdown-BGGlzivq.cjs} +14 -50
  50. package/dist/packages/unified/dist/{markdown-BiaU4FQg.mjs → markdown-BGGlzivq.mjs} +16 -52
  51. package/dist/packages/unified/dist/markdown-BGGlzivq.mjs.map +1 -0
  52. package/package.json +20 -16
  53. package/dist/packages/unified/dist/html-DzncQodH.cjs +0 -156
  54. package/dist/packages/unified/dist/html-DzncQodH.mjs +0 -157
  55. package/dist/packages/unified/dist/html-DzncQodH.mjs.map +0 -1
  56. package/dist/packages/unified/dist/markdown-BiaU4FQg.mjs.map +0 -1
@@ -73,15 +73,12 @@ function CommandEntry(props) {
73
73
  ],
74
74
  state: [
75
75
  "useGlobal",
76
+ "GlobalOptions",
76
77
  "useGlobalOptions",
77
78
  "withCommand",
78
79
  "useArgs",
79
80
  "hasFlag",
80
- "isHelp",
81
- {
82
- name: "GlobalOptions",
83
- type: true
84
- }
81
+ "isHelp"
85
82
  ],
86
83
  prompts: [
87
84
  "text",
@@ -70,15 +70,12 @@ function CommandEntry(props) {
70
70
  ],
71
71
  state: [
72
72
  "useGlobal",
73
+ "GlobalOptions",
73
74
  "useGlobalOptions",
74
75
  "withCommand",
75
76
  "useArgs",
76
77
  "hasFlag",
77
- "isHelp",
78
- {
79
- name: "GlobalOptions",
80
- type: true
81
- }
78
+ "isHelp"
82
79
  ],
83
80
  prompts: [
84
81
  "text",
@@ -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 { code, computed, For, Match, Show, Switch } from \"@alloy-js/core\";\nimport { ElseIfClause, IfStatement } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport type {\n CommandTree,\n NumberCommandParameter,\n StringCommandParameter\n} from \"@shell-shock/core\";\nimport { CommandParameterKinds } from \"@shell-shock/core\";\nimport { CommandValidationLogic } from \"@shell-shock/core/components/command-validation-logic\";\nimport {\n formatDescription,\n formatShortDescription,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport { CommandHandlerDeclaration } from \"@shell-shock/preset-script/components/command-entry\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport interface CommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.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\", \"paths\"],\n console: [\n \"debug\",\n \"info\",\n \"help\",\n \"warn\",\n \"error\",\n \"table\",\n \"italic\",\n \"cursor\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"textColors\",\n \"createSpinner\"\n ],\n utils: [\"sleep\", \"isMinimal\", \"isInteractive\", \"isUnicodeSupported\"],\n state: [\n \"useGlobal\",\n \"useGlobalOptions\",\n \"withCommand\",\n \"useArgs\",\n \"hasFlag\",\n \"isHelp\",\n { name: \"GlobalOptions\", type: true }\n ],\n prompts: [\n \"text\",\n \"numeric\",\n \"toggle\",\n \"select\",\n \"confirm\",\n \"waitForKeyPress\",\n \"isCancel\"\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 upgrade: [\"executeUpgrade\"]\n })}>\n <Spacing />\n <CommandHandlerDeclaration\n command={command}\n banner={code`await showBanner();\n await executeUpgrade(); `}>\n <IfStatement condition={code`!isInteractive`}>\n <CommandValidationLogic command={command} />\n </IfStatement>\n <Show\n when={\n Object.values(command.options ?? {}).filter(\n option => !option.optional\n ).length > 0 ||\n Object.values(command.args ?? {}).filter(arg => !arg.optional)\n .length > 0\n }>\n <ElseIfClause\n condition={code`!isHelp() && (${Object.values(\n command.options ?? {}\n )\n .filter(option => !option.optional)\n .map(option =>\n (option.kind === CommandParameterKinds.string ||\n option.kind === CommandParameterKinds.number) &&\n option.variadic\n ? `(!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } || options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0)`\n : `options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } === undefined`\n )\n .join(\" || \")}${\n Object.values(command.options ?? {}).filter(\n option => !option.optional\n ).length > 0 &&\n Object.values(command.args ?? {}).filter(arg => !arg.optional)\n .length > 0\n ? \" || \"\n : \"\"\n }${Object.values(command.args ?? {})\n .filter(arg => !arg.optional)\n .map(arg =>\n (arg.kind === CommandParameterKinds.string ||\n arg.kind === CommandParameterKinds.number) &&\n arg.variadic\n ? `(!${camelCase(\n arg.name\n )} || ${camelCase(arg.name)}.length === 0)`\n : `${camelCase(arg.name)} === undefined`\n )\n .join(\" || \")}) `}>\n {code`writeLine(\"\"); `}\n <Spacing />\n <For each={Object.values(command.options ?? {})} doubleHardline>\n {option => (\n <>\n <Show when={!option.optional}>\n <IfStatement\n condition={code`!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }`}>\n <Show\n when={\n option.kind === CommandParameterKinds.boolean ||\n !option.choices ||\n option.choices.length === 0\n }\n fallback={code`const value = await select({\n message: \\`Please select a value for the \\${italic(\"${\n option.name\n }\")} option\\`, ${\n option.description\n ? `description: \\`${formatDescription(\n option.description\n )}\\`,\n `\n : \"\"\n }options: [ ${(\n option as\n | StringCommandParameter\n | NumberCommandParameter\n ).choices\n ?.map(\n choice =>\n `{ value: ${JSON.stringify(\n choice\n )}, label: \"${choice}\", ${\n option.description\n ? `description: \\`${formatShortDescription(\n option.description\n )}\\``\n : \"\"\n } }`\n )\n .join(\", \")} ]\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}>\n <Switch>\n <Match\n when={\n option.kind === CommandParameterKinds.string\n }>{code`\n const value = await text({\n message: \\`Please provide a value for the \\${italic(\"${\n option.name\n }\")} option\\`,\n ${\n option.description\n ? `description: \\`${formatDescription(\n option.description\n )}\\`,\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this option\";\n }\n\n return null;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n <Match\n when={\n option.kind === CommandParameterKinds.number\n }>{code`\n const value = await numeric({\n message: \\`Please provide a numeric value for the \\${italic(\"${option.name}\")} option\\`,\n ${\n option.description\n ? `description: \\`${formatDescription(\n option.description\n )}\\`,\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n <Match\n when={\n option.kind === CommandParameterKinds.boolean\n }>{code`\n const value = await toggle({\n message: \\`Please select a value for the \\${italic(\"${option.name}\")} option\\`,\n ${\n option.description\n ? `description: \\`${formatDescription(\n option.description\n )}\\`,\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n </Switch>\n </Show>\n </IfStatement>\n <Show\n when={\n (option.kind === CommandParameterKinds.string ||\n option.kind === CommandParameterKinds.number) &&\n option.variadic\n }>\n <ElseIfClause\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0`}>\n {code`\n const value = await text({\n message: \\`Please provide one or more${\n option.kind === CommandParameterKinds.number\n ? \" numeric\"\n : \"\"\n } values for the \\${italic(\"${\n option.name\n }\")} option (values are separated by a \\\\\",\\\\\" character)\\`,\n ${\n option.description\n ? `description: \\`${formatDescription(\n option.description\n )}\\`,\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this option\";\n }\n if (val.split(\",\").map(v => v.trim()).filter(Boolean).length === 0) {\n return \"At least one value must be provided for this option\";\n }\n ${\n option.kind === CommandParameterKinds.number\n ? `const invalidIndex = val.split(\",\").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));\n if (invalidIndex !== -1) {\n return \\`Invalid numeric value provided for item #\\${invalidIndex + 1} - all provided items must be a valid number\\`;\n } `\n : \"\"\n }\n return undefined;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value.split(\",\").map(value => value.trim()).filter(Boolean)${\n option.kind === CommandParameterKinds.number\n ? `.map(Number)`\n : \"\"\n } ;\n `}\n </ElseIfClause>\n </Show>\n </Show>\n </>\n )}\n </For>\n <Spacing />\n <For each={command.args} doubleHardline>\n {arg => (\n <>\n <Show when={!arg.optional}>\n <IfStatement condition={code`!${camelCase(arg.name)}`}>\n <Show\n when={\n arg.kind === CommandParameterKinds.boolean ||\n !arg.choices ||\n arg.choices.length === 0\n }\n fallback={code`const value = await select({\n message: \\`Please select a value for the \\${italic(\"${\n arg.name\n }\")} argument\\`,${\n arg.description\n ? `description: \\`${formatDescription(\n arg.description\n )}\\`,\n `\n : \"\"\n }\n options: [ ${(\n arg as\n | StringCommandParameter\n | NumberCommandParameter\n ).choices\n ?.map(\n choice =>\n `{ value: ${JSON.stringify(\n choice\n )}, label: \"${choice}\", ${\n arg.description\n ? `description: \\`${formatShortDescription(\n arg.description\n )}\\``\n : \"\"\n } }`\n )\n .join(\", \")} ]\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(arg.name)} = value;\n `}>\n <Switch>\n <Match\n when={\n arg.kind === CommandParameterKinds.string\n }>{code`\n const value = await text({\n message: \\`Please provide a value for the \\${italic(\"${arg.name}\")} argument\\`,\n ${\n arg.description\n ? `description: \\`${formatShortDescription(\n arg.description\n )}\\`,\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this argument\";\n }\n\n return null;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(arg.name)} = value;\n `}</Match>\n <Match\n when={\n arg.kind === CommandParameterKinds.number\n }>{code`\n const value = await numeric({\n message: \\`Please provide a numeric value for the \\${italic(\"${arg.name}\")} argument\\`,\n ${\n arg.description\n ? `description: \\`${formatShortDescription(\n arg.description\n )}\\`,\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(arg.name)} = value;\n `}</Match>\n <Match\n when={\n arg.kind === CommandParameterKinds.boolean\n }>{code`\n const value = await toggle({\n message: \\`Please select a value for the \\${italic(\"${arg.name}\")} argument\\`,\n ${\n arg.description\n ? `description: \\`${formatShortDescription(\n arg.description\n )}\\`,\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(arg.name)} = value;\n `}</Match>\n </Switch>\n </Show>\n </IfStatement>\n <Show\n when={\n (arg.kind === CommandParameterKinds.string ||\n arg.kind === CommandParameterKinds.number) &&\n arg.variadic\n }>\n <ElseIfClause\n condition={code`${camelCase(arg.name)}.length === 0`}>\n {code`\n const value = await text({\n message: \\`Please provide one or more${\n arg.kind === CommandParameterKinds.number\n ? \" numeric\"\n : \"\"\n } values for the \\${italic(\"${arg.name}\")} argument (values are separated by a \\\\\",\\\\\" character)\\`,\n ${\n arg.description\n ? `description: \\`${formatShortDescription(\n arg.description\n )}\\`,\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this argument\";\n }\n if (val.split(\",\").map(v => v.trim()).filter(Boolean).length === 0) {\n return \"At least one value must be provided for this argument\";\n }\n ${\n arg.kind === CommandParameterKinds.number\n ? `const invalidIndex = val.split(\",\").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));\n if (invalidIndex !== -1) {\n return \\`Invalid numeric value provided for item #\\${invalidIndex + 1} - all provided items must be a valid number\\`;\n } `\n : \"\"\n }\n\n return undefined;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(arg.name)} = value.split(\",\").map(value => value.trim()).filter(Boolean)${\n arg.kind === CommandParameterKinds.number\n ? `.map(Number)`\n : \"\"\n } ;\n `}\n </ElseIfClause>\n </Show>\n </Show>\n </>\n )}\n </For>\n {code`writeLine(\"\"); `}\n <Spacing />\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 \\${italic(\"${command.title}\")} command can be executed: \\\\n\\\\n\\${failures.map(failure => \" - \" + failure).join(\"\\\\n\")}\\`);\n options.help = true; `}\n </IfStatement>\n </ElseIfClause>\n </Show>\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":";;;;;;;;;;;;;;;;;;;;;;;CA8CA,MAAO,EACL,SACC,SACD,gBACA,GAAA,SACF;;CAEE,MAAA,WAAA,eAAA,UAAA,QAAA,SAAA,QAAA,YAAA,CAAA,qBAAA,QAAA,CA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AAU,IAAC,KAAQ,CAAC,gEAAsB,IAAA,SAAA,sBAAA,SAAA,iBAAA,GAAA;;;gBAG3C,CAAC;;cAEL,CAAC,CAAC;;YAEN,CAAC,CAAC;WACJ,CAAC;UAAE,IAAI;UAAI,gBAAA,SAAA,EAAA,CAAA;UAAA,gBAAA,wBAAA,EACD,SACV,CAAC;UAAE,gBAAkB,aAAS;WAC7B,WAAU,IAAA;WACV,IAAI,WAAI;;;;WAIT,CAAC;UAAC;;QAEN,CAAC;;MAEL,CAAC,CAAC;;IAEN,CAAC,CAAC;;EAEN,CAAC,CAAC,EAAE,gBAAkB,KAAC;EACtB,IAAI,OAAO;AACT,UAAO,OAAO,OAAM,QAAA,SAAA;;EAEtB,WAAU,UAAG,gBAAA,MAAA;GACX,IAAI,OAAM;AACR,WAAO,MAAA;;GAET,IAAI,WAAW;AACb,WAAO,gBAAI,cAAA,EACT,SAAS,OACV,CAAC;;GAEJ,IAAI,WAAW;AACb,WAAO,gBAAiB,qBAAS,EAC/B,SAAS,OACV,CAAC;;GAEL,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 { code, computed, For, Match, Show, Switch } from \"@alloy-js/core\";\nimport { ElseIfClause, IfStatement } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport type {\n CommandTree,\n NumberCommandParameter,\n StringCommandParameter\n} from \"@shell-shock/core\";\nimport { CommandParameterKinds } from \"@shell-shock/core\";\nimport { CommandValidationLogic } from \"@shell-shock/core/components/command-validation-logic\";\nimport {\n formatDescription,\n formatShortDescription,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport { CommandHandlerDeclaration } from \"@shell-shock/preset-script/components/command-entry\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport interface CommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.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\", \"paths\"],\n console: [\n \"debug\",\n \"info\",\n \"help\",\n \"warn\",\n \"error\",\n \"table\",\n \"italic\",\n \"cursor\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"textColors\",\n \"createSpinner\"\n ],\n utils: [\"sleep\", \"isMinimal\", \"isInteractive\", \"isUnicodeSupported\"],\n state: [\n \"useGlobal\",\n \"GlobalOptions\",\n \"useGlobalOptions\",\n \"withCommand\",\n \"useArgs\",\n \"hasFlag\",\n \"isHelp\"\n ],\n prompts: [\n \"text\",\n \"numeric\",\n \"toggle\",\n \"select\",\n \"confirm\",\n \"waitForKeyPress\",\n \"isCancel\"\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 upgrade: [\"executeUpgrade\"]\n })}>\n <Spacing />\n <CommandHandlerDeclaration\n command={command}\n banner={code`await showBanner();\n await executeUpgrade(); `}>\n <IfStatement condition={code`!isInteractive`}>\n <CommandValidationLogic command={command} />\n </IfStatement>\n <Show\n when={\n Object.values(command.options ?? {}).filter(\n option => !option.optional\n ).length > 0 ||\n Object.values(command.args ?? {}).filter(arg => !arg.optional)\n .length > 0\n }>\n <ElseIfClause\n condition={code`!isHelp() && (${Object.values(\n command.options ?? {}\n )\n .filter(option => !option.optional)\n .map(option =>\n (option.kind === CommandParameterKinds.string ||\n option.kind === CommandParameterKinds.number) &&\n option.variadic\n ? `(!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } || options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0)`\n : `options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } === undefined`\n )\n .join(\" || \")}${\n Object.values(command.options ?? {}).filter(\n option => !option.optional\n ).length > 0 &&\n Object.values(command.args ?? {}).filter(arg => !arg.optional)\n .length > 0\n ? \" || \"\n : \"\"\n }${Object.values(command.args ?? {})\n .filter(arg => !arg.optional)\n .map(arg =>\n (arg.kind === CommandParameterKinds.string ||\n arg.kind === CommandParameterKinds.number) &&\n arg.variadic\n ? `(!${camelCase(\n arg.name\n )} || ${camelCase(arg.name)}.length === 0)`\n : `${camelCase(arg.name)} === undefined`\n )\n .join(\" || \")}) `}>\n {code`writeLine(\"\"); `}\n <Spacing />\n <For each={Object.values(command.options ?? {})} doubleHardline>\n {option => (\n <>\n <Show when={!option.optional}>\n <IfStatement\n condition={code`!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }`}>\n <Show\n when={\n option.kind === CommandParameterKinds.boolean ||\n !option.choices ||\n option.choices.length === 0\n }\n fallback={code`const value = await select({\n message: \\`Please select a value for the \\${italic(\"${\n option.name\n }\")} option\\`, ${\n option.description\n ? `description: \\`${formatDescription(\n option.description\n )}\\`,\n `\n : \"\"\n }options: [ ${(\n option as\n | StringCommandParameter\n | NumberCommandParameter\n ).choices\n ?.map(\n choice =>\n `{ value: ${JSON.stringify(\n choice\n )}, label: \"${choice}\", ${\n option.description\n ? `description: \\`${formatShortDescription(\n option.description\n )}\\``\n : \"\"\n } }`\n )\n .join(\", \")} ]\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}>\n <Switch>\n <Match\n when={\n option.kind === CommandParameterKinds.string\n }>{code`\n const value = await text({\n message: \\`Please provide a value for the \\${italic(\"${\n option.name\n }\")} option\\`,\n ${\n option.description\n ? `description: \\`${formatDescription(\n option.description\n )}\\`,\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this option\";\n }\n\n return null;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n <Match\n when={\n option.kind === CommandParameterKinds.number\n }>{code`\n const value = await numeric({\n message: \\`Please provide a numeric value for the \\${italic(\"${option.name}\")} option\\`,\n ${\n option.description\n ? `description: \\`${formatDescription(\n option.description\n )}\\`,\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n <Match\n when={\n option.kind === CommandParameterKinds.boolean\n }>{code`\n const value = await toggle({\n message: \\`Please select a value for the \\${italic(\"${option.name}\")} option\\`,\n ${\n option.description\n ? `description: \\`${formatDescription(\n option.description\n )}\\`,\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value;\n `}</Match>\n </Switch>\n </Show>\n </IfStatement>\n <Show\n when={\n (option.kind === CommandParameterKinds.string ||\n option.kind === CommandParameterKinds.number) &&\n option.variadic\n }>\n <ElseIfClause\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0`}>\n {code`\n const value = await text({\n message: \\`Please provide one or more${\n option.kind === CommandParameterKinds.number\n ? \" numeric\"\n : \"\"\n } values for the \\${italic(\"${\n option.name\n }\")} option (values are separated by a \\\\\",\\\\\" character)\\`,\n ${\n option.description\n ? `description: \\`${formatDescription(\n option.description\n )}\\`,\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this option\";\n }\n if (val.split(\",\").map(v => v.trim()).filter(Boolean).length === 0) {\n return \"At least one value must be provided for this option\";\n }\n ${\n option.kind === CommandParameterKinds.number\n ? `const invalidIndex = val.split(\",\").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));\n if (invalidIndex !== -1) {\n return \\`Invalid numeric value provided for item #\\${invalidIndex + 1} - all provided items must be a valid number\\`;\n } `\n : \"\"\n }\n return undefined;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } = value.split(\",\").map(value => value.trim()).filter(Boolean)${\n option.kind === CommandParameterKinds.number\n ? `.map(Number)`\n : \"\"\n } ;\n `}\n </ElseIfClause>\n </Show>\n </Show>\n </>\n )}\n </For>\n <Spacing />\n <For each={command.args} doubleHardline>\n {arg => (\n <>\n <Show when={!arg.optional}>\n <IfStatement condition={code`!${camelCase(arg.name)}`}>\n <Show\n when={\n arg.kind === CommandParameterKinds.boolean ||\n !arg.choices ||\n arg.choices.length === 0\n }\n fallback={code`const value = await select({\n message: \\`Please select a value for the \\${italic(\"${\n arg.name\n }\")} argument\\`,${\n arg.description\n ? `description: \\`${formatDescription(\n arg.description\n )}\\`,\n `\n : \"\"\n }\n options: [ ${(\n arg as\n | StringCommandParameter\n | NumberCommandParameter\n ).choices\n ?.map(\n choice =>\n `{ value: ${JSON.stringify(\n choice\n )}, label: \"${choice}\", ${\n arg.description\n ? `description: \\`${formatShortDescription(\n arg.description\n )}\\``\n : \"\"\n } }`\n )\n .join(\", \")} ]\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(arg.name)} = value;\n `}>\n <Switch>\n <Match\n when={\n arg.kind === CommandParameterKinds.string\n }>{code`\n const value = await text({\n message: \\`Please provide a value for the \\${italic(\"${arg.name}\")} argument\\`,\n ${\n arg.description\n ? `description: \\`${formatShortDescription(\n arg.description\n )}\\`,\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this argument\";\n }\n\n return null;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(arg.name)} = value;\n `}</Match>\n <Match\n when={\n arg.kind === CommandParameterKinds.number\n }>{code`\n const value = await numeric({\n message: \\`Please provide a numeric value for the \\${italic(\"${arg.name}\")} argument\\`,\n ${\n arg.description\n ? `description: \\`${formatShortDescription(\n arg.description\n )}\\`,\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(arg.name)} = value;\n `}</Match>\n <Match\n when={\n arg.kind === CommandParameterKinds.boolean\n }>{code`\n const value = await toggle({\n message: \\`Please select a value for the \\${italic(\"${arg.name}\")} argument\\`,\n ${\n arg.description\n ? `description: \\`${formatShortDescription(\n arg.description\n )}\\`,\n `\n : \"\"\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(arg.name)} = value;\n `}</Match>\n </Switch>\n </Show>\n </IfStatement>\n <Show\n when={\n (arg.kind === CommandParameterKinds.string ||\n arg.kind === CommandParameterKinds.number) &&\n arg.variadic\n }>\n <ElseIfClause\n condition={code`${camelCase(arg.name)}.length === 0`}>\n {code`\n const value = await text({\n message: \\`Please provide one or more${\n arg.kind === CommandParameterKinds.number\n ? \" numeric\"\n : \"\"\n } values for the \\${italic(\"${arg.name}\")} argument (values are separated by a \\\\\",\\\\\" character)\\`,\n ${\n arg.description\n ? `description: \\`${formatShortDescription(\n arg.description\n )}\\`,\n `\n : \"\"\n }validate(val) {\n if (!val || val.trim() === \"\") {\n return \"A value must be provided for this argument\";\n }\n if (val.split(\",\").map(v => v.trim()).filter(Boolean).length === 0) {\n return \"At least one value must be provided for this argument\";\n }\n ${\n arg.kind === CommandParameterKinds.number\n ? `const invalidIndex = val.split(\",\").map(v => v.trim()).filter(Boolean).findIndex(v => Number.isNaN(Number(v));\n if (invalidIndex !== -1) {\n return \\`Invalid numeric value provided for item #\\${invalidIndex + 1} - all provided items must be a valid number\\`;\n } `\n : \"\"\n }\n\n return undefined;\n }\n });\n if (isCancel(value)) {\n return;\n }\n\n ${camelCase(arg.name)} = value.split(\",\").map(value => value.trim()).filter(Boolean)${\n arg.kind === CommandParameterKinds.number\n ? `.map(Number)`\n : \"\"\n } ;\n `}\n </ElseIfClause>\n </Show>\n </Show>\n </>\n )}\n </For>\n {code`writeLine(\"\"); `}\n <Spacing />\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 \\${italic(\"${command.title}\")} command can be executed: \\\\n\\\\n\\${failures.map(failure => \" - \" + failure).join(\"\\\\n\")}\\`);\n options.help = true; `}\n </IfStatement>\n </ElseIfClause>\n </Show>\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":";;;;;;;;;;;;;;;;;;;;;;;CA8CA,MAAO,EACL,SACC,SACD,gBACA,GAAA,SACF;;CAEE,MAAA,WAAA,eAAA,UAAA,QAAA,SAAA,QAAA,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,KAAA,IAAA,EAAA,WAAA,CAAA;CACA,MAAK,oBAAoB,eAAc,iBAAa,aAAA,UAAA,QAAA,WAAA,aAAA,SAAA,MAAA,CAAA,EAAA,QAAA,MAAA,OAAA,QAAA,QAAA,MAAA,KAAA,CAAA,CAAA;CACpD,MAAA,iBAAA,gBAAA;EACF,GAAO,QAAQ;EACb,QAAQ,QAAS;;AAEjB,QAAM,CAAA,gBAAU,WAAc,WAAmB,MAAA;EACjD,IAAM,OAAA;AACJ,UAAS,SAAA;;EAET,IAAI,iBAAiB;AACnB,UAAO,eAAK;;EAEd,IAAA,UAAA;AACD,UAAA,KAAA,WAAA,EAAA,EAAA,GACK,kBAAmB,MAAC,WAAa,IAAA,GAAA,kBAAA,QAAA,KAAA,kBAAA,UAAA,SAAA,WAAA,QAAA,KAAA,IACrC,CAAA;;EAEA,IAAI,iBAAiB;AACnB,UAAE,KAAQ,kBAAoB,EAAC,EAAA;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AACb,WAAO,gBAAQ,qBAA+B,EAC5C,SAAS,OACV,CAAC;;GAEL,CAAC;EACH,CAAC,CAAC"}
@@ -58,15 +58,12 @@ function VirtualCommandEntry(props) {
58
58
  ],
59
59
  state: [
60
60
  "useGlobal",
61
+ "GlobalOptions",
61
62
  "useGlobalOptions",
62
63
  "withCommand",
63
64
  "useArgs",
64
65
  "hasFlag",
65
- "isHelp",
66
- {
67
- name: "GlobalOptions",
68
- type: true
69
- }
66
+ "isHelp"
70
67
  ],
71
68
  prompts: [
72
69
  "text",
@@ -55,15 +55,12 @@ function VirtualCommandEntry(props) {
55
55
  ],
56
56
  state: [
57
57
  "useGlobal",
58
+ "GlobalOptions",
58
59
  "useGlobalOptions",
59
60
  "withCommand",
60
61
  "useArgs",
61
62
  "hasFlag",
62
- "isHelp",
63
- {
64
- name: "GlobalOptions",
65
- type: true
66
- }
63
+ "isHelp"
67
64
  ],
68
65
  prompts: [
69
66
  "text",
@@ -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 { computed, For, Show } from \"@alloy-js/core\";\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 { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport type { CommandTree } from \"@shell-shock/core\";\nimport { isDynamicPathSegment } from \"@shell-shock/core/plugin-utils\";\nimport { VirtualCommandHandlerDeclaration } from \"@shell-shock/preset-script/components/virtual-command-entry\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\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<CLIPresetContext>();\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: [\n \"warn\",\n \"error\",\n \"info\",\n \"help\",\n \"table\",\n \"writeLine\",\n \"splitText\",\n \"textColors\",\n \"stripAnsi\"\n ],\n utils: [\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"isInteractive\",\n \"findSuggestions\",\n \"sleep\"\n ],\n state: [\n \"useGlobal\",\n \"useGlobalOptions\",\n \"withCommand\",\n \"useArgs\",\n \"hasFlag\",\n \"isHelp\",\n { name: \"GlobalOptions\", type: true }\n ],\n prompts: [\"text\", \"numeric\", \"toggle\", \"select\", \"isCancel\"],\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 command={command}>\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":";;;;;;;;;;;;;;;;;AAyCA,SAAE,oBAAA,OAAA;CACA,MAAK,EACL,SACF,SACE,4BAEA;CACA,MAAM,UAAU,eAAc;CAC9B,MAAE,WAAS,eAAA,UAAA,QAAA,WAAA,QAAA,SAAA,QAAA,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,KAAA,IAAA,EAAA,WAAA,CAAA;AACX,QAAI,CAAA,gBAAiB,gBAAA,WAAA,MAAA;EACnB,IAAE,OAAQ;AACR,UAAG,SAAO;;EAEZ,IAAG,UAAQ;AACX,UAAA,KAAA,WAAA,EAAA,EAAA,OAAA,QAAA,QAAA,SAAA,CAAA,QAAA,GAAA,WAAA,MAAA,UAAA,CAAA,QAAA,KAAA,CAAA,MAAA,WAAA;AACD,QAAA,KAAA,MAAA,UAAA,CAAA;;KAEM,OAAA,SAAA,WAAA,KAAA;KACJ,CAAA;AACE,WAAA;MACE,EAAE,CAAK,CAAA;;EAEZ,IAAI,iBAAa;AACf,UAAI,KAAQ,kBAAK,EAAA,EAAA;IACf,KAAE,CAAA,iBAAe,UAAgB;IACjC,SAAK;KAAA;KAAW;KAAW;KAAM;KAAS;KAAA;KAAA;KAAA;KAAA;KAAA;IAC1C,OAAK;KAAA;KAAc;KAAiB;KAAA;KAAA;KAAA;IACpC,OAAM;KAAA;KAAe;KAAU;KAAA;KAAA;KAAA;KAAA;MAC7B,MAAM;MACN,MAAK;;;IAEP,SAAM;KAAA;KAAU;KAAA;KAAA;KAAA;KAAA;KACf,UAAS,QAAG,GAAA,QAAA,SAAqB,QAAA,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,GAAA,CAAA,WAAA;KACjC,UAAA,UAAA,GAAA,QAAA,SAAA,QAAA,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,GAAA,CAAA,aAAA;IACF,CAAC;;EAEJ,IAAI,WAAW;AACb,UAAO,CAAA,gBAAK,SAAA,EAAA,CAAA,EAAA,gBAAA,kCAAA;IACL;IACL,IAAI,WAAM;AACR,YAAO,gBAAC,eAAA;MACN,IAAC,WAAM;AACN,cAAA,QAAU;;MAEX,IAAC,WAAW;AACX,cAAA,QAAS;;MAEZ,CAAA;;IAEH,CAAC,CAAC;;EAEN,CAAC,CAAC,EAAE,gBAAM,KAAgB;EACzB,IAAI,OAAK;AACP,UAAK,OAAA,OAAA,QAAA,SAAA;;EAEP,WAAS,UAAU,gBAAA,MAAA;GACjB,IAAI,OAAG;AACL,WAAK,MAAA;;GAEP,IAAI,WAAW;AACb,WAAK,gBAAO,cAAA,EACV,SAAS,OACV,CAAC;;GAEJ,IAAI,WAAU;AACZ,WAAK,gBAAK,qBAAA,EACR,SAAK,OACN,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 { computed, For, Show } from \"@alloy-js/core\";\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 { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport type { CommandTree } from \"@shell-shock/core\";\nimport { isDynamicPathSegment } from \"@shell-shock/core/plugin-utils\";\nimport { VirtualCommandHandlerDeclaration } from \"@shell-shock/preset-script/components/virtual-command-entry\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\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<CLIPresetContext>();\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: [\n \"warn\",\n \"error\",\n \"info\",\n \"help\",\n \"table\",\n \"writeLine\",\n \"splitText\",\n \"textColors\",\n \"stripAnsi\"\n ],\n utils: [\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"isInteractive\",\n \"findSuggestions\",\n \"sleep\"\n ],\n state: [\n \"useGlobal\",\n \"GlobalOptions\",\n \"useGlobalOptions\",\n \"withCommand\",\n \"useArgs\",\n \"hasFlag\",\n \"isHelp\"\n ],\n prompts: [\"text\", \"numeric\", \"toggle\", \"select\", \"isCancel\"],\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 command={command}>\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":";;;;;;;;;;;;;;;;;AAyCA,SAAE,oBAAA,OAAA;CACA,MAAK,EACL,SACF,SACE,4BAEA;CACA,MAAM,UAAU,eAAc;CAC9B,MAAE,WAAS,eAAA,UAAA,QAAA,WAAA,QAAA,SAAA,QAAA,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,KAAA,IAAA,EAAA,WAAA,CAAA;AACX,QAAI,CAAA,gBAAiB,gBAAA,WAAA,MAAA;EACnB,IAAE,OAAQ;AACR,UAAG,SAAO;;EAEZ,IAAG,UAAQ;AACX,UAAA,KAAA,WAAA,EAAA,EAAA,OAAA,QAAA,QAAA,SAAA,CAAA,QAAA,GAAA,WAAA,MAAA,UAAA,CAAA,QAAA,KAAA,CAAA,MAAA,WAAA;AACD,QAAA,KAAA,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\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`, onlyFirst ? void 0 : "g");
5
+ }
6
+
7
+ //#endregion
8
+ exports.default = ansiRegex;
@@ -0,0 +1,8 @@
1
+ //#region ../../node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
2
+ function ansiRegex({ onlyFirst = false } = {}) {
3
+ return new RegExp(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`, onlyFirst ? void 0 : "g");
4
+ }
5
+
6
+ //#endregion
7
+ export { ansiRegex as default };
8
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../../node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js"],"sourcesContent":["export default function ansiRegex({onlyFirst = false} = {}) {\n\t// Valid string terminator sequences are BEL, ESC\\, and 0x9c\n\tconst ST = '(?:\\\\u0007|\\\\u001B\\\\u005C|\\\\u009C)';\n\n\t// OSC sequences only: ESC ] ... ST (non-greedy until the first ST)\n\tconst osc = `(?:\\\\u001B\\\\][\\\\s\\\\S]*?${ST})`;\n\n\t// CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte\n\tconst csi = '[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:\\\\d{1,4}(?:[;:]\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]';\n\n\tconst pattern = `${osc}|${csi}`;\n\n\treturn new RegExp(pattern, onlyFirst ? undefined : 'g');\n}\n"],"x_google_ignoreList":[0],"mappings":";AAAA,SAAwB,UAAU,EAAC,YAAY,UAAS,EAAE,EAAE;AAY3D,QAAO,IAAI,OAFK,iJAEW,YAAY,SAAY,IAAI"}
@@ -0,0 +1,14 @@
1
+ const require_lookup = require('./lookup.cjs');
2
+
3
+ //#region ../../node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/index.js
4
+ function validate(codePoint) {
5
+ if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
6
+ }
7
+ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
8
+ validate(codePoint);
9
+ if (require_lookup.isFullWidth(codePoint) || require_lookup.isWide(codePoint) || ambiguousAsWide && require_lookup.isAmbiguous(codePoint)) return 2;
10
+ return 1;
11
+ }
12
+
13
+ //#endregion
14
+ exports.eastAsianWidth = eastAsianWidth;
@@ -0,0 +1,15 @@
1
+ import { isAmbiguous, isFullWidth, isWide } from "./lookup.mjs";
2
+
3
+ //#region ../../node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/index.js
4
+ function validate(codePoint) {
5
+ if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
6
+ }
7
+ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
8
+ validate(codePoint);
9
+ if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
10
+ return 1;
11
+ }
12
+
13
+ //#endregion
14
+ export { eastAsianWidth };
15
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../../node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/index.js"],"sourcesContent":["import {getCategory, isAmbiguous, isFullWidth, isWide} from './lookup.js';\n\nfunction validate(codePoint) {\n\tif (!Number.isSafeInteger(codePoint)) {\n\t\tthrow new TypeError(`Expected a code point, got \\`${typeof codePoint}\\`.`);\n\t}\n}\n\nexport function eastAsianWidthType(codePoint) {\n\tvalidate(codePoint);\n\n\treturn getCategory(codePoint);\n}\n\nexport function eastAsianWidth(codePoint, {ambiguousAsWide = false} = {}) {\n\tvalidate(codePoint);\n\n\tif (\n\t\tisFullWidth(codePoint)\n\t\t|| isWide(codePoint)\n\t\t|| (ambiguousAsWide && isAmbiguous(codePoint))\n\t) {\n\t\treturn 2;\n\t}\n\n\treturn 1;\n}\n\n// Private exports for https://github.com/sindresorhus/is-fullwidth-code-point\nexport {isFullWidth as _isFullWidth, isWide as _isWide} from './lookup.js';\n"],"x_google_ignoreList":[0],"mappings":";;;AAEA,SAAS,SAAS,WAAW;AAC5B,KAAI,CAAC,OAAO,cAAc,UAAU,CACnC,OAAM,IAAI,UAAU,gCAAgC,OAAO,UAAU,KAAK;;AAU5E,SAAgB,eAAe,WAAW,EAAC,kBAAkB,UAAS,EAAE,EAAE;AACzE,UAAS,UAAU;AAEnB,KACC,YAAY,UAAU,IACnB,OAAO,UAAU,IAChB,mBAAmB,YAAY,UAAU,CAE7C,QAAO;AAGR,QAAO"}