@shell-shock/core 0.17.2 → 0.17.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.cjs +5 -4
- package/dist/api.mjs +4 -2
- package/dist/api.mjs.map +1 -1
- package/dist/components/command-validation-logic.cjs +44 -11
- package/dist/components/command-validation-logic.mjs +44 -10
- package/dist/components/command-validation-logic.mjs.map +1 -1
- package/dist/components/docs.cjs +1 -2
- package/dist/components/exec-builtin.cjs +91 -99
- package/dist/components/exec-builtin.mjs +90 -97
- package/dist/components/exec-builtin.mjs.map +1 -1
- package/dist/components/helpers.cjs +1 -2
- package/dist/components/options-parser-logic.cjs +1 -2
- package/dist/components/state-builtin.cjs +2 -3
- package/dist/components/state-builtin.mjs +2 -2
- package/dist/components/state-builtin.mjs.map +1 -1
- package/dist/components/usage.cjs +1 -2
- package/dist/components/utils-builtin.cjs +2 -17
- package/dist/components/utils-builtin.mjs +1 -15
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/config.cjs +3 -3
- package/dist/config.mjs +2 -1
- package/dist/contexts/command.cjs +6 -3
- package/dist/contexts/command.mjs +5 -1
- package/dist/contexts/command.mjs.map +1 -1
- package/dist/contexts/options.cjs +7 -4
- package/dist/contexts/options.mjs +5 -1
- package/dist/contexts/options.mjs.map +1 -1
- package/dist/helpers/automd.cjs +1 -2
- package/dist/helpers/docs-helpers.cjs +3 -3
- package/dist/helpers/docs-helpers.mjs +2 -1
- package/dist/helpers/docs-helpers.mjs.map +1 -1
- package/dist/helpers/paths.cjs +3 -3
- package/dist/helpers/paths.mjs +2 -1
- package/dist/helpers/paths.mjs.map +1 -1
- package/dist/helpers/persistence.cjs +7 -5
- package/dist/helpers/persistence.mjs +6 -3
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/helpers/update-package-json.cjs +1 -2
- package/dist/helpers/utilities.cjs +3 -3
- package/dist/helpers/utilities.mjs +2 -1
- package/dist/helpers/utilities.mjs.map +1 -1
- package/dist/helpers/validations.cjs +1 -2
- package/dist/plugin-utils/context-helpers.cjs +21 -12
- package/dist/plugin-utils/context-helpers.mjs +20 -10
- package/dist/plugin-utils/context-helpers.mjs.map +1 -1
- package/dist/plugin-utils/deepkit.cjs +5 -6
- package/dist/plugin-utils/deepkit.mjs +5 -5
- package/dist/plugin-utils/deepkit.mjs.map +1 -1
- package/dist/plugin-utils/description-helpers.cjs +14 -8
- package/dist/plugin-utils/description-helpers.mjs +13 -6
- package/dist/plugin-utils/description-helpers.mjs.map +1 -1
- package/dist/plugin-utils/get-command-tree.cjs +5 -4
- package/dist/plugin-utils/get-command-tree.mjs +4 -2
- package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/reflect.cjs +3 -3
- package/dist/plugin-utils/reflect.mjs +2 -1
- package/dist/plugin-utils/traverse-command-tree.cjs +5 -4
- package/dist/plugin-utils/traverse-command-tree.mjs +4 -2
- package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/type-checks.cjs +11 -7
- package/dist/plugin-utils/type-checks.mjs +10 -5
- package/dist/plugin-utils/type-checks.mjs.map +1 -1
- package/dist/plugin.cjs +8 -5
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +7 -4
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/deepkit.cjs +4 -9
- package/dist/resolver/deepkit.mjs +4 -8
- package/dist/resolver/deepkit.mjs.map +1 -1
- package/dist/resolver/helpers.cjs +5 -4
- package/dist/resolver/helpers.mjs +4 -2
- package/dist/resolver/helpers.mjs.map +1 -1
- package/dist/resolver/module.cjs +1 -2
- package/dist/resolver/resolve.cjs +8 -5
- package/dist/resolver/resolve.mjs +7 -3
- package/dist/resolver/resolve.mjs.map +1 -1
- package/dist/types/command.cjs +65 -12
- package/dist/types/command.d.cts +9 -1
- package/dist/types/command.d.cts.map +1 -1
- package/dist/types/command.d.mts +9 -1
- package/dist/types/command.d.mts.map +1 -1
- package/dist/types/command.mjs +64 -10
- package/dist/types/command.mjs.map +1 -1
- package/dist/types/config.cjs +20 -7
- package/dist/types/config.d.cts +3 -2
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +3 -2
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/config.mjs +19 -5
- package/dist/types/config.mjs.map +1 -1
- package/dist/types/context.cjs +6 -3
- package/dist/types/context.mjs +5 -1
- package/dist/types/env.cjs +38 -3
- package/dist/types/env.d.cts +3 -1
- package/dist/types/env.d.cts.map +1 -1
- package/dist/types/env.d.mts +3 -1
- package/dist/types/env.d.mts.map +1 -1
- package/dist/types/env.mjs +37 -1
- package/dist/types/env.mjs.map +1 -1
- package/dist/types/options.cjs +1 -2
- package/package.json +11 -11
- package/dist/api.cjs.map +0 -1
- package/dist/components/command-validation-logic.cjs.map +0 -1
- package/dist/components/docs.cjs.map +0 -1
- package/dist/components/exec-builtin.cjs.map +0 -1
- package/dist/components/helpers.cjs.map +0 -1
- package/dist/components/options-parser-logic.cjs.map +0 -1
- package/dist/components/state-builtin.cjs.map +0 -1
- package/dist/components/usage.cjs.map +0 -1
- package/dist/components/utils-builtin.cjs.map +0 -1
- package/dist/config.cjs.map +0 -1
- package/dist/contexts/command.cjs.map +0 -1
- package/dist/contexts/options.cjs.map +0 -1
- package/dist/helpers/automd.cjs.map +0 -1
- package/dist/helpers/docs-helpers.cjs.map +0 -1
- package/dist/helpers/paths.cjs.map +0 -1
- package/dist/helpers/persistence.cjs.map +0 -1
- package/dist/helpers/update-package-json.cjs.map +0 -1
- package/dist/helpers/utilities.cjs.map +0 -1
- package/dist/helpers/validations.cjs.map +0 -1
- package/dist/plugin-utils/context-helpers.cjs.map +0 -1
- package/dist/plugin-utils/deepkit.cjs.map +0 -1
- package/dist/plugin-utils/description-helpers.cjs.map +0 -1
- package/dist/plugin-utils/get-command-tree.cjs.map +0 -1
- package/dist/plugin-utils/reflect.cjs.map +0 -1
- package/dist/plugin-utils/traverse-command-tree.cjs.map +0 -1
- package/dist/plugin-utils/type-checks.cjs.map +0 -1
- package/dist/plugin.cjs.map +0 -1
- package/dist/resolver/deepkit.cjs.map +0 -1
- package/dist/resolver/helpers.cjs.map +0 -1
- package/dist/resolver/module.cjs.map +0 -1
- package/dist/resolver/resolve.cjs.map +0 -1
- package/dist/types/command.cjs.map +0 -1
- package/dist/types/config.cjs.map +0 -1
- package/dist/types/context.cjs.map +0 -1
- package/dist/types/env.cjs.map +0 -1
- package/dist/types/options.cjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"options-parser-logic.cjs","names":[],"sources":["../../src/components/options-parser-logic.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport {\n ElseClause,\n ElseIfClause,\n IfStatement,\n InterfaceDeclaration,\n InterfaceMember,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type { PartialKeys } from \"@stryke/types/base\";\nimport { computedOptions } from \"../contexts/options\";\nimport {\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"../plugin-utils/context-helpers\";\nimport type {\n BooleanCommandOption,\n CommandOption,\n CommandTree,\n NumberCommandParameter,\n StringCommandParameter\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\nimport { BooleanInputParserLogic, CommandParameterType } from \"./helpers\";\n\nexport interface DynamicSegmentsParserLogicProps {\n /**\n * The command to generate the dynamic path segments parser logic for. This is used to access the command options and parameters when generating the parser logic for dynamic path segments.\n */\n command: CommandTree;\n\n /**\n * Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.\n */\n isCaseSensitive: boolean;\n}\n\nexport function DynamicSegmentsParserLogic(\n props: DynamicSegmentsParserLogicProps\n) {\n const { command } = props;\n\n return (\n <For each={command.segments ?? []}>\n {(segment, index) => (\n <Show when={isDynamicPathSegment(segment)}>\n <VarDeclaration\n let\n name={camelCase(getDynamicPathSegmentName(segment))}\n type=\"string | undefined\"\n />\n <hbr />\n <IfStatement\n condition={code`args.length > ${2 + index} && args[${2 + index}]`}>\n {code`${camelCase(\n getDynamicPathSegmentName(segment)\n )} = args[${2 + index}];`}\n </IfStatement>\n <hbr />\n <hbr />\n </Show>\n )}\n </For>\n );\n}\n\nexport interface ArgumentsParserLogicProps {\n /**\n * The command to generate the positional parameters parser logic for.\n */\n command: CommandTree;\n\n /**\n * The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${appSpecificEnvPrefix}_OPTION_NAME`).\n */\n appSpecificEnvPrefix: string;\n\n /**\n * Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.\n */\n isCaseSensitive: boolean;\n}\n\nexport function ArgumentsParserLogic(props: ArgumentsParserLogicProps) {\n const { command, appSpecificEnvPrefix, isCaseSensitive } = props;\n\n return (\n <Show when={command.args && command.args.length > 0}>\n <VarDeclaration\n let\n name=\"optionsIndex\"\n type=\"number\"\n initializer={code`Math.max(0, args.slice(${\n command.segments.length + 1\n }).findIndex(arg => arg.startsWith(\"-\") && /^(${Object.values(\n command.options ?? {}\n )\n .map(\n option =>\n `${\n isCaseSensitive || option.name.length === 1\n ? option.name\n : option.name\n .toLowerCase()\n .replaceAll(\"-\", \"\")\n .replaceAll(\"_\", \"\")\n }${option.alias && option.alias.length > 0 ? \"|\" : \"\"}${option.alias\n ?.map(a =>\n (isCaseSensitive || option.name.length === 1\n ? a\n : a\n .toLowerCase()\n .replaceAll(\"-\", \"\")\n .replaceAll(\"_\", \"\")) === \"?\"\n ? \"\\\\?\"\n : isCaseSensitive || option.name.length === 1\n ? a\n : a.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")\n )\n .join(\"|\")}`\n )\n .join(\"|\")})=?.*$/.test(arg${\n isCaseSensitive\n ? \"\"\n : '.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")'\n }))) + ${command.segments.length + 1};`}\n />\n <Spacing />\n <VarDeclaration\n let\n name=\"argsIndex\"\n type=\"number\"\n initializer={code`optionsIndex > ${\n command.segments.length + 1\n } ? ${command.segments.length + 1} : (Math.max(0, args.slice(optionsIndex).findLastIndex(arg => arg.startsWith(\"-\") && /^(${Object.values(\n command.options ?? {}\n )\n .map(\n option =>\n `${\n isCaseSensitive || option.name.length === 1\n ? option.name\n : option.name\n .toLowerCase()\n .replaceAll(\"-\", \"\")\n .replaceAll(\"_\", \"\")\n }${option.alias && option.alias.length > 0 ? \"|\" : \"\"}${option.alias\n ?.map(a =>\n (isCaseSensitive || option.name.length === 1\n ? a\n : a\n .toLowerCase()\n .replaceAll(\"-\", \"\")\n .replaceAll(\"_\", \"\")) === \"?\"\n ? \"\\\\?\"\n : isCaseSensitive || option.name.length === 1\n ? a\n : a.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")\n )\n .join(\"|\")}`\n )\n .join(\"|\")})=?.*$/.test(arg${\n isCaseSensitive\n ? \"\"\n : '.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")'\n }))) + ${command.segments.length + 1});`}\n />\n <Spacing />\n <For each={command.args ?? []} hardline>\n {(arg, index) => (\n <>\n <Show\n when={\n isSetString(arg.env) ||\n arg.default !== undefined ||\n ((arg.kind === CommandParameterKinds.string ||\n arg.kind === CommandParameterKinds.number) &&\n arg.variadic)\n }\n fallback={\n <>\n {code`let ${camelCase(arg.name)}!: `}\n <CommandParameterType parameter={arg} />\n {code`; `}\n </>\n }>\n <VarDeclaration\n let\n name={camelCase(arg.name)}\n type={<CommandParameterType parameter={arg} />}\n initializer={\n <>\n {code` ( `}\n <Show when={isSetString(arg.env)}>\n {code`env.${appSpecificEnvPrefix}_${constantCase(String(arg.env))} ?? `}\n </Show>\n <Show\n when={arg.default !== undefined}\n fallback={arg.variadic ? code`[]` : code`undefined`}>\n {arg.kind === CommandParameterKinds.string\n ? code`\"${arg.default}\"`\n : code`${arg.default}`}\n </Show>\n {code`) as `}\n <CommandParameterType parameter={arg} />\n {code`; `}\n </>\n }\n />\n </Show>\n <Spacing />\n <IfStatement\n condition={code`argsIndex + ${index} < args.length && argsIndex + ${index} !== optionsIndex`}>\n {code`${camelCase(arg.name)} = `}\n <Show\n when={\n arg.kind === CommandParameterKinds.string ||\n arg.kind === CommandParameterKinds.number\n }\n fallback={\n <BooleanInputParserLogic\n name={`args[argsIndex + ${index}] `}\n />\n }>\n <Show\n when={arg.variadic}\n fallback={\n <Show\n when={arg.kind === CommandParameterKinds.number}\n fallback={code`args[argsIndex + ${index}] `}>\n {code`Number(args[argsIndex + ${index}]) `}\n </Show>\n }>\n {code`args.slice(argsIndex + ${\n index\n }, (optionsIndex > argsIndex ? optionsIndex : args.length) - ${\n command.args.length - index\n }).join(\" \").split(\",\").map(item => item.trim().replace(/^(\"|')/, \"\").replace(/(\"|')$/, \"\")).filter(Boolean)`}\n </Show>\n </Show>\n {code` as `}\n <CommandParameterType parameter={arg} />\n {code`; `}\n </IfStatement>\n <Spacing />\n </>\n )}\n </For>\n </Show>\n );\n}\n\n/**\n * The command option interface property.\n */\nexport function OptionsMember({ option }: { option: CommandOption }) {\n const doc = option.description || `The ${option.title} command option.`;\n\n return (\n <>\n <Show when={Boolean(option.name)}>\n <Show when={option.kind === CommandParameterKinds.string}>\n <InterfaceMember\n name={option.name}\n doc={doc}\n type={<CommandParameterType parameter={option} />}\n optional={option.optional}\n />\n </Show>\n <Show when={option.kind === CommandParameterKinds.number}>\n <InterfaceMember\n name={option.name}\n doc={doc}\n type={<CommandParameterType parameter={option} />}\n optional={option.optional}\n />\n </Show>\n <Show when={option.kind === CommandParameterKinds.boolean}>\n <InterfaceMember\n name={option.name}\n doc={doc}\n type={<CommandParameterType parameter={option} />}\n optional={option.optional}\n />\n </Show>\n </Show>\n </>\n );\n}\n\nexport interface OptionsMemberParserLogicProps {\n /**\n * The option name to generate the parser logic for.\n */\n name: string;\n\n /**\n * The command option to generate the parser logic for.\n */\n option: CommandOption;\n\n /**\n * Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.\n *\n * @defaultValue false\n */\n isCaseSensitive: boolean;\n}\n\n/**\n * The command option property parser logic.\n */\nexport function OptionsMemberParserLogic(props: OptionsMemberParserLogicProps) {\n const { name, option, isCaseSensitive } = props;\n\n const equalsRegex = `/^--?(${\n isCaseSensitive || name.length === 1\n ? name\n : name.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")\n }${option.alias && option.alias.length > 0 ? \"|\" : \"\"}${option.alias\n ?.map(a =>\n (isCaseSensitive || name.length === 1\n ? a\n : a.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")) === \"?\"\n ? \"\\\\?\"\n : isCaseSensitive || name.length === 1\n ? a\n : a.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")\n )\n .join(\"|\")})=/`;\n\n return (\n <>\n <Show\n when={\n option.kind === CommandParameterKinds.string ||\n option.kind === CommandParameterKinds.number\n }>\n <Show\n when={\n (option as StringCommandParameter | NumberCommandParameter).variadic\n }>\n <Show\n when={name.includes(\"?\") || name.includes(\"-\")}\n fallback={code`options.${name} ??= []; `}>\n {code`options[\"${name}\"] ??= []; `}\n </Show>\n <hbr />\n <IfStatement\n condition={`${equalsRegex}.test(${\n isCaseSensitive\n ? \"arg\"\n : '\"-\" + arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")'\n })`}>\n <Show\n when={name.includes(\"?\") || name.includes(\"-\")}\n fallback={code`options.${name}.push(`}>\n {code`options[\"${name}\"].push(`}\n </Show>\n <Show when={option.kind === CommandParameterKinds.string}>\n {code`...arg.replace(${equalsRegex}, \"\").split(\",\").map(item => item.trim().replace(/^(\"|')/, \"\").replace(/(\"|')$/, \"\")).filter(Boolean) `}\n </Show>\n <Show when={option.kind === CommandParameterKinds.number}>\n {code`...arg.replace(${equalsRegex}, \"\").split(\",\").map(item => item.trim().replace(/^(\"|')/, \"\").replace(/(\"|')$/, \"\")).filter(Boolean).map(Number).filter(value => !Number.isNaN(value)) `}\n </Show>\n <Show\n when={\n (option.kind === CommandParameterKinds.string ||\n option.kind === CommandParameterKinds.number) &&\n option.choices &&\n option.choices.length > 0\n }>\n {code` as ${(\n option as StringCommandParameter | NumberCommandParameter\n ).choices\n ?.map(choice => (isSetString(choice) ? `\"${choice}\"` : choice))\n .join(\" | \")} `}\n </Show>\n {code`); `}\n </IfStatement>\n <ElseIfClause condition={`args.length > i + 1`}>\n <Show\n when={name.includes(\"?\") || name.includes(\"-\")}\n fallback={code`options.${name}.push(`}>\n {code`options[\"${name}\"].push(`}\n </Show>\n <Show when={option.kind === CommandParameterKinds.string}>\n {code`...args[++i].split(\",\").map(item => item.trim().replace(/^(\"|')/, \"\").replace(/(\"|')$/, \"\")).filter(Boolean) `}\n </Show>\n <Show when={option.kind === CommandParameterKinds.number}>\n {code`...args[++i].split(\",\").map(item => item.trim().replace(/^(\"|')/, \"\").replace(/(\"|')$/, \"\")).filter(Boolean).map(Number).filter(value => !Number.isNaN(value)) `}\n </Show>\n <Show\n when={\n (option.kind === CommandParameterKinds.string ||\n option.kind === CommandParameterKinds.number) &&\n option.choices &&\n option.choices.length > 0\n }>\n {code` as ${(\n option as StringCommandParameter | NumberCommandParameter\n ).choices\n ?.map(choice => (isSetString(choice) ? `\"${choice}\"` : choice))\n .join(\" | \")} `}\n </Show>\n {code`); `}\n </ElseIfClause>\n </Show>\n <Show\n when={\n !(option as StringCommandParameter | NumberCommandParameter)\n .variadic\n }>\n <IfStatement\n condition={`${equalsRegex}.test(${isCaseSensitive ? \"arg\" : '\"-\" + arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")'})`}>\n <Show when={option.kind === CommandParameterKinds.string}>\n <Show\n when={name.includes(\"?\") || name.includes(\"-\")}\n fallback={code`options.${name}`}>\n {code`options[\"${name}\"]`}\n </Show>\n {code` = arg.replace(${equalsRegex}, \"\").trim().replace(/^(\"|')/, \"\").replace(/(\"|')$/, \"\")`}\n <Show\n when={\n (option as StringCommandParameter).choices &&\n (option as StringCommandParameter).choices!.length > 0\n }>\n {code` as ${(option as StringCommandParameter).choices\n ?.map(choice => `\"${choice}\"`)\n .join(\" | \")}`}\n </Show>\n {code`; `}\n </Show>\n <Show when={option.kind === CommandParameterKinds.number}>\n <VarDeclaration\n const\n name=\"value\"\n initializer={code` Number(arg.replace(${equalsRegex}, \"\").trim().replace(/^(\"|')/, \"\").replace(/(\"|')$/, \"\")); `}\n />\n <hbr />\n <IfStatement condition={`!Number.isNaN(value)`}>\n <Show\n when={name.includes(\"?\") || name.includes(\"-\")}\n fallback={code`options.${name}`}>\n {code`options[\"${name}\"]`}\n </Show>\n {code` = value`}\n <Show\n when={\n (option as NumberCommandParameter).choices &&\n (option as NumberCommandParameter).choices!.length > 0\n }>\n {code` as ${(option as NumberCommandParameter).choices?.join(\" | \")}`}\n </Show>\n {code`; `}\n </IfStatement>\n </Show>\n </IfStatement>\n <ElseIfClause condition={`args.length > i + 1`}>\n <Show when={option.kind === CommandParameterKinds.string}>\n <Show\n when={name.includes(\"?\") || name.includes(\"-\")}\n fallback={code`options.${name}`}>\n {code`options[\"${name}\"]`}\n </Show>\n {code` = args[++i].trim().replace(/^(\"|')/, \"\").replace(/(\"|')$/, \"\")`}\n <Show\n when={\n (option as StringCommandParameter).choices &&\n (option as StringCommandParameter).choices!.length > 0\n }>\n {code` as ${(option as StringCommandParameter).choices?.map(choice => `\"${choice}\"`).join(\" | \")}`}\n </Show>\n {code`; `}\n </Show>\n <Show when={option.kind === CommandParameterKinds.number}>\n <VarDeclaration\n const\n name=\"value\"\n initializer={code` Number(args[++i].trim().replace(/^(\"|')/, \"\").replace(/(\"|')$/, \"\")); `}\n />\n <hbr />\n <IfStatement condition={`!Number.isNaN(value)`}>\n <Show\n when={name.includes(\"?\") || name.includes(\"-\")}\n fallback={code`options.${name}`}>\n {code`options[\"${name}\"]`}\n </Show>\n {code` = value`}\n <Show\n when={\n (option as NumberCommandParameter).choices &&\n (option as NumberCommandParameter).choices!.length > 0\n }>\n {code` as ${(option as NumberCommandParameter).choices?.join(\" | \")}`}\n </Show>\n {code`; `}\n </IfStatement>\n </Show>\n </ElseIfClause>\n <hbr />\n </Show>\n </Show>\n <Show when={option.kind === CommandParameterKinds.boolean}>\n <IfStatement\n condition={`${equalsRegex}.test(${isCaseSensitive ? \"arg\" : '\"-\" + arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")'})`}>\n <VarDeclaration\n const\n name=\"value\"\n initializer={code` arg.replace(${equalsRegex}, \"\").trim().replace(/^(\"|')/, \"\").replace(/(\"|')$/, \"\").toLowerCase(); `}\n />\n <hbr />\n <Show\n when={name.includes(\"?\") || name.includes(\"-\")}\n fallback={code`options.${name} = `}>\n {code`options[\"${name}\"] = `}\n </Show>\n <BooleanInputParserLogic name=\"value\" />\n </IfStatement>\n <ElseClause>\n <Show\n when={name.includes(\"?\") || name.includes(\"-\")}\n fallback={code`options.${name} = true; `}>\n {code`options[\"${name}\"] = true; `}\n </Show>\n </ElseClause>\n <Show when={Boolean((option as BooleanCommandOption).isNegativeOf)}>\n <hbr />\n <Show\n when={\n (option as BooleanCommandOption).isNegativeOf!.includes(\"?\") ||\n (option as BooleanCommandOption).isNegativeOf!.includes(\"-\")\n }\n fallback={code`options.${(option as BooleanCommandOption).isNegativeOf} = false; `}>\n {code`options[\"${(option as BooleanCommandOption).isNegativeOf}\"] = false; `}\n </Show>\n </Show>\n </Show>\n </>\n );\n}\n\nexport interface OptionsMemberParserConditionProps {\n /**\n * The option name to generate the parser logic for.\n */\n name: string;\n\n /**\n * Aliases for the option, which will also be parsed in the generated code. This will affect how the generated code compares command-line arguments to option names and aliases.\n */\n alias?: string[];\n\n /**\n * Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.\n *\n * @defaultValue false\n */\n isCaseSensitive: boolean;\n}\n\nexport function OptionsMemberParserCondition(\n props: OptionsMemberParserConditionProps\n) {\n const { name, alias: aliasProp, isCaseSensitive } = props;\n\n return (\n <>\n {code`${\n isCaseSensitive\n ? 'arg.startsWith(\"--'\n : 'arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\").startsWith(\"'\n }${isCaseSensitive ? name : name.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")}=\") || ${\n isCaseSensitive\n ? \"arg\"\n : 'arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")'\n } === \"${\n isCaseSensitive\n ? name\n : name.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")\n }\" || ${\n isCaseSensitive\n ? 'arg.startsWith(\"-'\n : 'arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\").startsWith(\"'\n }${isCaseSensitive ? name : name.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")}=\") || ${\n isCaseSensitive\n ? \"arg\"\n : 'arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")'\n } === \"${\n isCaseSensitive\n ? name\n : name.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")\n }\"`}\n <Show when={aliasProp && aliasProp.length > 0}>\n <For each={aliasProp ?? []}>\n {alias =>\n code` || ${\n isCaseSensitive || alias.length === 1\n ? 'arg.startsWith(\"--'\n : 'arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\").startsWith(\"'\n }${isCaseSensitive || alias.length === 1 ? alias : alias.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")}=\") || ${\n isCaseSensitive || alias.length === 1\n ? \"arg\"\n : 'arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")'\n } === \"${\n isCaseSensitive || alias.length === 1\n ? alias\n : alias.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")\n }\" || ${\n isCaseSensitive || alias.length === 1\n ? 'arg.startsWith(\"-'\n : 'arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\").startsWith(\"'\n }${isCaseSensitive || alias.length === 1 ? alias : alias.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")}=\") || ${\n isCaseSensitive || alias.length === 1\n ? \"arg\"\n : 'arg.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")'\n } === \"${\n isCaseSensitive || alias.length === 1\n ? alias\n : alias.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")\n }\"`\n }\n </For>\n </Show>\n </>\n );\n}\n\nexport function OptionsInterfaceDeclaration(props: { command: CommandTree }) {\n const { command } = props;\n\n const options = computed(() =>\n computedOptions(\n Object.entries(command.options).map(([name, option]) => ({\n ...option,\n name\n }))\n )\n );\n\n return (\n <InterfaceDeclaration\n export\n name={`${pascalCase(command.name)}Options`}\n extends=\"GlobalOptions\">\n <For each={Object.values(options.value)} hardline>\n {option => <OptionsMember option={option} />}\n </For>\n </InterfaceDeclaration>\n );\n}\n\nexport interface OptionsParserLogicProps extends PartialKeys<\n Pick<CommandTree, \"segments\" | \"options\" | \"name\">,\n \"segments\" | \"name\"\n> {\n /**\n * The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${appSpecificEnvPrefix}_OPTION_NAME`).\n */\n appSpecificEnvPrefix: string;\n\n /**\n * Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.\n *\n * @defaultValue false\n */\n isCaseSensitive?: boolean;\n}\n\n/**\n * The command options parser logic.\n */\nexport function OptionsParserLogic(props: OptionsParserLogicProps) {\n const {\n segments = [],\n options: _options,\n name: _name,\n appSpecificEnvPrefix,\n isCaseSensitive = false\n } = props;\n\n const options = computed(() =>\n computedOptions(\n Object.entries(_options).map(([name, option]) => ({\n ...option,\n name\n }))\n )\n );\n\n return (\n <>\n <VarDeclaration\n const\n name=\"options\"\n initializer={code` {\n ${\n segments.length > 0 ? \"...useGlobalOptions(), \" : \"\"\n }${Object.entries(options.value)\n .filter(\n ([, option]) =>\n option.env ||\n option.default !== undefined ||\n ((option.kind === CommandParameterKinds.string ||\n option.kind === CommandParameterKinds.number) &&\n option.variadic)\n )\n .map(([name, option]) => {\n if (option.kind === CommandParameterKinds.string) {\n return ` ${\n name.includes(\"?\") || name.includes(\"-\")\n ? `\"${name}\"`\n : `${name}`\n }: ${\n option.env ? `env.${appSpecificEnvPrefix}_${option.env}` : \"\"\n }${\n option.variadic\n ? option.default !== undefined\n ? `${\n option.env ? \" ?? \" : \"\"\n }${JSON.stringify(option.default)}`\n : option.env\n ? \" ?? []\"\n : \"[]\"\n : option.default !== undefined\n ? `${option.env ? \" ?? \" : \"\"}\"${option.default}\"`\n : \"\"\n }, `;\n } else if (option.kind === CommandParameterKinds.number) {\n return ` ${name.includes(\"?\") || name.includes(\"-\") ? `\"${name}\"` : `${name}`}: ${\n option.env ? `env.${appSpecificEnvPrefix}_${option.env}` : \"\"\n }${\n option.variadic\n ? option.default && Array.isArray(option.default)\n ? `${\n option.env ? \" ?? \" : \"\"\n }${JSON.stringify(option.default)}`\n : option.env\n ? \" ?? []\"\n : \"[]\"\n : option.default !== undefined\n ? `${option.env ? \" ?? \" : \"\"}${option.default}`\n : \"\"\n }, `;\n } else if (option.kind === CommandParameterKinds.boolean) {\n return ` ${name.includes(\"?\") || name.includes(\"-\") ? `\"${name}\"` : `${name}`}: ${\n option.env\n ? `env.${appSpecificEnvPrefix}_${option.env} ?? `\n : \"\"\n }${option.default ? \"true\" : \"false\"},`;\n }\n\n return \"\";\n })\n .join(\"\")}\n } as unknown as ${segments.length > 0 ? pascalCase(_name) : \"Global\"}Options;`}\n />\n <Spacing />\n {code`for (let i = 0; i < args.slice(${\n segments.filter(segment => isDynamicPathSegment(segment)).length\n }).length; i++) { `}\n <hbr />\n <VarDeclaration\n const\n name=\"arg\"\n type=\"string\"\n initializer={code` args[i].length > 3 && args[i].startsWith(\"--\")\n ? \\`--\\${args[i].slice(2).replaceAll(\"-\", \"\")${\n isCaseSensitive\n ? \"\"\n : '.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")'\n }}\\`\n : args[i].length > 2 && args[i].startsWith(\"-\")\n ? \\`-\\${args[i].slice(1).replaceAll(\"-\", \"\")}\\`\n : args[i]; `}\n />\n <hbr />\n <For each={Object.entries(options.value)} hardline>\n {([name, option], i) => (\n <Show\n when={i === 0}\n fallback={\n <ElseIfClause\n condition={\n <>\n <OptionsMemberParserCondition\n name={name}\n alias={option.alias}\n isCaseSensitive={isCaseSensitive}\n />\n </>\n }>\n <OptionsMemberParserLogic\n name={name}\n option={option}\n isCaseSensitive={isCaseSensitive}\n />\n </ElseIfClause>\n }>\n <IfStatement\n condition={\n <OptionsMemberParserCondition\n name={name}\n alias={option.alias}\n isCaseSensitive={isCaseSensitive}\n />\n }>\n <OptionsMemberParserLogic\n name={name}\n option={option}\n isCaseSensitive={isCaseSensitive}\n />\n </IfStatement>\n </Show>\n )}\n </For>\n <hbr />\n {code` } `}\n <hbr />\n </>\n );\n}\n\nexport interface CommandParserLogicProps {\n /**\n * The command to generate the parser logic for.\n */\n command: CommandTree;\n\n /**\n * The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${appSpecificEnvPrefix}_OPTION_NAME`).\n */\n appSpecificEnvPrefix: string;\n\n /**\n * Whether the command options should be parsed in a case-sensitive manner. This will affect how the generated code compares command-line arguments to option names and aliases.\n *\n * @defaultValue false\n */\n isCaseSensitive?: boolean;\n}\n\n/**\n * The command parser logic, which includes parsing dynamic path segments, positional parameters, and options.\n */\nexport function CommandParserLogic(props: CommandParserLogicProps) {\n const { command, appSpecificEnvPrefix, isCaseSensitive = false } = props;\n\n return (\n <>\n <DynamicSegmentsParserLogic\n command={command}\n isCaseSensitive={isCaseSensitive}\n />\n <Spacing />\n <OptionsParserLogic\n name={command.name}\n options={command.options}\n segments={command.segments}\n appSpecificEnvPrefix={appSpecificEnvPrefix}\n isCaseSensitive={isCaseSensitive}\n />\n <Spacing />\n <ArgumentsParserLogic\n command={command}\n appSpecificEnvPrefix={appSpecificEnvPrefix}\n isCaseSensitive={isCaseSensitive}\n />\n <Spacing />\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA2CA,SAAE,2BAAA,OAAA;CACA,MAAM,EACR,YACM;;EAEN,IAAO,OAAA;AACH,UAAA,QAAA,YAAA,EAAA;;EAEA,WAAA,SAAA,0DAAA,qBAAA;GACF,IAAQ,OAAC;;;GAGN,IAAA,WAAY;AACb,WAAA;qDAAA,qCAAA;MACF,OAAe;MACjB,IAAA,OAAA;;;MAGS,MAAA;MACP,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,kCAAA;MACQ,WAAW,mBAAC,iBAAK,IAAA,MAAA,WAAA,IAAA,MAAA;;AAElB,cAAA,mBAAA,mDAAA,kDAAA,QAAA,CAAA,CAAA,UAAA,IAAA,MAAA;;MAED,CAAA;qDAAmB,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;KAAA;;GAEtB,CAAC;EACH,CAAC;;;CAmBJ,MAA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EAAA,CAAA;EAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state-builtin.cjs","names":[],"sources":["../../src/components/state-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, For, Show, splitProps } from \"@alloy-js/core\";\nimport {\n FunctionDeclaration,\n InterfaceDeclaration,\n InterfaceMember,\n TypeDeclaration,\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 { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport { BuiltinFile } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport {\n TSDoc,\n TSDocInternal,\n TSDocLink,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport defu from \"defu\";\nimport { computedOptions } from \"../contexts/options\";\nimport { getAppBin } from \"../plugin-utils\";\nimport { getAppTitle } from \"../plugin-utils/context-helpers\";\nimport type { Context } from \"../types\";\nimport { OptionsMember, OptionsParserLogic } from \"./options-parser-logic\";\n\nexport function GlobalTypeDefinitions() {\n const context = usePowerlines<Context>();\n\n const options = computed(() => computedOptions(context.options));\n\n return (\n <>\n <TSDoc\n heading={`An object representing the global options available for every command in the ${getAppTitle(\n context,\n true\n )} command-line application.`}\n />\n <InterfaceDeclaration export name=\"GlobalOptions\">\n <For each={Object.values(options.value)} hardline>\n {option => <OptionsMember option={option} />}\n </For>\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"The context object for the current command execution, containing the command path and segments.\" />\n <InterfaceDeclaration\n export\n name=\"CommandContext\"\n typeParameters={[\n {\n name: \"THandler\",\n extends: \"(...params: any[]) => any\",\n default: \"any\"\n }\n ]}>\n <TSDoc\n heading={`The full command path as a string. For example, if the user runs \\`${getAppBin(\n context\n )} foo bar\\`, this would be \\`foo bar\\`. This is useful for commands that need to know their full invocation path, such as for help text or for commands that have dynamic behavior based on their position in the command hierarchy.`}\n />\n <InterfaceMember name=\"path\" type=\"string\" />\n <Spacing />\n <TSDoc\n heading={`An array of command path segments. For example, if the user runs \\`${getAppBin(\n context\n )} foo bar\\`, this would be \\`[\"foo\", \"bar\"]\\`. This is useful for commands that need to know their individual path segments, such as for dynamic routing or for commands that have behavior based on specific segments in the command hierarchy.`}\n />\n <InterfaceMember name=\"segments\" type=\"string[]\" />\n <Spacing />\n <TSDoc\n heading={`The parameters for the current command's handler function.`}\n />\n <InterfaceMember name=\"params\" type=\"Parameters<THandler>\" />\n </InterfaceDeclaration>\n <Spacing />\n <TypeDeclaration export name=\"GlobalContextStatus\">\n {code`\"initializing\" | \"preparing\" | \"executing\" | \"completed\"`}\n </TypeDeclaration>\n <Spacing />\n <TSDoc\n heading={`The state object for the ${getAppTitle(context)} application context.`}\n />\n <InterfaceDeclaration export name=\"GlobalContextState\">\n <TSDoc heading=\"The unique identifier for the current execution context.\" />\n <InterfaceMember name=\"executionId\" type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The status of the current execution context.\" />\n <InterfaceMember name=\"status\" type=\"GlobalContextStatus\" />\n <Spacing />\n <TSDoc heading=\"Indicates whether the current execution context has encountered an error.\" />\n <InterfaceMember name=\"isError\" type=\"boolean\" />\n <Spacing />\n <TSDoc heading=\"A map containing arbitrary data associated with the current execution context.\" />\n <InterfaceMember name=\"meta\" type=\"Map<string, unknown>\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc\n heading={`The context object for the ${getAppTitle(context)} application.`}\n />\n <InterfaceDeclaration export name=\"GlobalContext\">\n <TSDoc heading=\"The global options shared across all commands in the application.\" />\n <InterfaceMember name=\"options\" type=\"GlobalOptions\" />\n <Spacing />\n <TSDoc heading=\"The raw command-line arguments passed to the application.\" />\n <InterfaceMember name=\"inputArgs\" type=\"string[]\" />\n <Spacing />\n <TSDoc heading=\"The state of the current execution context.\" />\n <InterfaceMember name=\"state\" type=\"GlobalContextState\" />\n </InterfaceDeclaration>\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ArgsUtilities() {\n return (\n <>\n <TSDoc heading=\"Retrieves the command-line arguments from Deno or Node.js environments.\">\n <TSDocRemarks>\n {`This function is only intended for internal use. Please use \\`useArgs()\\` instead.`}\n </TSDocRemarks>\n <Spacing />\n <TSDocInternal />\n <Spacing />\n <TSDocReturns>\n {`An array of command-line arguments from Deno or Node.js environments.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration name=\"getInputArgs\" returnType=\"string[]\">\n {code`return ((globalThis as { Deno?: { args: string[] } })?.Deno?.args ?? process.argv ?? []) as string[];`}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport function ContextUtilities() {\n const context = usePowerlines<Context>();\n\n const options = computed(() =>\n Object.fromEntries(context.options.map(option => [option.name, option]))\n );\n\n return (\n <>\n <Spacing />\n\n <TSDoc\n heading={`The global ${getAppTitle(context)} application context store instance.`}>\n <TSDocInternal />\n </TSDoc>\n <VarDeclaration export const name=\"unstable_globalStore\">\n {code` new AsyncLocalStorage<GlobalContext>({ name: \"globalStore\" }); `}\n </VarDeclaration>\n <Spacing />\n <TSDoc\n heading={`Get the ${getAppTitle(\n context\n )} application context for the current application.`}>\n <TSDocReturns>\n {`The ${getAppTitle(\n context\n )} application context for the current application or undefined if the context is not available.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"useGlobal\" returnType=\"GlobalContext\">\n {code`return unstable_globalStore.getStore() as GlobalContext;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility hook function to get the command-line arguments from the ${getAppTitle(\n context\n )} application context.`}>\n <TSDocReturns>\n {\"An array of command-line arguments from the application context.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"useArgs\" returnType=\"string[]\">\n {code`return useGlobal()?.inputArgs ?? getInputArgs();`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility hook function to get the command-line global options from the ${getAppTitle(\n context\n )} application context.`}>\n <TSDocReturns>\n {\n \"An object containing the global options from the application context.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"useGlobalOptions\"\n returnType=\"GlobalOptions\">\n {code`return useGlobal()?.options ?? {};`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility hook function to get the state of the ${getAppTitle(\n context\n )} application context.`}>\n <TSDocReturns>{\"The state of the application context.\"}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"useState\"\n returnType=\"GlobalContextState\">\n {code`return useGlobal()?.state;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility function to update the state of the ${getAppTitle(\n context\n )} application context.`}>\n <TSDocRemarks>\n {`This function will throw an error if the global context is not available, so it should only be used within a valid context scope, such as within a command handler or within the \\`withGlobal()\\` function.`}\n </TSDocRemarks>\n <Spacing />\n <TSDocParam name=\"update\">\n {`The new state or a function that receives the previous state and returns the new state. This allows for both direct state updates and functional updates based on the previous state.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"setState\"\n parameters={[\n {\n name: \"update\",\n type: \"Partial<GlobalContextState> | ((prev: GlobalContextState) => GlobalContextState)\"\n }\n ]}>\n {code`const prev = useGlobal()?.state;\n if (!prev) {\n throw new Error(\n \\`The ${getAppTitle(\n context\n )} application context is not available. Make sure to call setState() within a valid context scope.\\`\n );\n }\n\n useGlobal().state = typeof update === \"function\" ? update(prev) : { ...prev, ...update }; `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility hook function to get the execution ID of the ${getAppTitle(\n context\n )} application context.`}>\n <TSDocReturns>\n {\"The execution ID of the application context.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"useExecutionId\" returnType=\"string\">\n {code`return useState().executionId;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility hook function to get the metadata of the ${getAppTitle(\n context\n )} application context.`}>\n <TSDocReturns>\n {\"The metadata of the application context.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"useMeta\"\n returnType=\"Map<string, unknown>\">\n {code`return useState().meta;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility hook function to get the current status of the ${getAppTitle(\n context\n )} application.`}>\n <TSDocReturns>{\"The current status of the application.\"}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"useStatus\"\n returnType=\"GlobalContextStatus\">\n {code`return useState().status;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`The global ${getAppTitle(context)} - command context store instance.`}>\n <TSDocInternal />\n </TSDoc>\n <VarDeclaration export name=\"unstable_commandStore\">\n {code`new AsyncLocalStorage<CommandContext>({ name: \"commandStore\" });`}\n </VarDeclaration>\n <Spacing />\n <TSDoc\n heading={`Get the ${getAppTitle(context)} - command context for the current application.`}>\n <TSDocReturns>\n {`The ${getAppTitle(context)} - command context for the current application.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"useCommand\" returnType=\"CommandContext\">\n {code`const result = unstable_commandStore.getStore();\nif (!result) {\n throw new Error(\n \\`The ${getAppTitle(context)} - command context is not available. Make sure to call useCommand() within a valid context scope.\\`\n );\n}\nreturn result;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A utility hook function to get the individual segments of the current command path.\">\n <TSDocReturns>{\"An array of command path segments.\"}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"useSegments\" returnType=\"string[]\">\n {code`return useCommand().segments;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A utility hook function to get the full command path as a string.\">\n <TSDocReturns>\n {`The full command path as a string. For example, if the user runs \\`${getAppBin(\n context\n )} foo bar\\`, this would return \\`\"foo bar\"\\`. This is useful for commands that need to know their full invocation path, such as for help text or for commands that have dynamic behavior based on their position in the command hierarchy.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"usePath\" returnType=\"string\">\n {code`return useCommand().path;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"Checks if a specific flag is present in the command-line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {\n 'The flag (or an array of flags/aliases) to check for, e.g., \"color\", \"no-color\".'\n }\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command-line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"hasFlag\"\n parameters={[\n { name: \"flag\", type: \"string | string[]\" },\n {\n name: \"argv\",\n type: \"string[]\",\n default: \"useArgs()\"\n }\n ]}>\n <VarDeclaration\n const\n name=\"position\"\n type=\"number\"\n initializer={code`(Array.isArray(flag) ? flag : [flag]).reduce((ret, f) => {\n const pos = argv.findIndex(arg => (f.startsWith(\"-\") ? \"\" : (f.length === 1 ? \"-\" : \"--\") + f)?.toLowerCase() === arg?.toLowerCase() || arg?.toLowerCase().startsWith((f.length === 1 ? \"-\" : \"--\") + f + \"=\"));\n return pos !== -1 ? pos : ret;\n }, -1);`}\n />\n <hbr />\n {code`return position !== -1 && argv.indexOf(\"--\") === -1 || position < argv.indexOf(\"--\");`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A utility function to determine if the help flag is present or if the command is in an error state during preparation.\">\n <TSDocReturns>\n {`True if the help flag is present or if the command is in an error state during preparation, false otherwise. This can be used to conditionally display help text or to alter command behavior when the user is likely seeking help.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"isHelp\" returnType=\"boolean\">\n {code`return !isCI && (hasFlag([\"help\", \"h\", \"?\"]) || (useStatus() === \"preparing\" && useState().isError)); `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility function to wrap the ${getAppTitle(\n context\n )} application within the global context scope.`}>\n <TSDocParam name=\"handler\">\n {`The callback function to run within the global context scope. This function will receive the global context as its argument, allowing it to access any properties or utilities defined on the context. The callback function can be asynchronous and can return a value or a promise.`}\n </TSDocParam>\n <TSDocReturns>\n {`The result of the callback function, which can be a value or a promise that resolves to a value.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"withGlobal\"\n parameters={[{ name: \"handler\", type: \"() => any\" }]}\n returnType=\"Promise<void>\">\n <VarDeclaration\n const\n name=\"args\"\n initializer={code`getInputArgs(); `}\n />\n <Spacing />\n <OptionsParserLogic\n options={options.value}\n appSpecificEnvPrefix={context.config.appSpecificEnvPrefix}\n isCaseSensitive={context.config.isCaseSensitive}\n />\n <Spacing />\n {code`\n return unstable_globalStore.run({ options, inputArgs: args, state: { executionId: randomUUID(), status: \"initializing\", isError: false, meta: new Map() } as GlobalContextState }, handler);`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility function to wrap a ${getAppTitle(\n context\n )} application command handler within the command context scope.`}>\n <TSDocParam name=\"handler\">\n {`The callback function to run within the command context scope. This function will receive the command context as its argument, allowing it to access any properties or utilities defined on the context. The callback function can be asynchronous and can return a value or a promise.`}\n </TSDocParam>\n <TSDocReturns>\n {`The result of the callback function, which can be a value or a promise that resolves to a value.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"withCommand\"\n typeParameters={[\n {\n name: \"THandler\",\n extends: \"(this: CommandContext, ...params: any[]) => any\",\n default: \"(this: CommandContext, ...params: any[]) => any\"\n }\n ]}\n parameters={[\n { name: \"path\", type: \"string\" },\n { name: \"segments\", type: \"string[]\" },\n { name: \"params\", type: \"Parameters<THandler>\" },\n { name: \"handler\", type: \"THandler\" }\n ]}\n returnType=\"Promise<{ error: string | Error | null }>\">\n {code`setState({ status: \"preparing\", isError: false });\n\n const ctx = { path, segments, params } as CommandContext<THandler>;\n const result = await Promise.resolve(unstable_commandStore.run(ctx, Reflect.apply(handler, ctx, params)));\n if (result instanceof Error || (typeof result === \"object\" && ((result as { error: unknown }).error instanceof Error || typeof (result as { error: unknown }).error === \"string\"))) {\n setState({ status: \"completed\", isError: true });\n return { error: result instanceof Error ? result : (result as { error: Error | string }).error };\n }\n\n setState({ status: \"completed\", isError: false });\n return { error: null }; `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface StateBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {}\n\n/**\n * A built-in module for handling application state utilities in Shell Shock.\n */\nexport function StateBuiltin(props: StateBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <BuiltinFile\n id=\"state\"\n description=\"A module that provides context hooks and utilities for accessing the application state.\"\n {...rest}\n imports={defu(rest.imports ?? {}, {\n \"node:async_hooks\": [\"AsyncLocalStorage\"],\n \"node:crypto\": [\"randomUUID\"]\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n env: [\"isCI\", \"env\"]\n })}>\n <GlobalTypeDefinitions />\n <Spacing />\n <ArgsUtilities />\n <Spacing />\n <ContextUtilities />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAgCA,SAAe,wBAAA;CACb,MAAA,6EAAS;CACT,MAAA,6CAAU,yCAAA,QAAA,QAAA,CAAA;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oB,0DAAO,EAAA,CAAA;KAAA,mBAAW;;KACA;;GAE3C,CAAC;kDAAgB,0DAAU,EAAK,CAAC;kDAAkB,4DAAQ;GAC1D,IAAI,UAAM;;;GAGV,IAAI,WAAM;AACR,WAAM,iDAAkB,iEAAU;KAChC,MAAE;KACF,UAAU;KACX,CAAC,kDAAA,mEAAA,gHAED,CAAC,CAAA;;GAEL,CAAC;kDAAI,0CAAmB;GACvB,UAAE;GACH,OAAA;GACH,MAAA;;IAEM,MAAC;IACL,SAAA;IACI,SAAI;IACP,CAAA;;;KAED,MAAA;KACG,MAAM;KACT;IAAA;KACI,MAAC;KACL,MAAS;;;KAET,MAAO;KACJ,MAAA;KACA;IAAC;KACA,MAAA;KACA,MAAI;KACL;IAAC;GACF,YAAU;GACV,UAAU,mBAAA;;;;;;;;;;;GAWX,CAAC;EAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usage.cjs","names":[],"sources":["../../src/components/usage.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, Match, Show, Switch } from \"@alloy-js/core\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport {\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"../plugin-utils/context-helpers\";\nimport type { CommandTree } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\nexport interface UsageProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The package manager to generate the usage example for.\n *\n * @remarks\n * If not specified, examples for all supported package managers will be generated.\n */\n packageManager?: \"npm\" | \"yarn\" | \"pnpm\" | \"bun\";\n\n /**\n * The bin name to use in the usage display.\n */\n bin: string;\n}\n\n/**\n * A component that generates the usage display for a command.\n */\nexport function Usage(props: UsageProps) {\n const { command, bin, packageManager } = props;\n\n return (\n <>\n {code`$ `}\n <Switch>\n <Match when={packageManager === \"npm\"}>{`npx `}</Match>\n <Match when={packageManager === \"yarn\"}>{`yarn exec `}</Match>\n <Match when={packageManager === \"pnpm\"}>{`pnpm exec `}</Match>\n <Match when={packageManager === \"bun\"}>{`bun x `}</Match>\n </Switch>\n {code`${bin}${\n command.segments.length > 0\n ? ` ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `[${snakeCase(getDynamicPathSegmentName(segment))}]`\n : segment\n )\n .join(\" \")}`\n : \"\"\n }${Object.values(command.children).length > 0 ? \" [commands]\" : \"\"}${\n command.args.length > 0\n ? ` ${command.args\n .map(\n param =>\n `<${snakeCase(param.name)}${\n (param.kind === CommandParameterKinds.string ||\n param.kind === CommandParameterKinds.number) &&\n param.variadic\n ? \"...\"\n : \"\"\n }>`\n )\n .join(\" \")}`\n : \"\"\n } [options]`}\n <Show when={command.args.length > 0}>\n <hbr />\n {code`$ `}\n <Switch>\n <Match when={packageManager === \"npm\"}>{`npx `}</Match>\n <Match when={packageManager === \"yarn\"}>{`yarn exec `}</Match>\n <Match when={packageManager === \"pnpm\"}>{`pnpm exec `}</Match>\n <Match when={packageManager === \"bun\"}>{`bun x `}</Match>\n </Switch>\n {code`${bin}${\n command.segments.length > 0\n ? ` ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `[${snakeCase(getDynamicPathSegmentName(segment))}]`\n : segment\n )\n .join(\" \")}`\n : \"\"\n }${Object.values(command.children).length > 0 ? \" [commands]\" : \"\"} [options] ${\n command.args.length > 0\n ? ` ${command.args\n .map(\n param =>\n `<${snakeCase(param.name)}${\n (param.kind === CommandParameterKinds.string ||\n param.kind === CommandPar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UAAE;QACH,CAAC;uDAAa,sBAAA;QACb,MAAC,mBAAA;QACJ,UAAS;QACP,CAAC;OAAA;QAEL,CAAC;gDAAS,mBAAA,GAAA,MAAA,QAAA,SAAA,SAAA,IAAA,IAAA,QAAA,SAAA,KAAA,YAAA,6CAAA,QAAA,GAAA,oDAAA,kDAAA,QAAA,CAAA,CAAA,KAAA,QAAA,CAAA,KAAA,IAAA,KAAA,KAAA,OAAA,OAAA,QAAA,SAAA,CAAA,SAAA,IAAA,gBAAA,GAAA,aAAA,QAAA,KAAA,SAAA,IAAA,IAAA,QAAA,KAAA,KAAA,UAAA,oDAAA,MAAA,KAAA,IAAA,MAAA,SAAA,4CAAA,UAAA,MAAA,SAAA,4CAAA,WAAA,MAAA,WAAA,QAAA,GAAA,GAAA,CAAA,KAAA,IAAA,KAAA,KAAA;KAAA;;GAEd,CAAC;EAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils-builtin.cjs","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show, splitProps } from \"@alloy-js/core\";\nimport {\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n InterfaceMember,\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 { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport { BuiltinFile } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport {\n TSDoc,\n TSDocInternal,\n TSDocLink,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport defu from \"defu\";\nimport type { Context } from \"../types/context\";\n\nexport interface UtilsBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {}\n\n/**\n * Generates the `findSuggestions` function for suggesting corrections for potentially misspelled options or commands.\n */\nexport function FindSuggestionsDeclaration() {\n const context = usePowerlines<Context>();\n\n return (\n <>\n <VarDeclaration\n const\n name=\"deburred\"\n initializer={code` {\n \"\\\\xc0\": \"A\", \"\\\\xc1\": \"A\", \"\\\\xc2\": \"A\", \"\\\\xc3\": \"A\", \"\\\\xc4\": \"A\", \"\\\\xc5\": \"A\",\n \"\\\\xe0\": \"a\", \"\\\\xe1\": \"a\", \"\\\\xe2\": \"a\", \"\\\\xe3\": \"a\", \"\\\\xe4\": \"a\", \"\\\\xe5\": \"a\",\n \"\\\\xc7\": \"C\", \"\\\\xe7\": \"c\",\n \"\\\\xd0\": \"D\", \"\\\\xf0\": \"d\",\n \"\\\\xc8\": \"E\", \"\\\\xc9\": \"E\", \"\\\\xca\": \"E\", \"\\\\xcb\": \"E\",\n \"\\\\xe8\": \"e\", \"\\\\xe9\": \"e\", \"\\\\xea\": \"e\", \"\\\\xeb\": \"e\",\n \"\\\\xcc\": \"I\", \"\\\\xcd\": \"I\", \"\\\\xce\": \"I\", \"\\\\xcf\": \"I\",\n \"\\\\xec\": \"i\", \"\\\\xed\": \"i\", \"\\\\xee\": \"i\", \"\\\\xef\": \"i\",\n \"\\\\xd1\": \"N\", \"\\\\xf1\": \"n\",\n \"\\\\xd2\": \"O\", \"\\\\xd3\": \"O\", \"\\\\xd4\": \"O\", \"\\\\xd5\": \"O\", \"\\\\xd6\": \"O\", \"\\\\xd8\": \"O\",\n \"\\\\xf2\": \"o\", \"\\\\xf3\": \"o\", \"\\\\xf4\": \"o\", \"\\\\xf5\": \"o\", \"\\\\xf6\": \"o\", \"\\\\xf8\": \"o\",\n \"\\\\xd9\": \"U\", \"\\\\xda\": \"U\", \"\\\\xdb\": \"U\", \"\\\\xdc\": \"U\",\n \"\\\\xf9\": \"u\", \"\\\\xfa\": \"u\", \"\\\\xfb\": \"u\", \"\\\\xfc\": \"u\",\n \"\\\\xdd\": \"Y\", \"\\\\xfd\": \"y\", \"\\\\xff\": \"y\",\n \"\\\\xc6\": \"Ae\", \"\\\\xe6\": \"ae\",\n \"\\\\xde\": \"Th\", \"\\\\xfe\": \"th\",\n \"\\\\xdf\": \"ss\",\n \"\\\\u0100\": \"A\", \"\\\\u0102\": \"A\", \"\\\\u0104\": \"A\",\n \"\\\\u0101\": \"a\", \"\\\\u0103\": \"a\", \"\\\\u0105\": \"a\",\n \"\\\\u0106\": \"C\", \"\\\\u0108\": \"C\", \"\\\\u010a\": \"C\", \"\\\\u010c\": \"C\",\n \"\\\\u0107\": \"c\", \"\\\\u0109\": \"c\", \"\\\\u010b\": \"c\", \"\\\\u010d\": \"c\",\n \"\\\\u010e\": \"D\", \"\\\\u0110\": \"D\", \"\\\\u010f\": \"d\", \"\\\\u0111\": \"d\",\n \"\\\\u0112\": \"E\", \"\\\\u0114\": \"E\", \"\\\\u0116\": \"E\", \"\\\\u0118\": \"E\", \"\\\\u011a\": \"E\",\n \"\\\\u0113\": \"e\", \"\\\\u0115\": \"e\", \"\\\\u0117\": \"e\", \"\\\\u0119\": \"e\", \"\\\\u011b\": \"e\",\n \"\\\\u011c\": \"G\", \"\\\\u011e\": \"G\", \"\\\\u0120\": \"G\", \"\\\\u0122\": \"G\",\n \"\\\\u011d\": \"g\", \"\\\\u011f\": \"g\", \"\\\\u0121\": \"g\", \"\\\\u0123\": \"g\",\n \"\\\\u0124\": \"H\", \"\\\\u0126\": \"H\", \"\\\\u0125\": \"h\", \"\\\\u0127\": \"h\",\n \"\\\\u0128\": \"I\", \"\\\\u012a\": \"I\", \"\\\\u012c\": \"I\", \"\\\\u012e\": \"I\", \"\\\\u0130\": \"I\",\n \"\\\\u0129\": \"i\", \"\\\\u012b\": \"i\", \"\\\\u012d\": \"i\", \"\\\\u012f\": \"i\", \"\\\\u0131\": \"i\",\n \"\\\\u0134\": \"J\", \"\\\\u0135\": \"j\",\n \"\\\\u0136\": \"K\", \"\\\\u0137\": \"k\", \"\\\\u0138\": \"k\",\n \"\\\\u0139\": \"L\", \"\\\\u013b\": \"L\", \"\\\\u013d\": \"L\", \"\\\\u013f\": \"L\", \"\\\\u0141\": \"L\",\n \"\\\\u013a\": \"l\", \"\\\\u013c\": \"l\", \"\\\\u013e\": \"l\", \"\\\\u0140\": \"l\", \"\\\\u0142\": \"l\",\n \"\\\\u0143\": \"N\", \"\\\\u0145\": \"N\", \"\\\\u0147\": \"N\", \"\\\\u014a\": \"N\",\n \"\\\\u0144\": \"n\", \"\\\\u0146\": \"n\", \"\\\\u0148\": \"n\", \"\\\\u014b\": \"n\",\n \"\\\\u014c\": \"O\", \"\\\\u014e\": \"O\", \"\\\\u0150\": \"O\",\n \"\\\\u014d\": \"o\", \"\\\\u014f\": \"o\", \"\\\\u0151\": \"o\",\n \"\\\\u0154\": \"R\", \"\\\\u0156\": \"R\", \"\\\\u0158\": \"R\",\n \"\\\\u0155\": \"r\", \"\\\\u0157\": \"r\", \"\\\\u0159\": \"r\",\n \"\\\\u015a\": \"S\", \"\\\\u015c\": \"S\", \"\\\\u015e\": \"S\", \"\\\\u0160\": \"S\",\n \"\\\\u015b\": \"s\", \"\\\\u015d\": \"s\", \"\\\\u015f\": \"s\", \"\\\\u0161\": \"s\",\n \"\\\\u0162\": \"T\", \"\\\\u0164\": \"T\", \"\\\\u0166\": \"T\",\n \"\\\\u0163\": \"t\", \"\\\\u0165\": \"t\", \"\\\\u0167\": \"t\",\n \"\\\\u0168\": \"U\", \"\\\\u016a\": \"U\", \"\\\\u016c\": \"U\", \"\\\\u016e\": \"U\", \"\\\\u0170\": \"U\", \"\\\\u0172\": \"U\",\n \"\\\\u0169\": \"u\", \"\\\\u016b\": \"u\", \"\\\\u016d\": \"u\", \"\\\\u016f\": \"u\", \"\\\\u0171\": \"u\", \"\\\\u0173\": \"u\",\n \"\\\\u0174\": \"W\", \"\\\\u0175\": \"w\",\n \"\\\\u0176\": \"Y\", \"\\\\u0177\": \"y\", \"\\\\u0178\": \"Y\",\n \"\\\\u0179\": \"Z\", \"\\\\u017b\": \"Z\", \"\\\\u017d\": \"Z\",\n \"\\\\u017a\": \"z\", \"\\\\u017c\": \"z\", \"\\\\u017e\": \"z\",\n \"\\\\u0132\": \"IJ\", \"\\\\u0133\": \"ij\",\n \"\\\\u0152\": \"Oe\", \"\\\\u0153\": \"oe\",\n \"\\\\u0149\": \"n\", \"\\\\u017f\": \"s\"\n } as Record<string, string>; `}\n />\n <Spacing />\n <TSDoc heading=\"A utility function that takes an input string and a list of possible matches, and returns a list of suggested matches based on the Levenshtein distance between the input and the possible matches.\">\n <TSDocRemarks>\n {\n \"This function is intended to be used to suggest corrections for potentially misspelled options or commands.\"\n }\n </TSDocRemarks>\n <Spacing />\n <TSDocInternal />\n <Spacing />\n <TSDocParam name=\"input\">\n {\"The input string to check for potential matches.\"}\n </TSDocParam>\n <TSDocParam name=\"options\">\n {\"A list of possible matches to compare against the input.\"}\n </TSDocParam>\n <TSDocReturns>\n {\"A list of suggested matches based on the Levenshtein distance.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"findSuggestions\"\n parameters={[\n {\n name: \"input\",\n type: \"string\"\n },\n {\n name: \"options\",\n type: \"string[]\"\n }\n ]}\n returnType=\"string[]\">\n <VarDeclaration\n const\n name=\"normalizedInput\"\n initializer={code`String(input ?? \"\")${\n context.config.isCaseSensitive ? \"\" : \".toLowerCase()\"\n }.trim().replaceAll(/[\\\\s\\\\-_\\\\.]+/gu, \" \").replace(/[\\\\\\\\xc0-\\\\\\\\xd6\\\\\\\\xd8-\\\\\\\\xf6\\\\\\\\xf8-\\\\\\\\xff\\\\\\\\u0100-\\\\\\\\u017f]/g, key => deburred[key]).replace(/[\\\\\\\\u0300-\\\\\\\\u036f\\\\\\\\ufe20-\\\\\\\\ufe2f\\\\\\\\u20d0-\\\\\\\\u20ff]/g, \"\"); `}\n />\n <Spacing />\n {code`\n if (!normalizedInput || options.length === 0) {\n return [];\n }\n\n const threshold = Math.ceil(normalizedInput.length * 0.25) || 1;\n const results: Array<{ option: string; distance: number }> = [];\n\n for (const option of options) {\n const normalizedOption = String(option ?? \"\")${\n context.config.isCaseSensitive ? \"\" : \".toLowerCase()\"\n }.trim().replaceAll(/[\\\\s\\\\-_\\\\.]+/gu, \" \").replace(/[\\\\\\\\xc0-\\\\\\\\xd6\\\\\\\\xd8-\\\\\\\\xf6\\\\\\\\xf8-\\\\\\\\xff\\\\\\\\u0100-\\\\\\\\u017f]/g, key => deburred[key]).replace(/[\\\\\\\\u0300-\\\\\\\\u036f\\\\\\\\ufe20-\\\\\\\\ufe2f\\\\\\\\u20d0-\\\\\\\\u20ff]/g, \"\");\n\n if (!normalizedOption) {\n continue;\n }\n\n const lenA = normalizedInput.length;\n const lenB = normalizedOption.length;\n\n if (Math.abs(lenA - lenB) > threshold) {\n continue;\n }\n\n let distance: number;\n if (lenA === 0) {\n distance = lenB;\n } else if (lenB === 0) {\n distance = lenA;\n } else if (lenA <= 32) {\n const peq: Record<string, number> = {};\n for (let i = 0; i < lenA; i++) {\n const c = normalizedInput[i]!;\n peq[c] = (peq[c] || 0) | (1 << i);\n }\n\n let pv = -1;\n let mv = 0;\n let score = lenA;\n\n for (let j = 0; j < lenB; j++) {\n const eq = peq[normalizedOption[j]!] || 0;\n const xv = eq | mv;\n const xh = ((eq & pv) + pv) ^ pv ^ eq;\n let ph = mv | ~(xh | pv);\n let mh = pv & xh;\n\n if ((ph >>> (lenA - 1)) & 1) {\n score++;\n }\n if ((mh >>> (lenA - 1)) & 1) {\n score--;\n }\n\n ph = (ph << 1) | 1;\n mh = mh << 1;\n pv = mh | ~(xv | ph);\n mv = ph & xv;\n }\n\n distance = score;\n } else {\n const row = new Array(lenB + 1);\n for (let j = 0; j <= lenB; j++) {\n row[j] = j;\n }\n\n for (let i = 1; i <= lenA; i++) {\n let prev = i;\n for (let j = 1; j <= lenB; j++) {\n const val = normalizedInput[i - 1] === normalizedOption[j - 1]\n ? row[j - 1]\n : Math.min(row[j - 1], prev, row[j]) + 1;\n row[j - 1] = prev;\n prev = val;\n }\n row[lenB] = prev;\n }\n\n distance = row[lenB];\n }\n\n if (distance <= threshold) {\n results.push({ option, distance });\n }\n }\n\n return results.sort((a, b) => a.distance - b.distance).map(r => r.option);\n `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal size and whether the process is running in the foreground, which can be used to determine how to render output (e.g., whether to use a progress bar or spinner).\n */\nexport function TerminalSizeDeclaration() {\n return (\n <>\n <VarDeclaration\n export\n const\n name=\"DEFAULT_TERMINAL_COLUMNS\"\n doc=\"Default number of terminal columns\"\n initializer={code`80`}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"DEFAULT_TERMINAL_ROWS\"\n doc=\"Default number of terminal rows\"\n initializer={code`24`}\n />\n <Spacing />\n <FunctionDeclaration name=\"isForegroundProcess\">\n {code`if (isLinux) {\n return true;\n }\n\n try {\n const statContents = readFileSync(\"/proc/self/stat\", \"utf8\");\n const closingParenthesisIndex = statContents.lastIndexOf(') ');\n\n if (closingParenthesisIndex === -1) {\n return false;\n }\n\n const statFields = statContents.slice(closingParenthesisIndex + 2).trim().split(/\\\\s+/);\n const processGroupId = Number.parseInt(statFields[2], 10);\n const foregroundProcessGroupId = Number.parseInt(statFields[5], 10);\n\n if (Number.isNaN(processGroupId) || Number.isNaN(foregroundProcessGroupId)) {\n return false;\n }\n\n if (foregroundProcessGroupId <= 0) {\n return false;\n }\n\n return processGroupId === foregroundProcessGroupId;\n } catch {\n return false;\n } `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration name=\"tput\">\n {code`try {\n const columns = execSync([\"tput\", \"cols\"], { env: { TERM: 'dumb', ...process.env } });\n const rows = execSync([\"tput\", \"lines\"], { env: { TERM: 'dumb', ...process.env } });\n\n if (columns && rows) {\n return { columns: Number.parseInt(columns.toString().trim(), 10), rows: Number.parseInt(rows.toString().trim(), 10) };\n }\n } catch {} `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration name=\"devTty\">\n {code`try {\n const writeStream = new WriteStream(\n openSync(\n \"/dev/tty\",\n fsConstants.O_NONBLOCK\n )\n ).getWindowSize();\n\n return { columns: writeStream[0], rows: writeStream[1] };\n } catch {} `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A utility function that attempts to determine the size of the terminal (number of columns and rows) using various methods, and falls back to default values if it cannot be determined. This can be used to adjust output formatting based on the available terminal size.\">\n <TSDocRemarks>\n {\n \"The function first checks if the process is running in a TTY environment and if the stdout or stderr streams provide column and row information. If not, it attempts to use platform-specific methods (like reading from /proc/self/stat on Linux, using tput on Unix-like systems, or checking /dev/tty) to determine the terminal size. If all else fails, it returns default values.\"\n }\n </TSDocRemarks>\n <Spacing />\n <TSDocReturns>\n {\n \"An object containing the number of columns and rows of the terminal.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getTerminalSize\"\n returnType=\"{ columns: number; rows: number; }\">\n <IfStatement\n condition={code`process.stdout?.columns && process.stdout?.rows`}>\n {code`return { columns: process.stdout.columns, rows: process.stdout.rows }; `}\n </IfStatement>\n <IfStatement\n condition={code`process.stderr?.columns && process.stderr?.rows`}>\n {code`return { columns: process.stderr.columns, rows: process.stderr.rows };`}\n </IfStatement>\n <Spacing />\n <IfStatement condition={code`isWindows`}>\n {code`return tput() ?? {\n columns: DEFAULT_TERMINAL_COLUMNS,\n rows: DEFAULT_TERMINAL_ROWS,\n }; `}\n </IfStatement>\n <IfStatement condition={code`isMacOS`}>\n {code`return devTty() ?? tput() ?? {\n columns: DEFAULT_TERMINAL_COLUMNS,\n rows: DEFAULT_TERMINAL_ROWS,\n }; `}\n </IfStatement>\n <Spacing />\n <VarDeclaration\n let\n name=\"result\"\n initializer={code`devTty() ?? tput(); `}\n />\n <IfStatement condition={code`!result && isForegroundProcess()`}>\n {code`try {\n const size = execSync([\"resize\", \"-u\"]).match(/\\\\d+/g);\n if (size.length === 2) {\n result = { columns: Number.parseInt(size[0], 10), rows: Number.parseInt(size[1], 10) };\n }\n } catch {} `}\n </IfStatement>\n <Spacing />\n {code`return result ?? {\n columns: DEFAULT_TERMINAL_COLUMNS,\n rows: DEFAULT_TERMINAL_ROWS,\n }; `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function EnvSupportUtilities() {\n return (\n <>\n <VarDeclaration\n export\n const\n name=\"isTTY\"\n doc=\"Detect if stdout.TTY is available\"\n initializer={code`Boolean(process.stdout && process.stdout.isTTY);`}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isMinimal\"\n doc=\"Detect if the current environment is minimal (CI, non-TTY, etc.)\"\n initializer={code` env.MINIMAL || isCI || isTest || !isTTY; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isInteractive\"\n doc=\"Detect if the current environment is interactive\"\n initializer={code` !isMinimal && process.stdin?.isTTY && env.TERM !== \"dumb\" && !hasFlag([\"no-interactive\", \"non-interactive\", \"no-interact\"]); `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ColorSupportUtilities() {\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"GetColorSupportLevelOptions\"\n doc=\"Options for the getColorSupportLevel function\">\n <InterfaceMember\n name=\"ignoreFlags\"\n type=\"boolean\"\n doc=\"Indicates if the function should skip checking command-line flags for color support\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Checks if a specific flag is present in the command-line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {'The flag to check for, e.g., \"color\", \"no-color\".'}\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command-line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getColorSupportLevel\"\n parameters={[\n { name: \"stream\", type: \"NodeJS.WriteStream & { fd: 1 | 2; }\" },\n {\n name: \"options\",\n type: \"GetColorSupportLevelOptions\",\n default: \"{ ignoreFlags: false }\"\n }\n ]}>\n {code`const { ignoreFlags } = options;\n\n let forceColor: number | undefined;\n if (env.FORCE_COLOR !== undefined) {\n forceColor = !env.FORCE_COLOR\n ? 0\n : typeof env.FORCE_COLOR === \"boolean\"\n ? 1\n : typeof env.FORCE_COLOR === \"number\" &&\n [0, 1, 2, 3].includes(Math.min(env.FORCE_COLOR as number, 3))\n ? Math.min(env.FORCE_COLOR as number, 3)\n : undefined;\n }\n\n if (ignoreFlags !== true && forceColor === undefined) {\n if (\n hasFlag(\"no-color\") ||\n hasFlag(\"no-colors\") ||\n hasFlag(\"color=false\") ||\n hasFlag(\"color=never\")\n ) {\n return 0;\n }\n\n if (\n hasFlag(\"color=16m\") ||\n hasFlag(\"color=full\") ||\n hasFlag(\"color=truecolor\")\n ) {\n return 3;\n }\n\n if (hasFlag(\"color=256\")) {\n return 2;\n }\n\n if (\n hasFlag(\"color\") ||\n hasFlag(\"colors\") ||\n hasFlag(\"color=true\") ||\n hasFlag(\"color=always\")\n ) {\n forceColor = 1;\n }\n }\n\n const level = Boolean(env.TF_BUILD) || Boolean(env.AGENT_NAME)\n ? 1\n : stream &&\n !(isTTY || (stream && stream.isTTY)) &&\n forceColor === undefined\n ? 0\n : env.TERM === \"dumb\"\n ? forceColor || 0\n : isWindows\n ? Number(os.release().split(\".\")[0]) >= 10 &&\n Number(os.release().split(\".\")[2]) >= 10_586\n ? Number(os.release().split(\".\")[2]) >= 14_931\n ? 3\n : 2\n : 1\n : isCI\n ? Boolean(env.GITHUB_ACTIONS) ||\n Boolean(env.GITEA_ACTIONS) ||\n Boolean(env.CIRCLECI)\n ? 3\n : Boolean(env.TRAVIS) ||\n Boolean(env.APPVEYOR) ||\n Boolean(env.GITLAB_CI) ||\n Boolean(env.BUILDKITE) ||\n Boolean(env.DRONE) ||\n env.CI_NAME === \"codeship\"\n ? 1\n : forceColor || 0\n : Boolean(env.TEAMCITY_VERSION)\n ? /^(?:9\\.0*[1-9]\\d*\\.|\\d{2,}\\.)/.test(String(env.TEAMCITY_VERSION) || \"\")\n ? 1\n : 0\n : String(env.COLORTERM) === \"truecolor\" ||\n env.TERM === \"xterm-kitty\"\n ? 3\n : Boolean(env.TERM_PROGRAM)\n ? env.TERM_PROGRAM === \"iTerm.app\"\n ? Number.parseInt(\n (env.TERM_PROGRAM_VERSION || \"\").split(\".\")[0] as string,\n 10\n ) >= 3\n ? 3\n : 2\n : env.TERM_PROGRAM === \"Apple_Terminal\"\n ? 2\n : 0\n : /-256(?:color)?$/i.test(env.TERM || \"\")\n ? 2\n : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(\n env.TERM || \"\"\n )\n ? 1\n : Boolean(env.COLORTERM);\n\n return typeof level === \"boolean\" || level === 0\n ? false\n : {\n level,\n hasBasic: true,\n has256: level >= 2,\n has16m: level >= 3,\n };\n\n `}\n </FunctionDeclaration>\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"colorSupportLevels\"\n doc=\"Detect the terminal color support level in the current environment\"\n initializer={code` {\n stdout: getColorSupportLevel(process.stdout),\n stderr: getColorSupportLevel(process.stderr),\n }; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isColorSupported\"\n doc=\"Detect if terminal color is supported in the current environment\"\n initializer={code` Boolean(colorSupportLevels.stdout); `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isUnicodeSupported\"\n doc=\"Detect if Unicode characters are supported in the current environment\"\n initializer={code` !isWindows\n ? env.TERM !== \"linux\"\n : Boolean(env.WT_SESSION) ||\n Boolean(env.TERMINUS_SUBLIME) ||\n env.ConEmuTask === \"{cmd::Cmder}\" ||\n env.TERM_PROGRAM === \"Terminus-Sublime\" ||\n env.TERM_PROGRAM === \"vscode\" ||\n env.TERM === \"xterm-256color\" ||\n env.TERM === \"alacritty\" ||\n env.TERM === \"rxvt-unicode\" ||\n env.TERM === \"rxvt-unicode-256color\" ||\n env.TERMINAL_EMULATOR === \"JetBrains-JediTerm\"; `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\n\nexport function HyperlinkSupportUtilities() {\n return (\n <>\n <FunctionDeclaration\n name=\"parseVersion\"\n parameters={[{ name: \"version\", type: \"string\", default: '\"\"' }]}>\n {code`if (/^\\d{3,4}$/.test(version)) {\n const match = /(\\d{1,2})(\\d{2})/.exec(version) ?? [];\n\n return {\n major: 0,\n minor: Number.parseInt(match[1]!, 10),\n patch: Number.parseInt(match[2]!, 10)\n };\n }\n\n const versionParts = (version ?? \"\")\n .split(\".\")\n .map(n => Number.parseInt(n, 10));\n\n return {\n major: versionParts[0],\n minor: versionParts[1],\n patch: versionParts[2]\n }; `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"Check if the current environment/terminal supports hyperlinks in the terminal.\">\n <TSDocReturns>\n {\"True if the current environment/terminal supports hyperlinks.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"isHyperlinkSupported\"\n returnType=\"boolean\">\n {code`if (Boolean(env.FORCE_HYPERLINK)) {\n return true;\n }\n\n if (Boolean(env.NETLIFY)) {\n return true;\n } else if (isColorSupported || isTTY) {\n return false;\n } else if (Boolean(env.WT_SESSION)) {\n return true;\n } else if (isWindows || isMinimal || Boolean(env.TEAMCITY_VERSION)) {\n return false;\n } else if (Boolean(env.TERM_PROGRAM)) {\n const version = parseVersion(env.TERM_PROGRAM_VERSION);\n\n switch (String(env.TERM_PROGRAM)) {\n case \"iTerm.app\": {\n if (version.major === 3) {\n return version.minor !== undefined && version.minor >= 1;\n }\n\n return version.major !== undefined && version.major > 3;\n }\n case \"WezTerm\": {\n return version.major !== undefined && version.major >= 20_200_620;\n }\n\n case \"vscode\": {\n if (Boolean(env.CURSOR_TRACE_ID)) {\n return true;\n }\n\n return (\n version.minor !== undefined &&\n version.major !== undefined &&\n (version.major > 1 || (version.major === 1 && version.minor >= 72))\n );\n }\n\n case \"ghostty\": {\n return true;\n }\n }\n }\n\n if (Boolean(env.VTE_VERSION)) {\n if (env.VTE_VERSION === \"0.50.0\") {\n return false;\n }\n\n const version = parseVersion(env.VTE_VERSION);\n return (\n (version.major !== undefined && version.major > 0) ||\n (version.minor !== undefined && version.minor >= 50)\n );\n }\n\n if (String(env.TERM) === \"alacritty\") {\n return true;\n }\n\n return false; `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * Generates the `resolveModule` function declaration, which is a utility for resolving file paths across different platforms.\n */\nexport function ResolveModuleFunctionDeclaration() {\n const context = usePowerlines<Context>();\n\n return (\n <>\n <Spacing />\n <InterfaceDeclaration\n name=\"ResolveModuleOptions\"\n doc=\"Options for the `resolve` handler function.\">\n <InterfaceMember\n name=\"parentURL\"\n optional\n type=\"string\"\n doc=\"The parent URL to use for resolving paths.\"\n />\n <hbr />\n <InterfaceMember\n name=\"conditions\"\n optional\n type=\"string[]\"\n doc=\"The conditions to use for resolving paths.\"\n />\n <hbr />\n </InterfaceDeclaration>\n <Spacing />\n <InterfaceDeclaration\n name=\"PackageConfig\"\n doc=\"Parsed package.json configuration for module resolution.\">\n <InterfaceMember\n name=\"pjsonPath\"\n type=\"string\"\n doc=\"The path to the package.json file.\"\n />\n <hbr />\n <InterfaceMember\n name=\"exists\"\n type=\"boolean\"\n doc=\"Whether the package.json file exists.\"\n />\n <hbr />\n <InterfaceMember\n name=\"main\"\n optional\n type=\"string\"\n doc=\"The main entry point of the package.\"\n />\n <hbr />\n <InterfaceMember\n name=\"name\"\n optional\n type=\"string\"\n doc=\"The name of the package.\"\n />\n <hbr />\n <InterfaceMember\n name=\"type\"\n optional\n type={`\"commonjs\" | \"module\" | \"none\"`}\n doc=\"The module type of the package.\"\n />\n <hbr />\n <InterfaceMember\n name=\"exports\"\n optional\n type=\"Record<string, unknown>\"\n doc=\"The exports map of the package.\"\n />\n <hbr />\n <InterfaceMember\n name=\"imports\"\n optional\n type=\"Record<string, unknown>\"\n doc=\"The imports map of the package.\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <VarDeclaration\n const\n name=\"DEFAULT_CONDITIONS_SET\"\n initializer={code`new Set([\"node\", \"import\"]);`}\n />\n <Spacing />\n <VarDeclaration\n const\n name=\"DEFAULT_EXTENSIONS\"\n initializer={code`[\".mjs\", \".cjs\", \".js\", \".json\", \".node\"];`}\n />\n <Spacing />\n <VarDeclaration\n const\n name=\"invalidPackageNameRegEx\"\n initializer={code`/^\\\\.|\\\\/|%/;`}\n />\n <Spacing />\n <FunctionDeclaration\n name=\"readPackageConfig\"\n parameters={[{ name: \"jsonPath\", type: \"string\" }]}\n returnType=\"PackageConfig\">\n {code`const result: PackageConfig = {\n pjsonPath: jsonPath,\n exists: false,\n main: undefined,\n name: undefined,\n type: \"none\",\n exports: undefined,\n imports: undefined\n };\n\n let content: string;\n try {\n content = readFileSync(jsonPath, \"utf8\");\n } catch (err: any) {\n if (err?.code === \"ENOENT\") {\n return result;\n }\n throw err;\n }\n\n let parsed: Record<string, unknown>;\n try {\n parsed = JSON.parse(content);\n } catch {\n return result;\n }\n\n result.exists = true;\n\n if (typeof parsed.name === \"string\") {\n result.name = parsed.name;\n }\n if (typeof parsed.main === \"string\") {\n result.main = parsed.main;\n }\n if (parsed.exports !== undefined && parsed.exports !== null) {\n result.exports = parsed.exports as Record<string, unknown>;\n }\n if (parsed.imports !== undefined && parsed.imports !== null) {\n result.imports = parsed.imports as Record<string, unknown>;\n }\n if (parsed.type === \"commonjs\" || parsed.type === \"module\") {\n result.type = parsed.type;\n }\n\n return result;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"getPackageScopeConfig\"\n parameters={[{ name: \"resolved\", type: \"URL | string\" }]}\n returnType=\"PackageConfig\">\n {code`let packageJSONUrl = new URL(\"package.json\", resolved);\n\n while (true) {\n const packageJSONPath = packageJSONUrl.pathname;\n if (packageJSONPath.endsWith(\"node_modules/package.json\")) {\n break;\n }\n\n const packageConfig = readPackageConfig(fileURLToPath(packageJSONUrl));\n if (packageConfig.exists) {\n return packageConfig;\n }\n\n const lastPackageJSONUrl = packageJSONUrl;\n packageJSONUrl = new URL(\"../package.json\", packageJSONUrl);\n\n if (packageJSONUrl.pathname === lastPackageJSONUrl.pathname) {\n break;\n }\n }\n\n return {\n pjsonPath: fileURLToPath(packageJSONUrl),\n exists: false,\n type: \"none\"\n };`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"isConditionalExportsMainSugar\"\n parameters={[{ name: \"exports\", type: \"unknown\" }]}\n returnType=\"boolean\">\n {code`if (typeof exports === \"string\" || Array.isArray(exports)) {\n return true;\n }\n if (typeof exports !== \"object\" || exports === null) {\n return false;\n }\n\n const keys = Object.getOwnPropertyNames(exports);\n let isConditionalSugar = false;\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]!;\n const currentIsConditionalSugar = key === \"\" || key[0] !== \".\";\n if (i === 0) {\n isConditionalSugar = currentIsConditionalSugar;\n } else if (isConditionalSugar !== currentIsConditionalSugar) {\n throw new Error(\n '\"exports\" cannot contain some keys starting with \\\\'.\\\\' and some not.'\n );\n }\n }\n\n return isConditionalSugar;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolvePackageTarget\"\n parameters={[\n { name: \"packageJsonUrl\", type: \"URL\" },\n { name: \"target\", type: \"unknown\" },\n { name: \"subpath\", type: \"string\" },\n { name: \"packageSubpath\", type: \"string\" },\n { name: \"base\", type: \"URL\" },\n { name: \"pattern\", type: \"boolean\" },\n { name: \"internal\", type: \"boolean\" },\n { name: \"conditions\", type: \"Set<string>\" }\n ]}\n returnType=\"URL | null | undefined\">\n {code`if (typeof target === \"string\") {\n if (!target.startsWith(\"./\")) {\n if (internal && !target.startsWith(\"../\") && !target.startsWith(\"/\")) {\n let isURL = false;\n try {\n new URL(target);\n isURL = true;\n } catch {}\n\n if (!isURL) {\n const exportTarget = pattern\n ? target.replace(/\\\\*/g, () => subpath)\n : target + subpath;\n return packageResolve(exportTarget, packageJsonUrl, conditions);\n }\n }\n return null;\n }\n\n const resolved = new URL(target, packageJsonUrl);\n const resolvedPath = resolved.pathname;\n const packagePath = new URL(\".\", packageJsonUrl).pathname;\n\n if (!resolvedPath.startsWith(packagePath)) {\n return null;\n }\n\n if (subpath === \"\") {\n return resolved;\n }\n\n if (pattern) {\n return new URL(resolved.href.replace(/\\\\*/g, () => subpath));\n }\n\n return new URL(subpath, resolved);\n }\n\n if (Array.isArray(target)) {\n if (target.length === 0) {\n return null;\n }\n\n let lastException: Error | null | undefined;\n for (const targetItem of target) {\n let resolveResult: URL | null | undefined;\n try {\n resolveResult = resolvePackageTarget(\n packageJsonUrl, targetItem, subpath, packageSubpath,\n base, pattern, internal, conditions\n );\n } catch (error: any) {\n lastException = error;\n if (error?.code === \"ERR_INVALID_PACKAGE_TARGET\") {\n continue;\n }\n throw error;\n }\n\n if (resolveResult === undefined) {\n continue;\n }\n if (resolveResult === null) {\n lastException = null;\n continue;\n }\n return resolveResult;\n }\n\n if (lastException === undefined || lastException === null) {\n return null;\n }\n throw lastException;\n }\n\n if (typeof target === \"object\" && target !== null) {\n const keys = Object.getOwnPropertyNames(target);\n for (const key of keys) {\n if (key === \"default\" || conditions.has(key)) {\n const conditionalTarget = (target as Record<string, unknown>)[key];\n const resolveResult = resolvePackageTarget(\n packageJsonUrl, conditionalTarget, subpath, packageSubpath,\n base, pattern, internal, conditions\n );\n if (resolveResult === undefined) {\n continue;\n }\n return resolveResult;\n }\n }\n return null;\n }\n\n if (target === null) {\n return null;\n }\n\n return null;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"packageExportsResolve\"\n parameters={[\n { name: \"packageJsonUrl\", type: \"URL\" },\n { name: \"packageSubpath\", type: \"string\" },\n { name: \"packageConfig\", type: \"PackageConfig\" },\n { name: \"base\", type: \"URL\" },\n { name: \"conditions\", type: \"Set<string>\" }\n ]}\n returnType=\"URL | null | undefined\">\n {code`let exports = packageConfig.exports;\n if (isConditionalExportsMainSugar(exports)) {\n exports = { \".\": exports } as Record<string, unknown>;\n }\n\n if (\n exports !== undefined &&\n exports !== null &&\n typeof exports === \"object\" &&\n Object.prototype.hasOwnProperty.call(exports, packageSubpath) &&\n !packageSubpath.includes(\"*\") &&\n !packageSubpath.endsWith(\"/\")\n ) {\n const target = (exports as Record<string, unknown>)[packageSubpath];\n const resolveResult = resolvePackageTarget(\n packageJsonUrl, target, \"\", packageSubpath,\n base, false, false, conditions\n );\n if (resolveResult === null || resolveResult === undefined) {\n const err = new Error(\n \\`Package subpath '\\${packageSubpath}' is not defined by \"exports\" in \\${fileURLToPath(packageJsonUrl)}\\`\n );\n (err as any).code = \"ERR_PACKAGE_PATH_NOT_EXPORTED\";\n throw err;\n }\n return resolveResult;\n }\n\n let bestMatch = \"\";\n let bestMatchSubpath = \"\";\n const keys = exports ? Object.getOwnPropertyNames(exports) : [];\n\n for (const key of keys) {\n const patternIndex = key.indexOf(\"*\");\n if (\n patternIndex !== -1 &&\n packageSubpath.startsWith(key.slice(0, patternIndex))\n ) {\n const patternTrailer = key.slice(patternIndex + 1);\n if (\n packageSubpath.length >= key.length &&\n packageSubpath.endsWith(patternTrailer) &&\n patternKeyCompare(bestMatch, key) === 1 &&\n key.lastIndexOf(\"*\") === patternIndex\n ) {\n bestMatch = key;\n bestMatchSubpath = packageSubpath.slice(\n patternIndex,\n packageSubpath.length - patternTrailer.length\n );\n }\n }\n }\n\n if (bestMatch) {\n const target = (exports as Record<string, unknown>)[bestMatch];\n const resolveResult = resolvePackageTarget(\n packageJsonUrl, target, bestMatchSubpath, bestMatch,\n base, true, false, conditions\n );\n if (resolveResult === null || resolveResult === undefined) {\n const err = new Error(\n \\`Package subpath '\\${packageSubpath}' is not defined by \"exports\" in \\${fileURLToPath(packageJsonUrl)}\\`\n );\n (err as any).code = \"ERR_PACKAGE_PATH_NOT_EXPORTED\";\n throw err;\n }\n return resolveResult;\n }\n\n const err = new Error(\n \\`Package subpath '\\${packageSubpath}' is not defined by \"exports\" in \\${fileURLToPath(packageJsonUrl)}\\`\n );\n (err as any).code = \"ERR_PACKAGE_PATH_NOT_EXPORTED\";\n throw err;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"patternKeyCompare\"\n parameters={[\n { name: \"a\", type: \"string\" },\n { name: \"b\", type: \"string\" }\n ]}\n returnType=\"number\">\n {code`const aPatternIndex = a.indexOf(\"*\");\n const bPatternIndex = b.indexOf(\"*\");\n const baseLengthA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;\n const baseLengthB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;\n if (baseLengthA > baseLengthB) return -1;\n if (baseLengthB > baseLengthA) return 1;\n if (aPatternIndex === -1) return 1;\n if (bPatternIndex === -1) return -1;\n if (a.length > b.length) return -1;\n if (b.length > a.length) return 1;\n return 0;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"legacyMainResolve\"\n parameters={[\n { name: \"packageJsonUrl\", type: \"URL\" },\n { name: \"packageConfig\", type: \"PackageConfig\" }\n ]}\n returnType=\"URL | undefined\">\n {code`let guess: URL | undefined;\n const tries: string[] = [];\n\n if (packageConfig.main !== undefined) {\n tries.push(\n \\`./\\${packageConfig.main}\\`,\n \\`./\\${packageConfig.main}.js\\`,\n \\`./\\${packageConfig.main}.json\\`,\n \\`./\\${packageConfig.main}.node\\`,\n \\`./\\${packageConfig.main}/index.js\\`,\n \\`./\\${packageConfig.main}/index.json\\`,\n \\`./\\${packageConfig.main}/index.node\\`\n );\n }\n\n tries.push(\"./index.js\", \"./index.json\", \"./index.node\");\n\n for (const entry of tries) {\n guess = new URL(entry, packageJsonUrl);\n try {\n const s = statSync(fileURLToPath(guess));\n if (s.isFile()) {\n return guess;\n }\n } catch {}\n guess = undefined;\n }\n\n return undefined;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"parsePackageName\"\n parameters={[\n { name: \"specifier\", type: \"string\" },\n { name: \"base\", type: \"URL\" }\n ]}\n returnType=\"{ packageName: string; packageSubpath: string; isScoped: boolean }\">\n {code`let separatorIndex = specifier.indexOf(\"/\");\n let validPackageName = true;\n let isScoped = false;\n\n if (specifier[0] === \"@\") {\n isScoped = true;\n if (separatorIndex === -1 || specifier.length === 0) {\n validPackageName = false;\n } else {\n separatorIndex = specifier.indexOf(\"/\", separatorIndex + 1);\n }\n }\n\n const packageName = separatorIndex === -1\n ? specifier\n : specifier.slice(0, separatorIndex);\n\n if (invalidPackageNameRegEx.exec(packageName) !== null) {\n validPackageName = false;\n }\n\n if (!validPackageName) {\n const err = new Error(\n \\`Invalid module \\\\\\`\\${specifier}\\\\\\` is not a valid package name imported from \\${fileURLToPath(base)}\\`\n );\n (err as any).code = \"ERR_INVALID_MODULE_SPECIFIER\";\n throw err;\n }\n\n const packageSubpath = \".\" + (separatorIndex === -1\n ? \"\"\n : specifier.slice(separatorIndex));\n\n return { packageName, packageSubpath, isScoped };`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"packageResolve\"\n parameters={[\n { name: \"specifier\", type: \"string\" },\n { name: \"base\", type: \"URL\" },\n { name: \"conditions\", type: \"Set<string>\" }\n ]}\n returnType=\"URL\">\n {code`if (builtinModules.includes(specifier)) {\n return new URL(\"node:\" + specifier);\n }\n\n const { packageName, packageSubpath, isScoped } = parsePackageName(specifier, base);\n\n // Self-resolution: check if the specifier matches the current package name\n const selfConfig = getPackageScopeConfig(base);\n if (\n selfConfig.exists &&\n selfConfig.name === packageName &&\n selfConfig.exports !== undefined &&\n selfConfig.exports !== null\n ) {\n const packageJsonUrl = pathToFileURL(selfConfig.pjsonPath);\n const result = packageExportsResolve(\n packageJsonUrl, packageSubpath, selfConfig, base, conditions\n );\n if (result) {\n return result;\n }\n }\n\n let packageJsonUrl = new URL(\n \"./node_modules/\" + packageName + \"/package.json\",\n base\n );\n let packageJsonPath = fileURLToPath(packageJsonUrl);\n let lastPath: string;\n\n do {\n let stat: ReturnType<typeof statSync> | undefined;\n try {\n stat = statSync(packageJsonPath.slice(0, -13));\n } catch {}\n\n if (!stat || !stat.isDirectory()) {\n lastPath = packageJsonPath;\n packageJsonUrl = new URL(\n (isScoped ? \"../../../../node_modules/\" : \"../../../node_modules/\") +\n packageName +\n \"/package.json\",\n packageJsonUrl\n );\n packageJsonPath = fileURLToPath(packageJsonUrl);\n continue;\n }\n\n const packageConfig = readPackageConfig(packageJsonPath);\n\n if (packageConfig.exports !== undefined && packageConfig.exports !== null) {\n const result = packageExportsResolve(\n packageJsonUrl, packageSubpath, packageConfig, base, conditions\n );\n if (result) {\n return result;\n }\n }\n\n if (packageSubpath === \".\") {\n const legacyResult = legacyMainResolve(packageJsonUrl, packageConfig);\n if (legacyResult) {\n return legacyResult;\n }\n\n return new URL(\".\", packageJsonUrl);\n }\n\n return new URL(packageSubpath, packageJsonUrl);\n } while (packageJsonPath.length !== lastPath!.length);\n\n const err = new Error(\\`Cannot find package \\\\\\`\\${packageName}\\\\\\`\\`);\n (err as any).code = \"ERR_MODULE_NOT_FOUND\";\n\n throw err;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"finalizeResolution\"\n parameters={[\n { name: \"resolved\", type: \"URL\" },\n { name: \"base\", type: \"URL\" }\n ]}\n returnType=\"URL\">\n {code`if (/%2f|%5c/i.test(resolved.pathname)) {\n const err = new Error(\n \\`Invalid module \\\\\\`\\${resolved.pathname}\\\\\\` must not include encoded \"/\" or \"\\\\\\\\\" characters imported from \\${fileURLToPath(base)}\\`\n );\n (err as any).code = \"ERR_INVALID_MODULE_SPECIFIER\";\n\n throw err;\n }\n\n const filePath = fileURLToPath(resolved);\n\n let stat: ReturnType<typeof statSync> | undefined;\n try {\n stat = statSync(filePath.endsWith(\"/\") ? filePath.slice(0, -1) : filePath);\n } catch {}\n\n if (stat && stat.isDirectory()) {\n const err = new Error(\n \\`Directory import \\\\\\`\\${filePath}\\\\\\` is not supported resolving ES modules imported from \\${fileURLToPath(base)}\\`\n );\n (err as any).code = \"ERR_UNSUPPORTED_DIR_IMPORT\";\n throw err;\n }\n\n if (!stat || !stat.isFile()) {\n const err = new Error(\n \\`Cannot find module \\\\\\`\\${filePath}\\\\\\` imported from \\${fileURLToPath(base)}\\`\n );\n (err as any).code = \"ERR_MODULE_NOT_FOUND\";\n throw err;\n }\n\n const real = realpathSync(filePath);\n const { search, hash } = resolved;\n const realUrl = pathToFileURL(real + (filePath.endsWith(sep) ? \"/\" : \"\"));\n realUrl.search = search;\n realUrl.hash = hash;\n\n return realUrl;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"moduleResolve\"\n parameters={[\n { name: \"specifier\", type: \"string\" },\n { name: \"base\", type: \"URL\" },\n { name: \"conditions\", type: \"Set<string>\" }\n ]}\n returnType=\"URL\">\n {code`let resolved: URL | undefined;\n\n if (\n specifier[0] === \"/\" ||\n (specifier[0] === \".\" &&\n (specifier.length === 1 ||\n specifier[1] === \"/\" ||\n (specifier[1] === \".\" && (specifier.length === 2 || specifier[2] === \"/\"))))\n ) {\n try {\n resolved = new URL(specifier, base);\n } catch (error_: any) {\n const err = new Error(\n \\`Failed to resolve module specifier \\\\\\`\\${specifier}\\\\\\` from \"\\${base}\": Invalid relative URL or base scheme is not hierarchical.\\`\n );\n err.cause = error_;\n throw err;\n }\n } else if (base.protocol === \"file:\" && specifier[0] === \"#\") {\n const packageConfig = getPackageScopeConfig(base);\n if (packageConfig.exists && packageConfig.imports) {\n const packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);\n const imports = packageConfig.imports;\n if (Object.prototype.hasOwnProperty.call(imports, specifier) && !specifier.includes(\"*\")) {\n const resolveResult = resolvePackageTarget(\n packageJsonUrl, imports[specifier], \"\", specifier,\n base, false, true, conditions\n );\n if (resolveResult !== null && resolveResult !== undefined) {\n resolved = resolveResult;\n }\n }\n\n if (!resolved) {\n let bestMatch = \"\";\n let bestMatchSubpath = \"\";\n const keys = Object.getOwnPropertyNames(imports);\n\n for (const key of keys) {\n const patternIndex = key.indexOf(\"*\");\n if (patternIndex !== -1 && specifier.startsWith(key.slice(0, -1))) {\n const patternTrailer = key.slice(patternIndex + 1);\n if (\n specifier.length >= key.length &&\n specifier.endsWith(patternTrailer) &&\n patternKeyCompare(bestMatch, key) === 1 &&\n key.lastIndexOf(\"*\") === patternIndex\n ) {\n bestMatch = key;\n bestMatchSubpath = specifier.slice(\n patternIndex,\n specifier.length - patternTrailer.length\n );\n }\n }\n }\n\n if (bestMatch) {\n const target = imports[bestMatch];\n const resolveResult = resolvePackageTarget(\n packageJsonUrl, target, bestMatchSubpath, bestMatch,\n base, true, true, conditions\n );\n if (resolveResult !== null && resolveResult !== undefined) {\n resolved = resolveResult;\n }\n }\n }\n }\n\n if (!resolved) {\n const err = new Error(\n \\`Package import specifier \\\\\\`\\${specifier}\\\\\\` is not defined in package imported from \\${fileURLToPath(base)}\\`\n );\n (err as any).code = \"ERR_PACKAGE_IMPORT_NOT_DEFINED\";\n throw err;\n }\n } else {\n try {\n resolved = new URL(specifier);\n } catch {\n resolved = packageResolve(specifier, base, conditions);\n }\n }\n\n if (resolved.protocol !== \"file:\") {\n return resolved;\n }\n\n return finalizeResolution(resolved, base);`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"tryModuleResolve\"\n parameters={[\n { name: \"id\", type: \"string\" },\n { name: \"url\", type: \"URL\" },\n { name: \"conditions\", type: \"Set<string>\" }\n ]}\n returnType=\"URL | undefined\">\n {code`try {\n return moduleResolve(id, url, conditions);\n } catch (error: any) {\n if (\n !(error as { code: string })?.code &&\n ![\n \"ERR_MODULE_NOT_FOUND\",\n \"ERR_UNSUPPORTED_DIR_IMPORT\",\n \"MODULE_NOT_FOUND\",\n \"ERR_PACKAGE_PATH_NOT_EXPORTED\"\n ].includes(error?.code)\n ) {\n throw error;\n }\n }`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A function to resolve module specifiers to URLs.\">\n <TSDocParam name=\"specifier\">{`The module specifier to resolve.`}</TSDocParam>\n <TSDocParam name=\"options\">\n {`The options for resolving the module. Defaults to an empty object.`}\n </TSDocParam>\n <TSDocReturns>{`The result of the resolve operation.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n async\n export\n name=\"resolveModule\"\n parameters={[\n { name: \"specifier\", type: \"string\" },\n {\n name: \"options\",\n type: \"ResolveModuleOptions\",\n default: \"{} as ResolveModuleOptions\"\n }\n ]}\n returnType=\"Promise<string>\">\n {code`const parentURL = options.parentURL ? new URL(options.parentURL) : undefined;\n const conditionsSet = options.conditions?.length\n ? new Set(options.conditions)\n : DEFAULT_CONDITIONS_SET;\n\n // Handle protocol-prefixed specifiers (node:, data:, http:, https:, ${context.config.framework}:)\n if (/^(?:node|data|https?|${context.config.framework}):/.test(specifier)) {\n return specifier;\n }\n\n const bareSpecifier = specifier.replace(/^node:/, \"\");\n if (builtinModules.includes(bareSpecifier)) {\n return \"node:\" + bareSpecifier;\n }\n\n if (specifier.startsWith(\"file://\")) {\n return specifier;\n }\n\n if (isAbsolute(specifier)) {\n try {\n const s = statSync(specifier);\n if (s.isFile()) {\n return pathToFileURL(realpathSync(specifier)).href;\n }\n } catch (err: any) {\n if (err?.code !== \"ENOENT\") {\n throw err;\n }\n }\n }\n\n const roots = [parentURL ?? pathToFileURL(join(process.cwd(), \"_\"))];\n\n const projectRootURL = pathToFileURL(\"${context.config.root}\");\n if (!roots.some(root => root.href === projectRootURL.href)) {\n roots.push(projectRootURL);\n }\n\n const workspaceRootURL = pathToFileURL(\"${\n context.workspaceConfig.workspaceRoot\n }\");\n if (!roots.some(root => root.href === workspaceRootURL.href)) {\n roots.push(workspaceRootURL);\n }\n\n let resolved: URL | undefined;\n for (const root of roots) {\n const _urls: URL[] = [];\n _urls.push(root);\n if (root.protocol === \"file:\") {\n _urls.push(\n new URL(\"./\", root),\n new URL(join(root.pathname, \"_index.js\"), root),\n new URL(\"node_modules\", root)\n );\n }\n\n for (const url of _urls) {\n resolved = tryModuleResolve(specifier, url, conditionsSet);\n if (resolved) {\n break;\n }\n\n for (const prefix of [\"\", \"/index\"]) {\n for (const extension of DEFAULT_EXTENSIONS) {\n resolved = tryModuleResolve(\n specifier + prefix + extension,\n url,\n conditionsSet\n );\n if (resolved) {\n break;\n }\n }\n if (resolved) {\n break;\n }\n }\n if (resolved) {\n break;\n }\n }\n\n if (resolved) {\n break;\n }\n }\n\n if (!resolved) {\n const err = new Error(\n \\`Cannot find module \\\\\\`\\${specifier}\\\\\\`\\`\n );\n (err as any).code = \"ERR_MODULE_NOT_FOUND\";\n\n throw err;\n }\n\n return pathToFileURL(fileURLToPath(resolved)).href;\n `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A built-in utilities module for Shell Shock.\n */\nexport function UtilsBuiltin(props: UtilsBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <BuiltinFile\n id=\"utils\"\n description=\"A collection of helper utilities that ease command-line application development.\"\n {...rest}\n imports={defu(rest.imports ?? {}, {\n \"node:os\": \"os\",\n \"node:process\": \"process\",\n \"node:path\": [\n \"resolve\",\n \"delimiter\",\n \"normalize\",\n \"join\",\n \"posix\",\n \"sep\",\n \"dirname\",\n \"isAbsolute\"\n ],\n \"node:fs\": [\n { name: \"constants\", alias: \"fsConstants\" },\n \"openSync\",\n \"closeSync\",\n \"read\",\n \"readFileSync\",\n \"statSync\",\n \"realpathSync\"\n ],\n \"node:fs/promises\": [\"stat\"],\n \"node:tty\": [\"WriteStream\"],\n \"node:util\": [\"promisify\"],\n \"node:url\": [\"fileURLToPath\", \"pathToFileURL\"],\n \"node:module\": [\"builtinModules\"]\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n console: [\"error\", \"verbose\", \"writeLine\"],\n env: [\n \"env\",\n \"isCI\",\n \"isTest\",\n \"isWindows\",\n \"isLinux\",\n \"isMacOS\",\n \"isDevelopment\",\n \"isDebug\"\n ],\n exec: [\"execSync\"],\n state: [\"hasFlag\"]\n })}>\n <TSDoc heading=\"A utility function to pause execution for a specified duration, which can be used in prompt interactions to create delays or timeouts. The function returns a promise that resolves after the specified duration in milliseconds, allowing it to be used with async/await syntax for easier handling of asynchronous prompt logic.\">\n <TSDocParam name=\"durationMs\">\n {`The duration to sleep in milliseconds.`}\n </TSDocParam>\n <TSDocReturns>\n {`A promise that resolves after the specified duration, allowing for asynchronous delays in prompt interactions.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"sleep\"\n parameters={[{ name: \"durationMs\", type: \"number\" }]}\n returnType=\"Promise<void>\">{code`return new Promise((resolve) => setTimeout(resolve, durationMs)); `}</FunctionDeclaration>\n <Spacing />\n <TerminalSizeDeclaration />\n <Spacing />\n <EnvSupportUtilities />\n <Spacing />\n <HyperlinkSupportUtilities />\n <Spacing />\n <ColorSupportUtilities />\n <Spacing />\n <ResolveModuleFunctionDeclaration />\n <Spacing />\n <FindSuggestionsDeclaration />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiCA,SAAW,6BAAA;CACT,MAAA,6EAAU;AACV,QAAA;kDAAY,qCAAA;GACZ,SAAA;GACA,MAAO;GACT,aAAiB,mBAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDf,CAAC;kDAAoB,0DAAM,EAAK,CAA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AA,0DAAA,EAAA,CAAA;oDAAA,2BAAA,EAAA,CAAA;oDAAA,0DAAA,EAAA,CAAA;oDAAA,uBAAA,EAAA,CAAA;oDAAA,0DAAA,EAAA,CAAA;oDAAA,kCAAA,EAAA,CAAA;oDAAA,0DAAA,EAAA,CAAA;oDAAA,4BAAA,EAAA,CAAA;oDAAA,0DAAA,EAAA,CAAA;oDAAA,qBAAA;KACG,IAAM,OAAG;AACZ,aAAA,QAAA,SAAA;;KAES;;;;EAGR,CAAC,CAAC"}
|
package/dist/config.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.cjs","names":[],"sources":["../src/config.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 { UserConfig } from \"./types/config\";\n\n/**\n * A utility function to define a Shell Shock user configuration.\n *\n * @remarks\n * This function is used to create a user configuration object for Shell Shock projects. It ensures that the configuration adheres to the expected structure.\n *\n * @param config - A partial user configuration object.\n * @returns A complete user configuration object.\n */\nexport function defineConfig(config: Partial<UserConfig>): UserConfig {\n return config as UserConfig;\n}\n"],"mappings":";;;AAAA,MAAM,aAAa;CAAC;CAAK;CAAW;CAA2B;;;;;;;;;;AAU/D,SAAgB,aAAW,QAAQ;AAClC,QAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command.cjs","names":[],"sources":["../../src/contexts/command.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 { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport type { CommandTree } from \"../types/command\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const CommandContext: ComponentContext<CommandTree | undefined> =\n createNamedContext<CommandTree | undefined>(\"Command\");\n\n/**\n * Hook to access the Command context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useCommand() {\n return useContext<CommandTree | undefined>(CommandContext)!;\n}\n"],"mappings":";;;;;;;;;;;;;;;AA4BE,QAAA,0BAAA,IAAA,CAAA,CAAA,eAAA,UAAA,CAAA,iCAAA,eAAA;;AAEF,WAAC,SAAA,CAAA,cAAA,QAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"options.cjs","names":[],"sources":["../../src/contexts/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 { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport type { BooleanCommandOption, CommandOption } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ExistingOptionsContext: ComponentContext<string[]> =\n createNamedContext<string[]>(\"ExistingOptions\", []);\n\n/**\n * Hook to access the ExistingOptions context.\n *\n * @remarks\n * This context provides a list of option names that already exist on the interface definition.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useExistingOptions() {\n return useContext<string[]>(ExistingOptionsContext)!;\n}\n\nexport function computedOptions(options: CommandOption[]) {\n return options.reduce(\n (ret, option) => {\n ret[camelCase(option.name)] ??= defu(\n {\n name: camelCase(option.name)\n },\n ret[option.name] ?? {},\n option\n ) as CommandOption;\n\n if (\n option.kind === CommandParameterKinds.boolean &&\n option.isNegativeOf\n ) {\n ret[camelCase(option.isNegativeOf)] = defu(\n {\n name: camelCase(option.isNegativeOf)\n },\n ret[option.isNegativeOf] ?? {},\n {\n ...option,\n env: isSetString(option.env) ? `NO_${option.env}` : false,\n description: `${option.description.replace(\n /\\.+$/,\n \"\"\n )}. This property is the negative form of ${option.name}.`,\n isNegativeOf: camelCase(option.name),\n default: !option.default\n }\n ) as BooleanCommandOption;\n }\n\n return ret;\n },\n {} as Record<string, CommandOption>\n );\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;AAUX,MAAa,0BAAsB,kCAAkB,IAAA,CAAA,CAAA,KAAA,CAAA,yCAAA,mBAAA,EAAA,CAAA;;;;;;;;;AASrD,SAAS,qBAA4B;AACrC,QAAY,0BAAW,IAAA,CAAA,CAAA,KAAA,CAAA,iCAAA,uBAAA;;AAEvB,mBAAS,SAAA,CAAA,sBAAuC,QAAQ;;AAEtD,QAAA,QAAA,OAAA,cAAA,KAAA,WAAA;AACK,sDAAW,OAAU,KAAA,wBAAgB,EAC1C,sDAAA,OAAA,KAAA,EACK,EAAA,IAAM,OAAA,SAAA,EAAA,EAAsB,OAAE;AACnC,MAAA,OAAA,SAA0B,4CAAsB,+BAEhD,qDAAA,OAAA,aAAA,sBAAA,EACS,sDAAW,OAAgB,aAAO,EAC5C,EAAA,IAAA,OAAA,iBAAA,EAAA,EAAA;GACG,GAAA;GACY,wDAAgB,OAAG,IAAO,GAAK,MAAM,OAAO,QAAO;GAClE,aAAA,GAAA,OAAA,YAAA,QAAA,QAAA,GAAA,CAAA,0CAAA,OAAA,KAAA;GACa,8DAAwB,OAAQ,KAAA;GAC5C,SAAA,CAAA,OAAA;GACK,CAAA;AAEP,SAAA;;;;;;;;AAGA,gBAAgB,SAAO;CAAA;CAAA;CAAA;CAAA;CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"automd.cjs","names":[],"sources":["../../src/helpers/automd.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 } from \"@alloy-js/core\";\nimport { For, Show } from \"@alloy-js/core/components\";\nimport { Heading } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { renderString } from \"@powerlines/plugin-alloy/render\";\nimport { defineGenerator } from \"automd\";\nimport { CommandDocs } from \"../components/docs\";\nimport { getAppTitle } from \"../plugin-utils\";\nimport type { Context } from \"../types/context\";\n\n/**\n * AutoMD generator to generate CLI command documentation\n *\n * @see https://automd.unjs.io/\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const commands = (context: Context) =>\n defineGenerator({\n name: \"commands\",\n async generate() {\n return {\n contents: renderString(\n context,\n <>\n <Heading level={2}>Commands</Heading>\n <Spacing />\n {code`The following commands are available in the ${getAppTitle(\n context,\n true\n )} command-line interface application:`}\n <Spacing />\n <For each={Object.values(context.commands)} doubleHardline>\n {child => (\n <Show when={!child.isVirtual}>\n <CommandDocs command={child} levelOffset={2} />\n </Show>\n )}\n </For>\n <Spacing />\n </>\n )\n };\n }\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqCA,MAAE,YAAgB,wCAAA;CAChB,MAAM;CACN,MAAE,WAAe;AACf,SAAE,EACA,4DAAY,SAAY;mDAAA,4BAAA;IACtB,OAAE;IACF,UAAG;IACJ,CAAC;mDAAoB,0DAAG,EAAQ,CAAC;8CAAQ,mBAAA,+CAAA,oCAAA,SAAA,KAAA,CAAA,sCAAA;mDAAA,0DAAA,EAAA,CAAA;mDAAA,+BAAA;IACxC,IAAI,OAAC;AACH,YAAO,OAAK,OAAS,QAAC,SAAa;;IAErC,gBAAM;IACN,WAAO,0DAAuB,gCAAa;KACzC,IAAG,OAAQ;AACT,aAAK,CAAA,MAAM;;KAEb,IAAI,WAAQ;AACV,6DAAmB,qCAAgB;OACjC,SAAQ;OACR,aAAC;OACF,CAAC;;KAEL,CAAC;IACH,CAAC;mDAAA,0DAAA,EAAA,CAAA;GAAA,CAAA,EACH;;CAEJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docs-helpers.cjs","names":[],"sources":["../../src/helpers/docs-helpers.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 { joinPaths } from \"@stryke/path/join\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Gets the output path for the generated documentation.\n *\n * @param context - The Shell Shock context.\n * @returns The output path for the generated documentation.\n */\nexport function getDocsOutputPath(context: Context): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;;AAwBA,SAAU,kBAAoB,SAAa;AACvC,yCAAY,QAAY,OAAQ,MAAA,QAAU,YAAa;;AAE3D,kBAAgB,SAAA;CAAA;CAAkB;CAAgB;CAAU;CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paths.cjs","names":[],"sources":["../../src/helpers/paths.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 { listFiles } from \"@stryke/fs/list-files\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { commonPath } from \"@stryke/path/common\";\nimport { findFilePath, findFolderName } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { existsSync } from \"node:fs\";\nimport { isTypeDefinition } from \"powerlines/utils\";\nimport {\n getDynamicPathSegmentName,\n isDynamicPathSegment,\n isPathSegmentGroup\n} from \"../plugin-utils/context-helpers\";\nimport type { Context } from \"../types/context\";\n\nexport function resolveCommandId(context: Context, file: string): string {\n return replacePath(findFilePath(file), context.commandsPath)\n .split(\"/\")\n .filter(p => Boolean(p) && !isDynamicPathSegment(p))\n .join(\"/\")\n .replaceAll(/^\\/+/g, \"\")\n .replaceAll(/\\/+$/g, \"\")\n .replaceAll(\"/\", \"-\");\n}\n\n/**\n * Finds the command name from the given file path.\n *\n * @param file - The file path to extract the command name from.\n * @returns The command name.\n */\nexport function resolveCommandName(file: string) {\n let path = findFilePath(file);\n let name = findFolderName(file, {\n requireExtension: true\n });\n\n while (isDynamicPathSegment(name)) {\n path = resolveParentPath(path);\n name = findFolderName(path, {\n requireExtension: true\n });\n }\n\n return name;\n}\n\nexport function resolveCommandPath(context: Context, file: string): string {\n return replacePath(findFilePath(file), context.commandsPath)\n .replaceAll(/^\\/+/g, \"\")\n .replaceAll(/\\/+$/g, \"\")\n .split(\"/\")\n .filter(path => path && !isPathSegmentGroup(path))\n .join(\"/\");\n}\n\nexport function resolveCommandDynamicPathSegments(\n context: Context,\n file: string\n): string[] {\n return replacePath(findFilePath(file), context.commandsPath)\n .split(\"/\")\n .filter(path => Boolean(path) && isDynamicPathSegment(path))\n .map(path => getDynamicPathSegmentName(path));\n}\n\nexport async function findCommandsRoot(context: Context): Promise<string> {\n let paths = [] as string[];\n if (isSetString(context.config.input)) {\n paths = await listFiles(\n appendPath(\n appendPath(context.config.input, context.config.root),\n context.workspaceConfig.workspaceRoot\n )\n );\n } else if (isTypeDefinition(context.config.input)) {\n paths = await listFiles(\n appendPath(\n appendPath(context.config.input.file, context.config.root),\n context.workspaceConfig.workspaceRoot\n )\n );\n } else if (\n Array.isArray(context.config.input) &&\n context.config.input.length > 0\n ) {\n paths = (\n await Promise.all(\n context.config.input.map(async input =>\n listFiles(\n appendPath(\n appendPath(\n isSetString(input) ? input : input.file,\n context.config.root\n ),\n context.workspaceConfig.workspaceRoot\n )\n )\n )\n )\n ).flat();\n } else if (isSetObject(context.config.input)) {\n paths = (\n await Promise.all(\n Object.values(context.config.input).map(async input =>\n Array.isArray(input)\n ? (\n await Promise.all(\n input.map(async i =>\n listFiles(\n appendPath(\n appendPath(\n isSetString(i) ? i : i.file,\n context.config.root\n ),\n context.workspaceConfig.workspaceRoot\n )\n )\n )\n )\n ).flat()\n : listFiles(\n appendPath(\n appendPath(\n isSetString(input) ? input : input.file,\n context.config.root\n ),\n context.workspaceConfig.workspaceRoot\n )\n )\n )\n )\n ).flat();\n }\n\n if (paths.length > 0) {\n return commonPath(paths.map(p => findFilePath(p)));\n }\n\n let commandsPath = joinPaths(context.config.root, \"src/commands\");\n if (!existsSync(commandsPath)) {\n commandsPath = joinPaths(context.config.root, \"commands\");\n if (!existsSync(commandsPath)) {\n commandsPath = joinPaths(context.config.root, \"src\");\n if (!existsSync(commandsPath)) {\n commandsPath = context.config.root;\n }\n }\n }\n\n paths = (\n await Promise.all([\n listFiles(\n joinPaths(\n appendPath(commandsPath, context.workspaceConfig.workspaceRoot),\n \"**/command.ts\"\n )\n ),\n listFiles(\n joinPaths(\n appendPath(commandsPath, context.workspaceConfig.workspaceRoot),\n \"**/command.tsx\"\n )\n )\n ])\n ).flat();\n if (paths.length > 0) {\n return commonPath(paths.map(p => findFilePath(p)));\n }\n\n return appendPath(commandsPath, context.workspaceConfig.workspaceRoot);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;AA+BX,SAAW,iBAAqB,SAAQ,MAAA;AACxC,2FAAiC,KAAM,EAAA,QAAQ,aAAA,YAExC,OAAS,cAAA,MAAiB,QAAS,EAAA,IAAA,CAAO,6CAAiB,EAAM,EAAC;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAChE,KAAA,IAAA,CACJ,WAAS,SAAA,GAAA,CACT,WAAY,SAAY,GAAG,CACvB,WAAI,KAAA,IAAA;;AAEb,iBAAiB,SAAS;CAAC;CAAA;CAAA;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AAkB,cAAA,QAAgB,gBAAA,cAAA;;AAEtC,iBAAU,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"persistence.cjs","names":[],"sources":["../../src/helpers/persistence.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 { joinPaths } from \"@stryke/path/join-paths\";\nimport type { CommandTree, SerializedCommandTree } from \"../types\";\nimport type { Context } from \"../types/context\";\n\nfunction serialize(command: CommandTree): SerializedCommandTree {\n return {\n ...command,\n parent: command.parent?.name ? command.parent.name : null,\n children: Object.fromEntries(\n Object.entries(command.children || {}).map(([name, child]) => [\n name,\n serialize(child)\n ])\n )\n };\n}\n\nfunction deserialize(\n command: SerializedCommandTree,\n parent: CommandTree | null = null\n): CommandTree {\n const result: CommandTree = {\n ...command,\n parent: parent ?? null,\n children: {}\n };\n\n result.children = Object.fromEntries(\n Object.entries(command.children || {}).map(([name, child]) => [\n name,\n deserialize(child, result)\n ])\n );\n\n return result;\n}\n\n/**\n * Gets the file path for persisting CLI command reflections.\n *\n * @param context - The Shell Shock context.\n * @returns The file path for persisting CLI command reflections.\n */\nexport function getCommandsPersistencePath(context: Context): string {\n return joinPaths(context.dataPath, \"reflections\", \"commands.json\");\n}\n\n/**\n * Reads the persisted CLI command reflections from the file system and populates the context's commands.\n *\n * @param context - The Shell Shock context.\n * @throws Will throw an error if the reflections file is empty or cannot be read.\n */\nexport async function readCommandsPersistence(context: Context) {\n const reflections = await context.fs.read(\n getCommandsPersistencePath(context)\n );\n if (!reflections || !reflections.length) {\n throw new Error(\n `CLI Command reflection file ${getCommandsPersistencePath(context)} is empty`\n );\n }\n\n context.commands = Object.fromEntries(\n Object.entries(\n (JSON.parse(reflections) ?? {}) as Record<string, SerializedCommandTree>\n ).map(([name, command]) => [name, deserialize(command)])\n );\n}\n\n/**\n * Writes the current CLI command reflections from the context to the file system for persistence.\n *\n * @param context - The Shell Shock context.\n * @returns A promise that resolves when the reflections have been successfully written to the file system.\n * @throws Will throw an error if there is an issue writing the reflections to the file system.\n */\nexport async function writeCommandsPersistence(context: Context) {\n const filePath = getCommandsPersistencePath(context);\n\n await context.fs.write(\n filePath,\n JSON.stringify(\n Object.fromEntries(\n Object.entries(context.commands).map(([name, command]) => [\n name,\n serialize(command)\n ])\n ),\n null,\n context.config.mode === \"production\" ? 0 : 2\n )\n );\n}\n"],"mappings":";;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;AAoBX,SAAS,UAAU,SAAS;AAC1B,QAAO;EACF,GAAA;EACH,QAAQ,QAAQ,QAAY,OAAG,QAAQ,OAAW,OAAO;EACzD,UAAU,OAAO,YAAW,OAAA,QAAA,QAAA,YAAA,EAAA,CAAA,CAAA,IAAA,cAAA,CAAA,MAAA,WAAA,CACpB,MACA,UAAA,MAAA,CACJ,EAAA;GAAA;GAAU;GAAK;GAAA,CAAA,CAAA,CAAA;EAClB;;AAEL,UAAG,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AACH,SAAA,YAAA,SAAA,SAAA,MAAA;;EAEQ,GAAC;EACP,QAAS,UAAA;EACH,UAAE,EAAA;EACP;AACD,QAAM,WAAQ,OAAa,YAAC,OAAA,QAAA,QAAA,YAAA,EAAA,CAAA,CAAA,IAAA,cAAA,CAAA,MAAA,WAAA,CACvB,MACH,YAAgB,OAAM,OAAA,CACtB,EAAA;EAAA;EAAW;EAAA;EAAA,CAAA,CAAA,CAAA;AACZ,QAAA;;AAEH,YAAS,SAAW;CAAA;CAAkB;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;;;;;;;AAOtC,SAAe,2BAAA,SAAA;AACf,+CAAA,QAAA,UAAA,eAAA,gBAAA;;AAEA,2BAAE,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOF,eAAmB,wBAAmB,SAAe;CACrD,MAAA,cAAA,MAAA,QAAA,GAAA,KAAA,2BAAA,QAAA,CAAA;yCAEE,OAAA,IAAA,MAAA,+BAAA,2BAAA,QAAA,CAAA,WAAA;AAED,SAAA,WAAA,OAAA,YAAA,OAAA,QAAA,KAAA,MAAA,YAAA,IAAA,EAAA,CAAA,CAAA,IAAA,cAAA,CAAA,MAAA,aAAA,CAAA,MAAA,YAAA,QAAA,CAAA,EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA;;AAED,wBAAwB,SAAS;CAAC;CAAI;CAAiB;CAA0B;CAAA;;;;;;;;AAQjF,eAAmB,yBAAkB,SAAA;CACjC,MAAC,WAAA,2BAAA,QAAA;AACH,OAAA,QAAA,GAAA,MAAA,UAAA,KAAA,UAAA,OAAA,YAAA,OAAA,QAAA,QAAA,SAAA,CAAA,IAAA,cAAA,CAAA,MAAA,aAAA,OAEA,UAAgB,QAAG,CACjB,EAAA;EAAA;EAAc;EAAA;EAAA,CAAA,CAAA,CAAA,EAAA,MAAA,QAAA,OAAA,SAAA,eAAA,IAAA,EAAA,CAAA;;AAElB,yBAAyB,SAAO;CAAA;CAAM;CAAmB;CAAE;CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-package-json.cjs","names":[],"sources":["../../src/helpers/update-package-json.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 { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { getAppName } from \"../plugin-utils/context-helpers\";\nimport type { UnresolvedContext } from \"../types/context\";\n\nexport function formatBinaryPath(\n format: string | string[] | undefined\n): string {\n return `./dist/bin.${\n format === \"cjs\" || (Array.isArray(format) && format.includes(\"cjs\"))\n ? \"cjs\"\n : \"mjs\"\n }`;\n}\n\nexport async function updatePackageJsonBinary(\n context: UnresolvedContext\n): Promise<void> {\n const packageJsonPath = joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n \"package.json\"\n );\n if (\n context.config.bin &&\n Array.isArray(context.config.bin) &&\n context.config.bin.length > 0\n ) {\n context.packageJson.bin = Object.fromEntries(\n getUnique(toArray(context.config.bin)).map(bin => [\n bin,\n formatBinaryPath(context.config.output.format)\n ])\n );\n\n await context.fs.write(\n packageJsonPath,\n StormJSON.stringify(context.packageJson)\n );\n } else {\n if (\n Array.isArray(context.config.output.format) &&\n context.config.output.format.length > 1\n ) {\n context.packageJson.bin = {\n [kebabCase(getAppName(context))]: formatBinaryPath(\n toArray(context.config.output.format)[0]\n )\n };\n context.packageJson.bin = toArray(context.config.output.format).reduce(\n (ret, format) => {\n ret[`${kebabCase(getAppName(context))}-${format}`] =\n formatBinaryPath(format);\n\n return ret;\n },\n context.packageJson.bin\n );\n } else {\n context.packageJson.bin = {\n [kebabCase(getAppName(context))]: formatBinaryPath(\n context.config.output.format\n )\n };\n }\n\n await context.fs.write(\n packageJsonPath,\n StormJSON.stringify(context.packageJson)\n );\n }\n\n if (!isSetObject(context.packageJson.bin)) {\n throw new Error(\n \"Unable to determine the CLI binary name. Please specify the `bin` option in your Shell Shock configuration or ensure that the `name` field is set in your package.json.\"\n );\n }\n\n context.config.bin = Object.keys(context.packageJson.bin);\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;AA0BX,SAAgB,iBAAc,QAAA;AAC3B,QAAO,cAAA,WAAA,SAAA,MAAA,QAAA,OAAA,IAAA,OAAA,SAAA,MAAA,GACA,QACA;;AAEV,iBAAY,SAAA;CAAA;CAAA;CAAA;CAAA;AACZ,eAAI,wBAAA,SAAA;CACJ,MAAA,yDAAA,QAAA,gBAAA,eAAA,QAAA,OAAA,MAAA,eAAA;2BAEO,MAAM,QAAS,QAAA,OAAA,IAAA,IACpB,QAAS,OAAA,IAAA,SAAA,GAAA;AACR,UAAa,YAAC,MAAA,OAAA,4FAAA,QAAA,OAAA,IAAA,CAAA,CAAA,IAAA,cAAA,QAAA,CACT,KACI,iBAAgB,QAAA,OAAa,OAAA,OAAA,CACrC,EAAO;GAAC;GAAO;GAAI;GAAA,CAAA,CAAA,CAAA;AAClB,QAAQ,QAAI,GAAA,MAAA,iBAAA,kCAAA,UAAA,QAAA,YAAA,CAAA;QAEZ;AACD,MAAQ,MAAM,QAAM,QAAA,OAAA,OAAA,OAAA,IACd,QAAQ,OAAQ,OAAO,OAAM,SAAA,GAAA;AAC3B,WAAO,YAAa,MAAA,mDAC5B,mCAAA,QAAA,CAAA,GAAA,uDAAA,QAAA,OAAA,OAAA,OAAA,CAAA,GAAA,EACQ;AACN,WAAU,YAAgB,4CAAa,QAAS,OAAE,OAAA,OAAA,CAAA,OAAA,cAAA,KAAA,WAAA;AAC7C,QAAA,mDAAA,mCAAA,QAAA,CAAA,CAAA,GAAA,YACH,iBAAyB,OAAO;AACjC,WAAA;MACF;IAAA;IAAA;IAAA;IAAA;IAAA,CAAA,EAAA,QAAA,YAAA,IAAA;QAGC,SAAA,YAAe,MAAA,mDACK,mCAAQ,QAAW,CAAA,GAAA,iBAAA,QAAA,OAAA,OAAA,OAAA,EACxC;AAEE,QAAA,QAAA,GAAA,MAAA,iBAAA,kCAAA,UAAA,QAAA,YAAA,CAAA;;AAEH,KAAE,oDAAe,QAAO,YAAa,IAAG,CACtC,OAAA,IAAA,MAAA,0KAAA;AAEF,SAAK,OAAU,MAAA,OAAW,KAAO,QAAK,YAAA,IAAgB;;AAE1D,wBAAQ,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.cjs","names":[],"sources":["../../src/helpers/utilities.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 { TreeItem } from \"@stryke/cli/utils/tree\";\nimport { formatTree } from \"@stryke/cli/utils/tree\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport type { CommandBase, CommandOption, CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\n\nfunction innerFormatCommandTree(command: CommandTree): TreeItem {\n return {\n name: `${command.name}${command.isVirtual ? \" (virtual)\" : \"\"}`,\n children: Object.values(command.children ?? {}).map(innerFormatCommandTree)\n };\n}\n\nexport function formatCommandTree(context: Context): string {\n return formatTree({\n name: context.config.name,\n children: Object.values(context.commands ?? {}).map(innerFormatCommandTree)\n });\n}\n\n/**\n * Retrieves the global command options based on the context configuration.\n *\n * @param context - The build context.\n * @param command - The command for which to retrieve global options.\n * @returns A record of global command options.\n */\nexport function getGlobalOptions(\n context: Context,\n command: CommandBase\n): Record<string, CommandOption> {\n let options!: Record<string, CommandOption>;\n if (Array.isArray(context.config.globalOptions)) {\n options = Object.fromEntries(\n getUniqueBy(\n context.config.globalOptions,\n (item: CommandOption) => item.name\n ).map(option => [option.name, option])\n );\n } else if (isFunction(context.config.globalOptions)) {\n options = Object.fromEntries(\n getUniqueBy(\n context.config.globalOptions(context, command),\n (item: CommandOption) => item.name\n ).map(option => [option.name, option])\n );\n } else {\n options = {};\n }\n\n return Object.fromEntries(\n Object.entries(options).map(([key, value]) => [\n key,\n { ...value, env: value.env ?? constantCase(key) }\n ])\n );\n}\n"],"mappings":";;;;;;;AAAA,MAAM,YAAY;CAAC;CAAK;CAAK;CAAU;CAAyB;;AAE5D,IAAG,SAAS;;;AAOhB,SAAS,uBAAuB,SAAG;AAClC,QAAU;EACV,MAAa,GAAG,QAAQ,OAAO,QAAQ,YAAA,eAA2B;EAC3D,UAAU,OAAO,OAAO,QAAG,YAAiB,EAAC,CAAA,CAAA,IAAA,uBAAA;;;;;;;;;AAIrD,SAAgB,kBAAkB,SAAS;;EAEpC,MAAO,QAAQ,OAAO;EACrB,UAAC,OAAa,OAAO,QAAW,YAAW,EAAA,CAAA,CAAA,IAAA,uBAAA;EACnD,CAAM;;AAEN,kBAAS,SAAkB;CAAC;CAAQ;CAAc;CAAU;CAAA;;;;;;;;AAQ5D,SAAG,iBAAA,SAAA,SAAA;CACH,IAAA;iDAEO,WAAS,OAAA,wDAA2B,QAAU,OAAO,eAAA,cAAA,SAAA,KAAA,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA,IAAA,cAAA,WAAA,CAAA,OAAA,MAAA,OAAA,EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA;0DAEpC,QAAK,OAAA,cAAA,CACzB,WAAU,OAAO,wDAA4B,QAAO,OAAA,cAAsB,SAAA,QAAA,EAAA,cAAA,SAAA,KAAA,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA,IAAA,cAAA,WAAA,CAAA,OAAA,MAAA,OAAA,EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA;;AAK3E,QAAA,OAAc,YAAO,OAAQ,QAAa,QAAQ,CAAA,IAAA,cAAQ,CAAA,KAAa,WAAA,CACzE,KACG;EAAM,GAAA;EAAU,KAAI,MAAM,6DAAO,IAAA;EAAA,CACjC,EAAA;EAAA;EAAc;EAAE;EAAY,CAAA,CAAA,CAAG;;AAEnC,iBAAE,SAAA;CAAA;CAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validations.cjs","names":[],"sources":["../../src/helpers/validations.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 { CommandTree } from \"../types\";\nimport { CommandParameterKinds } from \"../types\";\n\nexport interface ValidationFailure {\n code: string;\n details: string;\n}\n\nexport function validateArguments(command: CommandTree): ValidationFailure[] {\n const failures: ValidationFailure[] = [];\n\n let sequential = false;\n for (const argument of command.args ?? []) {\n if (\n (argument.kind === CommandParameterKinds.string ||\n argument.kind === CommandParameterKinds.number) &&\n argument.variadic\n ) {\n if (!sequential) {\n sequential = true;\n } else {\n failures.push({\n code: \"SEQUENTIAL_VARIADIC_ARGUMENTS\",\n details: `Sequential variadic arguments are not allowed - since the argument preceding ${argument.name} is variadic, it must not also be variadic.`\n });\n }\n } else {\n sequential = false;\n }\n }\n\n return failures;\n}\n\nexport function validateOptions(command: CommandTree): ValidationFailure[] {\n const failures: ValidationFailure[] = [];\n\n const optionNames = new Set<string>();\n for (const option of Object.values(command.options ?? {})) {\n if (optionNames.has(option.name)) {\n failures.push({\n code: \"DUPLICATE_OPTION_NAME\",\n details: `Duplicate option name \"${option.name}\" found in command.`\n });\n }\n optionNames.add(option.name);\n\n for (const alias of option.alias) {\n if (optionNames.has(alias)) {\n failures.push({\n code: \"DUPLICATE_OPTION_ALIAS\",\n details: `Duplicate option name \"${alias}\" (an alias of \"${\n option.name\n }\") found in command.`\n });\n }\n optionNames.add(alias);\n }\n }\n\n return failures;\n}\n\nexport function validateCommand(command: CommandTree): ValidationFailure[] {\n const results: ValidationFailure[] = [];\n\n let failures = validateOptions(command);\n if (failures.length > 0) {\n results.push(...failures);\n }\n\n failures = validateArguments(command);\n if (failures.length > 0) {\n results.push(...failures);\n }\n\n return results;\n}\n"],"mappings":";;;AAkBA,MAAM,uBAAsB;CAAA;CAAS;CAAM;CAAA;CAAA;;CAG3C,MAAO,WAAU,EAAA;CACf,IAAM,aAAM;AACZ,MAAO,MAAE,YAAM,QAAA,QAAA,EAAA,CACjB,MAAA,SAAA,SAAA,4CAAA,mFAEO,SAAS,SACR,KAAQ,CAAC;KAIV,UAAA,KAAA;EACa,MAAK;EACR,SAAS,gFAA+B,SAAA,KAAA;EAC1C,CAAA;KAIH,cAAC;AAGT,QAAM;;AAEV,kBAAM,SAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AACN,SAAW,gBAAA,SAAA;CACP,MAAE,WAAa,EAAA;CACf,MAAA,eAAA,IAAA,IAAA,CAAA,CAAA,IAAA,CAAA,kBAAA,IAAA,KAAA;AACF,MAAA,MAAA,UAAA,OAAA,OAAA,QAAA,WAAA,EAAA,CAAA,EAAA;mCAEO,UAAQ,KAAA;GACjB,MAAA;;GAEO,CAAA;;AAGC,OAAA,MAAW,SAAO,OAAI,OAAS;AAC3B,OAAC,YAAU,IAAO,MAAO,CAC7B,UAAgB,KAAM;IACV,MAAA;IACL,SAAA,0BAAsB,MAAA,kBAAA,OAAA,KAAA;IACpB,CAAC;AAEd,eAAA,IAAA,MAAA;;;AAGA,QAAK;;AAET,gBAAgB,SAAM;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AACtB,SAAgB,gBAAC,SAAuB;CACpC,MAAM,UAAU,EAAA;CAChB,IAAI,WAAW,gBAAA,QAAA;AACf,KAAI,SAAM,SAAS,EACf,SAAE,KAAA,GAAA,SAAA;AAEN,YAAE,kBAAsB,QAAA;AACxB,KAAA,SAAA,SAAA,EACF,SAAA,KAAA,GAAA,SAAA;AAEA,QAAO"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context-helpers.cjs","names":[],"sources":["../../src/plugin-utils/context-helpers.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 { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type { Context, UnresolvedContext } from \"../types\";\n\n/**\n * Sorts command argument aliases, placing single-character aliases first, followed by multi-character aliases, and then sorting them alphabetically.\n *\n * @param aliases - An array of argument aliases to sort.\n * @returns A new array of sorted aliases.\n */\nexport function sortArgAliases(aliases: string[]): string[] {\n if (aliases.length === 0) {\n return [];\n }\n\n const result = aliases.filter(alias => alias.length === 1);\n result.push(...aliases.filter(alias => alias.length > 1));\n\n return result.sort((a, b) => a.localeCompare(b));\n}\n\n/**\n * Retrieves the application name from the context and configuration.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The application name in kebab-case format.\n * @throws An error if no valid application name is found.\n */\nexport function getAppName(context: UnresolvedContext | Context): string {\n const result =\n context.config.name ||\n (isSetString(context.config.bin) ||\n (Array.isArray(context.config.bin) &&\n context.config.bin.length > 0 &&\n isSetString(context.config.bin[0]))\n ? isSetString(context.config.bin)\n ? context.config.bin\n : context.config.bin[0]\n : context.packageJson?.name);\n if (!isSetString(result)) {\n throw new Error(\n \"No application name found. Please provide a 'bin' option in the configuration or ensure the package.json has a valid 'name' field.\"\n );\n }\n\n return kebabCase(result);\n}\n\n/**\n * Retrieves the application title from the context and configuration.\n *\n * @param context - The build context containing workspace and package information.\n * @param replaceCLI - Whether to replace CLI-related terms in the title with the application name.\n * @returns The application title in title-case format.\n */\nexport function getAppTitle(\n context: UnresolvedContext | Context,\n replaceCLI = false\n): string {\n const title =\n context.config.title ||\n titleCase(context.config.name || getAppName(context));\n\n return (\n replaceCLI\n ? title.replace(\n /(?:cli|command-line|command line)\\s*(?:interface\\s*)?(?:application|app)?$/gi,\n \"\"\n )\n : title\n ).trim();\n}\n\n/**\n * Retrieves the application description from the context and configuration.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The application description.\n */\nexport function getAppDescription(\n context: UnresolvedContext | Context\n): string {\n return (\n context.config.description ||\n context.packageJson?.description ||\n `The ${getAppTitle(context, true)} command-line interface application.`\n );\n}\n\n/**\n * Retrieves the primary binary name for the application.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The primary binary name as a string.\n */\nexport function getAppBin(context: Context): string {\n return isSetObject(context.config.bin)\n ? Object.keys(context.config.bin)[0]!\n : kebabCase(getAppName(context));\n}\n\n/**\n * Determines if a given command path segment is variable (enclosed in square brackets).\n *\n * @example\n * ```typescript\n * isDynamicPathSegment(\"[user]\"); // true\n * isDynamicPathSegment(\"user\"); // false\n * ```\n *\n * @param path - The command path segment to check.\n * @returns True if the path is variable, false otherwise.\n */\nexport function isDynamicPathSegment(path: string): boolean {\n return path.startsWith(\"[\") && path.endsWith(\"]\");\n}\n\n/**\n * Extracts the variable name from a command path segment by removing enclosing square brackets.\n *\n * @example\n * ```typescript\n * getDynamicPathSegmentName(\"[user]\"); // \"user\"\n * ```\n *\n * @param path - The command path segment.\n * @returns The variable name without square brackets.\n */\nexport function getDynamicPathSegmentName(path: string): string {\n return path.replaceAll(/^\\[+/g, \"\").replaceAll(/\\]+$/g, \"\");\n}\n\n/**\n * Determines if a given command path segment is a path segment group (enclosed in parentheses).\n *\n * @example\n * ```typescript\n * isPathSegmentGroup(\"(user)\"); // true\n * isPathSegmentGroup(\"[user]\"); // false\n * isPathSegmentGroup(\"user\"); // false\n * ```\n *\n * @param path - The command path segment to check.\n * @returns True if the path is a path segment group, false otherwise.\n */\nexport function isPathSegmentGroup(path: string): boolean {\n return (path.startsWith(\"(\") && path.endsWith(\")\")) || path.startsWith(\"_\");\n}\n\n/**\n * Extracts the group name from a command path segment by removing enclosing parentheses.\n *\n * @example\n * ```typescript\n * getPathSegmentGroupName(\"(admin)\"); // \"admin\"\n * getPathSegmentGroupName(\"((group))\"); // \"group\"\n * ```\n *\n * @param path - The command path segment.\n * @returns The group name without parentheses.\n */\nexport function getPathSegmentGroupName(path: string): string {\n return path\n .replaceAll(/^\\(+/g, \"\")\n .replaceAll(/\\)+$/g, \"\")\n .replaceAll(/^_+/g, \"\");\n}\n\n/**\n * Extracts the variable name from a command path segment by removing enclosing square brackets.\n *\n * @example\n * ```typescript\n * getDynamicPathSegmentName(\"[user]\"); // \"user\"\n * ```\n *\n * @param path - The command path segment.\n * @returns The variable name without square brackets.\n */\nexport function getPathSegmentName(path: string): string {\n return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AA;CAAA;CAAA;;;;;;;AAOR,SAAU,UAAc,SAAM;AAC1B,2DAAY,QAAY,OAAA,IAAW,GACrC,OAAA,KAAA,QAAA,OAAA,IAAA,CAAA,qDACc,WAAA,QAAiB,CAAA;;AAEjC,UAAU,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;;;;;;AAaV,SAAE,qBAAA,MAAA;AACF,QAAO,KAAS,WAAU,IAAA,IAAS,KAAA,SAAU,IAAO;;AAEpD,qBAAkB,SAAQ;CAAA;CAAa;CAAC;CAAA;;;;;;;;;;;;AAYxC,SAAC,0BAAA,MAAA;AACG,QAAM,KAAM,WAAK,SAAa,GAAA,CAAA,WAAgB,SAAA,GAAA;;AAElD,0BAAE,SAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;;;;;;;AAcF,SAAgB,mBAAc,MAAQ;AACpC,QAAA,KAAA,WAAA,IAAA,IAAA,KAAA,SAAA,IAAA,IAAA,KAAA,WAAA,IAAA;;AAEF,mBAAc,SAAc;CAAC;CAAQ;CAAsB;CAAE;;;;;;;;;;;;;AAa7D,SAAgB,wBAAkB,MAAW;AACzC,QAAO,KACT,WAAA,SAAA,GAAA,CACK,WAAS,SAAA,GAAA,CACP,WAAM,QAAa,GAAG;;;;;;;;;;;;;;;;;;AAc/B,SAAE,mBAAA,MAAA;AACF,QAAO,wBAAS,0BAA6C,KAAC,CAAA;;AAE9D,mBAAmB,SAAQ;CAAA;CAAA;CAAA;CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deepkit.cjs","names":[],"sources":["../../src/plugin-utils/deepkit.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 { Type } from \"@powerlines/deepkit/vendor/type\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type {\n BaseCommandParameter,\n CommandParameterKind,\n StringCommandParameter\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\nimport { isCommandParameterKind } from \"./type-checks\";\n\n/**\n * Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.\n *\n * @param command - The command parameter or kind to extract the reflection kind from.\n * @param checkVariadic - Whether to check for variadic parameters (arrays).\n * @returns The extracted {@link ReflectionKind}.\n */\nexport function extractReflectionKind(\n command: BaseCommandParameter | CommandParameterKind,\n checkVariadic = true\n): ReflectionKind {\n if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.string) ||\n (isSetObject(command as BaseCommandParameter) &&\n (command as BaseCommandParameter).kind === CommandParameterKinds.string)\n ) {\n return checkVariadic && (command as StringCommandParameter).variadic\n ? ReflectionKind.array\n : ReflectionKind.string;\n } else if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.number) ||\n (isSetObject(command as BaseCommandParameter) &&\n (command as BaseCommandParameter).kind === CommandParameterKinds.number)\n ) {\n return checkVariadic && (command as any).variadic\n ? ReflectionKind.array\n : ReflectionKind.number;\n } else if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.boolean) ||\n (isSetObject(command) && command.kind === CommandParameterKinds.boolean)\n ) {\n return ReflectionKind.boolean;\n } else {\n return ReflectionKind.string;\n }\n}\n\n/**\n * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.\n *\n * @param command - The command parameter or kind to extract the type from.\n * @param checkVariadic - Whether to check for variadic parameters (arrays).\n * @returns The extracted {@link Type}.\n */\nexport function extractType(\n command: BaseCommandParameter | CommandParameterKind,\n checkVariadic = true\n): Type {\n const reflectionKind = extractReflectionKind(command, checkVariadic);\n if (reflectionKind === ReflectionKind.string) {\n return { kind: ReflectionKind.string };\n } else if (reflectionKind === ReflectionKind.number) {\n return { kind: ReflectionKind.number };\n } else if (reflectionKind === ReflectionKind.boolean) {\n return { kind: ReflectionKind.boolean };\n } else if (reflectionKind === ReflectionKind.array) {\n if (isCommandParameterKind(command)) {\n return {\n kind: ReflectionKind.array,\n type: extractType(\n {\n kind: command\n } as BaseCommandParameter,\n false\n )\n };\n } else if (isSetObject(command)) {\n return {\n kind: ReflectionKind.array,\n type: extractType(\n {\n ...command,\n kind: command.kind\n } as BaseCommandParameter,\n false\n )\n };\n } else {\n return {\n kind: ReflectionKind.array,\n type: { kind: ReflectionKind.string }\n };\n }\n } else {\n return { kind: ReflectionKind.string };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcC,KAAK,2CAAqB,QAAS,yHAEf,QAAQ,wEAEtB,QAAO,iBAAc,QAAW,WAC9B,+CAAiB,QACjB,+CAAoB;UAE3B,2CAAoB,QAAA,IACpB,YAAA,4CAAoB,6DACpB,QAAA,IACS,QAAM,SAAQ,4CAAA,OACjB,QAAC,iBAAuB,QAAQ,WAC/B,+CAAA;UAGK,2CAAuB,QAAQ,IAC5C,YAAA,4CAAA,8DACmB,QAAI,IAAQ,QAAS,SAAS,4CAAe,QAC7D,QAAM,+CAAgB;KAGnB,QAAQ,+CAAC;;AAGhB,sBAAkB,SAAA;CAAA;CAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;;;;;;;;AAQlB,SAAQ,YAAe,SAAA,gBAAA,MAAA;CACnB,MAAI,iBAAe,sBAAM,SAAA,cAAA;AACzB,KAAI,mBAAI,+CAAA,OACP,QAAA,EAAA,MAAA,+CAAiC,QAAA;UAEjC,mBAAuB,+CAAA,OACrB,QAAQ,EAAE,MAAC,+CAAoB,QAAQ;UAEnC,mBAAkB,+CAAgB,QACrC,QAAA,EAAA,MAAe,+CAAA,SAAA;UAEX,mBAAA,+CAAA,MACP,KAAA,2CAA8B,QAAG,CAChC,QAAY;EACF,MAAC,+CAAoB;EACjC,MAAA,YAAA,EACO,MAAe,SACjB,EAAA,MAAA;EACE;6DAEX,QAAA;EAEE,MAAA,+CAAA;EACc,MAAK,YAAa;GACjC,GAAA;GACmB,MAAI,QAAQ;GACtB,EAAA,MAAe;EACb;KAGD,QAAA;EACK,MAAE,+CAAA;EACV,MAAA,EAAA,MAAA,+CAAA,QAAA;EACA;KAIJ,QAAS,EAAI,MAAE,+CAAe,QAAQ;;AAG1C,YAAY,SAAC;CAAA;CAAiC;CAAQ;CAAA;CAAA;CAAA;CAAA;CAAA"}
|