@shell-shock/core 0.17.8 → 0.17.11

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 (272) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +29 -1
  2. package/dist/api.cjs +36 -1
  3. package/dist/api.cjs.map +1 -0
  4. package/dist/api.d.cts +2 -77
  5. package/dist/api.d.cts.map +1 -1
  6. package/dist/api.d.mts +2 -76
  7. package/dist/api.d.mts.map +1 -1
  8. package/dist/api.mjs +35 -1
  9. package/dist/api.mjs.map +1 -1
  10. package/dist/components/command-validation-logic.cjs +291 -1
  11. package/dist/components/command-validation-logic.cjs.map +1 -0
  12. package/dist/components/command-validation-logic.d.cts +1 -3
  13. package/dist/components/command-validation-logic.d.cts.map +1 -1
  14. package/dist/components/command-validation-logic.d.mts +1 -3
  15. package/dist/components/command-validation-logic.d.mts.map +1 -1
  16. package/dist/components/command-validation-logic.mjs +288 -1
  17. package/dist/components/command-validation-logic.mjs.map +1 -1
  18. package/dist/components/docs.cjs +265 -1
  19. package/dist/components/docs.cjs.map +1 -0
  20. package/dist/components/docs.d.cts +4 -5
  21. package/dist/components/docs.d.cts.map +1 -1
  22. package/dist/components/docs.d.mts +4 -5
  23. package/dist/components/docs.d.mts.map +1 -1
  24. package/dist/components/docs.mjs +256 -1
  25. package/dist/components/docs.mjs.map +1 -1
  26. package/dist/components/exec-builtin.cjs +429 -15
  27. package/dist/components/exec-builtin.cjs.map +1 -0
  28. package/dist/components/exec-builtin.d.cts +1 -2
  29. package/dist/components/exec-builtin.d.cts.map +1 -1
  30. package/dist/components/exec-builtin.d.mts +1 -2
  31. package/dist/components/exec-builtin.d.mts.map +1 -1
  32. package/dist/components/exec-builtin.mjs +424 -15
  33. package/dist/components/exec-builtin.mjs.map +1 -1
  34. package/dist/components/helpers.cjs +119 -1
  35. package/dist/components/helpers.cjs.map +1 -0
  36. package/dist/components/helpers.d.cts +6 -8
  37. package/dist/components/helpers.d.cts.map +1 -1
  38. package/dist/components/helpers.d.mts +6 -8
  39. package/dist/components/helpers.d.mts.map +1 -1
  40. package/dist/components/helpers.mjs +111 -1
  41. package/dist/components/helpers.mjs.map +1 -1
  42. package/dist/components/index.cjs +58 -1
  43. package/dist/components/index.mjs +10 -1
  44. package/dist/components/options-parser-logic.cjs +959 -5
  45. package/dist/components/options-parser-logic.cjs.map +1 -0
  46. package/dist/components/options-parser-logic.d.cts +8 -9
  47. package/dist/components/options-parser-logic.d.cts.map +1 -1
  48. package/dist/components/options-parser-logic.d.mts +8 -9
  49. package/dist/components/options-parser-logic.d.mts.map +1 -1
  50. package/dist/components/options-parser-logic.mjs +944 -5
  51. package/dist/components/options-parser-logic.mjs.map +1 -1
  52. package/dist/components/state-builtin.cjs +630 -8
  53. package/dist/components/state-builtin.cjs.map +1 -0
  54. package/dist/components/state-builtin.d.cts +4 -5
  55. package/dist/components/state-builtin.d.cts.map +1 -1
  56. package/dist/components/state-builtin.d.mts +4 -5
  57. package/dist/components/state-builtin.d.mts.map +1 -1
  58. package/dist/components/state-builtin.mjs +622 -8
  59. package/dist/components/state-builtin.mjs.map +1 -1
  60. package/dist/components/usage.cjs +116 -1
  61. package/dist/components/usage.cjs.map +1 -0
  62. package/dist/components/usage.d.cts +1 -2
  63. package/dist/components/usage.d.cts.map +1 -1
  64. package/dist/components/usage.d.mts +1 -2
  65. package/dist/components/usage.d.mts.map +1 -1
  66. package/dist/components/usage.mjs +113 -1
  67. package/dist/components/usage.mjs.map +1 -1
  68. package/dist/components/utils-builtin.cjs +839 -33
  69. package/dist/components/utils-builtin.cjs.map +1 -0
  70. package/dist/components/utils-builtin.d.cts +7 -8
  71. package/dist/components/utils-builtin.d.cts.map +1 -1
  72. package/dist/components/utils-builtin.d.mts +7 -8
  73. package/dist/components/utils-builtin.d.mts.map +1 -1
  74. package/dist/components/utils-builtin.mjs +828 -33
  75. package/dist/components/utils-builtin.mjs.map +1 -1
  76. package/dist/config.cjs +65 -1
  77. package/dist/config.cjs.map +1 -0
  78. package/dist/config.d.cts +29 -8
  79. package/dist/config.d.cts.map +1 -1
  80. package/dist/config.d.mts +29 -8
  81. package/dist/config.d.mts.map +1 -1
  82. package/dist/config.mjs +62 -1
  83. package/dist/config.mjs.map +1 -1
  84. package/dist/contexts/command.cjs +26 -1
  85. package/dist/contexts/command.cjs.map +1 -0
  86. package/dist/contexts/command.d.cts.map +1 -1
  87. package/dist/contexts/command.d.mts.map +1 -1
  88. package/dist/contexts/command.mjs +23 -1
  89. package/dist/contexts/command.mjs.map +1 -1
  90. package/dist/contexts/index.cjs +9 -1
  91. package/dist/contexts/index.mjs +4 -1
  92. package/dist/contexts/options.cjs +63 -1
  93. package/dist/contexts/options.cjs.map +1 -0
  94. package/dist/contexts/options.d.cts.map +1 -1
  95. package/dist/contexts/options.d.mts.map +1 -1
  96. package/dist/contexts/options.mjs +57 -1
  97. package/dist/contexts/options.mjs.map +1 -1
  98. package/dist/engine.cjs +138 -0
  99. package/dist/engine.cjs.map +1 -0
  100. package/dist/engine.d.cts +79 -0
  101. package/dist/engine.d.cts.map +1 -0
  102. package/dist/engine.d.mts +79 -0
  103. package/dist/engine.d.mts.map +1 -0
  104. package/dist/engine.mjs +136 -0
  105. package/dist/engine.mjs.map +1 -0
  106. package/dist/helpers/automd.cjs +70 -1
  107. package/dist/helpers/automd.cjs.map +1 -0
  108. package/dist/helpers/automd.mjs +69 -1
  109. package/dist/helpers/automd.mjs.map +1 -1
  110. package/dist/helpers/docs-helpers.cjs +23 -1
  111. package/dist/helpers/docs-helpers.cjs.map +1 -0
  112. package/dist/helpers/docs-helpers.mjs +22 -1
  113. package/dist/helpers/docs-helpers.mjs.map +1 -1
  114. package/dist/helpers/get-framework.cjs +24 -0
  115. package/dist/helpers/get-framework.cjs.map +1 -0
  116. package/dist/helpers/get-framework.mjs +24 -0
  117. package/dist/helpers/get-framework.mjs.map +1 -0
  118. package/dist/helpers/paths.cjs +137 -1
  119. package/dist/helpers/paths.cjs.map +1 -0
  120. package/dist/helpers/paths.mjs +133 -1
  121. package/dist/helpers/paths.mjs.map +1 -1
  122. package/dist/helpers/persistence.cjs +113 -1
  123. package/dist/helpers/persistence.cjs.map +1 -0
  124. package/dist/helpers/persistence.mjs +112 -1
  125. package/dist/helpers/persistence.mjs.map +1 -1
  126. package/dist/helpers/update-package-json.cjs +65 -1
  127. package/dist/helpers/update-package-json.cjs.map +1 -0
  128. package/dist/helpers/update-package-json.mjs +63 -1
  129. package/dist/helpers/update-package-json.mjs.map +1 -1
  130. package/dist/helpers/utilities.cjs +95 -1
  131. package/dist/helpers/utilities.cjs.map +1 -0
  132. package/dist/helpers/utilities.mjs +93 -1
  133. package/dist/helpers/utilities.mjs.map +1 -1
  134. package/dist/helpers/validations.cjs +71 -1
  135. package/dist/helpers/validations.cjs.map +1 -0
  136. package/dist/helpers/validations.mjs +69 -1
  137. package/dist/helpers/validations.mjs.map +1 -1
  138. package/dist/index.cjs +123 -1
  139. package/dist/index.cjs.map +1 -0
  140. package/dist/index.d.cts +80 -5
  141. package/dist/index.d.cts.map +1 -0
  142. package/dist/index.d.mts +80 -5
  143. package/dist/index.d.mts.map +1 -0
  144. package/dist/index.mjs +119 -1
  145. package/dist/index.mjs.map +1 -0
  146. package/dist/package.cjs +12 -0
  147. package/dist/package.cjs.map +1 -0
  148. package/dist/package.mjs +6 -0
  149. package/dist/package.mjs.map +1 -0
  150. package/dist/plugin-utils/compute-bin.cjs +48 -1
  151. package/dist/plugin-utils/compute-bin.cjs.map +1 -0
  152. package/dist/plugin-utils/compute-bin.d.cts +2 -2
  153. package/dist/plugin-utils/compute-bin.d.cts.map +1 -1
  154. package/dist/plugin-utils/compute-bin.d.mts +2 -2
  155. package/dist/plugin-utils/compute-bin.d.mts.map +1 -1
  156. package/dist/plugin-utils/compute-bin.mjs +47 -1
  157. package/dist/plugin-utils/compute-bin.mjs.map +1 -1
  158. package/dist/plugin-utils/context-helpers.cjs +224 -1
  159. package/dist/plugin-utils/context-helpers.cjs.map +1 -0
  160. package/dist/plugin-utils/context-helpers.d.cts +4 -4
  161. package/dist/plugin-utils/context-helpers.d.cts.map +1 -1
  162. package/dist/plugin-utils/context-helpers.d.mts +4 -4
  163. package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
  164. package/dist/plugin-utils/context-helpers.mjs +214 -1
  165. package/dist/plugin-utils/context-helpers.mjs.map +1 -1
  166. package/dist/plugin-utils/deepkit.cjs +70 -1
  167. package/dist/plugin-utils/deepkit.cjs.map +1 -0
  168. package/dist/plugin-utils/deepkit.d.cts +5 -5
  169. package/dist/plugin-utils/deepkit.d.cts.map +1 -1
  170. package/dist/plugin-utils/deepkit.d.mts +5 -5
  171. package/dist/plugin-utils/deepkit.d.mts.map +1 -1
  172. package/dist/plugin-utils/deepkit.mjs +68 -1
  173. package/dist/plugin-utils/deepkit.mjs.map +1 -1
  174. package/dist/plugin-utils/description-helpers.cjs +112 -2
  175. package/dist/plugin-utils/description-helpers.cjs.map +1 -0
  176. package/dist/plugin-utils/description-helpers.d.cts.map +1 -1
  177. package/dist/plugin-utils/description-helpers.d.mts.map +1 -1
  178. package/dist/plugin-utils/description-helpers.mjs +107 -2
  179. package/dist/plugin-utils/description-helpers.mjs.map +1 -1
  180. package/dist/plugin-utils/get-command-tree.cjs +118 -1
  181. package/dist/plugin-utils/get-command-tree.cjs.map +1 -0
  182. package/dist/plugin-utils/get-command-tree.d.cts.map +1 -1
  183. package/dist/plugin-utils/get-command-tree.d.mts.map +1 -1
  184. package/dist/plugin-utils/get-command-tree.mjs +114 -1
  185. package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
  186. package/dist/plugin-utils/index.cjs +39 -1
  187. package/dist/plugin-utils/index.d.cts +2 -2
  188. package/dist/plugin-utils/index.d.mts +2 -2
  189. package/dist/plugin-utils/index.mjs +10 -1
  190. package/dist/plugin-utils/reflect.cjs +52 -1
  191. package/dist/plugin-utils/reflect.cjs.map +1 -0
  192. package/dist/plugin-utils/reflect.d.cts.map +1 -1
  193. package/dist/plugin-utils/reflect.d.mts.map +1 -1
  194. package/dist/plugin-utils/reflect.mjs +50 -1
  195. package/dist/plugin-utils/reflect.mjs.map +1 -1
  196. package/dist/plugin-utils/traverse-command-tree.cjs +65 -1
  197. package/dist/plugin-utils/traverse-command-tree.cjs.map +1 -0
  198. package/dist/plugin-utils/traverse-command-tree.d.cts.map +1 -1
  199. package/dist/plugin-utils/traverse-command-tree.d.mts.map +1 -1
  200. package/dist/plugin-utils/traverse-command-tree.mjs +62 -1
  201. package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
  202. package/dist/plugin-utils/type-checks.cjs +222 -1
  203. package/dist/plugin-utils/type-checks.cjs.map +1 -0
  204. package/dist/plugin-utils/type-checks.d.cts +5 -5
  205. package/dist/plugin-utils/type-checks.d.cts.map +1 -1
  206. package/dist/plugin-utils/type-checks.d.mts +5 -5
  207. package/dist/plugin-utils/type-checks.d.mts.map +1 -1
  208. package/dist/plugin-utils/type-checks.mjs +217 -1
  209. package/dist/plugin-utils/type-checks.mjs.map +1 -1
  210. package/dist/plugin.cjs +495 -4
  211. package/dist/plugin.cjs.map +1 -0
  212. package/dist/plugin.d.cts.map +1 -1
  213. package/dist/plugin.d.mts.map +1 -1
  214. package/dist/plugin.mjs +488 -4
  215. package/dist/plugin.mjs.map +1 -1
  216. package/dist/resolver/helpers.cjs +182 -1
  217. package/dist/resolver/helpers.cjs.map +1 -0
  218. package/dist/resolver/helpers.mjs +178 -1
  219. package/dist/resolver/helpers.mjs.map +1 -1
  220. package/dist/resolver/resolve.cjs +479 -1
  221. package/dist/resolver/resolve.cjs.map +1 -0
  222. package/dist/resolver/resolve.mjs +478 -1
  223. package/dist/resolver/resolve.mjs.map +1 -1
  224. package/dist/types/command.cjs +402 -1
  225. package/dist/types/command.cjs.map +1 -0
  226. package/dist/types/command.d.cts +61 -119
  227. package/dist/types/command.d.cts.map +1 -1
  228. package/dist/types/command.d.mts +61 -119
  229. package/dist/types/command.d.mts.map +1 -1
  230. package/dist/types/command.mjs +367 -1
  231. package/dist/types/command.mjs.map +1 -1
  232. package/dist/types/config.cjs +175 -1
  233. package/dist/types/config.cjs.map +1 -0
  234. package/dist/types/config.d.cts +19 -12
  235. package/dist/types/config.d.cts.map +1 -1
  236. package/dist/types/config.d.mts +19 -12
  237. package/dist/types/config.d.mts.map +1 -1
  238. package/dist/types/config.mjs +163 -1
  239. package/dist/types/config.mjs.map +1 -1
  240. package/dist/types/context.cjs +45 -1
  241. package/dist/types/context.cjs.map +1 -0
  242. package/dist/types/context.d.cts +3 -2
  243. package/dist/types/context.d.cts.map +1 -1
  244. package/dist/types/context.d.mts +3 -2
  245. package/dist/types/context.d.mts.map +1 -1
  246. package/dist/types/context.mjs +40 -1
  247. package/dist/types/context.mjs.map +1 -1
  248. package/dist/types/env.cjs +53 -1
  249. package/dist/types/env.cjs.map +1 -0
  250. package/dist/types/env.d.cts +1 -1
  251. package/dist/types/env.d.cts.map +1 -1
  252. package/dist/types/env.d.mts +1 -1
  253. package/dist/types/env.d.mts.map +1 -1
  254. package/dist/types/env.mjs +50 -1
  255. package/dist/types/env.mjs.map +1 -1
  256. package/dist/types/index.cjs +53 -1
  257. package/dist/types/index.d.cts +4 -4
  258. package/dist/types/index.d.mts +4 -4
  259. package/dist/types/index.mjs +6 -1
  260. package/dist/types/options.cjs +13 -1
  261. package/dist/types/options.cjs.map +1 -0
  262. package/dist/types/options.d.cts.map +1 -1
  263. package/dist/types/options.d.mts.map +1 -1
  264. package/dist/types/options.mjs +10 -1
  265. package/dist/types/options.mjs.map +1 -1
  266. package/package.json +43 -34
  267. package/dist/resolver/deepkit.cjs +0 -1
  268. package/dist/resolver/deepkit.mjs +0 -2
  269. package/dist/resolver/deepkit.mjs.map +0 -1
  270. package/dist/resolver/module.cjs +0 -1
  271. package/dist/resolver/module.mjs +0 -2
  272. package/dist/resolver/module.mjs.map +0 -1
@@ -1,4 +1,84 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`);let t=require(`@alloy-js/core/jsx-runtime`),n=require(`@powerlines/deepkit/vendor/type`),r=require(`defu`);r=e.__toESM(r);let i=require(`@alloy-js/core`),a=require(`@powerlines/plugin-alloy/core/components/spacing`),o=require(`@alloy-js/typescript`),s=require(`@powerlines/plugin-alloy/typescript/components/builtin-file`),c=require(`@powerlines/plugin-alloy/typescript/components/tsdoc`);const l=[`T`,`K`,()=>u,()=>d,`Omit`,`b!b"e!!e!!ge!"o$#o##w%y`],u=[`T`,`K`,`Pick`,`l+e#!e"!fRb!b"Pde""N#!w#y`],d=[`T`,`U`,`Exclude`,`l6!Re$!RPe#!e$"qk#%QRb!b"Pde"!p)w#y`],f=[()=>l,`id`,`description`,`ExecBuiltinProps`,`P!P.".#Jo!#Mw$y`];function p(e){let[{children:l},u]=(0,i.splitProps)(e,[`children`]);return(0,t.createComponent)(s.BuiltinFile,(0,t.mergeProps)({id:`exec`,description:`A module to handle command execution in a Shell Shock application.`},u,{get imports(){return(0,r.default)(u.imports??{},{"node:path":[`basename`,`extname`,`dirname`,`join`],"node:fs":[`existsSync`],"node:child_process":[{name:`spawn`,alias:`_spawn`},`execFileSync`],"node:stream":[{name:`Stream`,default:!0,type:!0}]})},get builtinImports(){return(0,r.default)(u.builtinImports??{},{env:[`isWindows`,`env`]})},get children(){return[(0,t.createComponent)(o.FunctionDeclaration,{name:`resolveCommandEnv`,parameters:[{name:`params`,type:`{ argv: string[]; env?: NodeJS.ProcessEnv; }`}],returnType:`NodeJS.ProcessEnv`,children:i.code`const argv = params.argv;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
4
+ let _alloy_js_core = require("@alloy-js/core");
5
+ let defu = require("defu");
6
+ defu = require_runtime.__toESM(defu);
7
+ let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
8
+ let _alloy_js_typescript = require("@alloy-js/typescript");
9
+ let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
10
+ let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
11
+
12
+ //#region src/components/exec-builtin.tsx
13
+ const __ΩOmit = [
14
+ "T",
15
+ "K",
16
+ () => __ΩPick,
17
+ () => __ΩExclude,
18
+ "Omit",
19
+ "b!b\"e!!e!!ge!\"o$#o##w%y"
20
+ ];
21
+ const __ΩPick = [
22
+ "T",
23
+ "K",
24
+ "Pick",
25
+ "l+e#!e\"!fRb!b\"Pde\"\"N#!w#y"
26
+ ];
27
+ const __ΩExclude = [
28
+ "T",
29
+ "U",
30
+ "Exclude",
31
+ "l6!Re$!RPe#!e$\"qk#%QRb!b\"Pde\"!p)w#y"
32
+ ];
33
+ const __ΩExecBuiltinProps = [
34
+ () => __ΩOmit,
35
+ "id",
36
+ "description",
37
+ "ExecBuiltinProps",
38
+ "P!P.\".#Jo!#Mw$y"
39
+ ];
40
+ /**
41
+ * A built-in module for handling command execution in Shell Shock.
42
+ */
43
+ function ExecBuiltin(props) {
44
+ const [{ children }, rest] = (0, _alloy_js_core.splitProps)(props, ["children"]);
45
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
46
+ id: "exec",
47
+ description: "A module to handle command execution in a Shell Shock application."
48
+ }, rest, {
49
+ get imports() {
50
+ return (0, defu.default)(rest.imports ?? {}, {
51
+ "node:path": [
52
+ "basename",
53
+ "extname",
54
+ "dirname",
55
+ "join"
56
+ ],
57
+ "node:fs": ["existsSync"],
58
+ "node:child_process": [{
59
+ name: "spawn",
60
+ alias: "_spawn"
61
+ }, "execFileSync"],
62
+ "node:stream": [{
63
+ name: "Stream",
64
+ default: true,
65
+ type: true
66
+ }]
67
+ });
68
+ },
69
+ get builtinImports() {
70
+ return (0, defu.default)(rest.builtinImports ?? {}, { env: ["isWindows", "env"] });
71
+ },
72
+ get children() {
73
+ return [
74
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
75
+ name: "resolveCommandEnv",
76
+ parameters: [{
77
+ name: "params",
78
+ type: "{ argv: string[]; env?: NodeJS.ProcessEnv; }"
79
+ }],
80
+ returnType: "NodeJS.ProcessEnv",
81
+ children: _alloy_js_core.code`const argv = params.argv;
2
82
  const shouldSuppressNpmFund = (() => {
3
83
  const cmd = basename(argv[0] ?? "");
4
84
  if (cmd === "npm" || cmd === "npm.cmd" || cmd === "npm.exe") {
@@ -24,12 +104,32 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
24
104
  result.NPM_CONFIG_FUND ??= "false";
25
105
  result.npm_config_fund ??= "false";
26
106
  }
27
- return result; `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`isWindowsBatchCommand`,parameters:[{name:`resolvedCommand`,type:`string`}],returnType:`boolean`,children:i.code`if (!isWindows) {
107
+ return result; `
108
+ }),
109
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
110
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
111
+ name: "isWindowsBatchCommand",
112
+ parameters: [{
113
+ name: "resolvedCommand",
114
+ type: "string"
115
+ }],
116
+ returnType: "boolean",
117
+ children: _alloy_js_core.code`if (!isWindows) {
28
118
  return false;
29
119
  }
30
120
  const ext = extname(resolvedCommand).toLowerCase();
31
121
 
32
- return ext === ".cmd" || ext === ".bat"; `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`escapeForCmdExe`,parameters:[{name:`arg`,type:`string`}],returnType:`string`,children:i.code`if (/[&|<>^%\\\\r\\\\n]/.test(arg)) {
122
+ return ext === ".cmd" || ext === ".bat"; `
123
+ }),
124
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
125
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
126
+ name: "escapeForCmdExe",
127
+ parameters: [{
128
+ name: "arg",
129
+ type: "string"
130
+ }],
131
+ returnType: "string",
132
+ children: _alloy_js_core.code`if (/[&|<>^%\\\\r\\\\n]/.test(arg)) {
33
133
  throw new Error(
34
134
  \`Unsafe Windows cmd.exe argument detected: \${JSON.stringify(arg)}. \` +
35
135
  "Pass an explicit shell-wrapper argv at the call site instead."
@@ -38,9 +138,33 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
38
138
  if (!arg.includes(" ") && !arg.includes('"')) {
39
139
  return arg;
40
140
  }
41
- return \`"\${arg.replace(/"/g, '""')}"\`; `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`buildCmdExeCommandLine`,parameters:[{name:`resolvedCommand`,type:`string`},{name:`args`,type:`string[]`}],returnType:`string`,children:i.code`return [escapeForCmdExe(resolvedCommand), ...args.map(escapeForCmdExe)].join(
141
+ return \`"\${arg.replace(/"/g, '""')}"\`; `
142
+ }),
143
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
144
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
145
+ name: "buildCmdExeCommandLine",
146
+ parameters: [{
147
+ name: "resolvedCommand",
148
+ type: "string"
149
+ }, {
150
+ name: "args",
151
+ type: "string[]"
152
+ }],
153
+ returnType: "string",
154
+ children: _alloy_js_core.code`return [escapeForCmdExe(resolvedCommand), ...args.map(escapeForCmdExe)].join(
42
155
  " "
43
- ); `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`resolveNpmArgvForWindows`,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.`,parameters:[{name:`argv`,type:`string[]`}],returnType:`string[] | null`,children:i.code`if (!isWindows || argv.length === 0) {
156
+ ); `
157
+ }),
158
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
159
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
160
+ name: "resolveNpmArgvForWindows",
161
+ 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.",
162
+ parameters: [{
163
+ name: "argv",
164
+ type: "string[]"
165
+ }],
166
+ returnType: "string[] | null",
167
+ children: _alloy_js_core.code`if (!isWindows || argv.length === 0) {
44
168
  return null;
45
169
  }
46
170
  const base = basename(argv[0] ?? "")
@@ -60,7 +184,18 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
60
184
 
61
185
  return [shimmedCommand, ...argv.slice(1)];
62
186
  }
63
- return [process.execPath, cliPath, ...argv.slice(1)]; `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`resolveCommand`,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).`,parameters:[{name:`command`,type:`string`}],returnType:`string`,children:i.code`if (!isWindows) {
187
+ return [process.execPath, cliPath, ...argv.slice(1)]; `
188
+ }),
189
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
190
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
191
+ name: "resolveCommand",
192
+ 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).",
193
+ parameters: [{
194
+ name: "command",
195
+ type: "string"
196
+ }],
197
+ returnType: "string",
198
+ children: _alloy_js_core.code`if (!isWindows) {
64
199
  return command;
65
200
  }
66
201
  const base = basename(command).toLowerCase();
@@ -70,13 +205,33 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
70
205
  if (["pnpm", "yarn"].includes(base)) {
71
206
  return \`\${command}.cmd\`;
72
207
  }
73
- return command; `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`resolveCommandStdio`,parameters:[{name:`params`,type:`{ hasInput: boolean; preferInherit: boolean; }`}],returnType:`["pipe" | "inherit" | "ignore", "pipe", "pipe"]`,children:i.code`const stdin = params.hasInput
208
+ return command; `
209
+ }),
210
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
211
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
212
+ name: "resolveCommandStdio",
213
+ parameters: [{
214
+ name: "params",
215
+ type: "{ hasInput: boolean; preferInherit: boolean; }"
216
+ }],
217
+ returnType: "[\"pipe\" | \"inherit\" | \"ignore\", \"pipe\", \"pipe\"]",
218
+ children: _alloy_js_core.code`const stdin = params.hasInput
74
219
  ? "pipe"
75
220
  : params.preferInherit
76
221
  ? "inherit"
77
222
  : "pipe";
78
223
 
79
- return [stdin, "pipe", "pipe"]; `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`resolveProcessExitCode`,parameters:[{name:`params`,type:`{ explicitCode: number | null | undefined; childExitCode: number | null | undefined; resolvedSignal: NodeJS.Signals | null; usesWindowsExitCodeShim: boolean; timedOut: boolean; noOutputTimedOut: boolean; killIssuedByTimeout: boolean; }`}],returnType:`number | null`,children:i.code`return (
224
+ return [stdin, "pipe", "pipe"]; `
225
+ }),
226
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
227
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
228
+ name: "resolveProcessExitCode",
229
+ parameters: [{
230
+ name: "params",
231
+ type: "{ explicitCode: number | null | undefined; childExitCode: number | null | undefined; resolvedSignal: NodeJS.Signals | null; usesWindowsExitCodeShim: boolean; timedOut: boolean; noOutputTimedOut: boolean; killIssuedByTimeout: boolean; }"
232
+ }],
233
+ returnType: "number | null",
234
+ children: _alloy_js_core.code`return (
80
235
  params.explicitCode ??
81
236
  params.childExitCode ??
82
237
  (params.usesWindowsExitCodeShim &&
@@ -86,17 +241,189 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
86
241
  !params.killIssuedByTimeout
87
242
  ? 0
88
243
  : null)
89
- ); `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`shouldSpawnWithShell`,parameters:[{name:`params`,type:`{ resolvedCommand: string; platform: NodeJS.Platform; }`}],returnType:`boolean`,children:i.code`// SECURITY: never enable \`shell\` for argv-based execution.
244
+ ); `
245
+ }),
246
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
247
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
248
+ name: "shouldSpawnWithShell",
249
+ parameters: [{
250
+ name: "params",
251
+ type: "{ resolvedCommand: string; platform: NodeJS.Platform; }"
252
+ }],
253
+ returnType: "boolean",
254
+ children: _alloy_js_core.code`// SECURITY: never enable \`shell\` for argv-based execution.
90
255
  // \`shell\` routes through cmd.exe on Windows, which turns untrusted argv values
91
256
  // (like chat prompts passed as CLI args) into command-injection primitives.
92
257
  // If you need a shell, use an explicit shell-wrapper argv (e.g. \`cmd.exe /c ...\`)
93
258
  // and validate/escape at the call site.
94
259
  void params;
95
- return false; `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The result of a spawn operation.`}),(0,t.createComponent)(o.InterfaceDeclaration,{export:!0,name:`SpawnResult`,get children(){return[(0,t.createComponent)(c.TSDoc,{heading:`The PID of the spawned child process, if available.`}),(0,t.createComponent)(o.InterfaceMember,{name:`pid`,optional:!0,type:`number`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The standard output produced by the child process.`}),(0,t.createComponent)(o.InterfaceMember,{name:`stdout`,type:`string`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The standard error produced by the child process.`}),(0,t.createComponent)(o.InterfaceMember,{name:`stderr`,type:`string`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The exit code of the child process, if available.`}),(0,t.createComponent)(o.InterfaceMember,{name:`code`,type:`number | null`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The signal that caused the child process to terminate, if it was killed by a signal.`}),(0,t.createComponent)(o.InterfaceMember,{name:`signal`,type:`NodeJS.Signals | null`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`Whether the child process was killed.`}),(0,t.createComponent)(o.InterfaceMember,{name:`killed`,type:`boolean`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The reason for the child process termination.`}),(0,t.createComponent)(o.InterfaceMember,{name:`termination`,type:i.code`"exit" | "timeout" | "no-output-timeout" | "signal"`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`Whether the child process timed out due to no output.`}),(0,t.createComponent)(o.InterfaceMember,{name:`noOutputTimedOut`,optional:!0,type:`boolean`})]}}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`Options for spawning a child process.`}),(0,t.createComponent)(o.InterfaceDeclaration,{export:!0,name:`SpawnOptions`,get children(){return[(0,t.createComponent)(c.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.",get children(){return(0,t.createComponent)(c.TSDocDefaultValue,{get type(){return n.ReflectionKind.number},defaultValue:`300000`})}}),(0,t.createComponent)(o.InterfaceMember,{name:`timeoutMs`,optional:!0,type:`number`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The current working directory of the child process.`}),(0,t.createComponent)(o.InterfaceMember,{name:`cwd`,optional:!0,type:`string`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The input to be passed to the child process.`}),(0,t.createComponent)(o.InterfaceMember,{name:`input`,optional:!0,type:`string`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The environment variables for the child process.`}),(0,t.createComponent)(o.InterfaceMember,{name:`env`,optional:!0,type:`NodeJS.ProcessEnv`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`Whether to pass arguments to the child process verbatim on Windows.`}),(0,t.createComponent)(o.InterfaceMember,{name:`windowsVerbatimArguments`,optional:!0,type:`boolean`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.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.`}),(0,t.createComponent)(o.InterfaceMember,{name:`noOutputTimeoutMs`,optional:!0,type:`number`})]}}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.VarDeclaration,{const:!0,name:`WINDOWS_CLOSE_STATE_SETTLE_TIMEOUT_MS`,initializer:i.code`250`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.VarDeclaration,{const:!0,name:`WINDOWS_CLOSE_STATE_POLL_MS`,initializer:i.code`10`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`Spawns a child process with the given arguments and options, returning a promise that resolves with the result of the spawn operation.`,get children(){return[(0,t.createComponent)(c.TSDocParam,{name:`argv`,children:`The command and its arguments to spawn.`}),(0,t.createComponent)(c.TSDocParam,{name:`optionsOrTimeoutMs`,children:"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."}),(0,t.createComponent)(c.TSDocReturns,{children:`A promise that resolves with the result of the spawn operation, including stdout, stderr, exit code, signal, and termination reason.`})]}}),(0,t.createComponent)(o.FunctionDeclaration,{export:!0,async:!0,name:`spawn`,parameters:[{name:`argv`,type:`string[]`},{name:`optionsOrTimeoutMs`,type:`number | SpawnOptions`,default:`300000`}],returnType:`Promise<SpawnResult>`,children:i.code`const options: SpawnOptions =
260
+ return false; `
261
+ }),
262
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
263
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The result of a spawn operation." }),
264
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
265
+ "export": true,
266
+ name: "SpawnResult",
267
+ get children() {
268
+ return [
269
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The PID of the spawned child process, if available." }),
270
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
271
+ name: "pid",
272
+ optional: true,
273
+ type: "number"
274
+ }),
275
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
276
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The standard output produced by the child process." }),
277
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
278
+ name: "stdout",
279
+ type: "string"
280
+ }),
281
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
282
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The standard error produced by the child process." }),
283
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
284
+ name: "stderr",
285
+ type: "string"
286
+ }),
287
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
288
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The exit code of the child process, if available." }),
289
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
290
+ name: "code",
291
+ type: "number | null"
292
+ }),
293
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
294
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The signal that caused the child process to terminate, if it was killed by a signal." }),
295
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
296
+ name: "signal",
297
+ type: "NodeJS.Signals | null"
298
+ }),
299
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
300
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Whether the child process was killed." }),
301
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
302
+ name: "killed",
303
+ type: "boolean"
304
+ }),
305
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
306
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The reason for the child process termination." }),
307
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
308
+ name: "termination",
309
+ type: _alloy_js_core.code`"exit" | "timeout" | "no-output-timeout" | "signal"`
310
+ }),
311
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
312
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Whether the child process timed out due to no output." }),
313
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
314
+ name: "noOutputTimedOut",
315
+ optional: true,
316
+ type: "boolean"
317
+ })
318
+ ];
319
+ }
320
+ }),
321
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
322
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Options for spawning a child process." }),
323
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
324
+ "export": true,
325
+ name: "SpawnOptions",
326
+ get children() {
327
+ return [
328
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
329
+ 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.",
330
+ get children() {
331
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
332
+ type: "number",
333
+ defaultValue: "300_000"
334
+ });
335
+ }
336
+ }),
337
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
338
+ name: "timeoutMs",
339
+ optional: true,
340
+ type: "number"
341
+ }),
342
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
343
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The current working directory of the child process." }),
344
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
345
+ name: "cwd",
346
+ optional: true,
347
+ type: "string"
348
+ }),
349
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
350
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The input to be passed to the child process." }),
351
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
352
+ name: "input",
353
+ optional: true,
354
+ type: "string"
355
+ }),
356
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
357
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The environment variables for the child process." }),
358
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
359
+ name: "env",
360
+ optional: true,
361
+ type: "NodeJS.ProcessEnv"
362
+ }),
363
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
364
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Whether to pass arguments to the child process verbatim on Windows." }),
365
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
366
+ name: "windowsVerbatimArguments",
367
+ optional: true,
368
+ type: "boolean"
369
+ }),
370
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
371
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.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." }),
372
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
373
+ name: "noOutputTimeoutMs",
374
+ optional: true,
375
+ type: "number"
376
+ })
377
+ ];
378
+ }
379
+ }),
380
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
381
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
382
+ "const": true,
383
+ name: "WINDOWS_CLOSE_STATE_SETTLE_TIMEOUT_MS",
384
+ initializer: _alloy_js_core.code`250`
385
+ }),
386
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
387
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
388
+ "const": true,
389
+ name: "WINDOWS_CLOSE_STATE_POLL_MS",
390
+ initializer: _alloy_js_core.code`10`
391
+ }),
392
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
393
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
394
+ heading: "Spawns a child process with the given arguments and options, returning a promise that resolves with the result of the spawn operation.",
395
+ get children() {
396
+ return [
397
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
398
+ name: "argv",
399
+ children: "The command and its arguments to spawn."
400
+ }),
401
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
402
+ name: "optionsOrTimeoutMs",
403
+ children: `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.`
404
+ }),
405
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: "A promise that resolves with the result of the spawn operation, including stdout, stderr, exit code, signal, and termination reason." })
406
+ ];
407
+ }
408
+ }),
409
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
410
+ "export": true,
411
+ async: true,
412
+ name: "spawn",
413
+ parameters: [{
414
+ name: "argv",
415
+ type: "string[]"
416
+ }, {
417
+ name: "optionsOrTimeoutMs",
418
+ type: "number | SpawnOptions",
419
+ default: "300_000"
420
+ }],
421
+ returnType: "Promise<SpawnResult>",
422
+ children: _alloy_js_core.code`const options: SpawnOptions =
96
423
  typeof optionsOrTimeoutMs === "number"
97
424
  ? { timeoutMs: optionsOrTimeoutMs }
98
425
  : optionsOrTimeoutMs;
99
- const { timeoutMs = 300000, cwd, input, noOutputTimeoutMs } = options;
426
+ const { timeoutMs = 300_000, cwd, input, noOutputTimeoutMs } = options;
100
427
 
101
428
  const resolvedArgv =
102
429
  isWindows
@@ -315,18 +642,105 @@ return new Promise((resolve, reject) => {
315
642
  };
316
643
  waitForExitState();
317
644
  });
318
- });`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`A helper function that executes a command and returns its stdout.`,get children(){return[(0,t.createComponent)(c.TSDocParam,{name:`argv`,children:"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."}),(0,t.createComponent)(c.TSDocParam,{name:`optionsOrTimeoutMs`,children:"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."}),(0,t.createComponent)(c.TSDocReturns,{children:`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.`})]}}),(0,t.createComponent)(o.FunctionDeclaration,{export:!0,async:!0,name:`exec`,parameters:[{name:`argv`,type:`string[]`},{name:`optionsOrTimeoutMs`,type:`number | SpawnOptions`,default:`300000`}],returnType:`Promise<string>`,children:i.code`const spawnResult = await spawn(argv, optionsOrTimeoutMs);
645
+ });`
646
+ }),
647
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
648
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
649
+ heading: "A helper function that executes a command and returns its stdout.",
650
+ get children() {
651
+ return [
652
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
653
+ name: "argv",
654
+ children: `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.`
655
+ }),
656
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
657
+ name: "optionsOrTimeoutMs",
658
+ children: `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.`
659
+ }),
660
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: "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." })
661
+ ];
662
+ }
663
+ }),
664
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
665
+ "export": true,
666
+ async: true,
667
+ name: "exec",
668
+ parameters: [{
669
+ name: "argv",
670
+ type: "string[]"
671
+ }, {
672
+ name: "optionsOrTimeoutMs",
673
+ type: "number | SpawnOptions",
674
+ default: "300_000"
675
+ }],
676
+ returnType: "Promise<string>",
677
+ children: _alloy_js_core.code`const spawnResult = await spawn(argv, optionsOrTimeoutMs);
319
678
  if (spawnResult.code !== 0) {
320
679
  throw Object.assign(new Error(
321
680
  \`Command "\${argv.join(" ")}" exited with code \${spawnResult.code} and signal \${spawnResult.signal}\`
322
681
  ), spawnResult);
323
682
  }
324
683
 
325
- return spawnResult.stdout.trim(); `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.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.",get children(){return[(0,t.createComponent)(c.TSDocParam,{name:`argv`,children:"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."}),(0,t.createComponent)(c.TSDocParam,{name:`options`,children:"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."}),(0,t.createComponent)(c.TSDocReturns,{children:`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.`})]}}),(0,t.createComponent)(o.FunctionDeclaration,{export:!0,name:`execSync`,parameters:[{name:`argv`,type:`string[]`},{name:`options`,type:`SpawnOptions`,default:`{}`}],returnType:`string`,children:i.code`return execFileSync(argv.length > 0 ? argv[0] : "", argv.slice(1), {
684
+ return spawnResult.stdout.trim(); `
685
+ }),
686
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
687
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
688
+ 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.",
689
+ get children() {
690
+ return [
691
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
692
+ name: "argv",
693
+ children: `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.`
694
+ }),
695
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
696
+ name: "options",
697
+ children: `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.`
698
+ }),
699
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: "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." })
700
+ ];
701
+ }
702
+ }),
703
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
704
+ "export": true,
705
+ name: "execSync",
706
+ parameters: [{
707
+ name: "argv",
708
+ type: "string[]"
709
+ }, {
710
+ name: "options",
711
+ type: "SpawnOptions",
712
+ default: "{}"
713
+ }],
714
+ returnType: "string",
715
+ children: _alloy_js_core.code`return execFileSync(argv.length > 0 ? argv[0] : "", argv.slice(1), {
326
716
  encoding: "utf8",
327
717
  stdio: ["ignore", "pipe", "ignore"],
328
- timeout: options.timeoutMs ?? 300000,
718
+ timeout: options.timeoutMs ?? 300_000,
329
719
  env: resolveCommandEnv({ argv, env: options.env }),
330
720
  cwd: options.cwd || process.cwd(),
331
721
  windowsHide: true
332
- }).trim(); `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(i.Show,{get when(){return!!l},children:l})]}}))}p.__type=[()=>f,`props`,`ExecBuiltin`,`A built-in module for handling command execution in Shell Shock.`,`Pn!2""/#?$`],exports.ExecBuiltin=p,exports.__ΩExecBuiltinProps=f;
722
+ }).trim(); `
723
+ }),
724
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
725
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
726
+ get when() {
727
+ return Boolean(children);
728
+ },
729
+ children
730
+ })
731
+ ];
732
+ }
733
+ }));
734
+ }
735
+ ExecBuiltin.__type = [
736
+ () => __ΩExecBuiltinProps,
737
+ "props",
738
+ "ExecBuiltin",
739
+ "A built-in module for handling command execution in Shell Shock.",
740
+ "Pn!2\"\"/#?$"
741
+ ];
742
+
743
+ //#endregion
744
+ exports.ExecBuiltin = ExecBuiltin;
745
+ exports.__ΩExecBuiltinProps = __ΩExecBuiltinProps;
746
+ //# sourceMappingURL=exec-builtin.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec-builtin.cjs","names":[],"sources":[],"mappings":""}
@@ -1,4 +1,3 @@
1
- import * as _$_alloy_js_core0 from "@alloy-js/core";
2
1
  import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
3
2
 
4
3
  //#region src/components/exec-builtin.d.ts
@@ -6,7 +5,7 @@ interface ExecBuiltinProps extends Omit<BuiltinFileProps, "id" | "description">
6
5
  /**
7
6
  * A built-in module for handling command execution in Shell Shock.
8
7
  */
9
- declare function ExecBuiltin(props: ExecBuiltinProps): _$_alloy_js_core0.Children;
8
+ declare function ExecBuiltin(props: ExecBuiltinProps): import("@alloy-js/core").Children;
10
9
  //#endregion
11
10
  export { ExecBuiltin, ExecBuiltinProps };
12
11
  //# sourceMappingURL=exec-builtin.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exec-builtin.d.cts","names":[],"sources":["../../src/components/exec-builtin.tsx"],"mappings":";;;;UAqCiB,gBAAA,SAAyB,IAAA,CACxC,gBAAA;;AADF;;iBAQgB,WAAA,CAAY,KAAA,EAAO,gBAAA,GAAgB,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"exec-builtin.d.cts","names":[],"sources":["../../src/components/exec-builtin.tsx"],"mappings":";;;UAoCiB,gBAAA,SAAyB,IAAI,CAC5C,gBAAA;AADF;;;AAAA,iBAQgB,WAAA,CAAY,KAAA,EAAO,gBAAgB,4BAAA,QAAA"}
@@ -1,4 +1,3 @@
1
- import * as _$_alloy_js_core0 from "@alloy-js/core";
2
1
  import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
3
2
 
4
3
  //#region src/components/exec-builtin.d.ts
@@ -6,7 +5,7 @@ interface ExecBuiltinProps extends Omit<BuiltinFileProps, "id" | "description">
6
5
  /**
7
6
  * A built-in module for handling command execution in Shell Shock.
8
7
  */
9
- declare function ExecBuiltin(props: ExecBuiltinProps): _$_alloy_js_core0.Children;
8
+ declare function ExecBuiltin(props: ExecBuiltinProps): import("@alloy-js/core").Children;
10
9
  //#endregion
11
10
  export { ExecBuiltin, ExecBuiltinProps };
12
11
  //# sourceMappingURL=exec-builtin.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exec-builtin.d.mts","names":[],"sources":["../../src/components/exec-builtin.tsx"],"mappings":";;;;UAqCiB,gBAAA,SAAyB,IAAA,CACxC,gBAAA;;AADF;;iBAQgB,WAAA,CAAY,KAAA,EAAO,gBAAA,GAAgB,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"exec-builtin.d.mts","names":[],"sources":["../../src/components/exec-builtin.tsx"],"mappings":""}