@shell-shock/core 0.11.0 → 0.12.0
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/components/docs.d.cts +5 -5
- package/dist/components/docs.d.mts +5 -5
- package/dist/components/docs.d.mts.map +1 -1
- package/dist/components/helpers.cjs +9 -0
- package/dist/components/helpers.cjs.map +1 -1
- package/dist/components/helpers.d.cts +15 -7
- package/dist/components/helpers.d.cts.map +1 -1
- package/dist/components/helpers.d.mts +15 -7
- package/dist/components/helpers.d.mts.map +1 -1
- package/dist/components/helpers.mjs +9 -1
- package/dist/components/helpers.mjs.map +1 -1
- package/dist/components/index.cjs +1 -0
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.mjs +2 -2
- package/dist/components/options-parser-logic.cjs +142 -62
- package/dist/components/options-parser-logic.cjs.map +1 -1
- package/dist/components/options-parser-logic.d.cts +15 -15
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts +15 -15
- package/dist/components/options-parser-logic.d.mts.map +1 -1
- package/dist/components/options-parser-logic.mjs +143 -63
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/usage.d.cts +2 -2
- package/dist/components/usage.d.mts +2 -2
- package/dist/components/utils-builtin.d.cts +9 -9
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts +9 -9
- package/dist/components/utils-builtin.d.mts.map +1 -1
- package/dist/plugin-utils/description-helpers.cjs +105 -0
- package/dist/plugin-utils/description-helpers.cjs.map +1 -0
- package/dist/plugin-utils/description-helpers.d.cts +44 -0
- package/dist/plugin-utils/description-helpers.d.cts.map +1 -0
- package/dist/plugin-utils/description-helpers.d.mts +44 -0
- package/dist/plugin-utils/description-helpers.d.mts.map +1 -0
- package/dist/plugin-utils/description-helpers.mjs +101 -0
- package/dist/plugin-utils/description-helpers.mjs.map +1 -0
- package/dist/plugin-utils/index.cjs +5 -0
- package/dist/plugin-utils/index.d.cts +2 -1
- package/dist/plugin-utils/index.d.mts +2 -1
- package/dist/plugin-utils/index.mjs +2 -1
- package/dist/plugin-utils/type-checks.d.mts.map +1 -1
- package/dist/plugin.cjs +4 -6
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +4 -6
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/deepkit.cjs +6 -3
- package/dist/resolver/deepkit.cjs.map +1 -1
- package/dist/resolver/deepkit.mjs +6 -3
- package/dist/resolver/deepkit.mjs.map +1 -1
- package/dist/resolver/helpers.cjs +15 -21
- package/dist/resolver/helpers.cjs.map +1 -1
- package/dist/resolver/helpers.mjs +15 -21
- package/dist/resolver/helpers.mjs.map +1 -1
- package/dist/resolver/resolve.cjs +13 -13
- package/dist/resolver/resolve.cjs.map +1 -1
- package/dist/resolver/resolve.mjs +13 -13
- package/dist/resolver/resolve.mjs.map +1 -1
- package/dist/types/config.cjs +5 -3
- package/dist/types/config.cjs.map +1 -1
- package/dist/types/config.d.cts +7 -3
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +7 -3
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/config.mjs +5 -3
- package/dist/types/config.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options-parser-logic.mjs","names":["code","computed","For","Show","ElseClause","ElseIfClause","IfStatement","InterfaceDeclaration","InterfaceMember","VarDeclaration","Spacing","camelCase","constantCase","pascalCase","isSetString","computedOptions","getDynamicPathSegmentName","isDynamicPathSegment","CommandParameterKinds","BooleanInputParserLogic","DynamicSegmentsParserLogic","props","command","_$createComponent","each","segments","children","segment","index","when","name","type","_$createIntrinsic","condition","ArgumentsParserLogic","envPrefix","isCaseSensitive","args","length","initializer","Object","values","options","map","option","toLowerCase","replaceAll","alias","a","join","hardline","arg","kind","boolean","number","string","variadic","optional","env","String","default","undefined","fallback","_$memo","OptionsMember","doc","description","title","Boolean","OptionsMemberParserLogic","equalsRegex","includes","isNegativeOf","OptionsMemberParserCondition","aliasProp","OptionsInterfaceDeclaration","value","OptionsParserLogic","entries","JSON","stringify","filter","i","CommandParserLogic"],"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 { 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 } 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.${envPrefix}_OPTION_NAME`).\n */\n envPrefix: 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, envPrefix, 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 <VarDeclaration\n let\n name={camelCase(arg.name)}\n type={`${\n arg.kind === CommandParameterKinds.boolean\n ? \"boolean\"\n : arg.kind === CommandParameterKinds.number\n ? \"number\"\n : \"string\"\n }${\n (arg.kind === CommandParameterKinds.string ||\n arg.kind === CommandParameterKinds.number) &&\n arg.variadic\n ? \"[]\"\n : \"\"\n }${arg.optional ? \" | undefined\" : \"\"}`}\n initializer={\n <>\n <Show when={isSetString(arg.env)}>\n {code`env.${envPrefix}_${constantCase(String(arg.env))} ?? `}\n </Show>\n <Show\n when={arg.default !== undefined}\n fallback={\n (arg.kind === CommandParameterKinds.string ||\n arg.kind === CommandParameterKinds.number) &&\n arg.variadic\n ? code`[]`\n : code`undefined;`\n }>\n {arg.kind === CommandParameterKinds.string\n ? code`\"${arg.default}\"`\n : code`${arg.default}`}\n </Show>\n </>\n }\n />\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={\n (arg.kind === CommandParameterKinds.string ||\n arg.kind === CommandParameterKinds.number) &&\n arg.variadic\n }\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 </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={\n (option as StringCommandParameter).variadic\n ? \"string[]\"\n : \"string\"\n }\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={\n (option as NumberCommandParameter).variadic\n ? \"number[]\"\n : \"number\"\n }\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=\"boolean\"\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 {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 {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 <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 </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 <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 </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(() => computedOptions(command));\n\n return (\n <InterfaceDeclaration export name={`${pascalCase(command.name)}Options`}>\n <For each={Object.values(options.value)} hardline>\n {option => <OptionsMember option={option} />}\n </For>\n </InterfaceDeclaration>\n );\n}\n\nexport interface OptionsParserLogicProps {\n /**\n * The command to generate the options 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.${envPrefix}_OPTION_NAME`).\n */\n envPrefix: 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 { command, envPrefix, isCaseSensitive = false } = props;\n\n const options = computed(() => computedOptions(command));\n\n return (\n <>\n <VarDeclaration\n const\n name=\"options\"\n initializer={code` {\n ${Object.entries(options.value)\n .map(([name, option]) => {\n if (option.kind === CommandParameterKinds.string) {\n return ` ${name.includes(\"?\") || name.includes(\"-\") ? `\"${name}\"` : `${name}`}: ${\n option.env ? `env.${envPrefix}_${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.${envPrefix}_${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.boolean) {\n return ` ${name.includes(\"?\") || name.includes(\"-\") ? `\"${name}\"` : `${name}`}: ${\n option.env ? `env.${envPrefix}_${option.env} ?? ` : \"\"\n }${option.default ? \"true\" : \"false\"},`;\n }\n\n return \"\";\n })\n .join(\"\")}\n } as ${pascalCase(command.name)}Options;`}\n />\n <Spacing />\n {code`for (let i = 0; i < args.slice(${\n command.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\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\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.${envPrefix}_OPTION_NAME`).\n */\n envPrefix: 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, envPrefix, isCaseSensitive = false } = props;\n\n return (\n <>\n <DynamicSegmentsParserLogic\n command={command}\n isCaseSensitive={isCaseSensitive}\n />\n <Spacing />\n <OptionsParserLogic\n command={command}\n envPrefix={envPrefix}\n isCaseSensitive={isCaseSensitive}\n />\n <Spacing />\n <ArgumentsParserLogic\n command={command}\n envPrefix={envPrefix}\n isCaseSensitive={isCaseSensitive}\n />\n <Spacing />\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA2DA,SAAgBoB,2BACdC,OACA;CACA,MAAM,EAAEC,YAAYD;AAEpB,QAAAE,gBACGrB,KAAG;EAAA,IAACsB,OAAI;AAAA,UAAEF,QAAQG,YAAY,EAAE;;EAAAC,WAC7BC,SAASC,UAAKL,gBACbpB,MAAI;GAAA,IAAC0B,OAAI;AAAA,WAAEZ,qBAAqBU,QAAQ;;GAAA,IAAAD,WAAA;AAAA,WAAA;KAAAH,gBACtCd,gBAAc;MAAA,OAAA;MAAA,IAEbqB,OAAI;AAAA,cAAEnB,UAAUK,0BAA0BW,QAAQ,CAAC;;MACnDI,MAAI;MAAA,CAAA;KAAAC,gBAAA,OAAA,EAAA,CAAA;KAAAT,gBAGLjB,aAAW;MACV2B,WAAWjC,IAAI,iBAAiB,IAAI4B,MAAK,WAAY,IAAIA,MAAK;MAAG,IAAAF,WAAA;AAAA,cAChE1B,IAAI,GAAGW,UACNK,0BAA0BW,QAC5B,CAAC,CAAA,UAAW,IAAIC,MAAK;;MAAI,CAAA;KAAAI,gBAAA,OAAA,EAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAA;;GAAA,CAAA;EAK9B,CAAA;;AAsBP,SAAgBE,qBAAqBb,OAAkC;CACrE,MAAM,EAAEC,SAASa,WAAWC,oBAAoBf;AAEhD,QAAAE,gBACGpB,MAAI;EAAA,IAAC0B,OAAI;AAAA,UAAEP,QAAQe,QAAQf,QAAQe,KAAKC,SAAS;;EAAC,IAAAZ,WAAA;AAAA,UAAA;IAAAH,gBAChDd,gBAAc;KAAA,OAAA;KAEbqB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AV,WAAA;AAAA,YAAAH,gBAIrCjB,aAAW;MAAA,IACV2B,YAAS;AAAA,cAAAV,gBACNkD,8BAA4B;QACrB3C;QAAI,IACViB,QAAK;AAAA,gBAAEH,OAAOG;;QACGX;QAAe,CAAA;;MAAA,IAAAV,WAAA;AAAA,cAAAH,gBAGnC8C,0BAAwB;QACjBvC;QACEc;QACSR;QAAe,CAAA;;MAAA,CAAA;;IAAA,CAAA;GAIvC,CAAA;EAAAJ,gBAAA,OAAA,EAAA,CAAA;EAIFhC,IAAI;EAAKgC,gBAAA,OAAA,EAAA,CAAA;EAAA;;;;;AA4BhB,SAAgBmD,mBAAmB9D,OAAgC;CACjE,MAAM,EAAEC,SAASa,WAAWC,kBAAkB,UAAUf;AAExD,QAAA;EAAAE,gBAEKH,4BAA0B;GAChBE;GACQc;GAAe,CAAA;EAAAb,gBAEjCb,SAAO,EAAA,CAAA;EAAAa,gBACPsD,oBAAkB;GACRvD;GACEa;GACMC;GAAe,CAAA;EAAAb,gBAEjCb,SAAO,EAAA,CAAA;EAAAa,gBACPW,sBAAoB;GACVZ;GACEa;GACMC;GAAe,CAAA;EAAAb,gBAEjCb,SAAO,EAAA,CAAA;EAAA"}
|
|
1
|
+
{"version":3,"file":"options-parser-logic.mjs","names":["code","computed","For","Show","ElseClause","ElseIfClause","IfStatement","InterfaceDeclaration","InterfaceMember","VarDeclaration","Spacing","camelCase","constantCase","pascalCase","isSetString","computedOptions","getDynamicPathSegmentName","isDynamicPathSegment","CommandParameterKinds","BooleanInputParserLogic","CommandParameterType","DynamicSegmentsParserLogic","props","command","_$createComponent","each","segments","children","segment","index","when","name","type","_$createIntrinsic","condition","ArgumentsParserLogic","appSpecificEnvPrefix","isCaseSensitive","args","length","initializer","Object","values","options","map","option","toLowerCase","replaceAll","alias","a","join","hardline","arg","env","default","undefined","kind","string","number","variadic","fallback","_$memo","parameter","String","OptionsMember","doc","description","title","Boolean","optional","boolean","OptionsMemberParserLogic","equalsRegex","includes","choices","choice","isNegativeOf","OptionsMemberParserCondition","aliasProp","OptionsInterfaceDeclaration","value","OptionsParserLogic","entries","filter","JSON","stringify","Array","isArray","i","CommandParserLogic"],"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 { 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 <Show when={isSetString(arg.env)}>\n {code`env.${appSpecificEnvPrefix}_${constantCase(String(arg.env))} ?? `}\n </Show>\n <Show\n when={arg.default !== undefined}\n fallback={\n (arg.kind === CommandParameterKinds.string ||\n arg.kind === CommandParameterKinds.number) &&\n arg.variadic\n ? code`[]`\n : code`undefined;`\n }>\n {arg.kind === CommandParameterKinds.string\n ? code`\"${arg.default}\"`\n : code`${arg.default}`}\n </Show>\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={\n (arg.kind === CommandParameterKinds.string ||\n arg.kind === CommandParameterKinds.number) &&\n arg.variadic\n }\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 </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(() => computedOptions(command));\n\n return (\n <InterfaceDeclaration export name={`${pascalCase(command.name)}Options`}>\n <For each={Object.values(options.value)} hardline>\n {option => <OptionsMember option={option} />}\n </For>\n </InterfaceDeclaration>\n );\n}\n\nexport interface OptionsParserLogicProps {\n /**\n * The command to generate the options 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 options parser logic.\n */\nexport function OptionsParserLogic(props: OptionsParserLogicProps) {\n const { command, appSpecificEnvPrefix, isCaseSensitive = false } = props;\n\n const options = computed(() => computedOptions(command));\n\n return (\n <>\n <VarDeclaration\n const\n name=\"options\"\n initializer={code` {\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 ${pascalCase(command.name)}Options;`}\n />\n <Spacing />\n {code`for (let i = 0; i < args.slice(${\n command.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\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\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 command={command}\n appSpecificEnvPrefix={appSpecificEnvPrefix}\n isCaseSensitive={isCaseSensitive}\n />\n <Spacing />\n <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B;GAChBE;GACQc;GAAe,CAAA;EAAAb,gBAEjCd,SAAO,EAAA,CAAA;EAAAc,gBACPyD,oBAAkB;GACR1D;GACaa;GACLC;GAAe,CAAA;EAAAb,gBAEjCd,SAAO,EAAA,CAAA;EAAAc,gBACPW,sBAAoB;GACVZ;GACaa;GACLC;GAAe,CAAA;EAAAb,gBAEjCd,SAAO,EAAA,CAAA;EAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandTree } from "../types/command.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _alloy_js_core25 from "@alloy-js/core";
|
|
3
3
|
|
|
4
4
|
//#region src/components/usage.d.ts
|
|
5
5
|
interface UsageProps {
|
|
@@ -22,7 +22,7 @@ interface UsageProps {
|
|
|
22
22
|
/**
|
|
23
23
|
* A component that generates the usage display for a command.
|
|
24
24
|
*/
|
|
25
|
-
declare function Usage(props: UsageProps):
|
|
25
|
+
declare function Usage(props: UsageProps): _alloy_js_core25.Children;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { Usage, UsageProps };
|
|
28
28
|
//# sourceMappingURL=usage.d.cts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandTree } from "../types/command.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _alloy_js_core9 from "@alloy-js/core";
|
|
3
3
|
|
|
4
4
|
//#region src/components/usage.d.ts
|
|
5
5
|
interface UsageProps {
|
|
@@ -22,7 +22,7 @@ interface UsageProps {
|
|
|
22
22
|
/**
|
|
23
23
|
* A component that generates the usage display for a command.
|
|
24
24
|
*/
|
|
25
|
-
declare function Usage(props: UsageProps):
|
|
25
|
+
declare function Usage(props: UsageProps): _alloy_js_core9.Children;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { Usage, UsageProps };
|
|
28
28
|
//# sourceMappingURL=usage.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core17 from "@alloy-js/core";
|
|
2
2
|
import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
3
3
|
|
|
4
4
|
//#region src/components/utils-builtin.d.ts
|
|
@@ -6,32 +6,32 @@ interface UtilsBuiltinProps extends Omit<BuiltinFileProps, "id" | "description">
|
|
|
6
6
|
/**
|
|
7
7
|
* Generates the `findSuggestions` function for suggesting corrections for potentially misspelled options or commands.
|
|
8
8
|
*/
|
|
9
|
-
declare function FindSuggestionsDeclaration():
|
|
9
|
+
declare function FindSuggestionsDeclaration(): _alloy_js_core17.Children;
|
|
10
10
|
/**
|
|
11
11
|
* Generates utilities for detecting terminal color support.
|
|
12
12
|
*/
|
|
13
|
-
declare function EnvSupportUtilities():
|
|
13
|
+
declare function EnvSupportUtilities(): _alloy_js_core17.Children;
|
|
14
14
|
/**
|
|
15
15
|
* Generates utilities for detecting terminal color support.
|
|
16
16
|
*/
|
|
17
|
-
declare function ColorSupportUtilities():
|
|
17
|
+
declare function ColorSupportUtilities(): _alloy_js_core17.Children;
|
|
18
18
|
/**
|
|
19
19
|
* Generates utilities for detecting terminal color support.
|
|
20
20
|
*/
|
|
21
|
-
declare function HyperlinkSupportUtilities():
|
|
21
|
+
declare function HyperlinkSupportUtilities(): _alloy_js_core17.Children;
|
|
22
22
|
/**
|
|
23
23
|
* Generates utilities for detecting terminal color support.
|
|
24
24
|
*/
|
|
25
|
-
declare function ArgsUtilities():
|
|
25
|
+
declare function ArgsUtilities(): _alloy_js_core17.Children;
|
|
26
26
|
/**
|
|
27
27
|
* Generates the `spawn` function declaration, which is a cross-platform utility for spawning child processes with proper color support and environment variable handling.
|
|
28
28
|
*/
|
|
29
|
-
declare function SpawnFunctionDeclaration():
|
|
30
|
-
declare function ContextUtilities():
|
|
29
|
+
declare function SpawnFunctionDeclaration(): _alloy_js_core17.Children;
|
|
30
|
+
declare function ContextUtilities(): _alloy_js_core17.Children;
|
|
31
31
|
/**
|
|
32
32
|
* A built-in utilities module for Shell Shock.
|
|
33
33
|
*/
|
|
34
|
-
declare function UtilsBuiltin(props: UtilsBuiltinProps):
|
|
34
|
+
declare function UtilsBuiltin(props: UtilsBuiltinProps): _alloy_js_core17.Children;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { ArgsUtilities, ColorSupportUtilities, ContextUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, SpawnFunctionDeclaration, UtilsBuiltin, UtilsBuiltinProps };
|
|
37
37
|
//# sourceMappingURL=utils-builtin.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-builtin.d.cts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UAyCiB,iBAAA,SAA0B,KACzC;;AADF;AAQA;AA4MgB,iBA5MA,0BAAA,CAAA,CA4MmB,EA5MO,
|
|
1
|
+
{"version":3,"file":"utils-builtin.d.cts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UAyCiB,iBAAA,SAA0B,KACzC;;AADF;AAQA;AA4MgB,iBA5MA,0BAAA,CAAA,CA4MmB,EA5MO,gBAAA,CAAA,QA4MP;AAiCnC;AAsMA;AA0GA;AA+EgB,iBAhaA,mBAAA,CAAA,CAgawB,EAhaL,gBAAA,CAAA,QAgaK;AAkTxC;AAsFA;;iBAvwBgB,qBAAA,CAAA,GAAqB,gBAAA,CAAA;;;;iBAsMrB,yBAAA,CAAA,GAAyB,gBAAA,CAAA;;;;iBA0GzB,aAAA,CAAA,GAAa,gBAAA,CAAA;;;;iBA+Eb,wBAAA,CAAA,GAAwB,gBAAA,CAAA;iBAkTxB,gBAAA,CAAA,GAAgB,gBAAA,CAAA;;;;iBAsFhB,YAAA,QAAoB,oBAAiB,gBAAA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core10 from "@alloy-js/core";
|
|
2
2
|
import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
3
3
|
|
|
4
4
|
//#region src/components/utils-builtin.d.ts
|
|
@@ -6,32 +6,32 @@ interface UtilsBuiltinProps extends Omit<BuiltinFileProps, "id" | "description">
|
|
|
6
6
|
/**
|
|
7
7
|
* Generates the `findSuggestions` function for suggesting corrections for potentially misspelled options or commands.
|
|
8
8
|
*/
|
|
9
|
-
declare function FindSuggestionsDeclaration():
|
|
9
|
+
declare function FindSuggestionsDeclaration(): _alloy_js_core10.Children;
|
|
10
10
|
/**
|
|
11
11
|
* Generates utilities for detecting terminal color support.
|
|
12
12
|
*/
|
|
13
|
-
declare function EnvSupportUtilities():
|
|
13
|
+
declare function EnvSupportUtilities(): _alloy_js_core10.Children;
|
|
14
14
|
/**
|
|
15
15
|
* Generates utilities for detecting terminal color support.
|
|
16
16
|
*/
|
|
17
|
-
declare function ColorSupportUtilities():
|
|
17
|
+
declare function ColorSupportUtilities(): _alloy_js_core10.Children;
|
|
18
18
|
/**
|
|
19
19
|
* Generates utilities for detecting terminal color support.
|
|
20
20
|
*/
|
|
21
|
-
declare function HyperlinkSupportUtilities():
|
|
21
|
+
declare function HyperlinkSupportUtilities(): _alloy_js_core10.Children;
|
|
22
22
|
/**
|
|
23
23
|
* Generates utilities for detecting terminal color support.
|
|
24
24
|
*/
|
|
25
|
-
declare function ArgsUtilities():
|
|
25
|
+
declare function ArgsUtilities(): _alloy_js_core10.Children;
|
|
26
26
|
/**
|
|
27
27
|
* Generates the `spawn` function declaration, which is a cross-platform utility for spawning child processes with proper color support and environment variable handling.
|
|
28
28
|
*/
|
|
29
|
-
declare function SpawnFunctionDeclaration():
|
|
30
|
-
declare function ContextUtilities():
|
|
29
|
+
declare function SpawnFunctionDeclaration(): _alloy_js_core10.Children;
|
|
30
|
+
declare function ContextUtilities(): _alloy_js_core10.Children;
|
|
31
31
|
/**
|
|
32
32
|
* A built-in utilities module for Shell Shock.
|
|
33
33
|
*/
|
|
34
|
-
declare function UtilsBuiltin(props: UtilsBuiltinProps):
|
|
34
|
+
declare function UtilsBuiltin(props: UtilsBuiltinProps): _alloy_js_core10.Children;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { ArgsUtilities, ColorSupportUtilities, ContextUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, SpawnFunctionDeclaration, UtilsBuiltin, UtilsBuiltinProps };
|
|
37
37
|
//# sourceMappingURL=utils-builtin.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-builtin.d.mts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UAyCiB,iBAAA,SAA0B,KACzC;;AADF;AAQA;AA4MgB,iBA5MA,0BAAA,CAAA,CA4MmB,EA5MO,
|
|
1
|
+
{"version":3,"file":"utils-builtin.d.mts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UAyCiB,iBAAA,SAA0B,KACzC;;AADF;AAQA;AA4MgB,iBA5MA,0BAAA,CAAA,CA4MmB,EA5MO,gBAAA,CAAA,QA4MP;AAiCnC;AAsMA;AA0GA;AA+EgB,iBAhaA,mBAAA,CAAA,CAgawB,EAhaL,gBAAA,CAAA,QAgaK;AAkTxC;AAsFA;;iBAvwBgB,qBAAA,CAAA,GAAqB,gBAAA,CAAA;;;;iBAsMrB,yBAAA,CAAA,GAAyB,gBAAA,CAAA;;;;iBA0GzB,aAAA,CAAA,GAAa,gBAAA,CAAA;;;;iBA+Eb,wBAAA,CAAA,GAAwB,gBAAA,CAAA;iBAkTxB,gBAAA,CAAA,GAAgB,gBAAA,CAAA;;;;iBAsFhB,YAAA,QAAoB,oBAAiB,gBAAA,CAAA"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/plugin-utils/description-helpers.ts
|
|
3
|
+
const __ΩFormatDescriptionOptions = [
|
|
4
|
+
"replaceNewlines",
|
|
5
|
+
true,
|
|
6
|
+
"collapseWhitespace",
|
|
7
|
+
"FormatDescriptionOptions",
|
|
8
|
+
"P)4!8>\")4#8>\"Mw$y"
|
|
9
|
+
];
|
|
10
|
+
/**
|
|
11
|
+
* Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
|
|
15
|
+
*
|
|
16
|
+
* @param description - The full description string.
|
|
17
|
+
* @returns The formatted description string.
|
|
18
|
+
*/
|
|
19
|
+
function formatDescriptionWhitespace(description, options = {}) {
|
|
20
|
+
let formattedDescription = description.trim();
|
|
21
|
+
if (options.replaceNewlines) formattedDescription = formattedDescription.replace(/\s*\n\s*/g, " ");
|
|
22
|
+
if (options.collapseWhitespace) formattedDescription = formattedDescription.replace(/\s{2,}/g, " ");
|
|
23
|
+
return formattedDescription.trim();
|
|
24
|
+
}
|
|
25
|
+
formatDescriptionWhitespace.__type = [
|
|
26
|
+
"description",
|
|
27
|
+
() => __ΩFormatDescriptionOptions,
|
|
28
|
+
"options",
|
|
29
|
+
() => ({}),
|
|
30
|
+
"formatDescriptionWhitespace",
|
|
31
|
+
"P&2!n\"2#>$&/%"
|
|
32
|
+
];
|
|
33
|
+
/**
|
|
34
|
+
* Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
|
|
38
|
+
*
|
|
39
|
+
* @param description - The full description string.
|
|
40
|
+
* @returns The formatted description string.
|
|
41
|
+
*/
|
|
42
|
+
function formatDescriptionEscapes(description) {
|
|
43
|
+
return description.replaceAll("'", "\\'").replaceAll("\"", "\\\"").replaceAll("`", "\\`").replace(/\$\{/g, "\\${");
|
|
44
|
+
}
|
|
45
|
+
formatDescriptionEscapes.__type = [
|
|
46
|
+
"description",
|
|
47
|
+
"formatDescriptionEscapes",
|
|
48
|
+
"P&2!&/\""
|
|
49
|
+
];
|
|
50
|
+
/**
|
|
51
|
+
* Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
|
|
55
|
+
*
|
|
56
|
+
* @param description - The full description string.
|
|
57
|
+
* @returns The formatted description string.
|
|
58
|
+
*/
|
|
59
|
+
function formatDescription(description, options = {}) {
|
|
60
|
+
return formatDescriptionEscapes(formatDescriptionWhitespace(description, options));
|
|
61
|
+
}
|
|
62
|
+
formatDescription.__type = [
|
|
63
|
+
"description",
|
|
64
|
+
() => __ΩFormatDescriptionOptions,
|
|
65
|
+
"options",
|
|
66
|
+
() => ({}),
|
|
67
|
+
"formatDescription",
|
|
68
|
+
"P&2!n\"2#>$&/%"
|
|
69
|
+
];
|
|
70
|
+
const __ΩFormatShortDescriptionOptions = [
|
|
71
|
+
() => __ΩFormatDescriptionOptions,
|
|
72
|
+
"length",
|
|
73
|
+
60,
|
|
74
|
+
"FormatShortDescriptionOptions",
|
|
75
|
+
"Pn!'4\"8>#Mw$y"
|
|
76
|
+
];
|
|
77
|
+
/**
|
|
78
|
+
* Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.
|
|
79
|
+
*
|
|
80
|
+
* @param description - The full description string.
|
|
81
|
+
* @param options - Options for formatting the short description, including the maximum length.
|
|
82
|
+
* @returns The extracted short description.
|
|
83
|
+
*/
|
|
84
|
+
function formatShortDescription(description, options = {}) {
|
|
85
|
+
const length = options.length ?? 60;
|
|
86
|
+
const formattedDescription = formatDescriptionWhitespace(description, options);
|
|
87
|
+
let result = ((formattedDescription.indexOf("\n") < length + 1 || formattedDescription.search(/[.!?\n]\s*\S/) > length + 1 ? formattedDescription.trim().match(/^.*[.!?\n]\s?\S/)?.[0]?.trim()?.slice(0, -1)?.trim() : void 0) || formattedDescription).trim();
|
|
88
|
+
if (result.trim().length > length) result = `${result.substring(0, Math.max(0, length - 3)).trim()}...`;
|
|
89
|
+
return formatDescriptionEscapes(result);
|
|
90
|
+
}
|
|
91
|
+
formatShortDescription.__type = [
|
|
92
|
+
"description",
|
|
93
|
+
() => __ΩFormatShortDescriptionOptions,
|
|
94
|
+
"options",
|
|
95
|
+
() => ({}),
|
|
96
|
+
"formatShortDescription",
|
|
97
|
+
"P&2!n\"2#>$&/%"
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
//#endregion
|
|
101
|
+
exports.__ΩFormatDescriptionOptions = __ΩFormatDescriptionOptions;
|
|
102
|
+
exports.__ΩFormatShortDescriptionOptions = __ΩFormatShortDescriptionOptions;
|
|
103
|
+
exports.formatDescription = formatDescription;
|
|
104
|
+
exports.formatShortDescription = formatShortDescription;
|
|
105
|
+
//# sourceMappingURL=description-helpers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description-helpers.cjs","names":[],"sources":["../../src/plugin-utils/description-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\nexport interface FormatDescriptionOptions {\n /**\n * If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.\n *\n * @defaultValue false\n */\n replaceNewlines?: boolean;\n\n /**\n * If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.\n *\n * @defaultValue false\n */\n collapseWhitespace?: boolean;\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionWhitespace(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n let formattedDescription = description.trim();\n if (options.replaceNewlines) {\n formattedDescription = formattedDescription.replace(/\\s*\\n\\s*/g, \" \");\n }\n if (options.collapseWhitespace) {\n formattedDescription = formattedDescription.replace(/\\s{2,}/g, \" \");\n }\n\n return formattedDescription.trim();\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionEscapes(description: string): string {\n return description\n .replaceAll(\"'\", \"\\\\'\")\n .replaceAll('\"', '\\\\\"')\n .replaceAll(\"`\", \"\\\\`\")\n .replace(/\\$\\{/g, \"\\\\${\");\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nexport function formatDescription(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n return formatDescriptionEscapes(\n formatDescriptionWhitespace(description, options)\n );\n}\n\nexport interface FormatShortDescriptionOptions extends FormatDescriptionOptions {\n /**\n * The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.\n *\n * @defaultValue 60\n */\n length?: number;\n}\n\n/**\n * Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.\n *\n * @param description - The full description string.\n * @param options - Options for formatting the short description, including the maximum length.\n * @returns The extracted short description.\n */\nexport function formatShortDescription(\n description: string,\n options: FormatShortDescriptionOptions = {}\n): string {\n const length = options.length ?? 60;\n const formattedDescription = formatDescriptionWhitespace(\n description,\n options\n );\n\n const firstSentenceMatch =\n formattedDescription.indexOf(\"\\n\") < length + 1 ||\n formattedDescription.search(/[.!?\\n]\\s*\\S/) > length + 1\n ? formattedDescription\n .trim()\n .match(/^.*[.!?\\n]\\s?\\S/)?.[0]\n ?.trim()\n ?.slice(0, -1)\n ?.trim()\n : undefined;\n\n let result = (firstSentenceMatch || formattedDescription).trim();\n if (result.trim().length > length) {\n result = `${result.substring(0, Math.max(0, length - 3)).trim()}...`;\n }\n\n return formatDescriptionEscapes(result);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,SAAG,4BAAA,aAAA,UAAA,EAAA,EAAA;CACC,IAAI,uBAAe,YAAA,MAAA;AACnB,KAAA,QAAA,gBACI,wBAAsB,qBAAA,QAAA,aAAA,IAAA;gCAG5B,wBAAA,qBAAA,QAAA,WAAA,IAAA;AAED,QAAA,qBAAA,MAAA;;AAED,4BAA4B,SAAS;CAAC;OAAqB;CAA6B;QAAkB,EAAE;CAAG;CAAW;CAAA;;;;;;;;;;AAU1H,SAAS,yBAAsB,aAAA;AAC3B,QAAO,YACT,WAAA,KAAA,MAAA,CACO,WAAW,MAAK,OAAM,CACtB,WAAW,KAAK,MAAM,CAC7B,QAAA,SAAA,OAAA;;AAEF,yBAAyB,SAAS;CAAC;CAAC;CAAA;CAAA;;;;;;;;;;AAUpC,SAAgB,kBAAkB,aAAU,UAAA,EAAA,EAAA;AAC1C,QAAA,yBAAA,4BAAA,aAAA,QAAA,CAAA;;AAEF,kBAAkB,SAAC;CAAA;OAAA;CAAA;QAAA,EAAA;CAAA;CAAA;CAAA;AACnB,MAAM,mCAAoB;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;AAS1B,SAAU,uBAAA,aAAA,UAAA,EAAA,EAAA;CACN,MAAM,SAAS,QAAQ,UAAU;CACpC,MAAA,uBAAA,4BAAA,aAAA,QAAA;CAUE,IAAA,WAT4B,qBAAoB,QAAA,KAAA,GAAA,SAAA,KAC3C,qBAAqB,OAAO,eAAQ,GAAA,SAAA,IAC1C,qBACW,MAAM,CACN,MAAM,kBAAE,GAAA,IACP,MAAM,EACV,MAAA,GAAA,GAAA,EACI,MAAM,GACV,WACP,sBAAA,MAAA;AACH,KAAA,OAAA,MAAA,CAAA,SAAA;AAGI,QAAA,yBAAA,OAAA;;AAEJ,uBAAG,SAAA;CAAA;OAAA;CAAA;QAAA,EAAA;CAAA;CAAA;CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//#region src/plugin-utils/description-helpers.d.ts
|
|
2
|
+
interface FormatDescriptionOptions {
|
|
3
|
+
/**
|
|
4
|
+
* If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.
|
|
5
|
+
*
|
|
6
|
+
* @defaultValue false
|
|
7
|
+
*/
|
|
8
|
+
replaceNewlines?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.
|
|
11
|
+
*
|
|
12
|
+
* @defaultValue false
|
|
13
|
+
*/
|
|
14
|
+
collapseWhitespace?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
|
|
21
|
+
*
|
|
22
|
+
* @param description - The full description string.
|
|
23
|
+
* @returns The formatted description string.
|
|
24
|
+
*/
|
|
25
|
+
declare function formatDescription(description: string, options?: FormatDescriptionOptions): string;
|
|
26
|
+
interface FormatShortDescriptionOptions extends FormatDescriptionOptions {
|
|
27
|
+
/**
|
|
28
|
+
* The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.
|
|
29
|
+
*
|
|
30
|
+
* @defaultValue 60
|
|
31
|
+
*/
|
|
32
|
+
length?: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.
|
|
36
|
+
*
|
|
37
|
+
* @param description - The full description string.
|
|
38
|
+
* @param options - Options for formatting the short description, including the maximum length.
|
|
39
|
+
* @returns The extracted short description.
|
|
40
|
+
*/
|
|
41
|
+
declare function formatShortDescription(description: string, options?: FormatShortDescriptionOptions): string;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { FormatDescriptionOptions, FormatShortDescriptionOptions, formatDescription, formatShortDescription };
|
|
44
|
+
//# sourceMappingURL=description-helpers.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description-helpers.d.cts","names":[],"sources":["../../src/plugin-utils/description-helpers.ts"],"sourcesContent":[],"mappings":";UAkBiB,wBAAA;EAAA;AAkEjB;AASA;AAgBA;;;;;;;;;;;;;;;;;;;iBAzBgB,iBAAA,gCAEL;UAOM,6BAAA,SAAsC;;;;;;;;;;;;;;;iBAgBvC,sBAAA,gCAEL"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//#region src/plugin-utils/description-helpers.d.ts
|
|
2
|
+
interface FormatDescriptionOptions {
|
|
3
|
+
/**
|
|
4
|
+
* If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.
|
|
5
|
+
*
|
|
6
|
+
* @defaultValue false
|
|
7
|
+
*/
|
|
8
|
+
replaceNewlines?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.
|
|
11
|
+
*
|
|
12
|
+
* @defaultValue false
|
|
13
|
+
*/
|
|
14
|
+
collapseWhitespace?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.
|
|
21
|
+
*
|
|
22
|
+
* @param description - The full description string.
|
|
23
|
+
* @returns The formatted description string.
|
|
24
|
+
*/
|
|
25
|
+
declare function formatDescription(description: string, options?: FormatDescriptionOptions): string;
|
|
26
|
+
interface FormatShortDescriptionOptions extends FormatDescriptionOptions {
|
|
27
|
+
/**
|
|
28
|
+
* The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.
|
|
29
|
+
*
|
|
30
|
+
* @defaultValue 60
|
|
31
|
+
*/
|
|
32
|
+
length?: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.
|
|
36
|
+
*
|
|
37
|
+
* @param description - The full description string.
|
|
38
|
+
* @param options - Options for formatting the short description, including the maximum length.
|
|
39
|
+
* @returns The extracted short description.
|
|
40
|
+
*/
|
|
41
|
+
declare function formatShortDescription(description: string, options?: FormatShortDescriptionOptions): string;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { FormatDescriptionOptions, FormatShortDescriptionOptions, formatDescription, formatShortDescription };
|
|
44
|
+
//# sourceMappingURL=description-helpers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description-helpers.d.mts","names":[],"sources":["../../src/plugin-utils/description-helpers.ts"],"sourcesContent":[],"mappings":";UAkBiB,wBAAA;EAAA;AAkEjB;AASA;AAgBA;;;;;;;;;;;;;;;;;;;iBAzBgB,iBAAA,gCAEL;UAOM,6BAAA,SAAsC;;;;;;;;;;;;;;;iBAgBvC,sBAAA,gCAEL"}
|