@shell-shock/core 0.12.0 → 0.12.1
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.d.cts +7 -7
- package/dist/components/helpers.d.cts.map +1 -1
- package/dist/components/helpers.d.mts +7 -7
- package/dist/components/options-parser-logic.cjs.map +1 -1
- package/dist/components/options-parser-logic.d.cts +11 -11
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts +2 -2
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/usage.d.mts +2 -2
- package/dist/components/usage.d.mts.map +1 -1
- package/dist/components/utils-builtin.cjs +5 -9
- package/dist/components/utils-builtin.cjs.map +1 -1
- 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/components/utils-builtin.mjs +5 -9
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/helpers/automd.cjs +1 -1
- package/dist/helpers/automd.cjs.map +1 -1
- package/dist/helpers/automd.mjs +1 -1
- package/dist/helpers/automd.mjs.map +1 -1
- package/dist/plugin-utils/get-command-tree.cjs +26 -0
- package/dist/plugin-utils/get-command-tree.cjs.map +1 -1
- package/dist/plugin-utils/get-command-tree.d.cts +8 -1
- package/dist/plugin-utils/get-command-tree.d.cts.map +1 -1
- package/dist/plugin-utils/get-command-tree.d.mts +8 -1
- package/dist/plugin-utils/get-command-tree.d.mts.map +1 -1
- package/dist/plugin-utils/get-command-tree.mjs +26 -1
- package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +2 -1
- package/dist/plugin-utils/index.d.cts +2 -2
- package/dist/plugin-utils/index.d.mts +2 -2
- package/dist/plugin-utils/index.mjs +2 -2
- package/dist/plugin-utils/type-checks.d.cts.map +1 -1
- package/dist/plugin-utils/type-checks.d.mts.map +1 -1
- package/dist/plugin.cjs +1 -1
- package/dist/plugin.mjs +1 -1
- package/dist/resolver/helpers.cjs +1 -1
- package/dist/resolver/helpers.cjs.map +1 -1
- package/dist/resolver/helpers.mjs +1 -1
- package/dist/resolver/helpers.mjs.map +1 -1
- package/dist/resolver/module.cjs +2 -2
- package/dist/resolver/module.cjs.map +1 -1
- package/dist/resolver/module.mjs +2 -2
- package/dist/resolver/module.mjs.map +1 -1
- package/package.json +11 -11
|
@@ -122,7 +122,7 @@ applyDefaults.__type = [
|
|
|
122
122
|
];
|
|
123
123
|
function resolveVirtualCommand(ctx) {
|
|
124
124
|
ctx.output.title ??= (0, __stryke_string_format_title_case.titleCase)(ctx.input.command.name);
|
|
125
|
-
ctx.output.description ??= `A collection of available ${ctx.output.title.replace(/(?:c|C)ommands?$/, "").trim() || (0, __stryke_string_format_title_case.titleCase)(ctx.input.command.name)} commands that are included in the ${require_context_helpers.getAppTitle(ctx.input.context)} command-line application.`;
|
|
125
|
+
ctx.output.description ??= `A collection of available ${ctx.output.title.replace(/(?:c|C)ommands?$/, "").trim() || (0, __stryke_string_format_title_case.titleCase)(ctx.input.command.name)} commands that are included in the ${require_context_helpers.getAppTitle(ctx.input.context, true)} command-line application.`;
|
|
126
126
|
}
|
|
127
127
|
resolveVirtualCommand.__type = [
|
|
128
128
|
"ResolverContext",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.cjs","names":[],"sources":["../../src/resolver/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 { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { createDefu } from \"defu\";\nimport { getAppTitle } from \"../plugin-utils/context-helpers\";\nimport type { CommandArgument, CommandParameterKind } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport type { ResolverContext } from \"./types\";\n\n/**\n * Resolves the description for a command option based on its reflection.\n *\n * @param name - The name of the command option.\n * @param kind - The reflection kind of the command option.\n * @param optional - Whether the command option is optional.\n * @param variadic - Whether the command option is variadic (i.e., an array).\n * @param title - The title of the command option, if any.\n * @param defaultValue - The default value of the command option, if any.\n * @returns The resolved description for the command option.\n */\nexport function resolveCommandOptionDescription(\n name: string,\n kind: CommandParameterKind,\n optional = false,\n variadic = false,\n title?: string,\n defaultValue?: any\n): string {\n return `A${optional && !defaultValue ? \"n optional\" : \"\"} command-line ${\n kind === CommandParameterKinds.boolean ? \"flag\" : \"option\"\n } that allows the user to ${\n kind === CommandParameterKinds.boolean\n ? \"set the\"\n : variadic\n ? \"specify custom\"\n : \"specify a custom\"\n } ${title?.trim() || titleCase(name)} ${\n kind === CommandParameterKinds.boolean\n ? \"indicator\"\n : `${kind === CommandParameterKinds.number ? \"numeric\" : \"string\"} value${\n variadic ? \"s\" : \"\"\n }`\n }.`;\n}\n\n/**\n * Resolves the description for a command argument based on its reflection.\n *\n * @param name - The name of the command argument.\n * @param kind - The reflection kind of the command argument.\n * @param optional - Whether the command argument is optional.\n * @param variadic - Whether the command argument is variadic (i.e., an array).\n * @param title - The title of the command argument, if any.\n * @param defaultValue - The default value of the command argument, if any.\n * @returns The resolved description for the command argument.\n */\nexport function resolveCommandArgumentDescription(\n name: string,\n kind: CommandParameterKind,\n optional = false,\n variadic = false,\n title?: string,\n defaultValue?: any\n): string {\n return `An${\n optional && !defaultValue ? \" optional\" : \"\"\n } argument that allows the user to ${\n kind === CommandParameterKinds.boolean\n ? \"set the\"\n : variadic\n ? \"specify custom\"\n : \"specify a custom\"\n } ${title?.trim() || titleCase(name)} ${\n kind === CommandParameterKinds.boolean\n ? \"indicator\"\n : `${kind === CommandParameterKinds.number ? \"numeric\" : \"string\"} value${\n variadic ? \"s\" : \"\"\n }`\n }.`;\n}\n\nexport function applyOptionsDefaults(ctx: ResolverContext) {\n return Object.fromEntries(\n Object.entries(ctx.output.options).map(([key, option]) => {\n const name = option.name || key;\n const title = option.title || titleCase(name);\n\n return [\n key,\n {\n ...option,\n name,\n title,\n description:\n option.description ||\n resolveCommandOptionDescription(\n name,\n option.kind,\n option.optional,\n option.kind !== CommandParameterKinds.boolean && option.variadic,\n title,\n option.default\n ),\n env:\n option.env || option.env === false\n ? option.env\n : ctx.input.context.config.autoAssignEnv\n ? constantCase(name)\n : false\n }\n ];\n })\n );\n}\n\nexport function applyArgsDefaults(ctx: ResolverContext): CommandArgument[] {\n return ctx.output.args.map((arg, i) => {\n const name = arg.name || `arg${i + 1}`;\n const title = arg.title || titleCase(name);\n\n return {\n ...arg,\n name,\n title,\n description:\n arg.description ||\n resolveCommandArgumentDescription(\n name,\n arg.kind,\n arg.optional,\n arg.kind !== CommandParameterKinds.boolean && arg.variadic,\n title,\n arg.default\n ),\n env: arg.name\n ? arg.env || arg.env === false\n ? arg.env\n : ctx.input.context.config.autoAssignEnv\n ? constantCase(name)\n : false\n : false\n };\n });\n}\n\nexport function applyDefaults(ctx: ResolverContext) {\n ctx.output.description ??= `The ${ctx.output.title.replace(/(?:c|C)ommands?$/, \"\").trim()} executable command-line interface.`;\n}\n\nexport function resolveVirtualCommand<TContext extends Context = Context>(\n ctx: ResolverContext<TContext>\n) {\n ctx.output.title ??= titleCase(ctx.input.command.name);\n ctx.output.description ??= `A collection of available ${\n ctx.output.title.replace(/(?:c|C)ommands?$/, \"\").trim() ||\n titleCase(ctx.input.command.name)\n } commands that are included in the ${getAppTitle(\n ctx.input.context\n )} command-line application.`;\n}\n\n/**\n * Merges two command parameters, giving precedence to string values in the second configuration.\n *\n * @param objA - The first command parameter object.\n * @param objB - The second command parameter object.\n * @returns The merged command parameter object.\n */\nexport const mergeCommandParameter = createDefu((obj, key, value) => {\n if (isString(obj[key]) && isString(value)) {\n if (isSetString(value)) {\n obj[key] = value;\n }\n\n return true;\n } else if (Array.isArray(obj[key]) && Array.isArray(value)) {\n if (value.length > 0) {\n obj[key] = getUniqueBy((obj[key] as unknown[]).concat(value), item =>\n isString(item) ? item : JSON.stringify(item)\n ) as (typeof obj)[typeof key];\n }\n\n return true;\n }\n\n return false;\n});\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;;;;;;AAsCX,SAAE,gCAAA,MAAA,MAAA,WAAA,OAAA,WAAA,OAAA,OAAA,cAAA;AACE,QAAO,IAAI,YAAY,CAAC,eAAe,eAAI,GAAA,gBAAA,SAAA,4CAAA,UAAA,SAAA,SAAA,2BAAA,SAAA,4CAAA,UACrC,YACA,WACI,mBACA,mBAAI,GAAA,OAAA,MAAA,qDAAA,KAAA,CAAA,GAAA,SAAA,4CAAA,UACR,cACA,GAAG,SAAM,4CAAA,SAAA,YAAA,SAAA,QAAA,WAAA,MAAA,KAAA;;AAEnB,gCAAgC,SAAS;CAAC;CAAQ;CAAwB;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;;;;;AAY1E,SAAgB,kCAAY,MAAA,MAAA,WAAA,OAAA,WAAA,OAAA,OAAA,cAAA;AACxB,QAAK,KAAA,YAAA,CAAA,eAAA,cAAA,GAAA,oCAAA,SAAA,4CAAA,UACJ,YACL,8BAEE,mBAAA,GAAA,OAAA,MAAA,qDA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AAA;CAAA;CAAA;CAAA;CAAA;AACf,SAAgB,cAAK,KAAA;AACjB,KAAI,OAAO,gBAAgB,OAAC,IAAA,OAAA,MAAA,QAAA,oBAAA,GAAA,CAAA,MAAA,CAAA;;AAEhC,cAAc,SAAI;CAAA;CAAA;CAAA;CAAA;CAAA;AAClB,SAAgB,sBAAS,KAAA;AACrB,KAAI,OAAO,2DAAc,IAAA,MAAA,QAAA,KAAA;AACzB,KAAI,OAAO,gBAAgB,6BAA6B,IAAI,OAAO,MAAM,QAAC,oBAAA,GAAA,CAAA,MAAA,qDAC5D,IAAC,MAAA,QAAA,KAAA,CAAA,qCAAA,oCAAA,IAAA,MAAA,
|
|
1
|
+
{"version":3,"file":"helpers.cjs","names":[],"sources":["../../src/resolver/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 { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { createDefu } from \"defu\";\nimport { getAppTitle } from \"../plugin-utils/context-helpers\";\nimport type { CommandArgument, CommandParameterKind } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport type { ResolverContext } from \"./types\";\n\n/**\n * Resolves the description for a command option based on its reflection.\n *\n * @param name - The name of the command option.\n * @param kind - The reflection kind of the command option.\n * @param optional - Whether the command option is optional.\n * @param variadic - Whether the command option is variadic (i.e., an array).\n * @param title - The title of the command option, if any.\n * @param defaultValue - The default value of the command option, if any.\n * @returns The resolved description for the command option.\n */\nexport function resolveCommandOptionDescription(\n name: string,\n kind: CommandParameterKind,\n optional = false,\n variadic = false,\n title?: string,\n defaultValue?: any\n): string {\n return `A${optional && !defaultValue ? \"n optional\" : \"\"} command-line ${\n kind === CommandParameterKinds.boolean ? \"flag\" : \"option\"\n } that allows the user to ${\n kind === CommandParameterKinds.boolean\n ? \"set the\"\n : variadic\n ? \"specify custom\"\n : \"specify a custom\"\n } ${title?.trim() || titleCase(name)} ${\n kind === CommandParameterKinds.boolean\n ? \"indicator\"\n : `${kind === CommandParameterKinds.number ? \"numeric\" : \"string\"} value${\n variadic ? \"s\" : \"\"\n }`\n }.`;\n}\n\n/**\n * Resolves the description for a command argument based on its reflection.\n *\n * @param name - The name of the command argument.\n * @param kind - The reflection kind of the command argument.\n * @param optional - Whether the command argument is optional.\n * @param variadic - Whether the command argument is variadic (i.e., an array).\n * @param title - The title of the command argument, if any.\n * @param defaultValue - The default value of the command argument, if any.\n * @returns The resolved description for the command argument.\n */\nexport function resolveCommandArgumentDescription(\n name: string,\n kind: CommandParameterKind,\n optional = false,\n variadic = false,\n title?: string,\n defaultValue?: any\n): string {\n return `An${\n optional && !defaultValue ? \" optional\" : \"\"\n } argument that allows the user to ${\n kind === CommandParameterKinds.boolean\n ? \"set the\"\n : variadic\n ? \"specify custom\"\n : \"specify a custom\"\n } ${title?.trim() || titleCase(name)} ${\n kind === CommandParameterKinds.boolean\n ? \"indicator\"\n : `${kind === CommandParameterKinds.number ? \"numeric\" : \"string\"} value${\n variadic ? \"s\" : \"\"\n }`\n }.`;\n}\n\nexport function applyOptionsDefaults(ctx: ResolverContext) {\n return Object.fromEntries(\n Object.entries(ctx.output.options).map(([key, option]) => {\n const name = option.name || key;\n const title = option.title || titleCase(name);\n\n return [\n key,\n {\n ...option,\n name,\n title,\n description:\n option.description ||\n resolveCommandOptionDescription(\n name,\n option.kind,\n option.optional,\n option.kind !== CommandParameterKinds.boolean && option.variadic,\n title,\n option.default\n ),\n env:\n option.env || option.env === false\n ? option.env\n : ctx.input.context.config.autoAssignEnv\n ? constantCase(name)\n : false\n }\n ];\n })\n );\n}\n\nexport function applyArgsDefaults(ctx: ResolverContext): CommandArgument[] {\n return ctx.output.args.map((arg, i) => {\n const name = arg.name || `arg${i + 1}`;\n const title = arg.title || titleCase(name);\n\n return {\n ...arg,\n name,\n title,\n description:\n arg.description ||\n resolveCommandArgumentDescription(\n name,\n arg.kind,\n arg.optional,\n arg.kind !== CommandParameterKinds.boolean && arg.variadic,\n title,\n arg.default\n ),\n env: arg.name\n ? arg.env || arg.env === false\n ? arg.env\n : ctx.input.context.config.autoAssignEnv\n ? constantCase(name)\n : false\n : false\n };\n });\n}\n\nexport function applyDefaults(ctx: ResolverContext) {\n ctx.output.description ??= `The ${ctx.output.title.replace(/(?:c|C)ommands?$/, \"\").trim()} executable command-line interface.`;\n}\n\nexport function resolveVirtualCommand<TContext extends Context = Context>(\n ctx: ResolverContext<TContext>\n) {\n ctx.output.title ??= titleCase(ctx.input.command.name);\n ctx.output.description ??= `A collection of available ${\n ctx.output.title.replace(/(?:c|C)ommands?$/, \"\").trim() ||\n titleCase(ctx.input.command.name)\n } commands that are included in the ${getAppTitle(\n ctx.input.context,\n true\n )} command-line application.`;\n}\n\n/**\n * Merges two command parameters, giving precedence to string values in the second configuration.\n *\n * @param objA - The first command parameter object.\n * @param objB - The second command parameter object.\n * @returns The merged command parameter object.\n */\nexport const mergeCommandParameter = createDefu((obj, key, value) => {\n if (isString(obj[key]) && isString(value)) {\n if (isSetString(value)) {\n obj[key] = value;\n }\n\n return true;\n } else if (Array.isArray(obj[key]) && Array.isArray(value)) {\n if (value.length > 0) {\n obj[key] = getUniqueBy((obj[key] as unknown[]).concat(value), item =>\n isString(item) ? item : JSON.stringify(item)\n ) as (typeof obj)[typeof key];\n }\n\n return true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A,KAAA,KAAA,UAAA;AACH,kDAAC,IAAA,KAAA,iDAAA,MAAA,EAAA;AACF,0DAAA,MAAA,CACH,KAAA,OAAA;AAEQ,SAAO;YAEF,MAAM,QAAQ,IAAI,KAAK,IAAI,MAAE,QAAA,MAAA,EAAA;AAClC,MAAI,MAAM,SAAS;;;;;AAGnB,SAAI;;AAER,QAAO;GACR;CAAC;CAAO;CAAM;CAAA;CAAA;CAAA,CAAA,CAAA"}
|
|
@@ -121,7 +121,7 @@ applyDefaults.__type = [
|
|
|
121
121
|
];
|
|
122
122
|
function resolveVirtualCommand(ctx) {
|
|
123
123
|
ctx.output.title ??= titleCase(ctx.input.command.name);
|
|
124
|
-
ctx.output.description ??= `A collection of available ${ctx.output.title.replace(/(?:c|C)ommands?$/, "").trim() || titleCase(ctx.input.command.name)} commands that are included in the ${getAppTitle(ctx.input.context)} command-line application.`;
|
|
124
|
+
ctx.output.description ??= `A collection of available ${ctx.output.title.replace(/(?:c|C)ommands?$/, "").trim() || titleCase(ctx.input.command.name)} commands that are included in the ${getAppTitle(ctx.input.context, true)} command-line application.`;
|
|
125
125
|
}
|
|
126
126
|
resolveVirtualCommand.__type = [
|
|
127
127
|
"ResolverContext",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.mjs","names":[],"sources":["../../src/resolver/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 { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { createDefu } from \"defu\";\nimport { getAppTitle } from \"../plugin-utils/context-helpers\";\nimport type { CommandArgument, CommandParameterKind } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport type { ResolverContext } from \"./types\";\n\n/**\n * Resolves the description for a command option based on its reflection.\n *\n * @param name - The name of the command option.\n * @param kind - The reflection kind of the command option.\n * @param optional - Whether the command option is optional.\n * @param variadic - Whether the command option is variadic (i.e., an array).\n * @param title - The title of the command option, if any.\n * @param defaultValue - The default value of the command option, if any.\n * @returns The resolved description for the command option.\n */\nexport function resolveCommandOptionDescription(\n name: string,\n kind: CommandParameterKind,\n optional = false,\n variadic = false,\n title?: string,\n defaultValue?: any\n): string {\n return `A${optional && !defaultValue ? \"n optional\" : \"\"} command-line ${\n kind === CommandParameterKinds.boolean ? \"flag\" : \"option\"\n } that allows the user to ${\n kind === CommandParameterKinds.boolean\n ? \"set the\"\n : variadic\n ? \"specify custom\"\n : \"specify a custom\"\n } ${title?.trim() || titleCase(name)} ${\n kind === CommandParameterKinds.boolean\n ? \"indicator\"\n : `${kind === CommandParameterKinds.number ? \"numeric\" : \"string\"} value${\n variadic ? \"s\" : \"\"\n }`\n }.`;\n}\n\n/**\n * Resolves the description for a command argument based on its reflection.\n *\n * @param name - The name of the command argument.\n * @param kind - The reflection kind of the command argument.\n * @param optional - Whether the command argument is optional.\n * @param variadic - Whether the command argument is variadic (i.e., an array).\n * @param title - The title of the command argument, if any.\n * @param defaultValue - The default value of the command argument, if any.\n * @returns The resolved description for the command argument.\n */\nexport function resolveCommandArgumentDescription(\n name: string,\n kind: CommandParameterKind,\n optional = false,\n variadic = false,\n title?: string,\n defaultValue?: any\n): string {\n return `An${\n optional && !defaultValue ? \" optional\" : \"\"\n } argument that allows the user to ${\n kind === CommandParameterKinds.boolean\n ? \"set the\"\n : variadic\n ? \"specify custom\"\n : \"specify a custom\"\n } ${title?.trim() || titleCase(name)} ${\n kind === CommandParameterKinds.boolean\n ? \"indicator\"\n : `${kind === CommandParameterKinds.number ? \"numeric\" : \"string\"} value${\n variadic ? \"s\" : \"\"\n }`\n }.`;\n}\n\nexport function applyOptionsDefaults(ctx: ResolverContext) {\n return Object.fromEntries(\n Object.entries(ctx.output.options).map(([key, option]) => {\n const name = option.name || key;\n const title = option.title || titleCase(name);\n\n return [\n key,\n {\n ...option,\n name,\n title,\n description:\n option.description ||\n resolveCommandOptionDescription(\n name,\n option.kind,\n option.optional,\n option.kind !== CommandParameterKinds.boolean && option.variadic,\n title,\n option.default\n ),\n env:\n option.env || option.env === false\n ? option.env\n : ctx.input.context.config.autoAssignEnv\n ? constantCase(name)\n : false\n }\n ];\n })\n );\n}\n\nexport function applyArgsDefaults(ctx: ResolverContext): CommandArgument[] {\n return ctx.output.args.map((arg, i) => {\n const name = arg.name || `arg${i + 1}`;\n const title = arg.title || titleCase(name);\n\n return {\n ...arg,\n name,\n title,\n description:\n arg.description ||\n resolveCommandArgumentDescription(\n name,\n arg.kind,\n arg.optional,\n arg.kind !== CommandParameterKinds.boolean && arg.variadic,\n title,\n arg.default\n ),\n env: arg.name\n ? arg.env || arg.env === false\n ? arg.env\n : ctx.input.context.config.autoAssignEnv\n ? constantCase(name)\n : false\n : false\n };\n });\n}\n\nexport function applyDefaults(ctx: ResolverContext) {\n ctx.output.description ??= `The ${ctx.output.title.replace(/(?:c|C)ommands?$/, \"\").trim()} executable command-line interface.`;\n}\n\nexport function resolveVirtualCommand<TContext extends Context = Context>(\n ctx: ResolverContext<TContext>\n) {\n ctx.output.title ??= titleCase(ctx.input.command.name);\n ctx.output.description ??= `A collection of available ${\n ctx.output.title.replace(/(?:c|C)ommands?$/, \"\").trim() ||\n titleCase(ctx.input.command.name)\n } commands that are included in the ${getAppTitle(\n ctx.input.context\n )} command-line application.`;\n}\n\n/**\n * Merges two command parameters, giving precedence to string values in the second configuration.\n *\n * @param objA - The first command parameter object.\n * @param objB - The second command parameter object.\n * @returns The merged command parameter object.\n */\nexport const mergeCommandParameter = createDefu((obj, key, value) => {\n if (isString(obj[key]) && isString(value)) {\n if (isSetString(value)) {\n obj[key] = value;\n }\n\n return true;\n } else if (Array.isArray(obj[key]) && Array.isArray(value)) {\n if (value.length > 0) {\n obj[key] = getUniqueBy((obj[key] as unknown[]).concat(value), item =>\n isString(item) ? item : JSON.stringify(item)\n ) as (typeof obj)[typeof key];\n }\n\n return true;\n }\n\n return false;\n});\n"],"mappings":";;;;;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;;;;;;AAsCX,SAAE,gCAAA,MAAA,MAAA,WAAA,OAAA,WAAA,OAAA,OAAA,cAAA;AACE,QAAO,IAAI,YAAY,CAAC,eAAe,eAAI,GAAA,gBAAA,SAAA,sBAAA,UAAA,SAAA,SAAA,2BAAA,SAAA,sBAAA,UACrC,YACA,WACI,mBACA,mBAAI,GAAA,OAAA,MAAA,IAAA,UAAA,KAAA,CAAA,GAAA,SAAA,sBAAA,UACR,cACA,GAAG,SAAM,sBAAA,SAAA,YAAA,SAAA,QAAA,WAAA,MAAA,KAAA;;AAEnB,gCAAgC,SAAS;CAAC;CAAQ;CAAwB;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;;;;;AAY1E,SAAgB,kCAAY,MAAA,MAAA,WAAA,OAAA,WAAA,OAAA,OAAA,cAAA;AACxB,QAAK,KAAA,YAAA,CAAA,eAAA,cAAA,GAAA,oCAAA,SAAA,sBAAA,UACJ,YACL,8BAEE,mBAAA,GAAA,OAAA,MAAA,IAAA,UAAA,KAAA,CAAA,GAAA,SAAA,sBAAA,UACQ,cACT,GAAA,SAAA,sBAAA,SAAA,YAAA,SAAA,QAAA,WAAA,MAAA,KAAA;;AAED,kCAAkC,SAAS;CAAC;CAAQ;CAAQ;CAAA;CAAA;C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AAc,SAAI;CAAA;CAAA;CAAA;CAAA;CAAA;AAClB,SAAgB,sBAAS,KAAA;AACrB,KAAI,OAAO,UAAU,UAAI,IAAA,MAAA,QAAA,KAAA;AACzB,KAAI,OAAO,gBAAgB,6BAA6B,IAAI,OAAO,MAAM,QAAC,oBAAA,GAAA,CAAA,MAAA,IACtE,UAAU,IAAC,MAAA,QAAA,KAAA,CAAA,qCAAA,YAAA,IAAA,MAAA,
|
|
1
|
+
{"version":3,"file":"helpers.mjs","names":[],"sources":["../../src/resolver/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 { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { createDefu } from \"defu\";\nimport { getAppTitle } from \"../plugin-utils/context-helpers\";\nimport type { CommandArgument, CommandParameterKind } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport type { ResolverContext } from \"./types\";\n\n/**\n * Resolves the description for a command option based on its reflection.\n *\n * @param name - The name of the command option.\n * @param kind - The reflection kind of the command option.\n * @param optional - Whether the command option is optional.\n * @param variadic - Whether the command option is variadic (i.e., an array).\n * @param title - The title of the command option, if any.\n * @param defaultValue - The default value of the command option, if any.\n * @returns The resolved description for the command option.\n */\nexport function resolveCommandOptionDescription(\n name: string,\n kind: CommandParameterKind,\n optional = false,\n variadic = false,\n title?: string,\n defaultValue?: any\n): string {\n return `A${optional && !defaultValue ? \"n optional\" : \"\"} command-line ${\n kind === CommandParameterKinds.boolean ? \"flag\" : \"option\"\n } that allows the user to ${\n kind === CommandParameterKinds.boolean\n ? \"set the\"\n : variadic\n ? \"specify custom\"\n : \"specify a custom\"\n } ${title?.trim() || titleCase(name)} ${\n kind === CommandParameterKinds.boolean\n ? \"indicator\"\n : `${kind === CommandParameterKinds.number ? \"numeric\" : \"string\"} value${\n variadic ? \"s\" : \"\"\n }`\n }.`;\n}\n\n/**\n * Resolves the description for a command argument based on its reflection.\n *\n * @param name - The name of the command argument.\n * @param kind - The reflection kind of the command argument.\n * @param optional - Whether the command argument is optional.\n * @param variadic - Whether the command argument is variadic (i.e., an array).\n * @param title - The title of the command argument, if any.\n * @param defaultValue - The default value of the command argument, if any.\n * @returns The resolved description for the command argument.\n */\nexport function resolveCommandArgumentDescription(\n name: string,\n kind: CommandParameterKind,\n optional = false,\n variadic = false,\n title?: string,\n defaultValue?: any\n): string {\n return `An${\n optional && !defaultValue ? \" optional\" : \"\"\n } argument that allows the user to ${\n kind === CommandParameterKinds.boolean\n ? \"set the\"\n : variadic\n ? \"specify custom\"\n : \"specify a custom\"\n } ${title?.trim() || titleCase(name)} ${\n kind === CommandParameterKinds.boolean\n ? \"indicator\"\n : `${kind === CommandParameterKinds.number ? \"numeric\" : \"string\"} value${\n variadic ? \"s\" : \"\"\n }`\n }.`;\n}\n\nexport function applyOptionsDefaults(ctx: ResolverContext) {\n return Object.fromEntries(\n Object.entries(ctx.output.options).map(([key, option]) => {\n const name = option.name || key;\n const title = option.title || titleCase(name);\n\n return [\n key,\n {\n ...option,\n name,\n title,\n description:\n option.description ||\n resolveCommandOptionDescription(\n name,\n option.kind,\n option.optional,\n option.kind !== CommandParameterKinds.boolean && option.variadic,\n title,\n option.default\n ),\n env:\n option.env || option.env === false\n ? option.env\n : ctx.input.context.config.autoAssignEnv\n ? constantCase(name)\n : false\n }\n ];\n })\n );\n}\n\nexport function applyArgsDefaults(ctx: ResolverContext): CommandArgument[] {\n return ctx.output.args.map((arg, i) => {\n const name = arg.name || `arg${i + 1}`;\n const title = arg.title || titleCase(name);\n\n return {\n ...arg,\n name,\n title,\n description:\n arg.description ||\n resolveCommandArgumentDescription(\n name,\n arg.kind,\n arg.optional,\n arg.kind !== CommandParameterKinds.boolean && arg.variadic,\n title,\n arg.default\n ),\n env: arg.name\n ? arg.env || arg.env === false\n ? arg.env\n : ctx.input.context.config.autoAssignEnv\n ? constantCase(name)\n : false\n : false\n };\n });\n}\n\nexport function applyDefaults(ctx: ResolverContext) {\n ctx.output.description ??= `The ${ctx.output.title.replace(/(?:c|C)ommands?$/, \"\").trim()} executable command-line interface.`;\n}\n\nexport function resolveVirtualCommand<TContext extends Context = Context>(\n ctx: ResolverContext<TContext>\n) {\n ctx.output.title ??= titleCase(ctx.input.command.name);\n ctx.output.description ??= `A collection of available ${\n ctx.output.title.replace(/(?:c|C)ommands?$/, \"\").trim() ||\n titleCase(ctx.input.command.name)\n } commands that are included in the ${getAppTitle(\n ctx.input.context,\n true\n )} command-line application.`;\n}\n\n/**\n * Merges two command parameters, giving precedence to string values in the second configuration.\n *\n * @param objA - The first command parameter object.\n * @param objB - The second command parameter object.\n * @returns The merged command parameter object.\n */\nexport const mergeCommandParameter = createDefu((obj, key, value) => {\n if (isString(obj[key]) && isString(value)) {\n if (isSetString(value)) {\n obj[key] = value;\n }\n\n return true;\n } else if (Array.isArray(obj[key]) && Array.isArray(value)) {\n if (value.length > 0) {\n obj[key] = getUniqueBy((obj[key] as unknown[]).concat(value), item =>\n isString(item) ? item : JSON.stringify(item)\n ) as (typeof obj)[typeof key];\n }\n\n return true;\n }\n\n return false;\n});\n"],"mappings":";;;;;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;;;;;;AAsCX,SAAE,gCAAA,MAAA,MAAA,WAAA,OAAA,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A;AAEQ,SAAO;YAEF,MAAM,QAAQ,IAAI,KAAK,IAAI,MAAE,QAAA,MAAA,EAAA;AAClC,MAAI,MAAM,SAAS;;;;;AAGnB,SAAI;;AAER,QAAO;GACR;CAAC;CAAO;CAAM;CAAA;CAAA;CAAA,CAAA,CAAA"}
|
package/dist/resolver/module.cjs
CHANGED
|
@@ -89,7 +89,7 @@ async function resolveFromExports(ctx) {
|
|
|
89
89
|
"param0",
|
|
90
90
|
"",
|
|
91
91
|
"P\"2!\"/\""
|
|
92
|
-
])));
|
|
92
|
+
])).concat(Object.entries(ctx.output.options)));
|
|
93
93
|
} else if (Object.values(ctx.module.options).every(require_type_checks.isCommandParameterConfig)) ctx.output.options = Object.fromEntries(Object.entries(ctx.module.options).map(__assignType(([name, option]) => [name, {
|
|
94
94
|
name,
|
|
95
95
|
...option,
|
|
@@ -98,7 +98,7 @@ async function resolveFromExports(ctx) {
|
|
|
98
98
|
"param0",
|
|
99
99
|
"",
|
|
100
100
|
"P\"2!\"/\""
|
|
101
|
-
])));
|
|
101
|
+
])).concat(Object.entries(ctx.output.options)));
|
|
102
102
|
else throw new TypeError(`Command options for command at path "${ctx.input.command.path}" must be defined as a record of valid CommandOption objects, a Zod object schema, or a standard JSON Schema object.`);
|
|
103
103
|
if ((0, __stryke_type_checks_is_set_object.isSetObject)(ctx.module?.args)) if ((0, __stryke_zod.isZod3Type)(ctx.module.args) || (0, __stryke_json.isStandardJsonSchema)(ctx.module.args) || (0, __stryke_json.isJsonSchema7TupleType)(ctx.module.args)) {
|
|
104
104
|
let jsonSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.cjs","names":[],"sources":["../../src/resolver/module.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 type {\n JsonSchema7EnumType,\n JsonSchema7ObjectType,\n JsonSchema7Type\n} from \"@stryke/json\";\nimport {\n isJsonSchema7ArrayType,\n isJsonSchema7BooleanType,\n isJsonSchema7NumberType,\n isJsonSchema7ObjectType,\n isJsonSchema7StringType,\n isJsonSchema7TupleType,\n isStandardJsonSchema\n} from \"@stryke/json\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { extractJsonSchema7, isZod3Type } from \"@stryke/zod\";\nimport { isCommandParameterConfig } from \"../plugin-utils\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandParameterConfig,\n Context,\n StringCommandParameter\n} from \"../types\";\nimport { CommandParameterKinds } from \"../types\";\nimport type { ResolverContext } from \"./types\";\n\nfunction resolveCommandOption(\n name: string,\n parent: JsonSchema7ObjectType,\n schema: JsonSchema7Type\n): Partial<CommandOption> {\n const result = {\n name,\n kind:\n isJsonSchema7ArrayType(schema) && schema.items\n ? isJsonSchema7NumberType(schema.items)\n ? CommandParameterKinds.number\n : CommandParameterKinds.string\n : isJsonSchema7BooleanType(schema)\n ? CommandParameterKinds.boolean\n : isJsonSchema7NumberType(schema)\n ? CommandParameterKinds.number\n : CommandParameterKinds.string,\n title: schema.title,\n description: schema.description,\n alias: toArray((schema as { alias?: string | string[] }).alias || []),\n env: (schema as { env?: string }).env,\n optional: !parent.required?.includes(name),\n default: schema.default\n } as Partial<CommandOption>;\n if (\n result.kind === CommandParameterKinds.string ||\n result.kind === CommandParameterKinds.number\n ) {\n result.variadic = isJsonSchema7ArrayType(schema);\n if (result.kind === CommandParameterKinds.string) {\n result.format = (\n schema as { format?: StringCommandParameter[\"format\"] }\n ).format;\n }\n\n if (\n (isJsonSchema7StringType(schema) || isJsonSchema7NumberType(schema)) &&\n (schema as JsonSchema7EnumType).enum\n ) {\n result.choices = (schema as JsonSchema7EnumType).enum;\n }\n } else if (result.kind === CommandParameterKinds.boolean) {\n result.skipAddingNegative = (\n schema as { skipAddingNegative?: boolean }\n ).skipAddingNegative;\n result.isNegativeOf = (schema as { isNegativeOf?: string }).isNegativeOf;\n }\n\n return result;\n}\n\nfunction resolveCommandArgument(\n schema: JsonSchema7Type\n): Partial<CommandArgument> {\n const result = {\n name: (schema as { name?: string }).name,\n kind:\n isJsonSchema7ArrayType(schema) && schema.items\n ? isJsonSchema7NumberType(schema.items)\n ? CommandParameterKinds.number\n : CommandParameterKinds.string\n : isJsonSchema7BooleanType(schema)\n ? CommandParameterKinds.boolean\n : isJsonSchema7NumberType(schema)\n ? CommandParameterKinds.number\n : CommandParameterKinds.string,\n title: schema.title,\n description: schema.description,\n alias: toArray((schema as { alias?: string | string[] }).alias || []),\n env: (schema as { env?: string }).env,\n default: schema.default\n } as Partial<CommandArgument>;\n if (\n result.kind === CommandParameterKinds.string ||\n result.kind === CommandParameterKinds.number\n ) {\n result.variadic = isJsonSchema7ArrayType(schema);\n if (result.kind === CommandParameterKinds.string) {\n result.format = (\n schema as { format?: StringCommandParameter[\"format\"] }\n ).format;\n }\n\n if (\n (isJsonSchema7StringType(schema) || isJsonSchema7NumberType(schema)) &&\n (schema as JsonSchema7EnumType).enum\n ) {\n result.choices = (schema as JsonSchema7EnumType).enum;\n }\n }\n\n return result;\n}\n\nexport async function resolveFromExports<TContext extends Context = Context>(\n ctx: ResolverContext<TContext>\n) {\n validateExports(ctx);\n\n const metadata = ctx.module?.metadata ?? {};\n if (isSetString(metadata.title)) {\n ctx.output.title = metadata.title;\n }\n if (isSetString(metadata.description)) {\n ctx.output.description = metadata.description;\n }\n if (\n isSetString(metadata.alias) ||\n (Array.isArray(metadata.alias) && metadata.alias.length > 0)\n ) {\n ctx.output.alias = toArray(metadata.alias);\n }\n if (isSetString(metadata.icon)) {\n ctx.output.icon = metadata.icon;\n }\n\n if (isSetObject(ctx.module?.options)) {\n if (\n isZod3Type(ctx.module.options) ||\n isStandardJsonSchema(ctx.module.options) ||\n isJsonSchema7ObjectType(ctx.module.options)\n ) {\n let jsonSchema: JsonSchema7Type;\n if (isZod3Type(ctx.module.options)) {\n jsonSchema = extractJsonSchema7(ctx.module.options);\n } else if (isStandardJsonSchema(ctx.module.options)) {\n jsonSchema = ctx.module.options[\"~standard\"].jsonSchema.input({\n target: \"draft-07\"\n });\n } else {\n jsonSchema = ctx.module.options as JsonSchema7ObjectType;\n }\n\n if (!isJsonSchema7ObjectType(jsonSchema)) {\n throw new TypeError(\n `Command options for command at path \"${\n ctx.input.command.path\n }\" must be defined as a Zod object schema, a standard JSON Schema object, or a JSON Schema object.`\n );\n }\n\n ctx.output.options = Object.fromEntries(\n Object.entries((jsonSchema as JsonSchema7ObjectType).properties).map(\n ([name, property]) => [\n name,\n resolveCommandOption(name, jsonSchema, property)\n ]\n )\n ) as Record<string, CommandOption>;\n } else if (\n Object.values(ctx.module.options).every(isCommandParameterConfig)\n ) {\n ctx.output.options = Object.fromEntries(\n Object.entries(\n ctx.module.options as Record<string, CommandParameterConfig>\n ).map(([name, option]) => [\n name,\n { name, ...option, alias: toArray(option.alias) }\n ])\n ) as Record<string, CommandOption>;\n } else {\n throw new TypeError(\n `Command options for command at path \"${\n ctx.input.command.path\n }\" must be defined as a record of valid CommandOption objects, a Zod object schema, or a standard JSON Schema object.`\n );\n }\n }\n\n if (isSetObject(ctx.module?.args)) {\n if (\n isZod3Type(ctx.module.args) ||\n isStandardJsonSchema(ctx.module.args) ||\n isJsonSchema7TupleType(ctx.module.args)\n ) {\n let jsonSchema: JsonSchema7Type;\n if (isZod3Type(ctx.module.args)) {\n jsonSchema = extractJsonSchema7(ctx.module.args);\n } else if (isStandardJsonSchema(ctx.module.args)) {\n jsonSchema = ctx.module.args[\"~standard\"].jsonSchema.input({\n target: \"draft-07\"\n });\n } else {\n jsonSchema = ctx.module.args;\n }\n\n if (!isJsonSchema7TupleType(jsonSchema)) {\n throw new TypeError(\n `Command arguments for command at path \"${\n ctx.input.command.path\n }\" must be defined as a Zod tuple schema, a standard JSON Schema tuple object, or a JSON Schema tuple object.`\n );\n }\n\n ctx.output.args = jsonSchema.items.map(item =>\n resolveCommandArgument(item)\n ) as CommandArgument[];\n } else if (Object.values(ctx.module.args).every(isCommandParameterConfig)) {\n ctx.output.args = ctx.module.args.map(arg => ({\n ...arg,\n alias: toArray(arg.alias)\n })) as CommandArgument[];\n } else {\n throw new TypeError(\n `Command arguments for command at path \"${\n ctx.input.command.path\n }\" must be defined as a record of valid CommandArgument objects, a Zod tuple schema, or a standard JSON Schema tuple object.`\n );\n }\n }\n}\n\nfunction validateExports<TContext extends Context = Context>(\n ctx: ResolverContext<TContext>\n) {\n if (!ctx.module) {\n throw new Error(\n `Command module at path \"${\n ctx.input.command.path\n }\" is undefined or null. Please ensure the module exports a valid command.`\n );\n } else if (!isSetObject(ctx.module)) {\n throw new TypeError(\n `Command module at path \"${\n ctx.input.command.path\n }\" is not an object. Please ensure the module exports a valid command.`\n );\n } else if (!(\"default\" in ctx.module)) {\n throw new Error(\n `Command module at path \"${\n ctx.input.command.path\n }\" does not appear to be valid. Please ensure the module's default export is a valid command handler function.`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA,MAAM,aAAa;CAAC;CAAK;CAAW;CAA2B;;AAE3D,IAAG,SAAS;;;AA2BhB,SAAS,qBAAgB,MAAA,QAAA,QAAA;CACrB,MAAM,SAAS;EACX;EACA,gDAAa,OAAA,IAAA,OAAA,mDACiB,OAAO,MAAM,GACjC,4CAAsB,SACtB,4CAAsB,qDACD,OAAO,GAClC,4CAAA,qDACK,OAAA,GACF,4CAAA,SACO,4CAAE;EAChB,OAAC,OAAA;EACD,aAAa,OAAE;EACf,8CAAS,OAAA,SAAA,EAAA,CAAA;EACT,KAA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AK,aAAC,WAAA,MAAA,EAC5C,QAAA,YACe,CAAC;;AAKX,MAAA,2CAAA,WAAA,CACS,OAAM,IAAI,UAAU,0CAAE,IAAA,MAAA,QAAA,KAAA,8GAAA;AAE1B,MAAI,OAAO,OAAO,WAAW,MAAM,IAAC,cAAA,SAAA,uBAAA,KAAA,EAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;YAE/B,OAAO,OAAO,IAAI,OAAE,KAAA,CAAA,MAAA,6CAAA,CACzB,KAAI,OAAO,OAAO,IAAI,OAAO,KAAC,IAAA,cAAA,SAAA;EAC1B,GAAG;EACH,8CAAe,IAAI,MAAK;EAC3B,GAAG;EAAC;EAAO;EAAI;EAAU,CAAC,CAAC;KAG5B,OAAC,IAAA,UAAA,0CAAA,IAAA,MAAA,QAAA,KAAA,6HAAA;;AAIb,mBAAmB,SAAS;CAAC;CAAmB;CAAA;CAAA;CAAA;AAChD,SAAS,gBAAgB,KAAE;AACvB,KAAI,CAAC,IAAI,OACL,OAAM,IAAI,MAAM,2BAAS,IAAA,MAAA,QAAA,KAAA,2EAAA;UAExB,qDAAA,IAAA,OAAA,CACH,OAAA,IAAA,UAAA,2BAAA,IAAA,MAAA,QAAA,KAAA,uEAAA;UAEO,EAAE,aAAa,IAAI,QACxB,OAAM,IAAI,MAAM,2BAA2B,IAAI,MAAM,QAAQ,KAAI,+GAAG;;AAG5E,gBAAgB,SAAS;CAAC;CAAmB;CAAO;CAAO;CAAA"}
|
|
1
|
+
{"version":3,"file":"module.cjs","names":[],"sources":["../../src/resolver/module.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 type {\n JsonSchema7EnumType,\n JsonSchema7ObjectType,\n JsonSchema7Type\n} from \"@stryke/json\";\nimport {\n isJsonSchema7ArrayType,\n isJsonSchema7BooleanType,\n isJsonSchema7NumberType,\n isJsonSchema7ObjectType,\n isJsonSchema7StringType,\n isJsonSchema7TupleType,\n isStandardJsonSchema\n} from \"@stryke/json\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { extractJsonSchema7, isZod3Type } from \"@stryke/zod\";\nimport { isCommandParameterConfig } from \"../plugin-utils\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandParameterConfig,\n Context,\n StringCommandParameter\n} from \"../types\";\nimport { CommandParameterKinds } from \"../types\";\nimport type { ResolverContext } from \"./types\";\n\nfunction resolveCommandOption(\n name: string,\n parent: JsonSchema7ObjectType,\n schema: JsonSchema7Type\n): Partial<CommandOption> {\n const result = {\n name,\n kind:\n isJsonSchema7ArrayType(schema) && schema.items\n ? isJsonSchema7NumberType(schema.items)\n ? CommandParameterKinds.number\n : CommandParameterKinds.string\n : isJsonSchema7BooleanType(schema)\n ? CommandParameterKinds.boolean\n : isJsonSchema7NumberType(schema)\n ? CommandParameterKinds.number\n : CommandParameterKinds.string,\n title: schema.title,\n description: schema.description,\n alias: toArray((schema as { alias?: string | string[] }).alias || []),\n env: (schema as { env?: string }).env,\n optional: !parent.required?.includes(name),\n default: schema.default\n } as Partial<CommandOption>;\n if (\n result.kind === CommandParameterKinds.string ||\n result.kind === CommandParameterKinds.number\n ) {\n result.variadic = isJsonSchema7ArrayType(schema);\n if (result.kind === CommandParameterKinds.string) {\n result.format = (\n schema as { format?: StringCommandParameter[\"format\"] }\n ).format;\n }\n\n if (\n (isJsonSchema7StringType(schema) || isJsonSchema7NumberType(schema)) &&\n (schema as JsonSchema7EnumType).enum\n ) {\n result.choices = (schema as JsonSchema7EnumType).enum;\n }\n } else if (result.kind === CommandParameterKinds.boolean) {\n result.skipAddingNegative = (\n schema as { skipAddingNegative?: boolean }\n ).skipAddingNegative;\n result.isNegativeOf = (schema as { isNegativeOf?: string }).isNegativeOf;\n }\n\n return result;\n}\n\nfunction resolveCommandArgument(\n schema: JsonSchema7Type\n): Partial<CommandArgument> {\n const result = {\n name: (schema as { name?: string }).name,\n kind:\n isJsonSchema7ArrayType(schema) && schema.items\n ? isJsonSchema7NumberType(schema.items)\n ? CommandParameterKinds.number\n : CommandParameterKinds.string\n : isJsonSchema7BooleanType(schema)\n ? CommandParameterKinds.boolean\n : isJsonSchema7NumberType(schema)\n ? CommandParameterKinds.number\n : CommandParameterKinds.string,\n title: schema.title,\n description: schema.description,\n alias: toArray((schema as { alias?: string | string[] }).alias || []),\n env: (schema as { env?: string }).env,\n default: schema.default\n } as Partial<CommandArgument>;\n if (\n result.kind === CommandParameterKinds.string ||\n result.kind === CommandParameterKinds.number\n ) {\n result.variadic = isJsonSchema7ArrayType(schema);\n if (result.kind === CommandParameterKinds.string) {\n result.format = (\n schema as { format?: StringCommandParameter[\"format\"] }\n ).format;\n }\n\n if (\n (isJsonSchema7StringType(schema) || isJsonSchema7NumberType(schema)) &&\n (schema as JsonSchema7EnumType).enum\n ) {\n result.choices = (schema as JsonSchema7EnumType).enum;\n }\n }\n\n return result;\n}\n\nexport async function resolveFromExports<TContext extends Context = Context>(\n ctx: ResolverContext<TContext>\n) {\n validateExports(ctx);\n\n const metadata = ctx.module?.metadata ?? {};\n if (isSetString(metadata.title)) {\n ctx.output.title = metadata.title;\n }\n if (isSetString(metadata.description)) {\n ctx.output.description = metadata.description;\n }\n if (\n isSetString(metadata.alias) ||\n (Array.isArray(metadata.alias) && metadata.alias.length > 0)\n ) {\n ctx.output.alias = toArray(metadata.alias);\n }\n if (isSetString(metadata.icon)) {\n ctx.output.icon = metadata.icon;\n }\n\n if (isSetObject(ctx.module?.options)) {\n if (\n isZod3Type(ctx.module.options) ||\n isStandardJsonSchema(ctx.module.options) ||\n isJsonSchema7ObjectType(ctx.module.options)\n ) {\n let jsonSchema: JsonSchema7Type;\n if (isZod3Type(ctx.module.options)) {\n jsonSchema = extractJsonSchema7(ctx.module.options);\n } else if (isStandardJsonSchema(ctx.module.options)) {\n jsonSchema = ctx.module.options[\"~standard\"].jsonSchema.input({\n target: \"draft-07\"\n });\n } else {\n jsonSchema = ctx.module.options as JsonSchema7ObjectType;\n }\n\n if (!isJsonSchema7ObjectType(jsonSchema)) {\n throw new TypeError(\n `Command options for command at path \"${\n ctx.input.command.path\n }\" must be defined as a Zod object schema, a standard JSON Schema object, or a JSON Schema object.`\n );\n }\n\n ctx.output.options = Object.fromEntries(\n Object.entries((jsonSchema as JsonSchema7ObjectType).properties)\n .map(([name, property]) => [\n name,\n resolveCommandOption(name, jsonSchema, property)\n ])\n .concat(Object.entries(ctx.output.options))\n ) as Record<string, CommandOption>;\n } else if (\n Object.values(ctx.module.options).every(isCommandParameterConfig)\n ) {\n ctx.output.options = Object.fromEntries(\n Object.entries(\n ctx.module.options as Record<string, CommandParameterConfig>\n )\n .map(([name, option]) => [\n name,\n { name, ...option, alias: toArray(option.alias) }\n ])\n .concat(Object.entries(ctx.output.options))\n ) as Record<string, CommandOption>;\n } else {\n throw new TypeError(\n `Command options for command at path \"${\n ctx.input.command.path\n }\" must be defined as a record of valid CommandOption objects, a Zod object schema, or a standard JSON Schema object.`\n );\n }\n }\n\n if (isSetObject(ctx.module?.args)) {\n if (\n isZod3Type(ctx.module.args) ||\n isStandardJsonSchema(ctx.module.args) ||\n isJsonSchema7TupleType(ctx.module.args)\n ) {\n let jsonSchema: JsonSchema7Type;\n if (isZod3Type(ctx.module.args)) {\n jsonSchema = extractJsonSchema7(ctx.module.args);\n } else if (isStandardJsonSchema(ctx.module.args)) {\n jsonSchema = ctx.module.args[\"~standard\"].jsonSchema.input({\n target: \"draft-07\"\n });\n } else {\n jsonSchema = ctx.module.args;\n }\n\n if (!isJsonSchema7TupleType(jsonSchema)) {\n throw new TypeError(\n `Command arguments for command at path \"${\n ctx.input.command.path\n }\" must be defined as a Zod tuple schema, a standard JSON Schema tuple object, or a JSON Schema tuple object.`\n );\n }\n\n ctx.output.args = jsonSchema.items.map(item =>\n resolveCommandArgument(item)\n ) as CommandArgument[];\n } else if (Object.values(ctx.module.args).every(isCommandParameterConfig)) {\n ctx.output.args = ctx.module.args.map(arg => ({\n ...arg,\n alias: toArray(arg.alias)\n })) as CommandArgument[];\n } else {\n throw new TypeError(\n `Command arguments for command at path \"${\n ctx.input.command.path\n }\" must be defined as a record of valid CommandArgument objects, a Zod tuple schema, or a standard JSON Schema tuple object.`\n );\n }\n }\n}\n\nfunction validateExports<TContext extends Context = Context>(\n ctx: ResolverContext<TContext>\n) {\n if (!ctx.module) {\n throw new Error(\n `Command module at path \"${\n ctx.input.command.path\n }\" is undefined or null. Please ensure the module exports a valid command.`\n );\n } else if (!isSetObject(ctx.module)) {\n throw new TypeError(\n `Command module at path \"${\n ctx.input.command.path\n }\" is not an object. Please ensure the module exports a valid command.`\n );\n } else if (!(\"default\" in ctx.module)) {\n throw new Error(\n `Command module at path \"${\n ctx.input.command.path\n }\" does not appear to be valid. Please ensure the module's default export is a valid command handler function.`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA,MAAM,aAAa;CAAC;CAAK;CAAW;CAA2B;;AAE3D,IAAG,SAAS;;;AA2BhB,SAAS,qBAAgB,MAAA,QAAA,QAAA;CACrB,MAAM,SAAS;EACX;EACA,gDAAa,OAAA,IAAA,OAAA,mDACiB,OAAO,MAAM,GACjC,4CAAsB,SACtB,4CAAsB,qDACD,OAAO,GAClC,4CAAA,qDACK,OAAA,GACF,4CAAA,SACO,4CAAE;EAChB,OAAC,OAAA;EACD,aAAa,OAAE;EACf,8CAAS,OAAA,SAAA,EAAA,CAAA;EACT,KAAK,OAAO;EACZ,UAAU,CAAC,OAAO,UAAU,S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A,sBAEe,CAAC;MAGF,cAAa,IAAI,OAAO;AAElC,MAAA,2CAAA,WAAA,CACU,OAAM,IAAI,UAAU,0CAAC,IAAA,MAAA,QAAA,KAAA,8GAAA;AAEzB,MAAI,OAAO,OAAO,WAAW,MAAM,IAAI,cAAQ,SAAA,uBAAA,KAAA,EAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;YAE1C,OAAO,OAAO,IAAI,OAAO,KAAK,CAAC,MAAM,6CAAgB,CAC1D,KAAI,OAAO,OAAI,IAAA,OAAA,KAAA,IAAA,cAAA,SAAA;EACjB,GAAA;EACG,8CAAA,IAAA,MAAA;EACA,GAAG;EAAC;EAAO;EAAI;EAAU,CAAC,CAAC;KAG5B,OAAM,IAAI,UAAU,0CAAgB,IAAA,MAAA,QAAA,KAAA,6HAAA;;AAIhD,mBAAmB,SAAS;CAAC;CAAmB;CAAO;CAAsB;CAAY;AACzF,SAAS,gBAAA,KAAA;AACL,KAAE,CAAA,IAAA;UAGO,qDAAa,IAAI,OAAO,CAC7B,OAAM,IAAI,UAAU,2BAAS,IAAA,MAAA,QAAA,KAAA,uEAAA;UAExB,EAAE,aAAa,IAAI,QACxB,OAAG,IAAA,MAAA,2BAAA,IAAA,MAAA,QAAA,KAAA,+GAAA;;AAGX,gBAAc,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
|
package/dist/resolver/module.mjs
CHANGED
|
@@ -88,7 +88,7 @@ async function resolveFromExports(ctx) {
|
|
|
88
88
|
"param0",
|
|
89
89
|
"",
|
|
90
90
|
"P\"2!\"/\""
|
|
91
|
-
])));
|
|
91
|
+
])).concat(Object.entries(ctx.output.options)));
|
|
92
92
|
} else if (Object.values(ctx.module.options).every(isCommandParameterConfig)) ctx.output.options = Object.fromEntries(Object.entries(ctx.module.options).map(__assignType(([name, option]) => [name, {
|
|
93
93
|
name,
|
|
94
94
|
...option,
|
|
@@ -97,7 +97,7 @@ async function resolveFromExports(ctx) {
|
|
|
97
97
|
"param0",
|
|
98
98
|
"",
|
|
99
99
|
"P\"2!\"/\""
|
|
100
|
-
])));
|
|
100
|
+
])).concat(Object.entries(ctx.output.options)));
|
|
101
101
|
else throw new TypeError(`Command options for command at path "${ctx.input.command.path}" must be defined as a record of valid CommandOption objects, a Zod object schema, or a standard JSON Schema object.`);
|
|
102
102
|
if (isSetObject(ctx.module?.args)) if (isZod3Type(ctx.module.args) || isStandardJsonSchema(ctx.module.args) || isJsonSchema7TupleType(ctx.module.args)) {
|
|
103
103
|
let jsonSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","names":[],"sources":["../../src/resolver/module.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 type {\n JsonSchema7EnumType,\n JsonSchema7ObjectType,\n JsonSchema7Type\n} from \"@stryke/json\";\nimport {\n isJsonSchema7ArrayType,\n isJsonSchema7BooleanType,\n isJsonSchema7NumberType,\n isJsonSchema7ObjectType,\n isJsonSchema7StringType,\n isJsonSchema7TupleType,\n isStandardJsonSchema\n} from \"@stryke/json\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { extractJsonSchema7, isZod3Type } from \"@stryke/zod\";\nimport { isCommandParameterConfig } from \"../plugin-utils\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandParameterConfig,\n Context,\n StringCommandParameter\n} from \"../types\";\nimport { CommandParameterKinds } from \"../types\";\nimport type { ResolverContext } from \"./types\";\n\nfunction resolveCommandOption(\n name: string,\n parent: JsonSchema7ObjectType,\n schema: JsonSchema7Type\n): Partial<CommandOption> {\n const result = {\n name,\n kind:\n isJsonSchema7ArrayType(schema) && schema.items\n ? isJsonSchema7NumberType(schema.items)\n ? CommandParameterKinds.number\n : CommandParameterKinds.string\n : isJsonSchema7BooleanType(schema)\n ? CommandParameterKinds.boolean\n : isJsonSchema7NumberType(schema)\n ? CommandParameterKinds.number\n : CommandParameterKinds.string,\n title: schema.title,\n description: schema.description,\n alias: toArray((schema as { alias?: string | string[] }).alias || []),\n env: (schema as { env?: string }).env,\n optional: !parent.required?.includes(name),\n default: schema.default\n } as Partial<CommandOption>;\n if (\n result.kind === CommandParameterKinds.string ||\n result.kind === CommandParameterKinds.number\n ) {\n result.variadic = isJsonSchema7ArrayType(schema);\n if (result.kind === CommandParameterKinds.string) {\n result.format = (\n schema as { format?: StringCommandParameter[\"format\"] }\n ).format;\n }\n\n if (\n (isJsonSchema7StringType(schema) || isJsonSchema7NumberType(schema)) &&\n (schema as JsonSchema7EnumType).enum\n ) {\n result.choices = (schema as JsonSchema7EnumType).enum;\n }\n } else if (result.kind === CommandParameterKinds.boolean) {\n result.skipAddingNegative = (\n schema as { skipAddingNegative?: boolean }\n ).skipAddingNegative;\n result.isNegativeOf = (schema as { isNegativeOf?: string }).isNegativeOf;\n }\n\n return result;\n}\n\nfunction resolveCommandArgument(\n schema: JsonSchema7Type\n): Partial<CommandArgument> {\n const result = {\n name: (schema as { name?: string }).name,\n kind:\n isJsonSchema7ArrayType(schema) && schema.items\n ? isJsonSchema7NumberType(schema.items)\n ? CommandParameterKinds.number\n : CommandParameterKinds.string\n : isJsonSchema7BooleanType(schema)\n ? CommandParameterKinds.boolean\n : isJsonSchema7NumberType(schema)\n ? CommandParameterKinds.number\n : CommandParameterKinds.string,\n title: schema.title,\n description: schema.description,\n alias: toArray((schema as { alias?: string | string[] }).alias || []),\n env: (schema as { env?: string }).env,\n default: schema.default\n } as Partial<CommandArgument>;\n if (\n result.kind === CommandParameterKinds.string ||\n result.kind === CommandParameterKinds.number\n ) {\n result.variadic = isJsonSchema7ArrayType(schema);\n if (result.kind === CommandParameterKinds.string) {\n result.format = (\n schema as { format?: StringCommandParameter[\"format\"] }\n ).format;\n }\n\n if (\n (isJsonSchema7StringType(schema) || isJsonSchema7NumberType(schema)) &&\n (schema as JsonSchema7EnumType).enum\n ) {\n result.choices = (schema as JsonSchema7EnumType).enum;\n }\n }\n\n return result;\n}\n\nexport async function resolveFromExports<TContext extends Context = Context>(\n ctx: ResolverContext<TContext>\n) {\n validateExports(ctx);\n\n const metadata = ctx.module?.metadata ?? {};\n if (isSetString(metadata.title)) {\n ctx.output.title = metadata.title;\n }\n if (isSetString(metadata.description)) {\n ctx.output.description = metadata.description;\n }\n if (\n isSetString(metadata.alias) ||\n (Array.isArray(metadata.alias) && metadata.alias.length > 0)\n ) {\n ctx.output.alias = toArray(metadata.alias);\n }\n if (isSetString(metadata.icon)) {\n ctx.output.icon = metadata.icon;\n }\n\n if (isSetObject(ctx.module?.options)) {\n if (\n isZod3Type(ctx.module.options) ||\n isStandardJsonSchema(ctx.module.options) ||\n isJsonSchema7ObjectType(ctx.module.options)\n ) {\n let jsonSchema: JsonSchema7Type;\n if (isZod3Type(ctx.module.options)) {\n jsonSchema = extractJsonSchema7(ctx.module.options);\n } else if (isStandardJsonSchema(ctx.module.options)) {\n jsonSchema = ctx.module.options[\"~standard\"].jsonSchema.input({\n target: \"draft-07\"\n });\n } else {\n jsonSchema = ctx.module.options as JsonSchema7ObjectType;\n }\n\n if (!isJsonSchema7ObjectType(jsonSchema)) {\n throw new TypeError(\n `Command options for command at path \"${\n ctx.input.command.path\n }\" must be defined as a Zod object schema, a standard JSON Schema object, or a JSON Schema object.`\n );\n }\n\n ctx.output.options = Object.fromEntries(\n Object.entries((jsonSchema as JsonSchema7ObjectType).properties).map(\n ([name, property]) => [\n name,\n resolveCommandOption(name, jsonSchema, property)\n ]\n )\n ) as Record<string, CommandOption>;\n } else if (\n Object.values(ctx.module.options).every(isCommandParameterConfig)\n ) {\n ctx.output.options = Object.fromEntries(\n Object.entries(\n ctx.module.options as Record<string, CommandParameterConfig>\n ).map(([name, option]) => [\n name,\n { name, ...option, alias: toArray(option.alias) }\n ])\n ) as Record<string, CommandOption>;\n } else {\n throw new TypeError(\n `Command options for command at path \"${\n ctx.input.command.path\n }\" must be defined as a record of valid CommandOption objects, a Zod object schema, or a standard JSON Schema object.`\n );\n }\n }\n\n if (isSetObject(ctx.module?.args)) {\n if (\n isZod3Type(ctx.module.args) ||\n isStandardJsonSchema(ctx.module.args) ||\n isJsonSchema7TupleType(ctx.module.args)\n ) {\n let jsonSchema: JsonSchema7Type;\n if (isZod3Type(ctx.module.args)) {\n jsonSchema = extractJsonSchema7(ctx.module.args);\n } else if (isStandardJsonSchema(ctx.module.args)) {\n jsonSchema = ctx.module.args[\"~standard\"].jsonSchema.input({\n target: \"draft-07\"\n });\n } else {\n jsonSchema = ctx.module.args;\n }\n\n if (!isJsonSchema7TupleType(jsonSchema)) {\n throw new TypeError(\n `Command arguments for command at path \"${\n ctx.input.command.path\n }\" must be defined as a Zod tuple schema, a standard JSON Schema tuple object, or a JSON Schema tuple object.`\n );\n }\n\n ctx.output.args = jsonSchema.items.map(item =>\n resolveCommandArgument(item)\n ) as CommandArgument[];\n } else if (Object.values(ctx.module.args).every(isCommandParameterConfig)) {\n ctx.output.args = ctx.module.args.map(arg => ({\n ...arg,\n alias: toArray(arg.alias)\n })) as CommandArgument[];\n } else {\n throw new TypeError(\n `Command arguments for command at path \"${\n ctx.input.command.path\n }\" must be defined as a record of valid CommandArgument objects, a Zod tuple schema, or a standard JSON Schema tuple object.`\n );\n }\n }\n}\n\nfunction validateExports<TContext extends Context = Context>(\n ctx: ResolverContext<TContext>\n) {\n if (!ctx.module) {\n throw new Error(\n `Command module at path \"${\n ctx.input.command.path\n }\" is undefined or null. Please ensure the module exports a valid command.`\n );\n } else if (!isSetObject(ctx.module)) {\n throw new TypeError(\n `Command module at path \"${\n ctx.input.command.path\n }\" is not an object. Please ensure the module exports a valid command.`\n );\n } else if (!(\"default\" in ctx.module)) {\n throw new Error(\n `Command module at path \"${\n ctx.input.command.path\n }\" does not appear to be valid. Please ensure the module's default export is a valid command handler function.`\n );\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,MAAM,aAAa;CAAC;CAAK;CAAW;CAA2B;;AAE3D,IAAG,SAAS;;;AA2BhB,SAAS,qBAAgB,MAAA,QAAA,QAAA;CACrB,MAAM,SAAS;EACX;EACA,MAAM,uBAAO,OAAA,IAAA,OAAA,QACP,wBAAwB,OAAO,MAAM,GACjC,sBAAsB,SACtB,sBAAsB,SAC1B,yBAAyB,OAAO,GAClC,sBAAA,UACK,wBAAA,OAAA,GACF,sBAAA,SACO,sBAAE;EAChB,OAAC,OAAA;EACD,aAAa,OAAE;EACf,OAAO,QAAE,OAAA,SAAA,EAAA,CAAA;EACT,KAAK,OAAO;EACZ,UAAU,CAAC,OAAO,UAAU,SAAS,KAAC;;EAEzC;AACD,KAAI,OAAM,SAAA,sBAAA,UACN,OAAO,SAAS,sBAAO,QAAA;AACvB,SAAO,WAAS,uBAAA,OAAA;AAChB,MAAI,OAAO,SAAO,sBAAA,OACd,QAAK,SAAA,OAAA;AAET,OAAA,wBAAA,OAAA,IAAA,wBAAA,OAAA,KACI,OAAO,KACP,QAAO,UAAU,OAAO;YAGvB,OAAO,SAAS,sBAAY,SAAA;AACjC,SAAO,qBAAqB,OAAI;AAChC,SAAO,eAAe,OAAO;;AAEjC,QAAO;;AAEX,qBAAqB,SAAS;CAAC;CAAI;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA;AACnC,SAAS,uBAAuB,QAAQ;CACpC,MAAM,SAAS;EACX,MAAM,OAAO;EACb,MAAM,uBAAY,OAAA,IAAA,OAAA,QACZ,wBAAe,OAAA,MAAA,GACxB,sBAAA,SACa,sBAAsB,SAC1B,yBAAyB,OAAO,GA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I;EAAU,CAAC,CAAC;KAG5B,OAAC,IAAA,UAAA,0CAAA,IAAA,MAAA,QAAA,KAAA,6HAAA;;AAIb,mBAAmB,SAAS;CAAC;CAAmB;CAAA;CAAA;CAAA;AAChD,SAAS,gBAAgB,KAAE;AACvB,KAAI,CAAC,IAAI,OACL,OAAM,IAAI,MAAM,2BAAS,IAAA,MAAA,QAAA,KAAA,2EAAA;UAExB,CAAA,YAAA,IAAA,OAAA,CACH,OAAA,IAAA,UAAA,2BAAA,IAAA,MAAA,QAAA,KAAA,uEAAA;UAEO,EAAE,aAAa,IAAI,QACxB,OAAM,IAAI,MAAM,2BAA2B,IAAI,MAAM,QAAQ,KAAI,+GAAG;;AAG5E,gBAAgB,SAAS;CAAC;CAAmB;CAAO;CAAO;CAAA"}
|
|
1
|
+
{"version":3,"file":"module.mjs","names":[],"sources":["../../src/resolver/module.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 type {\n JsonSchema7EnumType,\n JsonSchema7ObjectType,\n JsonSchema7Type\n} from \"@stryke/json\";\nimport {\n isJsonSchema7ArrayType,\n isJsonSchema7BooleanType,\n isJsonSchema7NumberType,\n isJsonSchema7ObjectType,\n isJsonSchema7StringType,\n isJsonSchema7TupleType,\n isStandardJsonSchema\n} from \"@stryke/json\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { extractJsonSchema7, isZod3Type } from \"@stryke/zod\";\nimport { isCommandParameterConfig } from \"../plugin-utils\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandParameterConfig,\n Context,\n StringCommandParameter\n} from \"../types\";\nimport { CommandParameterKinds } from \"../types\";\nimport type { ResolverContext } from \"./types\";\n\nfunction resolveCommandOption(\n name: string,\n parent: JsonSchema7ObjectType,\n schema: JsonSchema7Type\n): Partial<CommandOption> {\n const result = {\n name,\n kind:\n isJsonSchema7ArrayType(schema) && schema.items\n ? isJsonSchema7NumberType(schema.items)\n ? CommandParameterKinds.number\n : CommandParameterKinds.string\n : isJsonSchema7BooleanType(schema)\n ? CommandParameterKinds.boolean\n : isJsonSchema7NumberType(schema)\n ? CommandParameterKinds.number\n : CommandParameterKinds.string,\n title: schema.title,\n description: schema.description,\n alias: toArray((schema as { alias?: string | string[] }).alias || []),\n env: (schema as { env?: string }).env,\n optional: !parent.required?.includes(name),\n default: schema.default\n } as Partial<CommandOption>;\n if (\n result.kind === CommandParameterKinds.string ||\n result.kind === CommandParameterKinds.number\n ) {\n result.variadic = isJsonSchema7ArrayType(schema);\n if (result.kind === CommandParameterKinds.string) {\n result.format = (\n schema as { format?: StringCommandParameter[\"format\"] }\n ).format;\n }\n\n if (\n (isJsonSchema7StringType(schema) || isJsonSchema7NumberType(schema)) &&\n (schema as JsonSchema7EnumType).enum\n ) {\n result.choices = (schema as JsonSchema7EnumType).enum;\n }\n } else if (result.kind === CommandParameterKinds.boolean) {\n result.skipAddingNegative = (\n schema as { skipAddingNegative?: boolean }\n ).skipAddingNegative;\n result.isNegativeOf = (schema as { isNegativeOf?: string }).isNegativeOf;\n }\n\n return result;\n}\n\nfunction resolveCommandArgument(\n schema: JsonSchema7Type\n): Partial<CommandArgument> {\n const result = {\n name: (schema as { name?: string }).name,\n kind:\n isJsonSchema7ArrayType(schema) && schema.items\n ? isJsonSchema7NumberType(schema.items)\n ? CommandParameterKinds.number\n : CommandParameterKinds.string\n : isJsonSchema7BooleanType(schema)\n ? CommandParameterKinds.boolean\n : isJsonSchema7NumberType(schema)\n ? CommandParameterKinds.number\n : CommandParameterKinds.string,\n title: schema.title,\n description: schema.description,\n alias: toArray((schema as { alias?: string | string[] }).alias || []),\n env: (schema as { env?: string }).env,\n default: schema.default\n } as Partial<CommandArgument>;\n if (\n result.kind === CommandParameterKinds.string ||\n result.kind === CommandParameterKinds.number\n ) {\n result.variadic = isJsonSchema7ArrayType(schema);\n if (result.kind === CommandParameterKinds.string) {\n result.format = (\n schema as { format?: StringCommandParameter[\"format\"] }\n ).format;\n }\n\n if (\n (isJsonSchema7StringType(schema) || isJsonSchema7NumberType(schema)) &&\n (schema as JsonSchema7EnumType).enum\n ) {\n result.choices = (schema as JsonSchema7EnumType).enum;\n }\n }\n\n return result;\n}\n\nexport async function resolveFromExports<TContext extends Context = Context>(\n ctx: ResolverContext<TContext>\n) {\n validateExports(ctx);\n\n const metadata = ctx.module?.metadata ?? {};\n if (isSetString(metadata.title)) {\n ctx.output.title = metadata.title;\n }\n if (isSetString(metadata.description)) {\n ctx.output.description = metadata.description;\n }\n if (\n isSetString(metadata.alias) ||\n (Array.isArray(metadata.alias) && metadata.alias.length > 0)\n ) {\n ctx.output.alias = toArray(metadata.alias);\n }\n if (isSetString(metadata.icon)) {\n ctx.output.icon = metadata.icon;\n }\n\n if (isSetObject(ctx.module?.options)) {\n if (\n isZod3Type(ctx.module.options) ||\n isStandardJsonSchema(ctx.module.options) ||\n isJsonSchema7ObjectType(ctx.module.options)\n ) {\n let jsonSchema: JsonSchema7Type;\n if (isZod3Type(ctx.module.options)) {\n jsonSchema = extractJsonSchema7(ctx.module.options);\n } else if (isStandardJsonSchema(ctx.module.options)) {\n jsonSchema = ctx.module.options[\"~standard\"].jsonSchema.input({\n target: \"draft-07\"\n });\n } else {\n jsonSchema = ctx.module.options as JsonSchema7ObjectType;\n }\n\n if (!isJsonSchema7ObjectType(jsonSchema)) {\n throw new TypeError(\n `Command options for command at path \"${\n ctx.input.command.path\n }\" must be defined as a Zod object schema, a standard JSON Schema object, or a JSON Schema object.`\n );\n }\n\n ctx.output.options = Object.fromEntries(\n Object.entries((jsonSchema as JsonSchema7ObjectType).properties)\n .map(([name, property]) => [\n name,\n resolveCommandOption(name, jsonSchema, property)\n ])\n .concat(Object.entries(ctx.output.options))\n ) as Record<string, CommandOption>;\n } else if (\n Object.values(ctx.module.options).every(isCommandParameterConfig)\n ) {\n ctx.output.options = Object.fromEntries(\n Object.entries(\n ctx.module.options as Record<string, CommandParameterConfig>\n )\n .map(([name, option]) => [\n name,\n { name, ...option, alias: toArray(option.alias) }\n ])\n .concat(Object.entries(ctx.output.options))\n ) as Record<string, CommandOption>;\n } else {\n throw new TypeError(\n `Command options for command at path \"${\n ctx.input.command.path\n }\" must be defined as a record of valid CommandOption objects, a Zod object schema, or a standard JSON Schema object.`\n );\n }\n }\n\n if (isSetObject(ctx.module?.args)) {\n if (\n isZod3Type(ctx.module.args) ||\n isStandardJsonSchema(ctx.module.args) ||\n isJsonSchema7TupleType(ctx.module.args)\n ) {\n let jsonSchema: JsonSchema7Type;\n if (isZod3Type(ctx.module.args)) {\n jsonSchema = extractJsonSchema7(ctx.module.args);\n } else if (isStandardJsonSchema(ctx.module.args)) {\n jsonSchema = ctx.module.args[\"~standard\"].jsonSchema.input({\n target: \"draft-07\"\n });\n } else {\n jsonSchema = ctx.module.args;\n }\n\n if (!isJsonSchema7TupleType(jsonSchema)) {\n throw new TypeError(\n `Command arguments for command at path \"${\n ctx.input.command.path\n }\" must be defined as a Zod tuple schema, a standard JSON Schema tuple object, or a JSON Schema tuple object.`\n );\n }\n\n ctx.output.args = jsonSchema.items.map(item =>\n resolveCommandArgument(item)\n ) as CommandArgument[];\n } else if (Object.values(ctx.module.args).every(isCommandParameterConfig)) {\n ctx.output.args = ctx.module.args.map(arg => ({\n ...arg,\n alias: toArray(arg.alias)\n })) as CommandArgument[];\n } else {\n throw new TypeError(\n `Command arguments for command at path \"${\n ctx.input.command.path\n }\" must be defined as a record of valid CommandArgument objects, a Zod tuple schema, or a standard JSON Schema tuple object.`\n );\n }\n }\n}\n\nfunction validateExports<TContext extends Context = Context>(\n ctx: ResolverContext<TContext>\n) {\n if (!ctx.module) {\n throw new Error(\n `Command module at path \"${\n ctx.input.command.path\n }\" is undefined or null. Please ensure the module exports a valid command.`\n );\n } else if (!isSetObject(ctx.module)) {\n throw new TypeError(\n `Command module at path \"${\n ctx.input.command.path\n }\" is not an object. Please ensure the module exports a valid command.`\n );\n } else if (!(\"default\" in ctx.module)) {\n throw new Error(\n `Command module at path \"${\n ctx.input.command.path\n }\" does not appear to be valid. Please ensure the module's default export is a valid command handler function.`\n );\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,MAAM,aAAa;CAAC;CAAK;CAAW;CAA2B;;AAE3D,IAAG,SAAS;;;AA2BhB,SAAS,qBAAgB,MAAA,QAAA,QAAA;CACrB,MAAM,SAAS;EACX;EACA,MAAM,uBAAO,OAAA,IAAA,OAAA,QACP,wBAAwB,OAAO,MAAM,GACjC,sBAAsB,SACtB,sBAAsB,SAC1B,yBAAyB,OAAO,GAClC,sBAAA,UACK,wBAAA,OAAA,GACF,sBAAA,SACO,sBAAE;EAChB,OAAC,OAAA;EACD,aAAa,OAAE;EACf,OAAO,QAAE,OAAA,SAAA,EAAA,CAAA;EACT,KAAK,OAAO;EACZ,UAAU,CAAC,OAAO,UAAU,SAAS,KAAC;;EAEzC;AACD,KAAI,OAAM,SAAA,sBAAA,UACN,OAAO,SAAS,sBAAO,QAAA;AACvB,SAAO,WAAS,uBAAA,OAAA;AAChB,MAAI,OAAO,SAAO,sBAAA,OACd,QAAK,SAAA,OAAA;AAET,OAAA,wBAAA,OAAA,IAAA,wBAAA,OAAA,KACI,OAAO,KACP,QAAO,UAAU,OAAO;YAGvB,OAAO,SAAS,sBAAY,SAAA;AACjC,SAAO,qBAAqB,OAAI;AAChC,SAAO,eAAe,OAAO;;AAEjC,QAAO;;AAEX,qBAAqB,SAAS;CAAC;CAAI;CAAA;OAAA;CAAA;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;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;YAE1C,OAAO,OAAO,IAAI,OAAO,KAAK,CAAC,MAAM,yBAAgB,CAC1D,KAAI,OAAO,OAAI,IAAA,OAAA,KAAA,IAAA,cAAA,SAAA;EACjB,GAAA;EACG,OAAA,QAAA,IAAA,MAAA;EACA,GAAG;EAAC;EAAO;EAAI;EAAU,CAAC,CAAC;KAG5B,OAAM,IAAI,UAAU,0CAAgB,IAAA,MAAA,QAAA,KAAA,6HAAA;;AAIhD,mBAAmB,SAAS;CAAC;CAAmB;CAAO;CAAsB;CAAY;AACzF,SAAS,gBAAA,KAAA;AACL,KAAE,CAAA,IAAA;UAGO,CAAC,YAAY,IAAI,OAAO,CAC7B,OAAM,IAAI,UAAU,2BAAS,IAAA,MAAA,QAAA,KAAA,uEAAA;UAExB,EAAE,aAAa,IAAI,QACxB,OAAG,IAAA,MAAA,2BAAA,IAAA,MAAA,QAAA,KAAA,+GAAA;;AAGX,gBAAc,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/core",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing the core Shell Shock functionality used to build and manage a command-line application.",
|
|
6
6
|
"repository": {
|
|
@@ -338,12 +338,12 @@
|
|
|
338
338
|
"@alloy-js/core": "0.23.0-dev.8",
|
|
339
339
|
"@alloy-js/markdown": "0.23.0-dev.1",
|
|
340
340
|
"@alloy-js/typescript": "0.23.0-dev.4",
|
|
341
|
-
"@powerlines/deepkit": "^0.6.
|
|
342
|
-
"@powerlines/plugin-alloy": "^0.24.
|
|
343
|
-
"@powerlines/plugin-automd": "^0.1.
|
|
344
|
-
"@powerlines/plugin-deepkit": "^0.11.
|
|
345
|
-
"@powerlines/plugin-nodejs": "^0.1.
|
|
346
|
-
"@powerlines/plugin-tsdown": "^0.1.
|
|
341
|
+
"@powerlines/deepkit": "^0.6.93",
|
|
342
|
+
"@powerlines/plugin-alloy": "^0.24.5",
|
|
343
|
+
"@powerlines/plugin-automd": "^0.1.314",
|
|
344
|
+
"@powerlines/plugin-deepkit": "^0.11.193",
|
|
345
|
+
"@powerlines/plugin-nodejs": "^0.1.233",
|
|
346
|
+
"@powerlines/plugin-tsdown": "^0.1.265",
|
|
347
347
|
"@standard-schema/spec": "^1.1.0",
|
|
348
348
|
"@standard-schema/utils": "^0.3.0",
|
|
349
349
|
"@stryke/cli": "^0.13.22",
|
|
@@ -359,16 +359,16 @@
|
|
|
359
359
|
"automd": "^0.4.3",
|
|
360
360
|
"defu": "^6.1.4",
|
|
361
361
|
"json-schema": "^0.4.0",
|
|
362
|
-
"powerlines": "^0.
|
|
362
|
+
"powerlines": "^0.40.1",
|
|
363
363
|
"rolldown": "1.0.0-rc.6"
|
|
364
364
|
},
|
|
365
365
|
"devDependencies": {
|
|
366
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
366
|
+
"@powerlines/plugin-plugin": "^0.12.265",
|
|
367
367
|
"@types/json-schema": "^7.0.15",
|
|
368
|
-
"@types/node": "^25.3.
|
|
368
|
+
"@types/node": "^25.3.5",
|
|
369
369
|
"typescript": "^5.9.3",
|
|
370
370
|
"zod": "^4.3.6"
|
|
371
371
|
},
|
|
372
372
|
"publishConfig": { "access": "public" },
|
|
373
|
-
"gitHead": "
|
|
373
|
+
"gitHead": "72aca0879750bcb186d5101569dcbdbd3276be10"
|
|
374
374
|
}
|