@shell-shock/core 0.17.10 → 0.17.12

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 (257) hide show
  1. package/dist/api.cjs +31 -143
  2. package/dist/api.cjs.map +1 -0
  3. package/dist/api.d.cts +2 -77
  4. package/dist/api.d.cts.map +1 -1
  5. package/dist/api.d.mts +2 -76
  6. package/dist/api.d.mts.map +1 -1
  7. package/dist/api.mjs +30 -140
  8. package/dist/api.mjs.map +1 -1
  9. package/dist/components/command-validation-logic.cjs +14 -15
  10. package/dist/components/command-validation-logic.cjs.map +1 -0
  11. package/dist/components/command-validation-logic.d.cts +1 -3
  12. package/dist/components/command-validation-logic.d.cts.map +1 -1
  13. package/dist/components/command-validation-logic.d.mts +1 -3
  14. package/dist/components/command-validation-logic.d.mts.map +1 -1
  15. package/dist/components/command-validation-logic.mjs +12 -13
  16. package/dist/components/command-validation-logic.mjs.map +1 -1
  17. package/dist/components/docs.cjs +6 -6
  18. package/dist/components/docs.cjs.map +1 -0
  19. package/dist/components/docs.d.cts +4 -5
  20. package/dist/components/docs.d.cts.map +1 -1
  21. package/dist/components/docs.d.mts +4 -5
  22. package/dist/components/docs.d.mts.map +1 -1
  23. package/dist/components/docs.mjs +4 -4
  24. package/dist/components/docs.mjs.map +1 -1
  25. package/dist/components/exec-builtin.cjs +9 -11
  26. package/dist/components/exec-builtin.cjs.map +1 -0
  27. package/dist/components/exec-builtin.d.cts +1 -2
  28. package/dist/components/exec-builtin.d.cts.map +1 -1
  29. package/dist/components/exec-builtin.d.mts +1 -2
  30. package/dist/components/exec-builtin.d.mts.map +1 -1
  31. package/dist/components/exec-builtin.mjs +7 -10
  32. package/dist/components/exec-builtin.mjs.map +1 -1
  33. package/dist/components/helpers.cjs +4 -5
  34. package/dist/components/helpers.cjs.map +1 -0
  35. package/dist/components/helpers.d.cts +6 -8
  36. package/dist/components/helpers.d.cts.map +1 -1
  37. package/dist/components/helpers.d.mts +6 -8
  38. package/dist/components/helpers.d.mts.map +1 -1
  39. package/dist/components/helpers.mjs +2 -3
  40. package/dist/components/helpers.mjs.map +1 -1
  41. package/dist/components/options-parser-logic.cjs +29 -30
  42. package/dist/components/options-parser-logic.cjs.map +1 -0
  43. package/dist/components/options-parser-logic.d.cts +8 -9
  44. package/dist/components/options-parser-logic.d.cts.map +1 -1
  45. package/dist/components/options-parser-logic.d.mts +8 -9
  46. package/dist/components/options-parser-logic.d.mts.map +1 -1
  47. package/dist/components/options-parser-logic.mjs +27 -28
  48. package/dist/components/options-parser-logic.mjs.map +1 -1
  49. package/dist/components/state-builtin.cjs +3 -2
  50. package/dist/components/state-builtin.cjs.map +1 -0
  51. package/dist/components/state-builtin.d.cts +4 -5
  52. package/dist/components/state-builtin.d.cts.map +1 -1
  53. package/dist/components/state-builtin.d.mts +4 -5
  54. package/dist/components/state-builtin.d.mts.map +1 -1
  55. package/dist/components/state-builtin.mjs +1 -1
  56. package/dist/components/state-builtin.mjs.map +1 -1
  57. package/dist/components/usage.cjs +4 -6
  58. package/dist/components/usage.cjs.map +1 -0
  59. package/dist/components/usage.d.cts +1 -2
  60. package/dist/components/usage.d.cts.map +1 -1
  61. package/dist/components/usage.d.mts +1 -2
  62. package/dist/components/usage.d.mts.map +1 -1
  63. package/dist/components/usage.mjs +2 -4
  64. package/dist/components/usage.mjs.map +1 -1
  65. package/dist/components/utils-builtin.cjs +5 -4
  66. package/dist/components/utils-builtin.cjs.map +1 -0
  67. package/dist/components/utils-builtin.d.cts +7 -8
  68. package/dist/components/utils-builtin.d.cts.map +1 -1
  69. package/dist/components/utils-builtin.d.mts +7 -8
  70. package/dist/components/utils-builtin.d.mts.map +1 -1
  71. package/dist/components/utils-builtin.mjs +3 -3
  72. package/dist/components/utils-builtin.mjs.map +1 -1
  73. package/dist/config.cjs +53 -19
  74. package/dist/config.cjs.map +1 -0
  75. package/dist/config.d.cts +29 -8
  76. package/dist/config.d.cts.map +1 -1
  77. package/dist/config.d.mts +29 -8
  78. package/dist/config.d.mts.map +1 -1
  79. package/dist/config.mjs +51 -18
  80. package/dist/config.mjs.map +1 -1
  81. package/dist/contexts/command.cjs +2 -2
  82. package/dist/contexts/command.cjs.map +1 -0
  83. package/dist/contexts/command.d.cts.map +1 -1
  84. package/dist/contexts/command.d.mts.map +1 -1
  85. package/dist/contexts/command.mjs.map +1 -1
  86. package/dist/contexts/options.cjs +4 -4
  87. package/dist/contexts/options.cjs.map +1 -0
  88. package/dist/contexts/options.d.cts.map +1 -1
  89. package/dist/contexts/options.d.mts.map +1 -1
  90. package/dist/contexts/options.mjs +2 -3
  91. package/dist/contexts/options.mjs.map +1 -1
  92. package/dist/engine.cjs +138 -0
  93. package/dist/engine.cjs.map +1 -0
  94. package/dist/engine.d.cts +79 -0
  95. package/dist/engine.d.cts.map +1 -0
  96. package/dist/engine.d.mts +79 -0
  97. package/dist/engine.d.mts.map +1 -0
  98. package/dist/engine.mjs +136 -0
  99. package/dist/engine.mjs.map +1 -0
  100. package/dist/helpers/automd.cjs +6 -7
  101. package/dist/helpers/automd.cjs.map +1 -0
  102. package/dist/helpers/automd.mjs +2 -3
  103. package/dist/helpers/automd.mjs.map +1 -1
  104. package/dist/helpers/docs-helpers.cjs +2 -2
  105. package/dist/helpers/docs-helpers.cjs.map +1 -0
  106. package/dist/helpers/docs-helpers.mjs.map +1 -1
  107. package/dist/helpers/get-framework.cjs +24 -0
  108. package/dist/helpers/get-framework.cjs.map +1 -0
  109. package/dist/helpers/get-framework.mjs +24 -0
  110. package/dist/helpers/get-framework.mjs.map +1 -0
  111. package/dist/helpers/paths.cjs +5 -5
  112. package/dist/helpers/paths.cjs.map +1 -0
  113. package/dist/helpers/paths.mjs +4 -4
  114. package/dist/helpers/paths.mjs.map +1 -1
  115. package/dist/helpers/persistence.cjs +4 -6
  116. package/dist/helpers/persistence.cjs.map +1 -0
  117. package/dist/helpers/persistence.mjs +3 -3
  118. package/dist/helpers/persistence.mjs.map +1 -1
  119. package/dist/helpers/update-package-json.cjs +2 -2
  120. package/dist/helpers/update-package-json.cjs.map +1 -0
  121. package/dist/helpers/update-package-json.mjs.map +1 -1
  122. package/dist/helpers/utilities.cjs +3 -3
  123. package/dist/helpers/utilities.cjs.map +1 -0
  124. package/dist/helpers/utilities.mjs +1 -1
  125. package/dist/helpers/utilities.mjs.map +1 -1
  126. package/dist/helpers/validations.cjs +3 -3
  127. package/dist/helpers/validations.cjs.map +1 -0
  128. package/dist/helpers/validations.mjs +1 -3
  129. package/dist/helpers/validations.mjs.map +1 -1
  130. package/dist/index.cjs +121 -51
  131. package/dist/index.cjs.map +1 -0
  132. package/dist/index.d.cts +80 -5
  133. package/dist/index.d.cts.map +1 -0
  134. package/dist/index.d.mts +80 -5
  135. package/dist/index.d.mts.map +1 -0
  136. package/dist/index.mjs +118 -6
  137. package/dist/index.mjs.map +1 -0
  138. package/dist/package.cjs +12 -0
  139. package/dist/package.cjs.map +1 -0
  140. package/dist/package.mjs +6 -0
  141. package/dist/package.mjs.map +1 -0
  142. package/dist/plugin-utils/compute-bin.cjs +8 -10
  143. package/dist/plugin-utils/compute-bin.cjs.map +1 -0
  144. package/dist/plugin-utils/compute-bin.d.cts +2 -2
  145. package/dist/plugin-utils/compute-bin.d.cts.map +1 -1
  146. package/dist/plugin-utils/compute-bin.d.mts +2 -2
  147. package/dist/plugin-utils/compute-bin.d.mts.map +1 -1
  148. package/dist/plugin-utils/compute-bin.mjs +6 -8
  149. package/dist/plugin-utils/compute-bin.mjs.map +1 -1
  150. package/dist/plugin-utils/context-helpers.cjs +7 -14
  151. package/dist/plugin-utils/context-helpers.cjs.map +1 -0
  152. package/dist/plugin-utils/context-helpers.d.cts +4 -4
  153. package/dist/plugin-utils/context-helpers.d.cts.map +1 -1
  154. package/dist/plugin-utils/context-helpers.d.mts +4 -4
  155. package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
  156. package/dist/plugin-utils/context-helpers.mjs +5 -12
  157. package/dist/plugin-utils/context-helpers.mjs.map +1 -1
  158. package/dist/plugin-utils/deepkit.cjs +15 -16
  159. package/dist/plugin-utils/deepkit.cjs.map +1 -0
  160. package/dist/plugin-utils/deepkit.d.cts +5 -5
  161. package/dist/plugin-utils/deepkit.d.cts.map +1 -1
  162. package/dist/plugin-utils/deepkit.d.mts +5 -5
  163. package/dist/plugin-utils/deepkit.d.mts.map +1 -1
  164. package/dist/plugin-utils/deepkit.mjs +14 -15
  165. package/dist/plugin-utils/deepkit.mjs.map +1 -1
  166. package/dist/plugin-utils/description-helpers.cjs +2 -1
  167. package/dist/plugin-utils/description-helpers.cjs.map +1 -0
  168. package/dist/plugin-utils/description-helpers.d.cts.map +1 -1
  169. package/dist/plugin-utils/description-helpers.d.mts.map +1 -1
  170. package/dist/plugin-utils/description-helpers.mjs.map +1 -1
  171. package/dist/plugin-utils/get-command-tree.cjs +2 -1
  172. package/dist/plugin-utils/get-command-tree.cjs.map +1 -0
  173. package/dist/plugin-utils/get-command-tree.d.cts.map +1 -1
  174. package/dist/plugin-utils/get-command-tree.d.mts.map +1 -1
  175. package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
  176. package/dist/plugin-utils/index.cjs +1 -1
  177. package/dist/plugin-utils/index.d.cts +2 -2
  178. package/dist/plugin-utils/index.d.mts +2 -2
  179. package/dist/plugin-utils/index.mjs +2 -2
  180. package/dist/plugin-utils/reflect.cjs +5 -5
  181. package/dist/plugin-utils/reflect.cjs.map +1 -0
  182. package/dist/plugin-utils/reflect.d.cts.map +1 -1
  183. package/dist/plugin-utils/reflect.d.mts.map +1 -1
  184. package/dist/plugin-utils/reflect.mjs +3 -5
  185. package/dist/plugin-utils/reflect.mjs.map +1 -1
  186. package/dist/plugin-utils/traverse-command-tree.cjs +2 -1
  187. package/dist/plugin-utils/traverse-command-tree.cjs.map +1 -0
  188. package/dist/plugin-utils/traverse-command-tree.d.cts.map +1 -1
  189. package/dist/plugin-utils/traverse-command-tree.d.mts.map +1 -1
  190. package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
  191. package/dist/plugin-utils/type-checks.cjs +146 -17
  192. package/dist/plugin-utils/type-checks.cjs.map +1 -0
  193. package/dist/plugin-utils/type-checks.d.cts +5 -5
  194. package/dist/plugin-utils/type-checks.d.cts.map +1 -1
  195. package/dist/plugin-utils/type-checks.d.mts +5 -5
  196. package/dist/plugin-utils/type-checks.d.mts.map +1 -1
  197. package/dist/plugin-utils/type-checks.mjs +145 -16
  198. package/dist/plugin-utils/type-checks.mjs.map +1 -1
  199. package/dist/plugin.cjs +80 -56
  200. package/dist/plugin.cjs.map +1 -0
  201. package/dist/plugin.d.cts.map +1 -1
  202. package/dist/plugin.d.mts.map +1 -1
  203. package/dist/plugin.mjs +75 -52
  204. package/dist/plugin.mjs.map +1 -1
  205. package/dist/resolver/helpers.cjs +33 -24
  206. package/dist/resolver/helpers.cjs.map +1 -0
  207. package/dist/resolver/helpers.mjs +32 -22
  208. package/dist/resolver/helpers.mjs.map +1 -1
  209. package/dist/resolver/resolve.cjs +319 -61
  210. package/dist/resolver/resolve.cjs.map +1 -0
  211. package/dist/resolver/resolve.mjs +316 -58
  212. package/dist/resolver/resolve.mjs.map +1 -1
  213. package/dist/types/command.cjs +43 -82
  214. package/dist/types/command.cjs.map +1 -0
  215. package/dist/types/command.d.cts +61 -119
  216. package/dist/types/command.d.cts.map +1 -1
  217. package/dist/types/command.d.mts +61 -119
  218. package/dist/types/command.d.mts.map +1 -1
  219. package/dist/types/command.mjs +42 -80
  220. package/dist/types/command.mjs.map +1 -1
  221. package/dist/types/config.cjs +45 -4
  222. package/dist/types/config.cjs.map +1 -0
  223. package/dist/types/config.d.cts +16 -11
  224. package/dist/types/config.d.cts.map +1 -1
  225. package/dist/types/config.d.mts +16 -11
  226. package/dist/types/config.d.mts.map +1 -1
  227. package/dist/types/config.mjs +40 -4
  228. package/dist/types/config.mjs.map +1 -1
  229. package/dist/types/context.cjs +9 -1
  230. package/dist/types/context.cjs.map +1 -0
  231. package/dist/types/context.d.cts +3 -2
  232. package/dist/types/context.d.cts.map +1 -1
  233. package/dist/types/context.d.mts +3 -2
  234. package/dist/types/context.d.mts.map +1 -1
  235. package/dist/types/context.mjs +7 -1
  236. package/dist/types/context.mjs.map +1 -1
  237. package/dist/types/env.cjs +2 -1
  238. package/dist/types/env.cjs.map +1 -0
  239. package/dist/types/env.d.cts.map +1 -1
  240. package/dist/types/env.d.mts.map +1 -1
  241. package/dist/types/env.mjs.map +1 -1
  242. package/dist/types/index.cjs +6 -3
  243. package/dist/types/index.d.cts +4 -4
  244. package/dist/types/index.d.mts +4 -4
  245. package/dist/types/index.mjs +4 -4
  246. package/dist/types/options.cjs +2 -1
  247. package/dist/types/options.cjs.map +1 -0
  248. package/dist/types/options.d.cts.map +1 -1
  249. package/dist/types/options.d.mts.map +1 -1
  250. package/dist/types/options.mjs.map +1 -1
  251. package/package.json +43 -35
  252. package/dist/resolver/deepkit.cjs +0 -135
  253. package/dist/resolver/deepkit.mjs +0 -135
  254. package/dist/resolver/deepkit.mjs.map +0 -1
  255. package/dist/resolver/module.cjs +0 -145
  256. package/dist/resolver/module.mjs +0 -145
  257. package/dist/resolver/module.mjs.map +0 -1
@@ -1,7 +1,6 @@
1
1
  import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
2
- import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
3
- import defu$1 from "defu";
4
2
  import { Show, code, splitProps } from "@alloy-js/core";
3
+ import defu$1 from "defu";
5
4
  import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
6
5
  import { FunctionDeclaration, InterfaceDeclaration, InterfaceMember, VarDeclaration } from "@alloy-js/typescript";
7
6
  import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
@@ -327,10 +326,8 @@ function ExecBuiltin(props) {
327
326
  heading: "The timeout in milliseconds for the spawn operation. If the process runs longer than this, it will be killed and the spawn promise will reject. This can also be provided as a number directly to the spawn function for convenience. Providing \\`-1\\` will disable the timeout.",
328
327
  get children() {
329
328
  return createComponent(TSDocDefaultValue, {
330
- get type() {
331
- return ReflectionKind.number;
332
- },
333
- defaultValue: "300000"
329
+ type: "number",
330
+ defaultValue: "300_000"
334
331
  });
335
332
  }
336
333
  }),
@@ -416,14 +413,14 @@ function ExecBuiltin(props) {
416
413
  }, {
417
414
  name: "optionsOrTimeoutMs",
418
415
  type: "number | SpawnOptions",
419
- default: "300000"
416
+ default: "300_000"
420
417
  }],
421
418
  returnType: "Promise<SpawnResult>",
422
419
  children: code`const options: SpawnOptions =
423
420
  typeof optionsOrTimeoutMs === "number"
424
421
  ? { timeoutMs: optionsOrTimeoutMs }
425
422
  : optionsOrTimeoutMs;
426
- const { timeoutMs = 300000, cwd, input, noOutputTimeoutMs } = options;
423
+ const { timeoutMs = 300_000, cwd, input, noOutputTimeoutMs } = options;
427
424
 
428
425
  const resolvedArgv =
429
426
  isWindows
@@ -671,7 +668,7 @@ return new Promise((resolve, reject) => {
671
668
  }, {
672
669
  name: "optionsOrTimeoutMs",
673
670
  type: "number | SpawnOptions",
674
- default: "300000"
671
+ default: "300_000"
675
672
  }],
676
673
  returnType: "Promise<string>",
677
674
  children: code`const spawnResult = await spawn(argv, optionsOrTimeoutMs);
@@ -715,7 +712,7 @@ return new Promise((resolve, reject) => {
715
712
  children: code`return execFileSync(argv.length > 0 ? argv[0] : "", argv.slice(1), {
716
713
  encoding: "utf8",
717
714
  stdio: ["ignore", "pipe", "ignore"],
718
- timeout: options.timeoutMs ?? 300000,
715
+ timeout: options.timeoutMs ?? 300_000,
719
716
  env: resolveCommandEnv({ argv, env: options.env }),
720
717
  cwd: options.cwd || process.cwd(),
721
718
  windowsHide: true
@@ -1 +1 @@
1
- {"version":3,"file":"exec-builtin.mjs","names":[],"sources":["../../src/components/exec-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show, splitProps } from \"@alloy-js/core\";\nimport {\n FunctionDeclaration,\n InterfaceDeclaration,\n InterfaceMember,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport type { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport { BuiltinFile } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport {\n TSDoc,\n TSDocDefaultValue,\n TSDocParam,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport defu from \"defu\";\n\nexport interface ExecBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {}\n\n/**\n * A built-in module for handling command execution in Shell Shock.\n */\nexport function ExecBuiltin(props: ExecBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <BuiltinFile\n id=\"exec\"\n description=\"A module to handle command execution in a Shell Shock application.\"\n {...rest}\n imports={defu(rest.imports ?? {}, {\n \"node:path\": [\"basename\", \"extname\", \"dirname\", \"join\"],\n \"node:fs\": [\"existsSync\"],\n \"node:child_process\": [\n { name: \"spawn\", alias: \"_spawn\" },\n \"execFileSync\"\n ],\n \"node:stream\": [{ name: \"Stream\", default: true, type: true }]\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n env: [\"isWindows\", \"env\"]\n })}>\n <FunctionDeclaration\n name=\"resolveCommandEnv\"\n parameters={[\n {\n name: \"params\",\n type: \"{ argv: string[]; env?: NodeJS.ProcessEnv; }\"\n }\n ]}\n returnType=\"NodeJS.ProcessEnv\">\n {code`const argv = params.argv;\n const shouldSuppressNpmFund = (() => {\n const cmd = basename(argv[0] ?? \"\");\n if (cmd === \"npm\" || cmd === \"npm.cmd\" || cmd === \"npm.exe\") {\n return true;\n }\n if (cmd === \"node\" || cmd === \"node.exe\") {\n const script = argv[1] ?? \"\";\n\n return script.includes(\"npm-cli.js\");\n }\n return false;\n })();\n\n const result = Object.fromEntries(\n Object.entries({\n ...env,\n ...(params.env ?? {})\n })\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, String(value)])\n );\n if (shouldSuppressNpmFund) {\n result.NPM_CONFIG_FUND ??= \"false\";\n result.npm_config_fund ??= \"false\";\n }\n return result; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"isWindowsBatchCommand\"\n parameters={[{ name: \"resolvedCommand\", type: \"string\" }]}\n returnType=\"boolean\">\n {code`if (!isWindows) {\n return false;\n }\n const ext = extname(resolvedCommand).toLowerCase();\n\n return ext === \".cmd\" || ext === \".bat\"; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"escapeForCmdExe\"\n parameters={[{ name: \"arg\", type: \"string\" }]}\n returnType=\"string\">\n {code`if (/[&|<>^%\\\\\\\\r\\\\\\\\n]/.test(arg)) {\n throw new Error(\n \\`Unsafe Windows cmd.exe argument detected: \\${JSON.stringify(arg)}. \\` +\n \"Pass an explicit shell-wrapper argv at the call site instead.\"\n );\n }\n if (!arg.includes(\" \") && !arg.includes('\"')) {\n return arg;\n }\n return \\`\"\\${arg.replace(/\"/g, '\"\"')}\"\\`; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"buildCmdExeCommandLine\"\n parameters={[\n { name: \"resolvedCommand\", type: \"string\" },\n { name: \"args\", type: \"string[]\" }\n ]}\n returnType=\"string\">\n {code`return [escapeForCmdExe(resolvedCommand), ...args.map(escapeForCmdExe)].join(\n \" \"\n ); `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveNpmArgvForWindows\"\n doc=\"On Windows, Node 18.20.2+ (CVE-2024-27980) rejects spawning .cmd/.bat directly without shell, causing EINVAL. Resolve npm/npx to node + cli script so we spawn node.exe instead of npm.cmd.\"\n parameters={[{ name: \"argv\", type: \"string[]\" }]}\n returnType=\"string[] | null\">\n {code`if (!isWindows || argv.length === 0) {\n return null;\n }\n const base = basename(argv[0] ?? \"\")\n .toLowerCase()\n .replace(/\\.(?:cmd|exe|bat)$/, \"\");\n const cliName =\n base === \"npx\" ? \"npx-cli.js\" : base === \"npm\" ? \"npm-cli.js\" : null;\n if (!cliName) {\n return null;\n }\n const nodeDir = dirname(process.execPath);\n const cliPath = join(nodeDir, \"node_modules\", \"npm\", \"bin\", cliName);\n if (!existsSync(cliPath)) {\n const command = argv[0] ?? \"\";\n const ext = extname(command).toLowerCase();\n const shimmedCommand = ext ? command : \\`\\${command}.cmd\\`;\n\n return [shimmedCommand, ...argv.slice(1)];\n }\n return [process.execPath, cliPath, ...argv.slice(1)]; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveCommand\"\n doc=\"Resolves a command for Windows compatibility. On Windows, non-.exe commands (like pnpm, yarn) are resolved to .cmd; npm/npx are handled by resolveNpmArgvForWindows to avoid spawn EINVAL (no direct .cmd).\"\n parameters={[{ name: \"command\", type: \"string\" }]}\n returnType=\"string\">\n {code`if (!isWindows) {\n return command;\n }\n const base = basename(command).toLowerCase();\n if (extname(base)) {\n return command;\n }\n if ([\"pnpm\", \"yarn\"].includes(base)) {\n return \\`\\${command}.cmd\\`;\n }\n return command; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveCommandStdio\"\n parameters={[\n {\n name: \"params\",\n type: \"{ hasInput: boolean; preferInherit: boolean; }\"\n }\n ]}\n returnType='[\"pipe\" | \"inherit\" | \"ignore\", \"pipe\", \"pipe\"]'>\n {code`const stdin = params.hasInput\n ? \"pipe\"\n : params.preferInherit\n ? \"inherit\"\n : \"pipe\";\n\n return [stdin, \"pipe\", \"pipe\"]; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveProcessExitCode\"\n parameters={[\n {\n name: \"params\",\n type: \"{ explicitCode: number | null | undefined; childExitCode: number | null | undefined; resolvedSignal: NodeJS.Signals | null; usesWindowsExitCodeShim: boolean; timedOut: boolean; noOutputTimedOut: boolean; killIssuedByTimeout: boolean; }\"\n }\n ]}\n returnType=\"number | null\">\n {code`return (\n params.explicitCode ??\n params.childExitCode ??\n (params.usesWindowsExitCodeShim &&\n params.resolvedSignal == null &&\n !params.timedOut &&\n !params.noOutputTimedOut &&\n !params.killIssuedByTimeout\n ? 0\n : null)\n ); `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"shouldSpawnWithShell\"\n parameters={[\n {\n name: \"params\",\n type: \"{ resolvedCommand: string; platform: NodeJS.Platform; }\"\n }\n ]}\n returnType=\"boolean\">\n {code`// SECURITY: never enable \\`shell\\` for argv-based execution.\n // \\`shell\\` routes through cmd.exe on Windows, which turns untrusted argv values\n // (like chat prompts passed as CLI args) into command-injection primitives.\n // If you need a shell, use an explicit shell-wrapper argv (e.g. \\`cmd.exe /c ...\\`)\n // and validate/escape at the call site.\n void params;\n return false; `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"The result of a spawn operation.\" />\n <InterfaceDeclaration export name=\"SpawnResult\">\n <TSDoc heading=\"The PID of the spawned child process, if available.\" />\n <InterfaceMember name=\"pid\" optional type=\"number\" />\n <Spacing />\n <TSDoc heading=\"The standard output produced by the child process.\" />\n <InterfaceMember name=\"stdout\" type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The standard error produced by the child process.\" />\n <InterfaceMember name=\"stderr\" type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The exit code of the child process, if available.\" />\n <InterfaceMember name=\"code\" type=\"number | null\" />\n <Spacing />\n <TSDoc heading=\"The signal that caused the child process to terminate, if it was killed by a signal.\" />\n <InterfaceMember name=\"signal\" type=\"NodeJS.Signals | null\" />\n <Spacing />\n <TSDoc heading=\"Whether the child process was killed.\" />\n <InterfaceMember name=\"killed\" type=\"boolean\" />\n <Spacing />\n <TSDoc heading=\"The reason for the child process termination.\" />\n <InterfaceMember\n name=\"termination\"\n type={code`\"exit\" | \"timeout\" | \"no-output-timeout\" | \"signal\"`}\n />\n <Spacing />\n <TSDoc heading=\"Whether the child process timed out due to no output.\" />\n <InterfaceMember name=\"noOutputTimedOut\" optional type=\"boolean\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Options for spawning a child process.\" />\n <InterfaceDeclaration export name=\"SpawnOptions\">\n <TSDoc heading=\"The timeout in milliseconds for the spawn operation. If the process runs longer than this, it will be killed and the spawn promise will reject. This can also be provided as a number directly to the spawn function for convenience. Providing \\`-1\\` will disable the timeout.\">\n <TSDocDefaultValue\n type={ReflectionKind.number}\n defaultValue=\"300000\"\n />\n </TSDoc>\n <InterfaceMember name=\"timeoutMs\" optional type=\"number\" />\n <Spacing />\n <TSDoc heading=\"The current working directory of the child process.\" />\n <InterfaceMember name=\"cwd\" optional type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The input to be passed to the child process.\" />\n <InterfaceMember name=\"input\" optional type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The environment variables for the child process.\" />\n <InterfaceMember name=\"env\" optional type=\"NodeJS.ProcessEnv\" />\n <Spacing />\n <TSDoc heading=\"Whether to pass arguments to the child process verbatim on Windows.\" />\n <InterfaceMember\n name=\"windowsVerbatimArguments\"\n optional\n type=\"boolean\"\n />\n <Spacing />\n <TSDoc heading=\"The timeout in milliseconds for the child process to produce output on stdout or stderr. If the process produces no output for this duration, it will be killed and the spawn promise will reject with a no-output-timeout termination reason.\" />\n <InterfaceMember name=\"noOutputTimeoutMs\" optional type=\"number\" />\n </InterfaceDeclaration>\n <Spacing />\n <VarDeclaration\n const\n name=\"WINDOWS_CLOSE_STATE_SETTLE_TIMEOUT_MS\"\n initializer={code`250`}\n />\n <Spacing />\n <VarDeclaration\n const\n name=\"WINDOWS_CLOSE_STATE_POLL_MS\"\n initializer={code`10`}\n />\n <Spacing />\n <TSDoc heading=\"Spawns a child process with the given arguments and options, returning a promise that resolves with the result of the spawn operation.\">\n <TSDocParam name=\"argv\">\n {\"The command and its arguments to spawn.\"}\n </TSDocParam>\n <TSDocParam name=\"optionsOrTimeoutMs\">\n {`The options for spawning the command, or a number representing the timeout in milliseconds. This allows for a convenient shorthand when only a timeout is needed. Providing \\`-1\\` will disable the timeout. If no options or timeout are provided, a default timeout of 5 minutes will be used.`}\n </TSDocParam>\n <TSDocReturns>\n {\n \"A promise that resolves with the result of the spawn operation, including stdout, stderr, exit code, signal, and termination reason.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"spawn\"\n parameters={[\n { name: \"argv\", type: \"string[]\" },\n {\n name: \"optionsOrTimeoutMs\",\n type: \"number | SpawnOptions\",\n default: \"300000\"\n }\n ]}\n returnType=\"Promise<SpawnResult>\">\n {code`const options: SpawnOptions =\n typeof optionsOrTimeoutMs === \"number\"\n ? { timeoutMs: optionsOrTimeoutMs }\n : optionsOrTimeoutMs;\nconst { timeoutMs = 300000, cwd, input, noOutputTimeoutMs } = options;\n\nconst resolvedArgv =\n isWindows\n ? (resolveNpmArgvForWindows(argv) ?? argv)\n : argv;\nconst resolvedCommand =\n resolvedArgv !== argv\n ? (resolvedArgv[0] ?? \"\")\n : resolveCommand(argv[0] ?? \"\");\nconst useCmdWrapper = isWindowsBatchCommand(resolvedCommand);\n\nconst child = _spawn(\n useCmdWrapper\n ? (env.COMSPEC ?? \"cmd.exe\")\n : resolvedCommand,\n useCmdWrapper\n ? [\n \"/d\",\n \"/s\",\n \"/c\",\n buildCmdExeCommandLine(resolvedCommand, resolvedArgv.slice(1))\n ]\n : resolvedArgv.slice(1), {\n stdio: resolveCommandStdio({ hasInput: input !== undefined, preferInherit: true }),\n cwd,\n env: resolveCommandEnv({ argv, env: options.env }),\n windowsHide: true,\n windowsVerbatimArguments: useCmdWrapper\n ? true\n : options.windowsVerbatimArguments,\n ...(shouldSpawnWithShell({\n resolvedCommand: useCmdWrapper\n ? (env.COMSPEC ?? \"cmd.exe\")\n : resolvedCommand,\n platform: process.platform\n })\n ? { shell: true }\n : {})\n});\n\nreturn new Promise((resolve, reject) => {\n let stdout = \"\";\n let stderr = \"\";\n let settled = false;\n let timedOut = false;\n let noOutputTimedOut = false;\n let killIssuedByTimeout = false;\n let childExitState: {\n code: number | null;\n signal: NodeJS.Signals | null;\n } | null = null;\n let closeFallbackTimer: NodeJS.Timeout | null = null;\n let noOutputTimer: NodeJS.Timeout | null = null;\n const shouldTrackOutputTimeout =\n typeof noOutputTimeoutMs === \"number\" &&\n Number.isFinite(noOutputTimeoutMs) &&\n noOutputTimeoutMs > 0;\n\n const clearNoOutputTimer = () => {\n if (!noOutputTimer) {\n return;\n }\n clearTimeout(noOutputTimer);\n noOutputTimer = null;\n };\n\n const clearCloseFallbackTimer = () => {\n if (!closeFallbackTimer) {\n return;\n }\n clearTimeout(closeFallbackTimer);\n closeFallbackTimer = null;\n };\n\n const killChild = () => {\n if (settled || typeof child?.kill !== \"function\") {\n return;\n }\n killIssuedByTimeout = true;\n child.kill(\"SIGKILL\");\n };\n\n const armNoOutputTimer = () => {\n if (!shouldTrackOutputTimeout || settled) {\n return;\n }\n clearNoOutputTimer();\n noOutputTimer = setTimeout(() => {\n if (settled) {\n return;\n }\n noOutputTimedOut = true;\n killChild();\n }, Math.floor(noOutputTimeoutMs));\n };\n\n const timer = setTimeout(() => {\n timedOut = true;\n killChild();\n }, timeoutMs >= 0 ? timeoutMs : Number.POSITIVE_INFINITY);\n armNoOutputTimer();\n\n if (input !== undefined && child.stdin) {\n child.stdin.write(input ?? \"\");\n child.stdin.end();\n }\n\n child.stdout?.on(\"data\", (d: Stream) => {\n stdout += d.toString();\n armNoOutputTimer();\n });\n child.stderr?.on(\"data\", (d: Stream) => {\n stderr += d.toString();\n armNoOutputTimer();\n });\n child.on(\"error\", err => {\n if (settled) {\n return;\n }\n settled = true;\n clearTimeout(timer);\n clearNoOutputTimer();\n clearCloseFallbackTimer();\n reject(err);\n });\n child.on(\"exit\", (code, signal) => {\n childExitState = { code, signal };\n if (settled || closeFallbackTimer) {\n return;\n }\n closeFallbackTimer = setTimeout(() => {\n if (settled) {\n return;\n }\n child.stdout?.destroy();\n child.stderr?.destroy();\n }, 250);\n });\n const resolveFromClose = (\n code: number | null,\n signal: NodeJS.Signals | null\n ) => {\n if (settled) {\n return;\n }\n settled = true;\n clearTimeout(timer);\n clearNoOutputTimer();\n clearCloseFallbackTimer();\n const resolvedSignal =\n childExitState?.signal ?? signal ?? child.signalCode ?? null;\n const resolvedCode = resolveProcessExitCode({\n explicitCode: childExitState?.code ?? code,\n childExitCode: child.exitCode,\n resolvedSignal,\n usesWindowsExitCodeShim: isWindows && (useCmdWrapper || resolvedArgv !== argv),\n timedOut,\n noOutputTimedOut,\n killIssuedByTimeout\n });\n const termination = noOutputTimedOut\n ? \"no-output-timeout\"\n : timedOut\n ? \"timeout\"\n : resolvedSignal != null\n ? \"signal\"\n : \"exit\";\n const normalizedCode =\n termination === \"timeout\" || termination === \"no-output-timeout\"\n ? resolvedCode === 0\n ? 124\n : resolvedCode\n : resolvedCode;\n resolve({\n pid: child.pid ?? undefined,\n stdout,\n stderr,\n code: normalizedCode,\n signal: resolvedSignal,\n killed: child.killed,\n termination,\n noOutputTimedOut\n });\n };\n child.on(\"close\", (code, signal) => {\n if (\n !isWindows ||\n childExitState != null ||\n code != null ||\n signal != null ||\n child.exitCode != null ||\n child.signalCode != null\n ) {\n resolveFromClose(code, signal);\n return;\n }\n\n const startedAt = Date.now();\n const waitForExitState = () => {\n if (settled) {\n return;\n }\n if (\n childExitState != null ||\n child.exitCode != null ||\n child.signalCode != null\n ) {\n resolveFromClose(code, signal);\n return;\n }\n if (Date.now() - startedAt >= WINDOWS_CLOSE_STATE_SETTLE_TIMEOUT_MS) {\n resolveFromClose(code, signal);\n return;\n }\n setTimeout(waitForExitState, WINDOWS_CLOSE_STATE_POLL_MS);\n };\n waitForExitState();\n });\n});`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A helper function that executes a command and returns its stdout.\">\n <TSDocParam name=\"argv\">\n {`The command and its arguments to spawn. This is passed directly to the spawn function. Remember that on Windows, commands like \\`npm\\` or \\`pnpm\\` will be resolved to their .cmd shims, so you can just pass \\`npm\\` without worrying about the extension.`}\n </TSDocParam>\n <TSDocParam name=\"optionsOrTimeoutMs\">\n {`The options for spawning the command, or a number representing the timeout in milliseconds. This is passed directly to the spawn function. Providing \\`-1\\` will disable the timeout. If no options or timeout are provided, a default timeout of 5 minutes will be used.`}\n </TSDocParam>\n <TSDocReturns>\n {\n \"A promise that resolves with the result of the spawn operation if the command exits with code 0, or rejects with an error if the command exits with a non-zero code or if there is a problem spawning the process.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"exec\"\n parameters={[\n { name: \"argv\", type: \"string[]\" },\n {\n name: \"optionsOrTimeoutMs\",\n type: \"number | SpawnOptions\",\n default: \"300000\"\n }\n ]}\n returnType=\"Promise<string>\">\n {code`const spawnResult = await spawn(argv, optionsOrTimeoutMs);\n if (spawnResult.code !== 0) {\n throw Object.assign(new Error(\n \\`Command \"\\${argv.join(\" \")}\" exited with code \\${spawnResult.code} and signal \\${spawnResult.signal}\\`\n ), spawnResult);\n }\n\n return spawnResult.stdout.trim(); `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A helper function that executes a command synchronously and returns its stdout. This is a thin wrapper around \\`child_process.execFileSync\\` with some added Windows compatibility handling.\">\n <TSDocParam name=\"argv\">\n {`The command and its arguments to spawn. This is passed directly to \\`execFileSync\\` after Windows-specific resolution. Remember that on Windows, commands like \\`npm\\` or \\`pnpm\\` will be resolved to their .cmd shims, so you can just pass \\`npm\\` without worrying about the extension.`}\n </TSDocParam>\n <TSDocParam name=\"options\">\n {`The options for spawning the command. This is passed directly to \\`execFileSync\\` after some processing. The timeout option is supported, but note that it will throw an error if the process runs longer than the specified timeout. If no options are provided, a default timeout of 5 minutes will be used.`}\n </TSDocParam>\n <TSDocReturns>\n {\n \"The standard output produced by the command if it exits with code 0. If the command exits with a non-zero code or if there is a problem spawning the process, an error will be thrown.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"execSync\"\n parameters={[\n { name: \"argv\", type: \"string[]\" },\n { name: \"options\", type: \"SpawnOptions\", default: \"{}\" }\n ]}\n returnType=\"string\">\n {code`return execFileSync(argv.length > 0 ? argv[0] : \"\", argv.slice(1), {\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n timeout: options.timeoutMs ?? 300000,\n env: resolveCommandEnv({ argv, env: options.env }),\n cwd: options.cwd || process.cwd(),\n windowsHide: true\n }).trim(); `}\n </FunctionDeclaration>\n <Spacing />\n\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAEA,MAAM,UAAU;CAAC;CAAG;CAAM;CAAS;CAAQ;;;;;;;AA0B3C,MAAM,sBAAsB;OAAE;CAAW;CAAO;CAAiB;CAAmB;CAAK;;;;AAKzF,SAAE,YAAA,OAAA;CACA,MAAM,CAAC,EACT;AAEA,QAAO,gBAAU,aAAiB,WAAY;EAC5C,IAAA;EACC,aAAO;EACP,EAAA,MAAA;;AAED,UAAA,OAAA,KAAA,WAAA,EAAA,EAAA;IACG,aAAgB;KAAA;KAAa;KAAQ;KAAa;KAAM;IAC3D,WAAA,CAAA,aAAA;IACK,sBAAqB,CAAA;KAClB,MAAC;;KAEF,EAAA,eAAA;IACJ,eAAA,CAAA;KACK,MAAI;KACR,SAAa;KACT,MAAI;KACR,CAAA;IACC,CAAC;;EAEJ,IAAI,iBAAM;AACR,UAAM,OAAM,KAAC,kBAAsB,EAAE,EAAC,EACpC,KAAG,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oB,YAAS;QAC7B,MAAI;QACJ,UAAG;QACL,CAAA;OAAA,gBAAA,cAAA,kOAEA,CAAA;OAAA;;KAEH,CAAA;IAAA,gBAAS,qBAAA;KACT,UAAM;KACL,OAAC;KACD,MAAI;KACJ,YAAY,CAAA;MACX,MAAA;MACC,MAAM;MACP,EAAC;MACD,MAAA;MACC,MAAA;MACA,SAAO;MACR,CAAC;KACF,YAAE;KACF,UAAK,IAAA;;;;;;;;KAQN,CAAC;IAAA,gBAAmB,SAAA,EAAA,CAAA;IAAA,gBAAA,OAAA;KACnB,SAAM;KACN,IAAE,WAAW;AACX,aAAO;OAAC,gBAAkB,YAAS;QACnC,MAAQ;QACR,UAAK;QACL,CAAA;OAAI,gBAAgB,YAAa;QACjC,MAAA;QACC,UAAS;QACZ,CAAA;OAAA,gBAAmB,cAAA,EACpB,UAAS;;;KAGV,CAAA;IAAA,gBAAW,qBAAA;KACd,UAAA;KACH,MAAA"}
1
+ {"version":3,"file":"exec-builtin.mjs","names":[],"sources":[],"mappings":""}
@@ -1,6 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_types_command = require('../types/command.cjs');
4
2
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
3
  let _alloy_js_core = require("@alloy-js/core");
6
4
 
@@ -95,11 +93,11 @@ IsNotVerbose.__type = [
95
93
  */
96
94
  function CommandParameterType(props) {
97
95
  const { parameter } = props;
98
- return _alloy_js_core.code`${(parameter.kind === require_types_command.CommandParameterKinds.string || parameter.kind === require_types_command.CommandParameterKinds.number) && parameter.choices && parameter.choices.length > 0 ? parameter.choices.map(__assignType((choice) => typeof choice === "string" ? `"${choice}"` : choice, [
96
+ return _alloy_js_core.code`${(parameter.type === "string" || parameter.type === "number") && parameter.choices && parameter.choices.length > 0 ? parameter.choices.map(__assignType((choice) => typeof choice === "string" ? `"${choice}"` : choice, [
99
97
  "choice",
100
98
  "",
101
99
  "P\"2!\"/\""
102
- ])).join(" | ") : parameter.kind === require_types_command.CommandParameterKinds.boolean ? "boolean" : parameter.kind === require_types_command.CommandParameterKinds.number ? "number" : "string"}${parameter.variadic ? "[]" : ""}${parameter.optional ? " | undefined" : ""}`;
100
+ ])).join(" | ") : parameter.type === "boolean" ? "boolean" : parameter.type === "number" ? "number" : "string"}${parameter.variadic ? "[]" : ""}${!parameter.required ? " | undefined" : ""}`;
103
101
  }
104
102
  CommandParameterType.__type = [
105
103
  "CommandParameter",
@@ -117,4 +115,5 @@ exports.IsDebug = IsDebug;
117
115
  exports.IsNotDebug = IsNotDebug;
118
116
  exports.IsNotVerbose = IsNotVerbose;
119
117
  exports.IsVerbose = IsVerbose;
120
- exports.__ΩBooleanInputParserLogicProps = __ΩBooleanInputParserLogicProps;
118
+ exports.__ΩBooleanInputParserLogicProps = __ΩBooleanInputParserLogicProps;
119
+ //# sourceMappingURL=helpers.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.cjs","names":[],"sources":[],"mappings":""}
@@ -1,6 +1,4 @@
1
1
  import { CommandParameter } from "../types/command.cjs";
2
- import * as _$_alloy_js_core0 from "@alloy-js/core";
3
-
4
2
  //#region src/components/helpers.d.ts
5
3
  interface BooleanInputParserLogicProps {
6
4
  name: string;
@@ -8,35 +6,35 @@ interface BooleanInputParserLogicProps {
8
6
  /**
9
7
  * Parses a string input into a boolean value, interpreting common truthy and falsy string representations.
10
8
  */
11
- declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps): _$_alloy_js_core0.Children;
9
+ declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps): import("@alloy-js/core").Children;
12
10
  /**
13
11
  * Write the logic to determine if the application is running in debug mode.
14
12
  *
15
13
  * @remarks
16
14
  * This is used to conditionally include debug-only logic in the generated application, such as additional logging or development tools. The logic should check for common indicators of debug mode, such as environment variables or the presence of a debugger.
17
15
  */
18
- declare function IsDebug(): _$_alloy_js_core0.Children;
16
+ declare function IsDebug(): import("@alloy-js/core").Children;
19
17
  /**
20
18
  * Write the logic to determine if the application is **not** running in debug mode.
21
19
  */
22
- declare function IsNotDebug(): _$_alloy_js_core0.Children;
20
+ declare function IsNotDebug(): import("@alloy-js/core").Children;
23
21
  /**
24
22
  * Write the logic to determine if the application is running in verbose mode.
25
23
  *
26
24
  * @remarks
27
25
  * This is used to conditionally include verbose-only logic in the generated application, such as additional logging or detailed output. The logic should check for common indicators of verbose mode, such as environment variables or command-line flags.
28
26
  */
29
- declare function IsVerbose(): _$_alloy_js_core0.Children;
27
+ declare function IsVerbose(): import("@alloy-js/core").Children;
30
28
  /**
31
29
  * Write the logic to determine if the application is **not** running in verbose mode.
32
30
  */
33
- declare function IsNotVerbose(): _$_alloy_js_core0.Children;
31
+ declare function IsNotVerbose(): import("@alloy-js/core").Children;
34
32
  /**
35
33
  * Write the type declaration for a command parameter based on its configuration.
36
34
  */
37
35
  declare function CommandParameterType(props: {
38
36
  parameter: CommandParameter;
39
- }): _$_alloy_js_core0.Children;
37
+ }): import("@alloy-js/core").Children;
40
38
  //#endregion
41
39
  export { BooleanInputParserLogic, BooleanInputParserLogicProps, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose };
42
40
  //# sourceMappingURL=helpers.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.cts","names":[],"sources":["../../src/components/helpers.tsx"],"mappings":";;;;UAsBiB,4BAAA;EACf,IAAA;AAAA;;AADF;;iBAOgB,uBAAA,CAAwB,KAAA,EAAO,4BAAA,GAA4B,iBAAA,CAAA,QAAA;;;AAA3E;;;;iBA0BgB,OAAA,CAAA,GAAO,iBAAA,CAAA,QAAA;;;;iBAOP,UAAA,CAAA,GAAU,iBAAA,CAAA,QAAA;AAP1B;;;;;AAOA;AAPA,iBAuBgB,SAAA,CAAA,GAAS,iBAAA,CAAA,QAAA;;;;iBAaT,YAAA,CAAA,GAAY,iBAAA,CAAA,QAAA;;;;iBAaZ,oBAAA,CAAqB,KAAA;EAAS,SAAA,EAAW,gBAAA;AAAA,IAAgB,iBAAA,CAAE,QAAA"}
1
+ {"version":3,"file":"helpers.d.cts","names":[],"sources":["../../src/components/helpers.tsx"],"mappings":";;UAqBiB,4BAAA;EACf,IAAI;AAAA;AADN;;;AAAA,iBAOgB,uBAAA,CAAwB,KAAA,EAAO,4BAA4B,4BAAA,QAAA;AANrE;AAMN;;;;;AANM,iBAgCU,OAAA,6BAAO,QAAA;;;AA1BoD;iBAiC3D,UAAA,6BAAU,QAAA;;;;AAPH;AAOvB;;iBAgBgB,SAAA,6BAAS,QAAA;;AAhBC;AAgB1B;iBAagB,YAAA,6BAAY,QAAA;;;AAbH;iBA0BT,oBAAA,CAAqB,KAAA;EAAS,SAAA,EAAW,gBAAgB;AAAA,6BAAE,QAAA"}
@@ -1,6 +1,4 @@
1
1
  import { CommandParameter } from "../types/command.mjs";
2
- import * as _$_alloy_js_core0 from "@alloy-js/core";
3
-
4
2
  //#region src/components/helpers.d.ts
5
3
  interface BooleanInputParserLogicProps {
6
4
  name: string;
@@ -8,35 +6,35 @@ interface BooleanInputParserLogicProps {
8
6
  /**
9
7
  * Parses a string input into a boolean value, interpreting common truthy and falsy string representations.
10
8
  */
11
- declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps): _$_alloy_js_core0.Children;
9
+ declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps): import("@alloy-js/core").Children;
12
10
  /**
13
11
  * Write the logic to determine if the application is running in debug mode.
14
12
  *
15
13
  * @remarks
16
14
  * This is used to conditionally include debug-only logic in the generated application, such as additional logging or development tools. The logic should check for common indicators of debug mode, such as environment variables or the presence of a debugger.
17
15
  */
18
- declare function IsDebug(): _$_alloy_js_core0.Children;
16
+ declare function IsDebug(): import("@alloy-js/core").Children;
19
17
  /**
20
18
  * Write the logic to determine if the application is **not** running in debug mode.
21
19
  */
22
- declare function IsNotDebug(): _$_alloy_js_core0.Children;
20
+ declare function IsNotDebug(): import("@alloy-js/core").Children;
23
21
  /**
24
22
  * Write the logic to determine if the application is running in verbose mode.
25
23
  *
26
24
  * @remarks
27
25
  * This is used to conditionally include verbose-only logic in the generated application, such as additional logging or detailed output. The logic should check for common indicators of verbose mode, such as environment variables or command-line flags.
28
26
  */
29
- declare function IsVerbose(): _$_alloy_js_core0.Children;
27
+ declare function IsVerbose(): import("@alloy-js/core").Children;
30
28
  /**
31
29
  * Write the logic to determine if the application is **not** running in verbose mode.
32
30
  */
33
- declare function IsNotVerbose(): _$_alloy_js_core0.Children;
31
+ declare function IsNotVerbose(): import("@alloy-js/core").Children;
34
32
  /**
35
33
  * Write the type declaration for a command parameter based on its configuration.
36
34
  */
37
35
  declare function CommandParameterType(props: {
38
36
  parameter: CommandParameter;
39
- }): _$_alloy_js_core0.Children;
37
+ }): import("@alloy-js/core").Children;
40
38
  //#endregion
41
39
  export { BooleanInputParserLogic, BooleanInputParserLogicProps, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose };
42
40
  //# sourceMappingURL=helpers.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.mts","names":[],"sources":["../../src/components/helpers.tsx"],"mappings":";;;;UAsBiB,4BAAA;EACf,IAAA;AAAA;;AADF;;iBAOgB,uBAAA,CAAwB,KAAA,EAAO,4BAAA,GAA4B,iBAAA,CAAA,QAAA;;;AAA3E;;;;iBA0BgB,OAAA,CAAA,GAAO,iBAAA,CAAA,QAAA;;;;iBAOP,UAAA,CAAA,GAAU,iBAAA,CAAA,QAAA;AAP1B;;;;;AAOA;AAPA,iBAuBgB,SAAA,CAAA,GAAS,iBAAA,CAAA,QAAA;;;;iBAaT,YAAA,CAAA,GAAY,iBAAA,CAAA,QAAA;;;;iBAaZ,oBAAA,CAAqB,KAAA;EAAS,SAAA,EAAW,gBAAA;AAAA,IAAgB,iBAAA,CAAE,QAAA"}
1
+ {"version":3,"file":"helpers.d.mts","names":[],"sources":["../../src/components/helpers.tsx"],"mappings":""}
@@ -1,4 +1,3 @@
1
- import { CommandParameterKinds } from "../types/command.mjs";
2
1
  import { createComponent } from "@alloy-js/core/jsx-runtime";
3
2
  import { code } from "@alloy-js/core";
4
3
 
@@ -93,11 +92,11 @@ IsNotVerbose.__type = [
93
92
  */
94
93
  function CommandParameterType(props) {
95
94
  const { parameter } = props;
96
- return code`${(parameter.kind === CommandParameterKinds.string || parameter.kind === CommandParameterKinds.number) && parameter.choices && parameter.choices.length > 0 ? parameter.choices.map(__assignType((choice) => typeof choice === "string" ? `"${choice}"` : choice, [
95
+ return code`${(parameter.type === "string" || parameter.type === "number") && parameter.choices && parameter.choices.length > 0 ? parameter.choices.map(__assignType((choice) => typeof choice === "string" ? `"${choice}"` : choice, [
97
96
  "choice",
98
97
  "",
99
98
  "P\"2!\"/\""
100
- ])).join(" | ") : parameter.kind === CommandParameterKinds.boolean ? "boolean" : parameter.kind === CommandParameterKinds.number ? "number" : "string"}${parameter.variadic ? "[]" : ""}${parameter.optional ? " | undefined" : ""}`;
99
+ ])).join(" | ") : parameter.type === "boolean" ? "boolean" : parameter.type === "number" ? "number" : "string"}${parameter.variadic ? "[]" : ""}${!parameter.required ? " | undefined" : ""}`;
101
100
  }
102
101
  CommandParameterType.__type = [
103
102
  "CommandParameter",
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.mjs","names":[],"sources":["../../src/components/helpers.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code } from \"@alloy-js/core\";\nimport type { CommandParameter } from \"../types\";\nimport { CommandParameterKinds } from \"../types\";\n\nexport interface BooleanInputParserLogicProps {\n name: string;\n}\n\n/**\n * Parses a string input into a boolean value, interpreting common truthy and falsy string representations.\n */\nexport function BooleanInputParserLogic(props: BooleanInputParserLogicProps) {\n const { name } = props;\n\n return (\n <>{code` !!${name} && ${name}.toLowerCase() !== \"false\" && ${\n name\n }.toLowerCase() !== \"f\" && ${name}.toLowerCase() !== \"no\" && ${\n name\n } !== \"n\" && ${name}.toLowerCase() !== \"0\" && ${\n name\n }.toLowerCase() !== \"off\" && ${\n name\n } !== \"disable\" && ${name}.toLowerCase() !== \"disabled\" && ${\n name\n }.toLowerCase() !== \"never\" && (Number.isNaN(Number.parseFloat(${\n name\n })) || Number.parseFloat(${name}) > 0) `}</>\n );\n}\n\n/**\n * Write the logic to determine if the application is running in debug mode.\n *\n * @remarks\n * This is used to conditionally include debug-only logic in the generated application, such as additional logging or development tools. The logic should check for common indicators of debug mode, such as environment variables or the presence of a debugger.\n */\nexport function IsDebug() {\n return code`isDevelopment || isDebug || env.LOG_LEVEL === \"debug\"`;\n}\n\n/**\n * Write the logic to determine if the application is **not** running in debug mode.\n */\nexport function IsNotDebug() {\n return (\n <>\n {code`!(`}\n <IsDebug />\n {code`)`}\n </>\n );\n}\n\n/**\n * Write the logic to determine if the application is running in verbose mode.\n *\n * @remarks\n * This is used to conditionally include verbose-only logic in the generated application, such as additional logging or detailed output. The logic should check for common indicators of verbose mode, such as environment variables or command-line flags.\n */\nexport function IsVerbose() {\n return (\n <>\n {code`( `}\n <IsDebug />\n {code`|| hasFlag([\"verbose\", \"verbose=true\", \"verbose=always\"]))`}\n </>\n );\n}\n\n/**\n * Write the logic to determine if the application is **not** running in verbose mode.\n */\nexport function IsNotVerbose() {\n return (\n <>\n {code`!(`}\n <IsVerbose />\n {code`)`}\n </>\n );\n}\n\n/**\n * Write the type declaration for a command parameter based on its configuration.\n */\nexport function CommandParameterType(props: { parameter: CommandParameter }) {\n const { parameter } = props;\n\n return code`${\n (parameter.kind === CommandParameterKinds.string ||\n parameter.kind === CommandParameterKinds.number) &&\n parameter.choices &&\n parameter.choices.length > 0\n ? parameter.choices\n .map(choice => (typeof choice === \"string\" ? `\"${choice}\"` : choice))\n .join(\" | \")\n : parameter.kind === CommandParameterKinds.boolean\n ? \"boolean\"\n : parameter.kind === CommandParameterKinds.number\n ? \"number\"\n : \"string\"\n }${\n parameter.variadic ? \"[]\" : \"\"\n }${parameter.optional ? \" | undefined\" : \"\"}`;\n}\n"],"mappings":";;;;;;AAEE,IAAG,SAAS;;;AAsBd,MAAA,kCAAA;CAAA;CAAA;CAAA;CAAA;;;;AAKA,SAAgB,wBAAwB,OAAO;CAC7C,MAAM,WAEN;AACA,QAAK,CAAA,IAAO,MAAG,KAAQ,MAAG,KAAM,gCAA8B,KAAA,4BAAA,KAAA,6BAAA,KAAA,cAAA,KAAA,4BAAA,KAAA,8BAAA,KAAA,oBAAA,KAAA,mCAAA,KAAA,gEAAA,KAAA,0BAAA,KAAA,SAAA;;AAEhE,wBAAwB,SAAS;OAAM;CAA2B;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOlE,SAAM,UAAA;AACJ,QAAI,IAAA;;AAEN,QAAQ,SAAS;CAAC;CAAW;CAAkB;CAAA;;;;AAI/C,SAAE,aAAA;AACA,QAAO;EAAA,IAAI;EAAM,gBAAmB,SAAC,EAAA,CAAW;EAAC,IAAG;EAAA;;AAEtD,WAAI,SAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOJ,SAAE,YAAA;AACA,QAAO;EAAA,IAAI;EAAM,gBAAmB,SAAC,EAAA,CAAW;EAAC,IAAK;EAA2B;;AAEnF,UAAO,SAAS;CAAA;CAAa;CAAA;CAAA;;;;AAI7B,SAAgB,eAAA;AACd,QAAK;EAAA,IAAO;EAAA,gBAAA,WAAA,EAAA,CAAA;EAAA,IAAA;EAAA;;AAEd,aAAG,SAAA;CAAA;CAAA;CAAA;CAAA;;;;AAIH,SAAa,qBAAsB,OAAI;CACtC,MAAA,EACG,cACD;AACD,QAAA,IAAA,IAAA,UAAA,SAAA,sBAAA,UAAA,UAAA,SAAA,sBAAA,WAAA,UAAA,WAAA,UAAA,QAAA,SAAA,IAAA,UAAA,QAAA,IAAA,cAAA,WAAA,OAAA,WAAA,WAAA,IAAA,OAAA,KAAA,QAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA,KAAA,MAAA,GAAA,UAAA,SAAA,sBAAA,UAAA,YAAA,UAAA,SAAA,sBAAA,SAAA,WAAA,WAAA,UAAA,WAAA,OAAA,KAAA,UAAA,WAAA,iBAAA;;AAEF,qBAAS,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
1
+ {"version":3,"file":"helpers.mjs","names":[],"sources":[],"mappings":""}
@@ -1,14 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_context_helpers = require('../plugin-utils/context-helpers.cjs');
4
- const require_types_command = require('../types/command.cjs');
5
3
  const require_contexts_options = require('../contexts/options.cjs');
6
4
  const require_components_helpers = require('./helpers.cjs');
7
5
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
+ let _alloy_js_core = require("@alloy-js/core");
8
7
  let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
9
8
  let _stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
10
9
  let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
11
- let _alloy_js_core = require("@alloy-js/core");
12
10
  let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
13
11
  let _alloy_js_typescript = require("@alloy-js/typescript");
14
12
  let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
@@ -183,10 +181,10 @@ function ArgumentsParserLogic(props) {
183
181
  return arg.variadic;
184
182
  },
185
183
  get fallback() {
186
- return arg.kind === require_types_command.CommandParameterKinds.string ? _alloy_js_core.code`"${arg.default}"` : _alloy_js_core.code`${arg.default}`;
184
+ return arg.type === "string" ? _alloy_js_core.code`"${arg.default}"` : _alloy_js_core.code`${arg.default}`;
187
185
  },
188
186
  get children() {
189
- return _alloy_js_core.code`[${arg.default?.map(__assignType((value) => arg.kind === require_types_command.CommandParameterKinds.string ? `"${value}"` : value, [
187
+ return _alloy_js_core.code`[${arg.default?.map(__assignType((value) => arg.type === "string" ? `"${value}"` : value, [
190
188
  "value",
191
189
  "",
192
190
  "P\"2!\"/\""
@@ -211,7 +209,7 @@ function ArgumentsParserLogic(props) {
211
209
  (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = `),
212
210
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
213
211
  get when() {
214
- return arg.kind === require_types_command.CommandParameterKinds.string || arg.kind === require_types_command.CommandParameterKinds.number;
212
+ return arg.type === "string" || arg.type === "number";
215
213
  },
216
214
  get fallback() {
217
215
  return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.BooleanInputParserLogic, { name: `args[argsIndex + ${index}] ` });
@@ -224,7 +222,7 @@ function ArgumentsParserLogic(props) {
224
222
  get fallback() {
225
223
  return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
226
224
  get when() {
227
- return arg.kind === require_types_command.CommandParameterKinds.number;
225
+ return arg.type === "number";
228
226
  },
229
227
  fallback: _alloy_js_core.code`args[argsIndex + ${index}] `,
230
228
  children: _alloy_js_core.code`Number(args[argsIndex + ${index}]) `
@@ -274,7 +272,7 @@ function OptionsMember({ option }) {
274
272
  return [
275
273
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
276
274
  get when() {
277
- return option.kind === require_types_command.CommandParameterKinds.string;
275
+ return option.type === "string";
278
276
  },
279
277
  get children() {
280
278
  return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
@@ -286,14 +284,14 @@ function OptionsMember({ option }) {
286
284
  return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: option });
287
285
  },
288
286
  get optional() {
289
- return option.optional;
287
+ return !option.required;
290
288
  }
291
289
  });
292
290
  }
293
291
  }),
294
292
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
295
293
  get when() {
296
- return option.kind === require_types_command.CommandParameterKinds.number;
294
+ return option.type === "number";
297
295
  },
298
296
  get children() {
299
297
  return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
@@ -305,14 +303,14 @@ function OptionsMember({ option }) {
305
303
  return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: option });
306
304
  },
307
305
  get optional() {
308
- return option.optional;
306
+ return !option.required;
309
307
  }
310
308
  });
311
309
  }
312
310
  }),
313
311
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
314
312
  get when() {
315
- return option.kind === require_types_command.CommandParameterKinds.boolean;
313
+ return option.type === "boolean";
316
314
  },
317
315
  get children() {
318
316
  return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
@@ -324,7 +322,7 @@ function OptionsMember({ option }) {
324
322
  return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: option });
325
323
  },
326
324
  get optional() {
327
- return option.optional;
325
+ return !option.required;
328
326
  }
329
327
  });
330
328
  }
@@ -365,7 +363,7 @@ function OptionsMemberParserLogic(props) {
365
363
  ])).join("|")})=/`;
366
364
  return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
367
365
  get when() {
368
- return option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number;
366
+ return option.type === "string" || option.type === "number";
369
367
  },
370
368
  get children() {
371
369
  return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
@@ -395,19 +393,19 @@ function OptionsMemberParserLogic(props) {
395
393
  }),
396
394
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
397
395
  get when() {
398
- return option.kind === require_types_command.CommandParameterKinds.string;
396
+ return option.type === "string";
399
397
  },
400
398
  children: _alloy_js_core.code`...arg.replace(${equalsRegex}, "").split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean) `
401
399
  }),
402
400
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
403
401
  get when() {
404
- return option.kind === require_types_command.CommandParameterKinds.number;
402
+ return option.type === "number";
405
403
  },
406
404
  children: _alloy_js_core.code`...arg.replace(${equalsRegex}, "").split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean).map(Number).filter(value => !Number.isNaN(value)) `
407
405
  }),
408
406
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
409
407
  get when() {
410
- return (option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number) && option.choices && option.choices.length > 0;
408
+ return (option.type === "string" || option.type === "number") && option.choices && option.choices.length > 0;
411
409
  },
412
410
  get children() {
413
411
  return _alloy_js_core.code` as ${option.choices?.map(__assignType((choice) => (0, _stryke_type_checks_is_set_string.isSetString)(choice) ? `"${choice}"` : choice, [
@@ -434,19 +432,19 @@ function OptionsMemberParserLogic(props) {
434
432
  }),
435
433
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
436
434
  get when() {
437
- return option.kind === require_types_command.CommandParameterKinds.string;
435
+ return option.type === "string";
438
436
  },
439
437
  children: _alloy_js_core.code`...args[++i].split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean) `
440
438
  }),
441
439
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
442
440
  get when() {
443
- return option.kind === require_types_command.CommandParameterKinds.number;
441
+ return option.type === "number";
444
442
  },
445
443
  children: _alloy_js_core.code`...args[++i].split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean).map(Number).filter(value => !Number.isNaN(value)) `
446
444
  }),
447
445
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
448
446
  get when() {
449
- return (option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number) && option.choices && option.choices.length > 0;
447
+ return (option.type === "string" || option.type === "number") && option.choices && option.choices.length > 0;
450
448
  },
451
449
  get children() {
452
450
  return _alloy_js_core.code` as ${option.choices?.map(__assignType((choice) => (0, _stryke_type_checks_is_set_string.isSetString)(choice) ? `"${choice}"` : choice, [
@@ -473,7 +471,7 @@ function OptionsMemberParserLogic(props) {
473
471
  get children() {
474
472
  return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
475
473
  get when() {
476
- return option.kind === require_types_command.CommandParameterKinds.string;
474
+ return option.type === "string";
477
475
  },
478
476
  get children() {
479
477
  return [
@@ -502,7 +500,7 @@ function OptionsMemberParserLogic(props) {
502
500
  }
503
501
  }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
504
502
  get when() {
505
- return option.kind === require_types_command.CommandParameterKinds.number;
503
+ return option.type === "number";
506
504
  },
507
505
  get children() {
508
506
  return [
@@ -546,7 +544,7 @@ function OptionsMemberParserLogic(props) {
546
544
  get children() {
547
545
  return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
548
546
  get when() {
549
- return option.kind === require_types_command.CommandParameterKinds.string;
547
+ return option.type === "string";
550
548
  },
551
549
  get children() {
552
550
  return [
@@ -575,7 +573,7 @@ function OptionsMemberParserLogic(props) {
575
573
  }
576
574
  }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
577
575
  get when() {
578
- return option.kind === require_types_command.CommandParameterKinds.number;
576
+ return option.type === "number";
579
577
  },
580
578
  get children() {
581
579
  return [
@@ -621,7 +619,7 @@ function OptionsMemberParserLogic(props) {
621
619
  }
622
620
  }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
623
621
  get when() {
624
- return option.kind === require_types_command.CommandParameterKinds.boolean;
622
+ return option.type === "boolean";
625
623
  },
626
624
  get children() {
627
625
  return [
@@ -789,14 +787,14 @@ function OptionsParserLogic(props) {
789
787
  name: "options",
790
788
  get initializer() {
791
789
  return _alloy_js_core.code` {
792
- ${segments.length > 0 ? "...useGlobalOptions(), " : ""}${Object.entries(options.value).filter(__assignType(([, option]) => option.env || option.default !== void 0 || (option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number) && option.variadic, [
790
+ ${segments.length > 0 ? "...useGlobalOptions(), " : ""}${Object.entries(options.value).filter(__assignType(([, option]) => option.env || option.default !== void 0 || (option.type === "string" || option.type === "number") && option.variadic, [
793
791
  "param0",
794
792
  "",
795
793
  "P\"2!\"/\""
796
794
  ])).map(__assignType(([name, option]) => {
797
- if (option.kind === require_types_command.CommandParameterKinds.string) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${appSpecificEnvPrefix}_${option.env}` : ""}${option.variadic ? option.default !== void 0 ? `${option.env ? " ?? " : ""}${JSON.stringify(option.default)}` : option.env ? " ?? []" : "[]" : option.default !== void 0 ? `${option.env ? " ?? " : ""}"${option.default}"` : ""}, `;
798
- else if (option.kind === require_types_command.CommandParameterKinds.number) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${appSpecificEnvPrefix}_${option.env}` : ""}${option.variadic ? option.default && Array.isArray(option.default) ? `${option.env ? " ?? " : ""}${JSON.stringify(option.default)}` : option.env ? " ?? []" : "[]" : option.default !== void 0 ? `${option.env ? " ?? " : ""}${option.default}` : ""}, `;
799
- else if (option.kind === require_types_command.CommandParameterKinds.boolean) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${appSpecificEnvPrefix}_${option.env} ?? ` : ""}${option.default ? "true" : "false"},`;
795
+ if (option.type === "string") return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${appSpecificEnvPrefix}_${option.env}` : ""}${option.variadic ? option.default !== void 0 ? `${option.env ? " ?? " : ""}${JSON.stringify(option.default)}` : option.env ? " ?? []" : "[]" : option.default !== void 0 ? `${option.env ? " ?? " : ""}"${option.default}"` : ""}, `;
796
+ else if (option.type === "number") return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${appSpecificEnvPrefix}_${option.env}` : ""}${option.variadic ? option.default && Array.isArray(option.default) ? `${option.env ? " ?? " : ""}${JSON.stringify(option.default)}` : option.env ? " ?? []" : "[]" : option.default !== void 0 ? `${option.env ? " ?? " : ""}${option.default}` : ""}, `;
797
+ else if (option.type === "boolean") return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${appSpecificEnvPrefix}_${option.env} ?? ` : ""}${option.default ? "true" : "false"},`;
800
798
  return "";
801
799
  }, [
802
800
  "param0",
@@ -959,4 +957,5 @@ exports.__ΩCommandParserLogicProps = __ΩCommandParserLogicProps;
959
957
  exports.__ΩDynamicSegmentsParserLogicProps = __ΩDynamicSegmentsParserLogicProps;
960
958
  exports.__ΩOptionsMemberParserConditionProps = __ΩOptionsMemberParserConditionProps;
961
959
  exports.__ΩOptionsMemberParserLogicProps = __ΩOptionsMemberParserLogicProps;
962
- exports.__ΩOptionsParserLogicProps = __ΩOptionsParserLogicProps;
960
+ exports.__ΩOptionsParserLogicProps = __ΩOptionsParserLogicProps;
961
+ //# sourceMappingURL=options-parser-logic.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options-parser-logic.cjs","names":[],"sources":[],"mappings":""}
@@ -1,6 +1,5 @@
1
1
  import { CommandOption, CommandTree } from "../types/command.cjs";
2
2
  import { PartialKeys } from "@stryke/types/base";
3
- import * as _$_alloy_js_core0 from "@alloy-js/core";
4
3
 
5
4
  //#region src/components/options-parser-logic.d.ts
6
5
  interface DynamicSegmentsParserLogicProps {
@@ -13,7 +12,7 @@ interface DynamicSegmentsParserLogicProps {
13
12
  */
14
13
  isCaseSensitive: boolean;
15
14
  }
16
- declare function DynamicSegmentsParserLogic(props: DynamicSegmentsParserLogicProps): _$_alloy_js_core0.Children;
15
+ declare function DynamicSegmentsParserLogic(props: DynamicSegmentsParserLogicProps): import("@alloy-js/core").Children;
17
16
  interface ArgumentsParserLogicProps {
18
17
  /**
19
18
  * The command to generate the positional parameters parser logic for.
@@ -28,7 +27,7 @@ interface ArgumentsParserLogicProps {
28
27
  */
29
28
  isCaseSensitive: boolean;
30
29
  }
31
- declare function ArgumentsParserLogic(props: ArgumentsParserLogicProps): _$_alloy_js_core0.Children;
30
+ declare function ArgumentsParserLogic(props: ArgumentsParserLogicProps): import("@alloy-js/core").Children;
32
31
  /**
33
32
  * The command option interface property.
34
33
  */
@@ -36,7 +35,7 @@ declare function OptionsMember({
36
35
  option
37
36
  }: {
38
37
  option: CommandOption;
39
- }): _$_alloy_js_core0.Children;
38
+ }): import("@alloy-js/core").Children;
40
39
  interface OptionsMemberParserLogicProps {
41
40
  /**
42
41
  * The option name to generate the parser logic for.
@@ -56,7 +55,7 @@ interface OptionsMemberParserLogicProps {
56
55
  /**
57
56
  * The command option property parser logic.
58
57
  */
59
- declare function OptionsMemberParserLogic(props: OptionsMemberParserLogicProps): _$_alloy_js_core0.Children;
58
+ declare function OptionsMemberParserLogic(props: OptionsMemberParserLogicProps): import("@alloy-js/core").Children;
60
59
  interface OptionsMemberParserConditionProps {
61
60
  /**
62
61
  * The option name to generate the parser logic for.
@@ -73,10 +72,10 @@ interface OptionsMemberParserConditionProps {
73
72
  */
74
73
  isCaseSensitive: boolean;
75
74
  }
76
- declare function OptionsMemberParserCondition(props: OptionsMemberParserConditionProps): _$_alloy_js_core0.Children;
75
+ declare function OptionsMemberParserCondition(props: OptionsMemberParserConditionProps): import("@alloy-js/core").Children;
77
76
  declare function OptionsInterfaceDeclaration(props: {
78
77
  command: CommandTree;
79
- }): _$_alloy_js_core0.Children;
78
+ }): import("@alloy-js/core").Children;
80
79
  interface OptionsParserLogicProps extends PartialKeys<Pick<CommandTree, "segments" | "options" | "name">, "segments" | "name"> {
81
80
  /**
82
81
  * The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${appSpecificEnvPrefix}_OPTION_NAME`).
@@ -92,7 +91,7 @@ interface OptionsParserLogicProps extends PartialKeys<Pick<CommandTree, "segment
92
91
  /**
93
92
  * The command options parser logic.
94
93
  */
95
- declare function OptionsParserLogic(props: OptionsParserLogicProps): _$_alloy_js_core0.Children;
94
+ declare function OptionsParserLogic(props: OptionsParserLogicProps): import("@alloy-js/core").Children;
96
95
  interface CommandParserLogicProps {
97
96
  /**
98
97
  * The command to generate the parser logic for.
@@ -112,7 +111,7 @@ interface CommandParserLogicProps {
112
111
  /**
113
112
  * The command parser logic, which includes parsing dynamic path segments, positional parameters, and options.
114
113
  */
115
- declare function CommandParserLogic(props: CommandParserLogicProps): _$_alloy_js_core0.Children;
114
+ declare function CommandParserLogic(props: CommandParserLogicProps): import("@alloy-js/core").Children;
116
115
  //#endregion
117
116
  export { ArgumentsParserLogic, ArgumentsParserLogicProps, CommandParserLogic, CommandParserLogicProps, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps };
118
117
  //# sourceMappingURL=options-parser-logic.d.cts.map