@shell-shock/core 0.10.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.
Files changed (161) hide show
  1. package/dist/components/docs.cjs +4 -4
  2. package/dist/components/docs.cjs.map +1 -1
  3. package/dist/components/docs.d.cts +5 -5
  4. package/dist/components/docs.d.cts.map +1 -1
  5. package/dist/components/docs.d.mts +5 -5
  6. package/dist/components/docs.d.mts.map +1 -1
  7. package/dist/components/helpers.cjs +9 -0
  8. package/dist/components/helpers.cjs.map +1 -1
  9. package/dist/components/helpers.d.cts +15 -7
  10. package/dist/components/helpers.d.cts.map +1 -1
  11. package/dist/components/helpers.d.mts +15 -7
  12. package/dist/components/helpers.d.mts.map +1 -1
  13. package/dist/components/helpers.mjs +9 -1
  14. package/dist/components/helpers.mjs.map +1 -1
  15. package/dist/components/index.cjs +1 -0
  16. package/dist/components/index.d.cts +2 -2
  17. package/dist/components/index.d.mts +2 -2
  18. package/dist/components/index.mjs +2 -2
  19. package/dist/components/options-parser-logic.cjs +167 -87
  20. package/dist/components/options-parser-logic.cjs.map +1 -1
  21. package/dist/components/options-parser-logic.d.cts +15 -15
  22. package/dist/components/options-parser-logic.d.cts.map +1 -1
  23. package/dist/components/options-parser-logic.d.mts +15 -15
  24. package/dist/components/options-parser-logic.d.mts.map +1 -1
  25. package/dist/components/options-parser-logic.mjs +163 -83
  26. package/dist/components/options-parser-logic.mjs.map +1 -1
  27. package/dist/components/usage.cjs +5 -5
  28. package/dist/components/usage.cjs.map +1 -1
  29. package/dist/components/usage.d.cts +2 -2
  30. package/dist/components/usage.d.cts.map +1 -1
  31. package/dist/components/usage.d.mts +2 -2
  32. package/dist/components/usage.mjs +4 -4
  33. package/dist/components/usage.mjs.map +1 -1
  34. package/dist/components/utils-builtin.cjs +2 -2
  35. package/dist/components/utils-builtin.cjs.map +1 -1
  36. package/dist/components/utils-builtin.d.cts +9 -9
  37. package/dist/components/utils-builtin.d.cts.map +1 -1
  38. package/dist/components/utils-builtin.d.mts +9 -9
  39. package/dist/components/utils-builtin.d.mts.map +1 -1
  40. package/dist/components/utils-builtin.mjs +5 -5
  41. package/dist/components/utils-builtin.mjs.map +1 -1
  42. package/dist/contexts/options.cjs +2 -2
  43. package/dist/contexts/options.cjs.map +1 -1
  44. package/dist/contexts/options.d.cts +1 -1
  45. package/dist/contexts/options.d.cts.map +1 -1
  46. package/dist/contexts/options.d.mts +1 -1
  47. package/dist/contexts/options.d.mts.map +1 -1
  48. package/dist/contexts/options.mjs +4 -4
  49. package/dist/contexts/options.mjs.map +1 -1
  50. package/dist/helpers/automd.cjs +2 -2
  51. package/dist/helpers/automd.cjs.map +1 -1
  52. package/dist/helpers/automd.mjs.map +1 -1
  53. package/dist/helpers/paths.cjs +125 -0
  54. package/dist/helpers/paths.cjs.map +1 -0
  55. package/dist/helpers/paths.mjs +121 -0
  56. package/dist/helpers/paths.mjs.map +1 -0
  57. package/dist/helpers/persistence.cjs +68 -116
  58. package/dist/helpers/persistence.cjs.map +1 -1
  59. package/dist/helpers/persistence.mjs +68 -116
  60. package/dist/helpers/persistence.mjs.map +1 -1
  61. package/dist/helpers/update-package-json.cjs +4 -4
  62. package/dist/helpers/update-package-json.cjs.map +1 -1
  63. package/dist/helpers/utilities.cjs +1 -1
  64. package/dist/helpers/utilities.mjs +1 -1
  65. package/dist/helpers/validations.cjs +2 -3
  66. package/dist/helpers/validations.cjs.map +1 -1
  67. package/dist/helpers/validations.mjs +2 -2
  68. package/dist/helpers/validations.mjs.map +1 -1
  69. package/dist/index.cjs +14 -11
  70. package/dist/index.d.cts +2 -2
  71. package/dist/index.d.mts +2 -2
  72. package/dist/index.mjs +3 -3
  73. package/dist/plugin-utils/deepkit.cjs +72 -0
  74. package/dist/plugin-utils/deepkit.cjs.map +1 -0
  75. package/dist/plugin-utils/deepkit.d.cts +24 -0
  76. package/dist/plugin-utils/deepkit.d.cts.map +1 -0
  77. package/dist/plugin-utils/deepkit.d.mts +24 -0
  78. package/dist/plugin-utils/deepkit.d.mts.map +1 -0
  79. package/dist/plugin-utils/deepkit.mjs +70 -0
  80. package/dist/plugin-utils/deepkit.mjs.map +1 -0
  81. package/dist/plugin-utils/description-helpers.cjs +105 -0
  82. package/dist/plugin-utils/description-helpers.cjs.map +1 -0
  83. package/dist/plugin-utils/description-helpers.d.cts +44 -0
  84. package/dist/plugin-utils/description-helpers.d.cts.map +1 -0
  85. package/dist/plugin-utils/description-helpers.d.mts +44 -0
  86. package/dist/plugin-utils/description-helpers.d.mts.map +1 -0
  87. package/dist/plugin-utils/description-helpers.mjs +101 -0
  88. package/dist/plugin-utils/description-helpers.mjs.map +1 -0
  89. package/dist/plugin-utils/get-command-tree.cjs +2 -2
  90. package/dist/plugin-utils/get-command-tree.cjs.map +1 -1
  91. package/dist/plugin-utils/index.cjs +32 -18
  92. package/dist/plugin-utils/index.d.cts +4 -1
  93. package/dist/plugin-utils/index.d.mts +4 -1
  94. package/dist/plugin-utils/index.mjs +4 -1
  95. package/dist/plugin-utils/reflect.cjs +4 -5
  96. package/dist/plugin-utils/reflect.cjs.map +1 -1
  97. package/dist/plugin-utils/reflect.mjs +4 -4
  98. package/dist/plugin-utils/reflect.mjs.map +1 -1
  99. package/dist/plugin-utils/type-checks.cjs +89 -0
  100. package/dist/plugin-utils/type-checks.cjs.map +1 -0
  101. package/dist/plugin-utils/type-checks.d.cts +42 -0
  102. package/dist/plugin-utils/type-checks.d.cts.map +1 -0
  103. package/dist/plugin-utils/type-checks.d.mts +42 -0
  104. package/dist/plugin-utils/type-checks.d.mts.map +1 -0
  105. package/dist/plugin-utils/type-checks.mjs +84 -0
  106. package/dist/plugin-utils/type-checks.mjs.map +1 -0
  107. package/dist/plugin.cjs +31 -29
  108. package/dist/plugin.cjs.map +1 -1
  109. package/dist/plugin.d.cts.map +1 -1
  110. package/dist/plugin.d.mts.map +1 -1
  111. package/dist/plugin.mjs +15 -13
  112. package/dist/plugin.mjs.map +1 -1
  113. package/dist/resolver/deepkit.cjs +132 -0
  114. package/dist/resolver/deepkit.cjs.map +1 -0
  115. package/dist/resolver/deepkit.mjs +131 -0
  116. package/dist/resolver/deepkit.mjs.map +1 -0
  117. package/dist/resolver/helpers.cjs +167 -0
  118. package/dist/resolver/helpers.cjs.map +1 -0
  119. package/dist/resolver/helpers.mjs +162 -0
  120. package/dist/resolver/helpers.mjs.map +1 -0
  121. package/dist/resolver/module.cjs +144 -0
  122. package/dist/resolver/module.cjs.map +1 -0
  123. package/dist/resolver/module.mjs +143 -0
  124. package/dist/resolver/module.mjs.map +1 -0
  125. package/dist/resolver/resolve.cjs +209 -0
  126. package/dist/resolver/resolve.cjs.map +1 -0
  127. package/dist/resolver/resolve.mjs +208 -0
  128. package/dist/resolver/resolve.mjs.map +1 -0
  129. package/dist/types/command.cjs +127 -104
  130. package/dist/types/command.cjs.map +1 -1
  131. package/dist/types/command.d.cts +39 -78
  132. package/dist/types/command.d.cts.map +1 -1
  133. package/dist/types/command.d.mts +39 -78
  134. package/dist/types/command.d.mts.map +1 -1
  135. package/dist/types/command.mjs +115 -95
  136. package/dist/types/command.mjs.map +1 -1
  137. package/dist/types/config.cjs +5 -3
  138. package/dist/types/config.cjs.map +1 -1
  139. package/dist/types/config.d.cts +7 -3
  140. package/dist/types/config.d.cts.map +1 -1
  141. package/dist/types/config.d.mts +7 -3
  142. package/dist/types/config.d.mts.map +1 -1
  143. package/dist/types/config.mjs +5 -3
  144. package/dist/types/config.mjs.map +1 -1
  145. package/dist/types/context.cjs +1 -1
  146. package/dist/types/context.cjs.map +1 -1
  147. package/dist/types/context.d.cts +2 -2
  148. package/dist/types/context.d.cts.map +1 -1
  149. package/dist/types/context.d.mts +2 -2
  150. package/dist/types/context.d.mts.map +1 -1
  151. package/dist/types/context.mjs +1 -1
  152. package/dist/types/context.mjs.map +1 -1
  153. package/dist/types/index.cjs +13 -10
  154. package/dist/types/index.d.cts +2 -2
  155. package/dist/types/index.d.mts +2 -2
  156. package/dist/types/index.mjs +2 -2
  157. package/package.json +24 -75
  158. package/dist/helpers/resolve-command.cjs +0 -430
  159. package/dist/helpers/resolve-command.cjs.map +0 -1
  160. package/dist/helpers/resolve-command.mjs +0 -425
  161. package/dist/helpers/resolve-command.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"persistence.mjs","names":[],"sources":["../../src/helpers/persistence.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ReflectionClass } from \"@powerlines/deepkit/vendor/type\";\nimport {\n deserializeType,\n ReflectionFunction,\n ReflectionKind,\n resolveClassType,\n serializeType\n} from \"@powerlines/deepkit/vendor/type\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandTree,\n SerializedCommandOption,\n SerializedCommandTree\n} from \"../types\";\nimport type { Context } from \"../types/context\";\n\nexport function getCommandsPersistencePath(context: Context): string {\n return joinPaths(context.dataPath, \"reflections\", \"commands.json\");\n}\n\nexport function serializedCommandTree(\n commands: Record<string, CommandTree>\n): Record<string, SerializedCommandTree> {\n const serialize = (\n node: CommandTree,\n parent: string | null = null\n ): SerializedCommandTree => {\n const serializedNode: SerializedCommandTree = {\n ...node,\n options: Object.entries(node.options).reduce(\n (ret, [key, option]) => {\n ret[key] = {\n ...omit(option, [\"reflection\"])\n };\n return ret;\n },\n {} as Record<string, SerializedCommandOption>\n ),\n arguments: node.arguments.map(arg => ({\n ...omit(arg, [\"reflection\"])\n })),\n parent,\n children: {},\n reflection: node.reflection\n ? serializeType(node.reflection.type)\n : undefined\n };\n\n for (const [key, child] of Object.entries(node.children || {})) {\n serializedNode.children[key] = serialize(child, node.id);\n }\n\n return serializedNode;\n };\n\n const result: Record<string, SerializedCommandTree> = {};\n for (const [key, child] of Object.entries(commands)) {\n result[key] = serialize(child, null);\n }\n\n return result;\n}\n\nexport function deserializeCommandTree(\n serializedCommands: Record<string, SerializedCommandTree>\n): Record<string, CommandTree> {\n const deserialize = (\n node: SerializedCommandTree,\n parent: CommandTree | null = null\n ): CommandTree => {\n const type = deserializeType(node.reflection);\n if (type.kind !== ReflectionKind.function) {\n throw new Error(\n `Failed to deserialize persisted data - invalid command handler reflection type for command ${node.id}`\n );\n }\n\n const reflection = new ReflectionFunction(type);\n\n let optionsReflection: ReflectionClass<any> | undefined;\n if (\n reflection.getParameters().length > 0 &&\n reflection.getParameters()[0]\n ) {\n const optionsType = reflection.getParameters()[0]!.type;\n if (optionsType.kind === ReflectionKind.objectLiteral) {\n optionsReflection = resolveClassType(optionsType);\n }\n }\n\n const deserializedNode: CommandTree = {\n ...node,\n options: optionsReflection\n ? Object.entries(node.options).reduce(\n (ret, [key, option]) => {\n ret[key] = {\n ...option,\n reflection: optionsReflection.getProperty(option.name)\n } as CommandOption;\n return ret;\n },\n {} as Record<string, CommandOption>\n )\n : {},\n arguments: node.arguments.map((arg, i) => ({\n ...arg,\n reflection:\n reflection.getParameters().length > i + 1\n ? reflection.getParameters()[i + 1]\n : reflection.getParameterOrUndefined(arg.name)\n })) as CommandArgument[],\n parent,\n children: {},\n reflection\n };\n\n for (const [key, child] of Object.entries(node.children || {})) {\n deserializedNode.children[key] = deserialize(child, deserializedNode);\n }\n\n return deserializedNode;\n };\n\n const result: Record<string, CommandTree> = {};\n for (const [key, child] of Object.entries(serializedCommands)) {\n result[key] = deserialize(child, null);\n }\n\n return result;\n}\n\nexport async function readCommandsPersistence(context: Context) {\n const reflections = await context.fs.read(\n getCommandsPersistencePath(context)\n );\n if (!reflections || !reflections.length) {\n throw new Error(\n `CLI Command reflection file ${getCommandsPersistencePath(context)} is empty`\n );\n }\n\n context.commands = deserializeCommandTree(JSON.parse(reflections));\n}\n\nexport async function writeCommandsPersistence(context: Context) {\n const filePath = getCommandsPersistencePath(context);\n\n await context.fs.write(\n filePath,\n JSON.stringify(\n serializedCommandTree(context.commands),\n null,\n context.config.mode === \"development\" ? 2 : 0\n )\n );\n}\n"],"mappings":";;;;;AAAA,MAAM,YAAY;CAAC;CAAK;CAAK;CAAU;CAAyB;;AAE5D,IAAG,SAAS;;;;AAOZ,QAAO,UAAU,QAAQ,UAAU,eAAY,gBAAA;;AAEnD,2BAA2B,SAAS;CAAC;CAAW;CAAW;CAAkB;CAAA;AAC7E,SAAgB,sBAAsB,UAAU;;EAExC,MAAM,iBAAiB;;GAEnB,SAAS,OAAO,QAAQ,KAAK,QAAQ,CAAC,OAAO,cAAa,KAAA,CAAA,KAAA,YAAA;iBAElD,GAAG,KAAK,QAAQ,CAAC,aAAa,CAAA,EAC3C;AACS,WAAC;MACF;IAAC;IAAI;IAAA;IAAA;IAAA,CAAA,EAAA,EAAA,CAAA;GACR,WAAI,KAAA,UAAA,IAAA,cAAA,SAAA,EACA,GAAE,KAAA,KAAA,CAAA,aAAA,CAAA,EACL,GAAC;IAAA;IAAA;IAAA;IAAA,CAAA,CAAA;GACF;GACA,UAAU,EAAE;GACZ,YAAY,KAAK,aACjB,cAAA,KAAA,WAAA,KAAA,GACK;GACR;AACD,OAAK,MAAA,CAAA,KAAA,UAAA,OAAA,QAAA,KAAA,YAAA,EAAA,CAAA,CACD,gBAAa,SAAA,OAAA,UAAA,OAAA,KAAA,GAAA;AAEjB,SAAO;IACR;EAAC;EAAe;EAAQ;QAAgB;EAAA;EAAA;EAAA;EAAA,CAAA;;AAE3C,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,SAAS,CAC/C,QAAO,OAAO,UAAU,OAAO,KAAK;;;AAI5C,sBAAsB,SAAS;OAAO;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA;AACtC,SAAgB,uBAAuB,oBAAE;CACrC,MAAM,cAAU,cAAA,MAAA,SAAA,SAAA;EACZ,MAAM,OAAO,gBAAA,KAAA,WAAA;AACb,MAAI,KAAK,SAAS,eAAK,SACnB,OAAM,IAAI,MAAM,8FAAE,KAAA,KAAA;EAEtB,MAAK,aAAA,IAAA,mBAAA,KAAA;EACL,IAAI;AACJ,MAAI,WAAW,eAAS,CAAA,SAAA,KACpB,WAAS,eAAA,CAAA,IAAA;GACT,MAAM,cAAc,WAAU,eAAA,CAAA,GAAA;AAC/B,OAAA,YAAA,SAAA,eAAA,cACK,qBAAI,iBAAA,YAAA;;EAGb,MAAA,mBAAA;GACK,GAAG;GACH,SAAS,oBACZ,OAAA,QAAA,KAAA,QAAA,CAAA,OAAA,cAAA,KAAA,CAAA,KAAA,YAAA;AACG,QAAA,OAAA;KACM,GAAA;KACM,YAAQ,kBAAA,YAAA,OAAA,KAAA;KACX;AACH,WAAA;MACb;IAAA;IAAA;IAAA;IAAA;IAAA,CAAA,EAAA,EAAA,CAAA;GAEO,WAAW,KAAK,UAAU,IAAI,cAAc,KAAK,OAAO;IACpD,GAAG;IACf,YAAA,WAAA,eAAA,CAAA,SAAA,IAAA,wCAEkB,WAAG,wBAAA,IAAA,KAAA;IACtB,GAAA;IAAA;IAAA;IAAA;IAAA;IAAA,CAAA,CAAA;;GAES,UAAU,EAAE;GACZ;GACH;AACP,OAAA,MAAA,CAAA,KAAA,UAAA,OAAA,QAAA,KAAA,YAAA,EAAA,CAAA;AAGF,SAAA;;;;;;;;;;CAEI,MAAM,SAAS,EAAE;AACjB,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,mBAAY,CAClD,QAAO,OAAO,YAAS,OAAA,KAAA;AAE3B,QAAO;;AAEX,uBAAoB,SAAA;OAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA;AACpB,eAAsB,wBAAwB,SAAG;CAC7C,MAAM,cAAc,MAAM,QAAQ,GAAG,KAAK,2BAAC,QAAA,CAAA;AAC3C,KAAI,CAAC,eAAY,CAAA,YAAA,OACb,OAAM,IAAI,MAAM,+BAA+B,2BAA2B,QAAQ,CAAA,WAAY;AAElG,SAAA,WAAA,uBAAA,KAAA,MAAA,YAAA,CAAA;;AAEJ,wBAAwB,SAAS;CAAC;CAAW;CAAM;CAAA;CAAA;;CAE/C,MAAM,WAAW,2BAA2B,QAAQ;AACpD,OAAG,QAAA,GAAA,MAAA,UAAA,KAAA,UAAA,sBAAA,QAAA,SAAA,EAAA,MAAA,QAAA,OAAA,SAAA,gBAAA,IAAA,EAAA,CAAA;;AAEP,yBAAyB,SAAS;CAAA;CAAA;CAAA;CAAA;CAAA"}
1
+ {"version":3,"file":"persistence.mjs","names":[],"sources":["../../src/helpers/persistence.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport type { CommandTree, SerializedCommandTree } from \"../types\";\nimport type { Context } from \"../types/context\";\n\nfunction serialize(command: CommandTree): SerializedCommandTree {\n return {\n ...command,\n parent: command.parent?.name ? command.parent.name : null,\n children: Object.fromEntries(\n Object.entries(command.children || {}).map(([name, child]) => [\n name,\n serialize(child)\n ])\n )\n };\n}\n\nfunction deserialize(\n command: SerializedCommandTree,\n parent: CommandTree | null = null\n): CommandTree {\n const result: CommandTree = {\n ...command,\n parent: parent ?? null,\n children: {}\n };\n\n result.children = Object.fromEntries(\n Object.entries(command.children || {}).map(([name, child]) => [\n name,\n deserialize(child, result)\n ])\n );\n\n return result;\n}\n\n/**\n * Gets the file path for persisting CLI command reflections.\n *\n * @param context - The Shell Shock context.\n * @returns The file path for persisting CLI command reflections.\n */\nexport function getCommandsPersistencePath(context: Context): string {\n return joinPaths(context.dataPath, \"reflections\", \"commands.json\");\n}\n\n/**\n * Reads the persisted CLI command reflections from the file system and populates the context's commands.\n *\n * @param context - The Shell Shock context.\n * @throws Will throw an error if the reflections file is empty or cannot be read.\n */\nexport async function readCommandsPersistence(context: Context) {\n const reflections = await context.fs.read(\n getCommandsPersistencePath(context)\n );\n if (!reflections || !reflections.length) {\n throw new Error(\n `CLI Command reflection file ${getCommandsPersistencePath(context)} is empty`\n );\n }\n\n context.commands = Object.fromEntries(\n Object.entries(\n (JSON.parse(reflections) ?? {}) as Record<string, SerializedCommandTree>\n ).map(([name, command]) => [name, deserialize(command)])\n );\n}\n\n/**\n * Writes the current CLI command reflections from the context to the file system for persistence.\n *\n * @param context - The Shell Shock context.\n * @returns A promise that resolves when the reflections have been successfully written to the file system.\n * @throws Will throw an error if there is an issue writing the reflections to the file system.\n */\nexport async function writeCommandsPersistence(context: Context) {\n const filePath = getCommandsPersistencePath(context);\n\n await context.fs.write(\n filePath,\n JSON.stringify(\n Object.fromEntries(\n Object.entries(context.commands).map(([name, command]) => [\n name,\n serialize(command)\n ])\n ),\n null,\n context.config.mode === \"production\" ? 0 : 2\n )\n );\n}\n"],"mappings":";;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;AAoBX,SAAS,UAAU,SAAS;AACxB,QAAK;EACD,GAAG;EACH,QAAQ,QAAQ,QAAQ,OAAO,QAAQ,OAAO,OAAO;EACrD,UAAU,OAAO,YAAO,OAAA,QAAA,QAAA,YAAA,EAAA,CAAA,CAAA,IAAA,cAAA,CAAA,MAAA,WAAA,CACpB,MACA,UAAA,MAAA,CACH,EAAE;GAAC;GAAU;GAAC;GAAA,CAAA,CAAA,CAAA;EAClB;;AAEL,UAAG,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AACH,SAAA,YAAA,SAAA,SAAA,MAAA;;EAEQ,GAAG;EACH,QAAQ,UAAU;EAClB,UAAU,EAAC;EACd;AACD,QAAO,WAAW,OAAO,YAAC,OAAA,QAAA,QAAA,YAAA,EAAA,CAAA,CAAA,IAAA,cAAA,CAAA,MAAA,WAAA,CACtB,MACA,YAAY,OAAM,OAAA,CACrB,EAAE;EAAC;EAAO;EAAA;EAAA,CAAA,CAAA,CAAA;AACZ,QAAA;;AAEH,YAAY,SAAS;CAAC;CAAgB;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;;;;;;;AAOtC,SAAe,2BAAA,SAAA;AACf,QAAA,UAAA,QAAA,UAAA,eAAA,gBAAA;;AAEA,2BAAE,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOF,eAAsB,wBAAwB,SAAS;CACvD,MAAA,cAAA,MAAA,QAAA,GAAA,KAAA,2BAAA,QAAA,CAAA;yCAEE,OAAA,IAAA,MAAA,+BAAA,2BAAA,QAAA,CAAA,WAAA;AAED,SAAA,WAAA,OAAA,YAAA,OAAA,QAAA,KAAA,MAAA,YAAA,IAAA,EAAA,CAAA,CAAA,IAAA,cAAA,CAAA,MAAA,aAAA,CAAA,MAAA,YAAA,QAAA,CAAA,EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA;;AAED,wBAAwB,SAAS;CAAC;CAAW;CAAW;CAAyB;CAAA;;;;;;;;AAQjF,eAAsB,yBAAyB,SAAS;CACpD,MAAC,WAAA,2BAAA,QAAA;AACH,OAAA,QAAA,GAAA,MAAA,UAAA,KAAA,UAAA,OAAA,YAAA,OAAA,QAAA,QAAA,SAAA,CAAA,IAAA,cAAA,CAAA,MAAA,aAAA,OAEM,UAAU,QAAQ,CACrB,EAAE;EAAC;EAAU;EAAA;EAAA,CAAA,CAAA,CAAA,EAAA,MAAA,QAAA,OAAA,SAAA,eAAA,IAAA,EAAA,CAAA;;AAElB,yBAAyB,SAAS;CAAC;CAAW;CAAW;CAAE;CAAA"}
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- const require_plugin_utils_context_helpers = require('../plugin-utils/context-helpers.cjs');
2
+ const require_context_helpers = require('../plugin-utils/context-helpers.cjs');
3
3
  let __stryke_convert_to_array = require("@stryke/convert/to-array");
4
4
  let __stryke_path_join_paths = require("@stryke/path/join-paths");
5
5
  let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
@@ -31,9 +31,9 @@ async function updatePackageJsonBinary(context) {
31
31
  await context.fs.write(packageJsonPath, __stryke_json_storm_json.StormJSON.stringify(context.packageJson));
32
32
  } else {
33
33
  if (Array.isArray(context.config.output.format) && context.config.output.format.length > 1) {
34
- context.packageJson.bin = { [(0, __stryke_string_format_kebab_case.kebabCase)(require_plugin_utils_context_helpers.getAppName(context))]: formatBinaryPath((0, __stryke_convert_to_array.toArray)(context.config.output.format)[0]) };
34
+ context.packageJson.bin = { [(0, __stryke_string_format_kebab_case.kebabCase)(require_context_helpers.getAppName(context))]: formatBinaryPath((0, __stryke_convert_to_array.toArray)(context.config.output.format)[0]) };
35
35
  context.packageJson.bin = (0, __stryke_convert_to_array.toArray)(context.config.output.format).reduce(__assignType((ret, format) => {
36
- ret[`${(0, __stryke_string_format_kebab_case.kebabCase)(require_plugin_utils_context_helpers.getAppName(context))}-${format}`] = formatBinaryPath(format);
36
+ ret[`${(0, __stryke_string_format_kebab_case.kebabCase)(require_context_helpers.getAppName(context))}-${format}`] = formatBinaryPath(format);
37
37
  return ret;
38
38
  }, [
39
39
  "ret",
@@ -41,7 +41,7 @@ async function updatePackageJsonBinary(context) {
41
41
  "",
42
42
  "P\"2!\"2\"\"/#"
43
43
  ]), context.packageJson.bin);
44
- } else context.packageJson.bin = { [(0, __stryke_string_format_kebab_case.kebabCase)(require_plugin_utils_context_helpers.getAppName(context))]: formatBinaryPath(context.config.output.format) };
44
+ } else context.packageJson.bin = { [(0, __stryke_string_format_kebab_case.kebabCase)(require_context_helpers.getAppName(context))]: formatBinaryPath(context.config.output.format) };
45
45
  await context.fs.write(packageJsonPath, __stryke_json_storm_json.StormJSON.stringify(context.packageJson));
46
46
  }
47
47
  if (!(0, __stryke_type_checks_is_set_object.isSetObject)(context.packageJson.bin)) throw new Error("Unable to determine the CLI binary name. Please specify the `bin` option in your Shell Shock configuration or ensure that the `name` field is set in your package.json.");
@@ -1 +1 @@
1
- {"version":3,"file":"update-package-json.cjs","names":[],"sources":["../../src/helpers/update-package-json.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { getAppName } from \"../plugin-utils/context-helpers\";\nimport type { UnresolvedContext } from \"../types/context\";\n\nexport function formatBinaryPath(\n format: string | string[] | undefined\n): string {\n return `./dist/bin.${\n format === \"cjs\" || (Array.isArray(format) && format.includes(\"cjs\"))\n ? \"cjs\"\n : \"mjs\"\n }`;\n}\n\nexport async function updatePackageJsonBinary(\n context: UnresolvedContext\n): Promise<void> {\n const packageJsonPath = joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n \"package.json\"\n );\n if (\n context.config.bin &&\n Array.isArray(context.config.bin) &&\n context.config.bin.length > 0\n ) {\n context.packageJson.bin = Object.fromEntries(\n getUnique(toArray(context.config.bin)).map(bin => [\n bin,\n formatBinaryPath(context.config.output.format)\n ])\n );\n\n await context.fs.write(\n packageJsonPath,\n StormJSON.stringify(context.packageJson)\n );\n } else {\n if (\n Array.isArray(context.config.output.format) &&\n context.config.output.format.length > 1\n ) {\n context.packageJson.bin = {\n [kebabCase(getAppName(context))]: formatBinaryPath(\n toArray(context.config.output.format)[0]\n )\n };\n context.packageJson.bin = toArray(context.config.output.format).reduce(\n (ret, format) => {\n ret[`${kebabCase(getAppName(context))}-${format}`] =\n formatBinaryPath(format);\n\n return ret;\n },\n context.packageJson.bin\n );\n } else {\n context.packageJson.bin = {\n [kebabCase(getAppName(context))]: formatBinaryPath(\n context.config.output.format\n )\n };\n }\n\n await context.fs.write(\n packageJsonPath,\n StormJSON.stringify(context.packageJson)\n );\n }\n\n if (!isSetObject(context.packageJson.bin)) {\n throw new Error(\n \"Unable to determine the CLI binary name. Please specify the `bin` option in your Shell Shock configuration or ensure that the `name` field is set in your package.json.\"\n );\n }\n\n context.config.bin = Object.keys(context.packageJson.bin);\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;AA0BX,SAAgB,iBAAiB,QAAK;AAClC,QAAM,cAAA,WAAA,SAAA,MAAA,QAAA,OAAA,IAAA,OAAA,SAAA,MAAA,GACA,QACA;;AAEV,iBAAY,SAAA;CAAA;CAAA;CAAA;CAAA;AACZ,eAAI,wBAAA,SAAA;CACJ,MAAA,0DAAA,QAAA,gBAAA,eAAA,QAAA,OAAA,MAAA,eAAA;2BAEQ,MAAM,QAAQ,QAAQ,OAAO,IAAI,IACjC,QAAQ,OAAO,IAAI,SAAA,GAAA;AACnB,UAAQ,YAAC,MAAA,OAAA,8FAAA,QAAA,OAAA,IAAA,CAAA,CAAA,IAAA,cAAA,QAAA,CACL,KACA,iBAAiB,QAAQ,OAAI,OAAA,OAAA,CAChC,EAAE;GAAC;GAAO;GAAI;GAAA,CAAA,CAAA,CAAA;AACf,QAAM,QAAG,GAAA,MAAA,iBAAA,mCAAA,UAAA,QAAA,YAAA,CAAA;QAEZ;AACG,MAAI,MAAM,QAAM,QAAA,OAAA,OAAA,OAAA,IACZ,QAAQ,OAAO,OAAO,OAAK,SAAA,GAAA;AAC3B,WAAQ,YAAY,MAAA,oDAC5B,gDAAA,QAAA,CAAA,GAAA,wDAAA,QAAA,OAAA,OAAA,OAAA,CAAA,GAAA,EACS;AACD,WAAQ,YAAY,6CAAc,QAAQ,OAAE,OAAA,OAAA,CAAA,OAAA,cAAA,KAAA,WAAA;AAC7C,QAAA,oDAAA,gDAAA,QAAA,CAAA,CAAA,GAAA,YACS,iBAAiB,OAAO;AACrC,WAAA;MACF;IAAA;IAAA;IAAA;IAAA;IAAA,CAAA,EAAA,QAAA,YAAA,IAAA;QAGO,SAAQ,YAAC,MAAA,oDACM,gDAAW,QAAO,CAAA,GAAA,iBAAA,QAAA,OAAA,OAAA,OAAA,EACxC;AAEE,QAAA,QAAA,GAAA,MAAA,iBAAA,mCAAA,UAAA,QAAA,YAAA,CAAA;;AAEH,KAAI,qDAAa,QAAQ,YAAY,IAAG,CACtC,OAAA,IAAA,MAAA,0KAAA;AAEF,SAAQ,OAAO,MAAM,OAAO,KAAK,QAAQ,YAAY,IAAC;;AAE1D,wBAAQ,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
1
+ {"version":3,"file":"update-package-json.cjs","names":[],"sources":["../../src/helpers/update-package-json.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { getAppName } from \"../plugin-utils/context-helpers\";\nimport type { UnresolvedContext } from \"../types/context\";\n\nexport function formatBinaryPath(\n format: string | string[] | undefined\n): string {\n return `./dist/bin.${\n format === \"cjs\" || (Array.isArray(format) && format.includes(\"cjs\"))\n ? \"cjs\"\n : \"mjs\"\n }`;\n}\n\nexport async function updatePackageJsonBinary(\n context: UnresolvedContext\n): Promise<void> {\n const packageJsonPath = joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n \"package.json\"\n );\n if (\n context.config.bin &&\n Array.isArray(context.config.bin) &&\n context.config.bin.length > 0\n ) {\n context.packageJson.bin = Object.fromEntries(\n getUnique(toArray(context.config.bin)).map(bin => [\n bin,\n formatBinaryPath(context.config.output.format)\n ])\n );\n\n await context.fs.write(\n packageJsonPath,\n StormJSON.stringify(context.packageJson)\n );\n } else {\n if (\n Array.isArray(context.config.output.format) &&\n context.config.output.format.length > 1\n ) {\n context.packageJson.bin = {\n [kebabCase(getAppName(context))]: formatBinaryPath(\n toArray(context.config.output.format)[0]\n )\n };\n context.packageJson.bin = toArray(context.config.output.format).reduce(\n (ret, format) => {\n ret[`${kebabCase(getAppName(context))}-${format}`] =\n formatBinaryPath(format);\n\n return ret;\n },\n context.packageJson.bin\n );\n } else {\n context.packageJson.bin = {\n [kebabCase(getAppName(context))]: formatBinaryPath(\n context.config.output.format\n )\n };\n }\n\n await context.fs.write(\n packageJsonPath,\n StormJSON.stringify(context.packageJson)\n );\n }\n\n if (!isSetObject(context.packageJson.bin)) {\n throw new Error(\n \"Unable to determine the CLI binary name. Please specify the `bin` option in your Shell Shock configuration or ensure that the `name` field is set in your package.json.\"\n );\n }\n\n context.config.bin = Object.keys(context.packageJson.bin);\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;AA0BX,SAAgB,iBAAiB,QAAK;AAClC,QAAM,cAAA,WAAA,SAAA,MAAA,QAAA,OAAA,IAAA,OAAA,SAAA,MAAA,GACA,QACA;;AAEV,iBAAY,SAAA;CAAA;CAAA;CAAA;CAAA;AACZ,eAAI,wBAAA,SAAA;CACJ,MAAA,0DAAA,QAAA,gBAAA,eAAA,QAAA,OAAA,MAAA,eAAA;2BAEQ,MAAM,QAAQ,QAAQ,OAAO,IAAI,IACjC,QAAQ,OAAO,IAAI,SAAA,GAAA;AACnB,UAAQ,YAAC,MAAA,OAAA,8FAAA,QAAA,OAAA,IAAA,CAAA,CAAA,IAAA,cAAA,QAAA,CACL,KACA,iBAAiB,QAAQ,OAAI,OAAA,OAAA,CAChC,EAAE;GAAC;GAAO;GAAI;GAAA,CAAA,CAAA,CAAA;AACf,QAAM,QAAG,GAAA,MAAA,iBAAA,mCAAA,UAAA,QAAA,YAAA,CAAA;QAEZ;AACG,MAAI,MAAM,QAAM,QAAA,OAAA,OAAA,OAAA,IACZ,QAAQ,OAAO,OAAO,OAAK,SAAA,GAAA;AAC3B,WAAQ,YAAY,MAAA,oDAC5B,mCAAA,QAAA,CAAA,GAAA,wDAAA,QAAA,OAAA,OAAA,OAAA,CAAA,GAAA,EACS;AACD,WAAQ,YAAY,6CAAc,QAAQ,OAAE,OAAA,OAAA,CAAA,OAAA,cAAA,KAAA,WAAA;AAC7C,QAAA,oDAAA,mCAAA,QAAA,CAAA,CAAA,GAAA,YACS,iBAAiB,OAAO;AACrC,WAAA;MACF;IAAA;IAAA;IAAA;IAAA;IAAA,CAAA,EAAA,QAAA,YAAA,IAAA;QAGO,SAAQ,YAAC,MAAA,oDACM,mCAAW,QAAO,CAAA,GAAA,iBAAA,QAAA,OAAA,OAAA,OAAA,EACxC;AAEE,QAAA,QAAA,GAAA,MAAA,iBAAA,mCAAA,UAAA,QAAA,YAAA,CAAA;;AAEH,KAAI,qDAAa,QAAQ,YAAY,IAAG,CACtC,OAAA,IAAA,MAAA,0KAAA;AAEF,SAAQ,OAAO,MAAM,OAAO,KAAK,QAAQ,YAAY,IAAC;;AAE1D,wBAAQ,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  let __stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
3
- let __stryke_cli_utils_tree = require("@stryke/cli/utils/tree");
4
3
  let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
4
+ let __stryke_cli_utils_tree = require("@stryke/cli/utils/tree");
5
5
  let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
6
6
 
7
7
  //#region src/helpers/utilities.ts
@@ -1,6 +1,6 @@
1
1
  import { constantCase } from "@stryke/string-format/constant-case";
2
- import { formatTree } from "@stryke/cli/utils/tree";
3
2
  import { getUniqueBy } from "@stryke/helpers/get-unique";
3
+ import { formatTree } from "@stryke/cli/utils/tree";
4
4
  import { isFunction } from "@stryke/type-checks/is-function";
5
5
 
6
6
  //#region src/helpers/utilities.ts
@@ -1,5 +1,4 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
1
+ const require_types_command = require('../types/command.cjs');
3
2
 
4
3
  //#region src/helpers/validations.ts
5
4
  const __ΩValidationFailure = [
@@ -11,7 +10,7 @@ const __ΩValidationFailure = [
11
10
  function validateArguments(command) {
12
11
  const failures = [];
13
12
  let sequential = false;
14
- for (const argument of command.arguments ?? []) if ((argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || argument.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) && argument.variadic) if (!sequential) sequential = true;
13
+ for (const argument of command.args ?? []) if ((argument.kind === require_types_command.CommandParameterKinds.string || argument.kind === require_types_command.CommandParameterKinds.number) && argument.variadic) if (!sequential) sequential = true;
15
14
  else failures.push({
16
15
  code: "SEQUENTIAL_VARIADIC_ARGUMENTS",
17
16
  details: `Sequential variadic arguments are not allowed - since the argument preceding ${argument.name} is variadic, it must not also be variadic.`
@@ -1 +1 @@
1
- {"version":3,"file":"validations.cjs","names":[],"sources":["../../src/helpers/validations.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport type { CommandTree } from \"../types\";\n\nexport interface ValidationFailure {\n code: string;\n details: string;\n}\n\nexport function validateArguments(command: CommandTree): ValidationFailure[] {\n const failures: ValidationFailure[] = [];\n\n let sequential = false;\n for (const argument of command.arguments ?? []) {\n if (\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n ) {\n if (!sequential) {\n sequential = true;\n } else {\n failures.push({\n code: \"SEQUENTIAL_VARIADIC_ARGUMENTS\",\n details: `Sequential variadic arguments are not allowed - since the argument preceding ${argument.name} is variadic, it must not also be variadic.`\n });\n }\n } else {\n sequential = false;\n }\n }\n\n return failures;\n}\n\nexport function validateOptions(command: CommandTree): ValidationFailure[] {\n const failures: ValidationFailure[] = [];\n\n const optionNames = new Set<string>();\n for (const option of Object.values(command.options ?? {})) {\n if (optionNames.has(option.name)) {\n failures.push({\n code: \"DUPLICATE_OPTION_NAME\",\n details: `Duplicate option name \"${option.name}\" found in command.`\n });\n }\n optionNames.add(option.name);\n\n for (const alias of option.alias) {\n if (optionNames.has(alias)) {\n failures.push({\n code: \"DUPLICATE_OPTION_ALIAS\",\n details: `Duplicate option name \"${alias}\" (an alias of \"${\n option.name\n }\") found in command.`\n });\n }\n optionNames.add(alias);\n }\n }\n\n return failures;\n}\n\nexport function validateCommand(command: CommandTree): ValidationFailure[] {\n const results: ValidationFailure[] = [];\n\n let failures = validateOptions(command);\n if (failures.length > 0) {\n results.push(...failures);\n }\n\n failures = validateArguments(command);\n if (failures.length > 0) {\n results.push(...failures);\n }\n\n return results;\n}\n"],"mappings":";;;;AAkBA,MAAM,uBAAuB;CAAC;CAAQ;CAAW;CAAe;CAAA;;CAG5D,MAAM,WAAW,EAAE;CACnB,IAAI,aAAM;AACV,MAAK,MAAM,YAAE,QAAA,aAAA,EAAA,CACjB,MAAA,SAAA,SAAA,gDAAA,uFAEY,SAAS,SACT,KAAI,CAAC;KAIV,UAAA,KAAA;EACa,MAAM;EACN,SAAS,gFAAqB,SAAA,KAAA;EACjC,CAAC;KAIN,cAAC;AAGT,QAAO;;AAEX,kBAAM,SAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AACN,SAAW,gBAAA,SAAA;CACP,MAAM,WAAW,EAAE;CACnB,MAAA,eAAA,IAAA,IAAA,CAAA,CAAA,IAAA,CAAA,kBAAA,IAAA,KAAA;AACF,MAAA,MAAA,UAAA,OAAA,OAAA,QAAA,WAAA,EAAA,CAAA,EAAA;mCAEU,UAAK,KAAA;GACjB,MAAA;;GAEa,CAAC;;AAGN,OAAK,MAAM,SAAS,OAAO,OAAI;AAC3B,OAAI,YAAY,IAAI,MAAM,CACtB,UAAS,KAAK;IACV,MAAA;IACA,SAAS,0BAAQ,MAAA,kBAAA,OAAA,KAAA;IACpB,CAAC;AAEd,eAAA,IAAA,MAAA;;;AAGA,QAAO;;AAEX,gBAAgB,SAAM;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AACtB,SAAgB,gBAAgB,SAAQ;CACpC,MAAM,UAAU,EAAE;CAClB,IAAI,WAAW,gBAAG,QAAA;AAClB,KAAI,SAAS,SAAS,EAClB,SAAE,KAAA,GAAA,SAAA;AAEN,YAAW,kBAAa,QAAA;AACxB,KAAA,SAAA,SAAA,EACF,SAAA,KAAA,GAAA,SAAA;AAEE,QAAO"}
1
+ {"version":3,"file":"validations.cjs","names":[],"sources":["../../src/helpers/validations.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandTree } from \"../types\";\nimport { CommandParameterKinds } from \"../types\";\n\nexport interface ValidationFailure {\n code: string;\n details: string;\n}\n\nexport function validateArguments(command: CommandTree): ValidationFailure[] {\n const failures: ValidationFailure[] = [];\n\n let sequential = false;\n for (const argument of command.args ?? []) {\n if (\n (argument.kind === CommandParameterKinds.string ||\n argument.kind === CommandParameterKinds.number) &&\n argument.variadic\n ) {\n if (!sequential) {\n sequential = true;\n } else {\n failures.push({\n code: \"SEQUENTIAL_VARIADIC_ARGUMENTS\",\n details: `Sequential variadic arguments are not allowed - since the argument preceding ${argument.name} is variadic, it must not also be variadic.`\n });\n }\n } else {\n sequential = false;\n }\n }\n\n return failures;\n}\n\nexport function validateOptions(command: CommandTree): ValidationFailure[] {\n const failures: ValidationFailure[] = [];\n\n const optionNames = new Set<string>();\n for (const option of Object.values(command.options ?? {})) {\n if (optionNames.has(option.name)) {\n failures.push({\n code: \"DUPLICATE_OPTION_NAME\",\n details: `Duplicate option name \"${option.name}\" found in command.`\n });\n }\n optionNames.add(option.name);\n\n for (const alias of option.alias) {\n if (optionNames.has(alias)) {\n failures.push({\n code: \"DUPLICATE_OPTION_ALIAS\",\n details: `Duplicate option name \"${alias}\" (an alias of \"${\n option.name\n }\") found in command.`\n });\n }\n optionNames.add(alias);\n }\n }\n\n return failures;\n}\n\nexport function validateCommand(command: CommandTree): ValidationFailure[] {\n const results: ValidationFailure[] = [];\n\n let failures = validateOptions(command);\n if (failures.length > 0) {\n results.push(...failures);\n }\n\n failures = validateArguments(command);\n if (failures.length > 0) {\n results.push(...failures);\n }\n\n return results;\n}\n"],"mappings":";;;AAkBA,MAAM,uBAAuB;CAAC;CAAQ;CAAK;CAAA;CAAA;;CAGvC,MAAM,WAAW,EAAE;CACnB,IAAI,aAAM;AACV,MAAK,MAAM,YAAE,QAAA,QAAA,EAAA,CACjB,MAAA,SAAA,SAAA,4CAAA,mFAEY,SAAS,SACT,KAAI,CAAC;KAIV,UAAA,KAAA;EACa,MAAM;EACN,SAAS,gFAA4B,SAAA,KAAA;EACxC,CAAC;KAIN,cAAC;AAGT,QAAO;;AAEX,kBAAM,SAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AACN,SAAW,gBAAA,SAAA;CACP,MAAM,WAAW,EAAE;CACnB,MAAA,eAAA,IAAA,IAAA,CAAA,CAAA,IAAA,CAAA,kBAAA,IAAA,KAAA;AACF,MAAA,MAAA,UAAA,OAAA,OAAA,QAAA,WAAA,EAAA,CAAA,EAAA;mCAEU,UAAK,KAAA;GACjB,MAAA;;GAEa,CAAC;;AAGN,OAAK,MAAM,SAAS,OAAO,OAAI;AAC3B,OAAI,YAAY,IAAI,MAAM,CACtB,UAAS,KAAK;IACV,MAAA;IACA,SAAS,0BAAQ,MAAA,kBAAA,OAAA,KAAA;IACpB,CAAC;AAEd,eAAA,IAAA,MAAA;;;AAGA,QAAO;;AAEX,gBAAgB,SAAM;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AACtB,SAAgB,gBAAgB,SAAQ;CACpC,MAAM,UAAU,EAAE;CAClB,IAAI,WAAW,gBAAG,QAAA;AAClB,KAAI,SAAS,SAAS,EAClB,SAAE,KAAA,GAAA,SAAA;AAEN,YAAW,kBAAa,QAAA;AACxB,KAAA,SAAA,SAAA,EACF,SAAA,KAAA,GAAA,SAAA;AAEE,QAAO"}
@@ -1,4 +1,4 @@
1
- import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
1
+ import { CommandParameterKinds } from "../types/command.mjs";
2
2
 
3
3
  //#region src/helpers/validations.ts
4
4
  const __ΩValidationFailure = [
@@ -10,7 +10,7 @@ const __ΩValidationFailure = [
10
10
  function validateArguments(command) {
11
11
  const failures = [];
12
12
  let sequential = false;
13
- for (const argument of command.arguments ?? []) if ((argument.kind === ReflectionKind.string || argument.kind === ReflectionKind.number) && argument.variadic) if (!sequential) sequential = true;
13
+ for (const argument of command.args ?? []) if ((argument.kind === CommandParameterKinds.string || argument.kind === CommandParameterKinds.number) && argument.variadic) if (!sequential) sequential = true;
14
14
  else failures.push({
15
15
  code: "SEQUENTIAL_VARIADIC_ARGUMENTS",
16
16
  details: `Sequential variadic arguments are not allowed - since the argument preceding ${argument.name} is variadic, it must not also be variadic.`
@@ -1 +1 @@
1
- {"version":3,"file":"validations.mjs","names":[],"sources":["../../src/helpers/validations.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport type { CommandTree } from \"../types\";\n\nexport interface ValidationFailure {\n code: string;\n details: string;\n}\n\nexport function validateArguments(command: CommandTree): ValidationFailure[] {\n const failures: ValidationFailure[] = [];\n\n let sequential = false;\n for (const argument of command.arguments ?? []) {\n if (\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n ) {\n if (!sequential) {\n sequential = true;\n } else {\n failures.push({\n code: \"SEQUENTIAL_VARIADIC_ARGUMENTS\",\n details: `Sequential variadic arguments are not allowed - since the argument preceding ${argument.name} is variadic, it must not also be variadic.`\n });\n }\n } else {\n sequential = false;\n }\n }\n\n return failures;\n}\n\nexport function validateOptions(command: CommandTree): ValidationFailure[] {\n const failures: ValidationFailure[] = [];\n\n const optionNames = new Set<string>();\n for (const option of Object.values(command.options ?? {})) {\n if (optionNames.has(option.name)) {\n failures.push({\n code: \"DUPLICATE_OPTION_NAME\",\n details: `Duplicate option name \"${option.name}\" found in command.`\n });\n }\n optionNames.add(option.name);\n\n for (const alias of option.alias) {\n if (optionNames.has(alias)) {\n failures.push({\n code: \"DUPLICATE_OPTION_ALIAS\",\n details: `Duplicate option name \"${alias}\" (an alias of \"${\n option.name\n }\") found in command.`\n });\n }\n optionNames.add(alias);\n }\n }\n\n return failures;\n}\n\nexport function validateCommand(command: CommandTree): ValidationFailure[] {\n const results: ValidationFailure[] = [];\n\n let failures = validateOptions(command);\n if (failures.length > 0) {\n results.push(...failures);\n }\n\n failures = validateArguments(command);\n if (failures.length > 0) {\n results.push(...failures);\n }\n\n return results;\n}\n"],"mappings":";;;AAkBA,MAAM,uBAAuB;CAAC;CAAQ;CAAW;CAAe;CAAA;;CAG5D,MAAM,WAAW,EAAE;CACnB,IAAI,aAAM;AACV,MAAK,MAAM,YAAE,QAAA,aAAA,EAAA,CACjB,MAAA,SAAA,SAAA,eAAA,sDAEY,SAAS,SACT,KAAI,CAAC;KAIV,UAAA,KAAA;EACa,MAAM;EACN,SAAS,gFAAqB,SAAA,KAAA;EACjC,CAAC;KAIN,cAAC;AAGT,QAAO;;AAEX,kBAAM,SAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AACN,SAAW,gBAAA,SAAA;CACP,MAAM,WAAW,EAAE;CACnB,MAAA,eAAA,IAAA,IAAA,CAAA,CAAA,IAAA,CAAA,kBAAA,IAAA,KAAA;AACF,MAAA,MAAA,UAAA,OAAA,OAAA,QAAA,WAAA,EAAA,CAAA,EAAA;mCAEU,UAAK,KAAA;GACjB,MAAA;;GAEa,CAAC;;AAGN,OAAK,MAAM,SAAS,OAAO,OAAI;AAC3B,OAAI,YAAY,IAAI,MAAM,CACtB,UAAS,KAAK;IACV,MAAA;IACA,SAAS,0BAAQ,MAAA,kBAAA,OAAA,KAAA;IACpB,CAAC;AAEd,eAAA,IAAA,MAAA;;;AAGA,QAAO;;AAEX,gBAAgB,SAAM;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AACtB,SAAgB,gBAAgB,SAAQ;CACpC,MAAM,UAAU,EAAE;CAClB,IAAI,WAAW,gBAAG,QAAA;AAClB,KAAI,SAAS,SAAS,EAClB,SAAE,KAAA,GAAA,SAAA;AAEN,YAAW,kBAAa,QAAA;AACxB,KAAA,SAAA,SAAA,EACF,SAAA,KAAA,GAAA,SAAA;AAEE,QAAO"}
1
+ {"version":3,"file":"validations.mjs","names":[],"sources":["../../src/helpers/validations.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandTree } from \"../types\";\nimport { CommandParameterKinds } from \"../types\";\n\nexport interface ValidationFailure {\n code: string;\n details: string;\n}\n\nexport function validateArguments(command: CommandTree): ValidationFailure[] {\n const failures: ValidationFailure[] = [];\n\n let sequential = false;\n for (const argument of command.args ?? []) {\n if (\n (argument.kind === CommandParameterKinds.string ||\n argument.kind === CommandParameterKinds.number) &&\n argument.variadic\n ) {\n if (!sequential) {\n sequential = true;\n } else {\n failures.push({\n code: \"SEQUENTIAL_VARIADIC_ARGUMENTS\",\n details: `Sequential variadic arguments are not allowed - since the argument preceding ${argument.name} is variadic, it must not also be variadic.`\n });\n }\n } else {\n sequential = false;\n }\n }\n\n return failures;\n}\n\nexport function validateOptions(command: CommandTree): ValidationFailure[] {\n const failures: ValidationFailure[] = [];\n\n const optionNames = new Set<string>();\n for (const option of Object.values(command.options ?? {})) {\n if (optionNames.has(option.name)) {\n failures.push({\n code: \"DUPLICATE_OPTION_NAME\",\n details: `Duplicate option name \"${option.name}\" found in command.`\n });\n }\n optionNames.add(option.name);\n\n for (const alias of option.alias) {\n if (optionNames.has(alias)) {\n failures.push({\n code: \"DUPLICATE_OPTION_ALIAS\",\n details: `Duplicate option name \"${alias}\" (an alias of \"${\n option.name\n }\") found in command.`\n });\n }\n optionNames.add(alias);\n }\n }\n\n return failures;\n}\n\nexport function validateCommand(command: CommandTree): ValidationFailure[] {\n const results: ValidationFailure[] = [];\n\n let failures = validateOptions(command);\n if (failures.length > 0) {\n results.push(...failures);\n }\n\n failures = validateArguments(command);\n if (failures.length > 0) {\n results.push(...failures);\n }\n\n return results;\n}\n"],"mappings":";;;AAkBA,MAAM,uBAAuB;CAAC;CAAQ;CAAK;CAAA;CAAA;;CAGvC,MAAM,WAAW,EAAE;CACnB,IAAI,aAAM;AACV,MAAK,MAAM,YAAE,QAAA,QAAA,EAAA,CACjB,MAAA,SAAA,SAAA,sBAAA,6DAEY,SAAS,SACT,KAAI,CAAC;KAIV,UAAA,KAAA;EACa,MAAM;EACN,SAAS,gFAA4B,SAAA,KAAA;EACxC,CAAC;KAIN,cAAC;AAGT,QAAO;;AAEX,kBAAM,SAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AACN,SAAW,gBAAA,SAAA;CACP,MAAM,WAAW,EAAE;CACnB,MAAA,eAAA,IAAA,IAAA,CAAA,CAAA,IAAA,CAAA,kBAAA,IAAA,KAAA;AACF,MAAA,MAAA,UAAA,OAAA,OAAA,QAAA,WAAA,EAAA,CAAA,EAAA;mCAEU,UAAK,KAAA;GACjB,MAAA;;GAEa,CAAC;;AAGN,OAAK,MAAM,SAAS,OAAO,OAAI;AAC3B,OAAI,YAAY,IAAI,MAAM,CACtB,UAAS,KAAK;IACV,MAAA;IACA,SAAS,0BAAQ,MAAA,kBAAA,OAAA,KAAA;IACpB,CAAC;AAEd,eAAA,IAAA,MAAA;;;AAGA,QAAO;;AAEX,gBAAgB,SAAM;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AACtB,SAAgB,gBAAgB,SAAQ;CACpC,MAAM,UAAU,EAAE;CAClB,IAAI,WAAW,gBAAG,QAAA;AAClB,KAAI,SAAS,SAAS,EAClB,SAAE,KAAA,GAAA,SAAA;AAEN,YAAW,kBAAa,QAAA;AACxB,KAAA,SAAA,SAAA,EACF,SAAA,KAAA,GAAA,SAAA;AAEE,QAAO"}
package/dist/index.cjs CHANGED
@@ -1,43 +1,46 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- const require_api = require('./api.cjs');
3
2
  const require_types_command = require('./types/command.cjs');
4
3
  const require_types_config = require('./types/config.cjs');
5
4
  const require_types_context = require('./types/context.cjs');
6
5
  const require_types_options = require('./types/options.cjs');
7
6
  const require_types_runtime = require('./types/runtime.cjs');
7
+ const require_api = require('./api.cjs');
8
8
 
9
9
  //#region src/index.ts
10
10
  var src_default = require_api.ShellShockAPI;
11
11
 
12
12
  //#endregion
13
+ exports.CommandParameterKinds = require_types_command.CommandParameterKinds;
13
14
  exports.ShellShockAPI = require_api.ShellShockAPI;
15
+ exports.__ΩAsCommandParameterConfig = require_types_command.__ΩAsCommandParameterConfig;
14
16
  exports.__ΩBaseCommandOptions = require_types_options.__ΩBaseCommandOptions;
15
17
  exports.__ΩBaseCommandParameter = require_types_command.__ΩBaseCommandParameter;
16
- exports.__ΩBooleanCommandArgument = require_types_command.__ΩBooleanCommandArgument;
17
18
  exports.__ΩBooleanCommandOption = require_types_command.__ΩBooleanCommandOption;
18
19
  exports.__ΩBooleanCommandParameter = require_types_command.__ΩBooleanCommandParameter;
20
+ exports.__ΩBooleanCommandParameterConfig = require_types_command.__ΩBooleanCommandParameterConfig;
19
21
  exports.__ΩCommandArgument = require_types_command.__ΩCommandArgument;
22
+ exports.__ΩCommandArgumentConfig = require_types_command.__ΩCommandArgumentConfig;
20
23
  exports.__ΩCommandBase = require_types_command.__ΩCommandBase;
24
+ exports.__ΩCommandConfig = require_types_command.__ΩCommandConfig;
21
25
  exports.__ΩCommandContext = require_types_runtime.__ΩCommandContext;
22
- exports.__ΩCommandInput = require_types_command.__ΩCommandInput;
26
+ exports.__ΩCommandMetadata = require_types_command.__ΩCommandMetadata;
23
27
  exports.__ΩCommandModule = require_types_command.__ΩCommandModule;
24
28
  exports.__ΩCommandOption = require_types_command.__ΩCommandOption;
25
- exports.__ΩCommandParameterSchema = require_types_command.__ΩCommandParameterSchema;
29
+ exports.__ΩCommandOptionConfig = require_types_command.__ΩCommandOptionConfig;
30
+ exports.__ΩCommandParameter = require_types_command.__ΩCommandParameter;
31
+ exports.__ΩCommandParameterConfig = require_types_command.__ΩCommandParameterConfig;
32
+ exports.__ΩCommandParameterKind = require_types_command.__ΩCommandParameterKind;
33
+ exports.__ΩCommandParameterType = require_types_command.__ΩCommandParameterType;
26
34
  exports.__ΩCommandTree = require_types_command.__ΩCommandTree;
27
35
  exports.__ΩContext = require_types_context.__ΩContext;
28
- exports.__ΩMetadata = require_types_command.__ΩMetadata;
29
- exports.__ΩNumberCommandArgument = require_types_command.__ΩNumberCommandArgument;
30
- exports.__ΩNumberCommandOption = require_types_command.__ΩNumberCommandOption;
31
36
  exports.__ΩNumberCommandParameter = require_types_command.__ΩNumberCommandParameter;
37
+ exports.__ΩNumberCommandParameterConfig = require_types_command.__ΩNumberCommandParameterConfig;
32
38
  exports.__ΩOptions = require_types_config.__ΩOptions;
33
39
  exports.__ΩOutputConfig = require_types_config.__ΩOutputConfig;
34
40
  exports.__ΩResolvedConfig = require_types_config.__ΩResolvedConfig;
35
- exports.__ΩSerializedCommandArgument = require_types_command.__ΩSerializedCommandArgument;
36
- exports.__ΩSerializedCommandOption = require_types_command.__ΩSerializedCommandOption;
37
41
  exports.__ΩSerializedCommandTree = require_types_command.__ΩSerializedCommandTree;
38
- exports.__ΩStringCommandArgument = require_types_command.__ΩStringCommandArgument;
39
- exports.__ΩStringCommandOption = require_types_command.__ΩStringCommandOption;
40
42
  exports.__ΩStringCommandParameter = require_types_command.__ΩStringCommandParameter;
43
+ exports.__ΩStringCommandParameterConfig = require_types_command.__ΩStringCommandParameterConfig;
41
44
  exports.__ΩUnresolvedContext = require_types_context.__ΩUnresolvedContext;
42
45
  exports.__ΩUserConfig = require_types_config.__ΩUserConfig;
43
46
  exports.createShellShock = require_api.createShellShock;
package/dist/index.d.cts CHANGED
@@ -1,8 +1,8 @@
1
- import { BaseCommandParameter, BooleanCommandArgument, BooleanCommandOption, BooleanCommandParameter, CommandArgument, CommandBase, CommandInput, CommandModule, CommandOption, CommandParameterSchema, CommandTree, Metadata, NumberCommandArgument, NumberCommandOption, NumberCommandParameter, SerializedCommandArgument, SerializedCommandOption, SerializedCommandTree, StringCommandArgument, StringCommandOption, StringCommandParameter } from "./types/command.cjs";
1
+ import { AsCommandParameterConfig, BaseCommandParameter, BooleanCommandOption, BooleanCommandParameter, BooleanCommandParameterConfig, CommandArgument, CommandArgumentConfig, CommandBase, CommandConfig, CommandMetadata, CommandModule, CommandOption, CommandOptionConfig, CommandParameter, CommandParameterConfig, CommandParameterKind, CommandParameterKinds, CommandParameterType, CommandTree, NumberCommandParameter, NumberCommandParameterConfig, SerializedCommandTree, StringCommandParameter, StringCommandParameterConfig } from "./types/command.cjs";
2
2
  import { Context, UnresolvedContext } from "./types/context.cjs";
3
3
  import { Options, OutputConfig, ResolvedConfig, UserConfig } from "./types/config.cjs";
4
4
  import { ShellShockAPI, createShellShock } from "./api.cjs";
5
5
  import { BaseCommandOptions } from "./types/options.cjs";
6
6
  import { CommandContext } from "./types/runtime.cjs";
7
7
  import "./types/index.cjs";
8
- export { BaseCommandOptions, BaseCommandParameter, BooleanCommandArgument, BooleanCommandOption, BooleanCommandParameter, CommandArgument, CommandBase, CommandContext, CommandInput, CommandModule, CommandOption, CommandParameterSchema, CommandTree, Context, Metadata, NumberCommandArgument, NumberCommandOption, NumberCommandParameter, Options, OutputConfig, ResolvedConfig, SerializedCommandArgument, SerializedCommandOption, SerializedCommandTree, ShellShockAPI, ShellShockAPI as default, StringCommandArgument, StringCommandOption, StringCommandParameter, UnresolvedContext, UserConfig, createShellShock };
8
+ export { AsCommandParameterConfig, BaseCommandOptions, BaseCommandParameter, BooleanCommandOption, BooleanCommandParameter, BooleanCommandParameterConfig, CommandArgument, CommandArgumentConfig, CommandBase, CommandConfig, CommandContext, CommandMetadata, CommandModule, CommandOption, CommandOptionConfig, CommandParameter, CommandParameterConfig, CommandParameterKind, CommandParameterKinds, CommandParameterType, CommandTree, Context, NumberCommandParameter, NumberCommandParameterConfig, Options, OutputConfig, ResolvedConfig, SerializedCommandTree, ShellShockAPI, ShellShockAPI as default, StringCommandParameter, StringCommandParameterConfig, UnresolvedContext, UserConfig, createShellShock };
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { BaseCommandParameter, BooleanCommandArgument, BooleanCommandOption, BooleanCommandParameter, CommandArgument, CommandBase, CommandInput, CommandModule, CommandOption, CommandParameterSchema, CommandTree, Metadata, NumberCommandArgument, NumberCommandOption, NumberCommandParameter, SerializedCommandArgument, SerializedCommandOption, SerializedCommandTree, StringCommandArgument, StringCommandOption, StringCommandParameter } from "./types/command.mjs";
1
+ import { AsCommandParameterConfig, BaseCommandParameter, BooleanCommandOption, BooleanCommandParameter, BooleanCommandParameterConfig, CommandArgument, CommandArgumentConfig, CommandBase, CommandConfig, CommandMetadata, CommandModule, CommandOption, CommandOptionConfig, CommandParameter, CommandParameterConfig, CommandParameterKind, CommandParameterKinds, CommandParameterType, CommandTree, NumberCommandParameter, NumberCommandParameterConfig, SerializedCommandTree, StringCommandParameter, StringCommandParameterConfig } from "./types/command.mjs";
2
2
  import { Context, UnresolvedContext } from "./types/context.mjs";
3
3
  import { Options, OutputConfig, ResolvedConfig, UserConfig } from "./types/config.mjs";
4
4
  import { ShellShockAPI, createShellShock } from "./api.mjs";
5
5
  import { BaseCommandOptions } from "./types/options.mjs";
6
6
  import { CommandContext } from "./types/runtime.mjs";
7
7
  import "./types/index.mjs";
8
- export { BaseCommandOptions, BaseCommandParameter, BooleanCommandArgument, BooleanCommandOption, BooleanCommandParameter, CommandArgument, CommandBase, CommandContext, CommandInput, CommandModule, CommandOption, CommandParameterSchema, CommandTree, Context, Metadata, NumberCommandArgument, NumberCommandOption, NumberCommandParameter, Options, OutputConfig, ResolvedConfig, SerializedCommandArgument, SerializedCommandOption, SerializedCommandTree, ShellShockAPI, ShellShockAPI as default, StringCommandArgument, StringCommandOption, StringCommandParameter, UnresolvedContext, UserConfig, createShellShock };
8
+ export { AsCommandParameterConfig, BaseCommandOptions, BaseCommandParameter, BooleanCommandOption, BooleanCommandParameter, BooleanCommandParameterConfig, CommandArgument, CommandArgumentConfig, CommandBase, CommandConfig, CommandContext, CommandMetadata, CommandModule, CommandOption, CommandOptionConfig, CommandParameter, CommandParameterConfig, CommandParameterKind, CommandParameterKinds, CommandParameterType, CommandTree, Context, NumberCommandParameter, NumberCommandParameterConfig, Options, OutputConfig, ResolvedConfig, SerializedCommandTree, ShellShockAPI, ShellShockAPI as default, StringCommandParameter, StringCommandParameterConfig, UnresolvedContext, UserConfig, createShellShock };
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
- import { ShellShockAPI, createShellShock } from "./api.mjs";
2
- import { __ΩBaseCommandParameter, __ΩBooleanCommandArgument, __ΩBooleanCommandOption, __ΩBooleanCommandParameter, __ΩCommandArgument, __ΩCommandBase, __ΩCommandInput, __ΩCommandModule, __ΩCommandOption, __ΩCommandParameterSchema, __ΩCommandTree, __ΩMetadata, __ΩNumberCommandArgument, __ΩNumberCommandOption, __ΩNumberCommandParameter, __ΩSerializedCommandArgument, __ΩSerializedCommandOption, __ΩSerializedCommandTree, __ΩStringCommandArgument, __ΩStringCommandOption, __ΩStringCommandParameter } from "./types/command.mjs";
1
+ import { CommandParameterKinds, __ΩAsCommandParameterConfig, __ΩBaseCommandParameter, __ΩBooleanCommandOption, __ΩBooleanCommandParameter, __ΩBooleanCommandParameterConfig, __ΩCommandArgument, __ΩCommandArgumentConfig, __ΩCommandBase, __ΩCommandConfig, __ΩCommandMetadata, __ΩCommandModule, __ΩCommandOption, __ΩCommandOptionConfig, __ΩCommandParameter, __ΩCommandParameterConfig, __ΩCommandParameterKind, __ΩCommandParameterType, __ΩCommandTree, __ΩNumberCommandParameter, __ΩNumberCommandParameterConfig, __ΩSerializedCommandTree, __ΩStringCommandParameter, __ΩStringCommandParameterConfig } from "./types/command.mjs";
3
2
  import { __ΩOptions, __ΩOutputConfig, __ΩResolvedConfig, __ΩUserConfig } from "./types/config.mjs";
4
3
  import { __ΩContext, __ΩUnresolvedContext } from "./types/context.mjs";
5
4
  import { __ΩBaseCommandOptions } from "./types/options.mjs";
6
5
  import { __ΩCommandContext } from "./types/runtime.mjs";
6
+ import { ShellShockAPI, createShellShock } from "./api.mjs";
7
7
 
8
8
  //#region src/index.ts
9
9
  var src_default = ShellShockAPI;
10
10
 
11
11
  //#endregion
12
- export { ShellShockAPI, __ΩBaseCommandOptions, __ΩBaseCommandParameter, __ΩBooleanCommandArgument, __ΩBooleanCommandOption, __ΩBooleanCommandParameter, __ΩCommandArgument, __ΩCommandBase, __ΩCommandContext, __ΩCommandInput, __ΩCommandModule, __ΩCommandOption, __ΩCommandParameterSchema, __ΩCommandTree, __ΩContext, __ΩMetadata, __ΩNumberCommandArgument, __ΩNumberCommandOption, __ΩNumberCommandParameter, __ΩOptions, __ΩOutputConfig, __ΩResolvedConfig, __ΩSerializedCommandArgument, __ΩSerializedCommandOption, __ΩSerializedCommandTree, __ΩStringCommandArgument, __ΩStringCommandOption, __ΩStringCommandParameter, __ΩUnresolvedContext, __ΩUserConfig, createShellShock, src_default as default };
12
+ export { CommandParameterKinds, ShellShockAPI, __ΩAsCommandParameterConfig, __ΩBaseCommandOptions, __ΩBaseCommandParameter, __ΩBooleanCommandOption, __ΩBooleanCommandParameter, __ΩBooleanCommandParameterConfig, __ΩCommandArgument, __ΩCommandArgumentConfig, __ΩCommandBase, __ΩCommandConfig, __ΩCommandContext, __ΩCommandMetadata, __ΩCommandModule, __ΩCommandOption, __ΩCommandOptionConfig, __ΩCommandParameter, __ΩCommandParameterConfig, __ΩCommandParameterKind, __ΩCommandParameterType, __ΩCommandTree, __ΩContext, __ΩNumberCommandParameter, __ΩNumberCommandParameterConfig, __ΩOptions, __ΩOutputConfig, __ΩResolvedConfig, __ΩSerializedCommandTree, __ΩStringCommandParameter, __ΩStringCommandParameterConfig, __ΩUnresolvedContext, __ΩUserConfig, createShellShock, src_default as default };
13
13
  //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,72 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_types_command = require('../types/command.cjs');
3
+ const require_type_checks = require('./type-checks.cjs');
4
+ let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
5
+ let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
6
+
7
+ //#region src/plugin-utils/deepkit.ts
8
+ /**
9
+ * Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
10
+ *
11
+ * @param command - The command parameter or kind to extract the reflection kind from.
12
+ * @param checkVariadic - Whether to check for variadic parameters (arrays).
13
+ * @returns The extracted {@link ReflectionKind}.
14
+ */
15
+ function extractReflectionKind(command, checkVariadic = true) {
16
+ if (require_type_checks.isCommandParameterKind(command) && command === require_types_command.CommandParameterKinds.string || (0, __stryke_type_checks_is_set_object.isSetObject)(command) && command.kind === require_types_command.CommandParameterKinds.string) return checkVariadic && command.variadic ? __powerlines_deepkit_vendor_type.ReflectionKind.array : __powerlines_deepkit_vendor_type.ReflectionKind.string;
17
+ else if (require_type_checks.isCommandParameterKind(command) && command === require_types_command.CommandParameterKinds.number || (0, __stryke_type_checks_is_set_object.isSetObject)(command) && command.kind === require_types_command.CommandParameterKinds.number) return checkVariadic && command.variadic ? __powerlines_deepkit_vendor_type.ReflectionKind.array : __powerlines_deepkit_vendor_type.ReflectionKind.number;
18
+ else if (require_type_checks.isCommandParameterKind(command) && command === require_types_command.CommandParameterKinds.boolean || (0, __stryke_type_checks_is_set_object.isSetObject)(command) && command.kind === require_types_command.CommandParameterKinds.boolean) return __powerlines_deepkit_vendor_type.ReflectionKind.boolean;
19
+ else return __powerlines_deepkit_vendor_type.ReflectionKind.string;
20
+ }
21
+ extractReflectionKind.__type = [
22
+ "BaseCommandParameter",
23
+ "CommandParameterKind",
24
+ "command",
25
+ "checkVariadic",
26
+ () => __powerlines_deepkit_vendor_type.__ΩReflectionKind,
27
+ "extractReflectionKind",
28
+ "PP\"w!\"w\"J2#\"2$n%/&"
29
+ ];
30
+ /**
31
+ * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
32
+ *
33
+ * @param command - The command parameter or kind to extract the type from.
34
+ * @param checkVariadic - Whether to check for variadic parameters (arrays).
35
+ * @returns The extracted {@link Type}.
36
+ */
37
+ function extractType(command, checkVariadic = true) {
38
+ const reflectionKind = extractReflectionKind(command, checkVariadic);
39
+ if (reflectionKind === __powerlines_deepkit_vendor_type.ReflectionKind.string) return { kind: __powerlines_deepkit_vendor_type.ReflectionKind.string };
40
+ else if (reflectionKind === __powerlines_deepkit_vendor_type.ReflectionKind.number) return { kind: __powerlines_deepkit_vendor_type.ReflectionKind.number };
41
+ else if (reflectionKind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean) return { kind: __powerlines_deepkit_vendor_type.ReflectionKind.boolean };
42
+ else if (reflectionKind === __powerlines_deepkit_vendor_type.ReflectionKind.array) if (require_type_checks.isCommandParameterKind(command)) return {
43
+ kind: __powerlines_deepkit_vendor_type.ReflectionKind.array,
44
+ type: extractType({ kind: command }, false)
45
+ };
46
+ else if ((0, __stryke_type_checks_is_set_object.isSetObject)(command)) return {
47
+ kind: __powerlines_deepkit_vendor_type.ReflectionKind.array,
48
+ type: extractType({
49
+ ...command,
50
+ kind: command.kind
51
+ }, false)
52
+ };
53
+ else return {
54
+ kind: __powerlines_deepkit_vendor_type.ReflectionKind.array,
55
+ type: { kind: __powerlines_deepkit_vendor_type.ReflectionKind.string }
56
+ };
57
+ else return { kind: __powerlines_deepkit_vendor_type.ReflectionKind.string };
58
+ }
59
+ extractType.__type = [
60
+ "BaseCommandParameter",
61
+ "CommandParameterKind",
62
+ "command",
63
+ "checkVariadic",
64
+ "Type",
65
+ "extractType",
66
+ "PP\"w!\"w\"J2#\"2$\"w%/&"
67
+ ];
68
+
69
+ //#endregion
70
+ exports.extractReflectionKind = extractReflectionKind;
71
+ exports.extractType = extractType;
72
+ //# sourceMappingURL=deepkit.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepkit.cjs","names":[],"sources":["../../src/plugin-utils/deepkit.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Type } from \"@powerlines/deepkit/vendor/type\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type {\n BaseCommandParameter,\n CommandParameterKind,\n StringCommandParameter\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\nimport { isCommandParameterKind } from \"./type-checks\";\n\n/**\n * Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.\n *\n * @param command - The command parameter or kind to extract the reflection kind from.\n * @param checkVariadic - Whether to check for variadic parameters (arrays).\n * @returns The extracted {@link ReflectionKind}.\n */\nexport function extractReflectionKind(\n command: BaseCommandParameter | CommandParameterKind,\n checkVariadic = true\n): ReflectionKind {\n if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.string) ||\n (isSetObject(command as BaseCommandParameter) &&\n (command as BaseCommandParameter).kind === CommandParameterKinds.string)\n ) {\n return checkVariadic && (command as StringCommandParameter).variadic\n ? ReflectionKind.array\n : ReflectionKind.string;\n } else if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.number) ||\n (isSetObject(command as BaseCommandParameter) &&\n (command as BaseCommandParameter).kind === CommandParameterKinds.number)\n ) {\n return checkVariadic && (command as any).variadic\n ? ReflectionKind.array\n : ReflectionKind.number;\n } else if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.boolean) ||\n (isSetObject(command) && command.kind === CommandParameterKinds.boolean)\n ) {\n return ReflectionKind.boolean;\n } else {\n return ReflectionKind.string;\n }\n}\n\n/**\n * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.\n *\n * @param command - The command parameter or kind to extract the type from.\n * @param checkVariadic - Whether to check for variadic parameters (arrays).\n * @returns The extracted {@link Type}.\n */\nexport function extractType(\n command: BaseCommandParameter | CommandParameterKind,\n checkVariadic = true\n): Type {\n const reflectionKind = extractReflectionKind(command, checkVariadic);\n if (reflectionKind === ReflectionKind.string) {\n return { kind: ReflectionKind.string };\n } else if (reflectionKind === ReflectionKind.number) {\n return { kind: ReflectionKind.number };\n } else if (reflectionKind === ReflectionKind.boolean) {\n return { kind: ReflectionKind.boolean };\n } else if (reflectionKind === ReflectionKind.array) {\n if (isCommandParameterKind(command)) {\n return {\n kind: ReflectionKind.array,\n type: extractType(\n {\n kind: command\n } as BaseCommandParameter,\n false\n )\n };\n } else if (isSetObject(command)) {\n return {\n kind: ReflectionKind.array,\n type: extractType(\n {\n ...command,\n kind: command.kind\n } as BaseCommandParameter,\n false\n )\n };\n } else {\n return {\n kind: ReflectionKind.array,\n type: { kind: ReflectionKind.string }\n };\n }\n } else {\n return { kind: ReflectionKind.string };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcI,KAAK,2CAAuB,QAAI,0HAEf,QAAQ,wEAErB,QAAO,iBAAiB,QAAQ,WAC1B,gDAAe,QACf,gDAAe;UAEf,2CAAQ,QAAA,IACd,YAAY,4CAAE,8DACD,QAAE,IACX,QAAQ,SAAK,4CAAA,OACjB,QAAO,iBAAiB,QAAQ,WAC1B,gDAAe;UAGf,2CAAuB,QAAQ,IAC5C,YAAA,4CAAA,+DACoB,QAAQ,IAAI,QAAQ,SAAS,4CAAsB,QAChE,QAAO,gDAAe;KAGtB,QAAO,gDAAe;;AAG9B,sBAAkB,SAAA;CAAA;CAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;;;;;;;;AAQlB,SAAgB,YAAW,SAAA,gBAAA,MAAA;CACvB,MAAM,iBAAiB,sBAAE,SAAA,cAAA;AACzB,KAAI,mBAAI,gDAAA,OACJ,QAAO,EAAE,MAAM,gDAAe,QAAA;UAEzB,mBAAmB,gDAAe,OACvC,QAAO,EAAE,MAAM,gDAAe,QAAQ;UAEjC,mBAAmB,gDAAe,QACvC,QAAO,EAAE,MAAM,gDAAI,SAAA;UAEf,mBAAA,gDAAA,MACJ,KAAI,2CAAuB,QAAG,CAC1B,QAAO;EACH,MAAM,gDAAe;EACjC,MAAA,YAAA,EACgB,MAAM,SACjB,EAAA,MAAA;EACI;8DAEb,QAAA;EAEE,MAAA,gDAAA;EACc,MAAM,YAAY;GACjC,GAAA;GACmB,MAAM,QAAQ;GACjB,EAAE,MAAK;EACX;KAGD,QAAO;EACH,MAAK,gDAAA;EACb,MAAA,EAAA,MAAA,gDAAA,QAAA;EACK;KAIL,QAAO,EAAE,MAAM,gDAAe,QAAI;;AAG1C,YAAY,SAAS;CAAC;CAAwB;CAAQ;CAAA;CAAA;CAAA;CAAA;CAAA"}
@@ -0,0 +1,24 @@
1
+ import { BaseCommandParameter, CommandParameterKind } from "../types/command.cjs";
2
+ import { ReflectionKind, Type } from "@powerlines/deepkit/vendor/type";
3
+
4
+ //#region src/plugin-utils/deepkit.d.ts
5
+
6
+ /**
7
+ * Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
8
+ *
9
+ * @param command - The command parameter or kind to extract the reflection kind from.
10
+ * @param checkVariadic - Whether to check for variadic parameters (arrays).
11
+ * @returns The extracted {@link ReflectionKind}.
12
+ */
13
+ declare function extractReflectionKind(command: BaseCommandParameter | CommandParameterKind, checkVariadic?: boolean): ReflectionKind;
14
+ /**
15
+ * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
16
+ *
17
+ * @param command - The command parameter or kind to extract the type from.
18
+ * @param checkVariadic - Whether to check for variadic parameters (arrays).
19
+ * @returns The extracted {@link Type}.
20
+ */
21
+ declare function extractType(command: BaseCommandParameter | CommandParameterKind, checkVariadic?: boolean): Type;
22
+ //#endregion
23
+ export { extractReflectionKind, extractType };
24
+ //# sourceMappingURL=deepkit.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepkit.d.cts","names":[],"sources":["../../src/plugin-utils/deepkit.ts"],"sourcesContent":[],"mappings":";;;;;;AAoCA;;;;;AAwCA;AACW,iBAzCK,qBAAA,CAyCL,OAAA,EAxCA,oBAwCA,GAxCuB,oBAwCvB,EAAA,aAAA,CAAA,EAAA,OAAA,CAAA,EAtCR,cAsCQ;;;;;;;;iBADK,WAAA,UACL,uBAAuB,gDAE/B"}
@@ -0,0 +1,24 @@
1
+ import { BaseCommandParameter, CommandParameterKind } from "../types/command.mjs";
2
+ import { ReflectionKind, Type } from "@powerlines/deepkit/vendor/type";
3
+
4
+ //#region src/plugin-utils/deepkit.d.ts
5
+
6
+ /**
7
+ * Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
8
+ *
9
+ * @param command - The command parameter or kind to extract the reflection kind from.
10
+ * @param checkVariadic - Whether to check for variadic parameters (arrays).
11
+ * @returns The extracted {@link ReflectionKind}.
12
+ */
13
+ declare function extractReflectionKind(command: BaseCommandParameter | CommandParameterKind, checkVariadic?: boolean): ReflectionKind;
14
+ /**
15
+ * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
16
+ *
17
+ * @param command - The command parameter or kind to extract the type from.
18
+ * @param checkVariadic - Whether to check for variadic parameters (arrays).
19
+ * @returns The extracted {@link Type}.
20
+ */
21
+ declare function extractType(command: BaseCommandParameter | CommandParameterKind, checkVariadic?: boolean): Type;
22
+ //#endregion
23
+ export { extractReflectionKind, extractType };
24
+ //# sourceMappingURL=deepkit.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepkit.d.mts","names":[],"sources":["../../src/plugin-utils/deepkit.ts"],"sourcesContent":[],"mappings":";;;;;;AAoCA;;;;;AAwCA;AACW,iBAzCK,qBAAA,CAyCL,OAAA,EAxCA,oBAwCA,GAxCuB,oBAwCvB,EAAA,aAAA,CAAA,EAAA,OAAA,CAAA,EAtCR,cAsCQ;;;;;;;;iBADK,WAAA,UACL,uBAAuB,gDAE/B"}
@@ -0,0 +1,70 @@
1
+ import { CommandParameterKinds } from "../types/command.mjs";
2
+ import { isCommandParameterKind } from "./type-checks.mjs";
3
+ import { isSetObject } from "@stryke/type-checks/is-set-object";
4
+ import { ReflectionKind, __ΩReflectionKind } from "@powerlines/deepkit/vendor/type";
5
+
6
+ //#region src/plugin-utils/deepkit.ts
7
+ /**
8
+ * Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
9
+ *
10
+ * @param command - The command parameter or kind to extract the reflection kind from.
11
+ * @param checkVariadic - Whether to check for variadic parameters (arrays).
12
+ * @returns The extracted {@link ReflectionKind}.
13
+ */
14
+ function extractReflectionKind(command, checkVariadic = true) {
15
+ if (isCommandParameterKind(command) && command === CommandParameterKinds.string || isSetObject(command) && command.kind === CommandParameterKinds.string) return checkVariadic && command.variadic ? ReflectionKind.array : ReflectionKind.string;
16
+ else if (isCommandParameterKind(command) && command === CommandParameterKinds.number || isSetObject(command) && command.kind === CommandParameterKinds.number) return checkVariadic && command.variadic ? ReflectionKind.array : ReflectionKind.number;
17
+ else if (isCommandParameterKind(command) && command === CommandParameterKinds.boolean || isSetObject(command) && command.kind === CommandParameterKinds.boolean) return ReflectionKind.boolean;
18
+ else return ReflectionKind.string;
19
+ }
20
+ extractReflectionKind.__type = [
21
+ "BaseCommandParameter",
22
+ "CommandParameterKind",
23
+ "command",
24
+ "checkVariadic",
25
+ () => __ΩReflectionKind,
26
+ "extractReflectionKind",
27
+ "PP\"w!\"w\"J2#\"2$n%/&"
28
+ ];
29
+ /**
30
+ * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
31
+ *
32
+ * @param command - The command parameter or kind to extract the type from.
33
+ * @param checkVariadic - Whether to check for variadic parameters (arrays).
34
+ * @returns The extracted {@link Type}.
35
+ */
36
+ function extractType(command, checkVariadic = true) {
37
+ const reflectionKind = extractReflectionKind(command, checkVariadic);
38
+ if (reflectionKind === ReflectionKind.string) return { kind: ReflectionKind.string };
39
+ else if (reflectionKind === ReflectionKind.number) return { kind: ReflectionKind.number };
40
+ else if (reflectionKind === ReflectionKind.boolean) return { kind: ReflectionKind.boolean };
41
+ else if (reflectionKind === ReflectionKind.array) if (isCommandParameterKind(command)) return {
42
+ kind: ReflectionKind.array,
43
+ type: extractType({ kind: command }, false)
44
+ };
45
+ else if (isSetObject(command)) return {
46
+ kind: ReflectionKind.array,
47
+ type: extractType({
48
+ ...command,
49
+ kind: command.kind
50
+ }, false)
51
+ };
52
+ else return {
53
+ kind: ReflectionKind.array,
54
+ type: { kind: ReflectionKind.string }
55
+ };
56
+ else return { kind: ReflectionKind.string };
57
+ }
58
+ extractType.__type = [
59
+ "BaseCommandParameter",
60
+ "CommandParameterKind",
61
+ "command",
62
+ "checkVariadic",
63
+ "Type",
64
+ "extractType",
65
+ "PP\"w!\"w\"J2#\"2$\"w%/&"
66
+ ];
67
+
68
+ //#endregion
69
+ export { extractReflectionKind, extractType };
70
+ //# sourceMappingURL=deepkit.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepkit.mjs","names":[],"sources":["../../src/plugin-utils/deepkit.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Type } from \"@powerlines/deepkit/vendor/type\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type {\n BaseCommandParameter,\n CommandParameterKind,\n StringCommandParameter\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\nimport { isCommandParameterKind } from \"./type-checks\";\n\n/**\n * Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.\n *\n * @param command - The command parameter or kind to extract the reflection kind from.\n * @param checkVariadic - Whether to check for variadic parameters (arrays).\n * @returns The extracted {@link ReflectionKind}.\n */\nexport function extractReflectionKind(\n command: BaseCommandParameter | CommandParameterKind,\n checkVariadic = true\n): ReflectionKind {\n if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.string) ||\n (isSetObject(command as BaseCommandParameter) &&\n (command as BaseCommandParameter).kind === CommandParameterKinds.string)\n ) {\n return checkVariadic && (command as StringCommandParameter).variadic\n ? ReflectionKind.array\n : ReflectionKind.string;\n } else if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.number) ||\n (isSetObject(command as BaseCommandParameter) &&\n (command as BaseCommandParameter).kind === CommandParameterKinds.number)\n ) {\n return checkVariadic && (command as any).variadic\n ? ReflectionKind.array\n : ReflectionKind.number;\n } else if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.boolean) ||\n (isSetObject(command) && command.kind === CommandParameterKinds.boolean)\n ) {\n return ReflectionKind.boolean;\n } else {\n return ReflectionKind.string;\n }\n}\n\n/**\n * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.\n *\n * @param command - The command parameter or kind to extract the type from.\n * @param checkVariadic - Whether to check for variadic parameters (arrays).\n * @returns The extracted {@link Type}.\n */\nexport function extractType(\n command: BaseCommandParameter | CommandParameterKind,\n checkVariadic = true\n): Type {\n const reflectionKind = extractReflectionKind(command, checkVariadic);\n if (reflectionKind === ReflectionKind.string) {\n return { kind: ReflectionKind.string };\n } else if (reflectionKind === ReflectionKind.number) {\n return { kind: ReflectionKind.number };\n } else if (reflectionKind === ReflectionKind.boolean) {\n return { kind: ReflectionKind.boolean };\n } else if (reflectionKind === ReflectionKind.array) {\n if (isCommandParameterKind(command)) {\n return {\n kind: ReflectionKind.array,\n type: extractType(\n {\n kind: command\n } as BaseCommandParameter,\n false\n )\n };\n } else if (isSetObject(command)) {\n return {\n kind: ReflectionKind.array,\n type: extractType(\n {\n ...command,\n kind: command.kind\n } as BaseCommandParameter,\n false\n )\n };\n } else {\n return {\n kind: ReflectionKind.array,\n type: { kind: ReflectionKind.string }\n };\n }\n } else {\n return { kind: ReflectionKind.string };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAcI,KAAK,uBAAuB,QAAI,gDAE3B,YAAY,QAAQ,kDAErB,QAAO,iBAAiB,QAAQ,WAC1B,eAAe,QACf,eAAe;UAEf,uBAAQ,QAAA,IACd,YAAY,sBAAE,UACb,YAAY,QAAE,IACX,QAAQ,SAAK,sBAAA,OACjB,QAAO,iBAAiB,QAAQ,WAC1B,eAAe;UAGf,uBAAuB,QAAQ,IAC5C,YAAA,sBAAA,WACQ,YAAY,QAAQ,IAAI,QAAQ,SAAS,sBAAsB,QAChE,QAAO,eAAe;KAGtB,QAAO,eAAe;;AAG9B,sBAAkB,SAAA;CAAA;CAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;;;;;;;;AAQlB,SAAgB,YAAW,SAAA,gBAAA,MAAA;CACvB,MAAM,iBAAiB,sBAAE,SAAA,cAAA;AACzB,KAAI,mBAAI,eAAA,OACJ,QAAO,EAAE,MAAM,eAAe,QAAA;UAEzB,mBAAmB,eAAe,OACvC,QAAO,EAAE,MAAM,eAAe,QAAQ;UAEjC,mBAAmB,eAAe,QACvC,QAAO,EAAE,MAAM,eAAI,SAAA;UAEf,mBAAA,eAAA,MACJ,KAAI,uBAAuB,QAAG,CAC1B,QAAO;EACH,MAAM,eAAe;EACjC,MAAA,YAAA,EACgB,MAAM,SACjB,EAAA,MAAA;EACI;UAEb,YAAA,QAAA;EAEE,MAAA,eAAA;EACc,MAAM,YAAY;GACjC,GAAA;GACmB,MAAM,QAAQ;GACjB,EAAE,MAAK;EACX;KAGD,QAAO;EACH,MAAK,eAAA;EACb,MAAA,EAAA,MAAA,eAAA,QAAA;EACK;KAIL,QAAO,EAAE,MAAM,eAAe,QAAI;;AAG1C,YAAY,SAAS;CAAC;CAAwB;CAAQ;CAAA;CAAA;CAAA;CAAA;CAAA"}