@shell-shock/core 0.16.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/{spawn-builtin.cjs → exec-builtin.cjs} +122 -56
- package/dist/components/exec-builtin.cjs.map +1 -0
- package/dist/components/exec-builtin.d.cts +12 -0
- package/dist/components/exec-builtin.d.cts.map +1 -0
- package/dist/components/exec-builtin.d.mts +12 -0
- package/dist/components/exec-builtin.d.mts.map +1 -0
- package/dist/components/{spawn-builtin.mjs → exec-builtin.mjs} +122 -56
- package/dist/components/exec-builtin.mjs.map +1 -0
- package/dist/components/index.cjs +3 -2
- package/dist/components/index.d.cts +3 -3
- package/dist/components/index.d.mts +3 -3
- package/dist/components/index.mjs +3 -3
- package/dist/components/state-builtin.cjs +11 -5
- package/dist/components/state-builtin.cjs.map +1 -1
- package/dist/components/state-builtin.mjs +11 -5
- package/dist/components/state-builtin.mjs.map +1 -1
- package/dist/components/utils-builtin.cjs +147 -0
- package/dist/components/utils-builtin.cjs.map +1 -1
- package/dist/components/utils-builtin.d.cts +5 -1
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts +5 -1
- package/dist/components/utils-builtin.d.mts.map +1 -1
- package/dist/components/utils-builtin.mjs +148 -2
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/plugin.cjs +2 -2
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.mjs +2 -2
- package/dist/plugin.mjs.map +1 -1
- package/dist/types/env.cjs +1 -1
- package/dist/types/env.cjs.map +1 -1
- package/dist/types/env.d.cts +1 -1
- package/dist/types/env.d.mts +1 -1
- package/dist/types/env.mjs +1 -1
- package/dist/types/env.mjs.map +1 -1
- package/package.json +16 -16
- package/dist/components/spawn-builtin.cjs.map +0 -1
- package/dist/components/spawn-builtin.d.cts +0 -12
- package/dist/components/spawn-builtin.d.cts.map +0 -1
- package/dist/components/spawn-builtin.d.mts +0 -12
- package/dist/components/spawn-builtin.d.mts.map +0 -1
- package/dist/components/spawn-builtin.mjs.map +0 -1
|
@@ -10,15 +10,15 @@ let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type")
|
|
|
10
10
|
let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
|
|
11
11
|
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
12
12
|
|
|
13
|
-
//#region src/components/
|
|
13
|
+
//#region src/components/exec-builtin.tsx
|
|
14
14
|
/**
|
|
15
|
-
* A built-in module for handling
|
|
15
|
+
* A built-in module for handling command execution in Shell Shock.
|
|
16
16
|
*/
|
|
17
|
-
function
|
|
17
|
+
function ExecBuiltin(props) {
|
|
18
18
|
const [{ children }, rest] = (0, _alloy_js_core.splitProps)(props, ["children"]);
|
|
19
19
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
|
|
20
|
-
id: "
|
|
21
|
-
description: "A module to handle
|
|
20
|
+
id: "exec",
|
|
21
|
+
description: "A module to handle command execution in a Shell Shock application."
|
|
22
22
|
}, rest, {
|
|
23
23
|
get imports() {
|
|
24
24
|
return (0, defu.default)(rest.imports ?? {}, {
|
|
@@ -32,7 +32,7 @@ function SpawnBuiltin(props) {
|
|
|
32
32
|
"node:child_process": [{
|
|
33
33
|
name: "spawn",
|
|
34
34
|
alias: "_spawn"
|
|
35
|
-
}],
|
|
35
|
+
}, "execFileSync"],
|
|
36
36
|
"node:stream": [{
|
|
37
37
|
name: "Stream",
|
|
38
38
|
default: true,
|
|
@@ -195,45 +195,6 @@ return command;`
|
|
|
195
195
|
: "pipe";
|
|
196
196
|
|
|
197
197
|
return [stdin, "pipe", "pipe"];`
|
|
198
|
-
}),
|
|
199
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
200
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
201
|
-
name: "resolveChildProcessInvocation",
|
|
202
|
-
parameters: [{
|
|
203
|
-
name: "params",
|
|
204
|
-
type: "{ argv: string[]; windowsVerbatimArguments?: boolean; }"
|
|
205
|
-
}],
|
|
206
|
-
returnType: "{ args: string[]; command: string; usesWindowsExitCodeShim: boolean; windowsHide: true; windowsVerbatimArguments?: boolean; }",
|
|
207
|
-
children: _alloy_js_core.code`const finalArgv =
|
|
208
|
-
isWindows
|
|
209
|
-
? (resolveNpmArgvForWindows(params.argv) ?? params.argv)
|
|
210
|
-
: params.argv;
|
|
211
|
-
const resolvedCommand =
|
|
212
|
-
finalArgv !== params.argv
|
|
213
|
-
? (finalArgv[0] ?? "")
|
|
214
|
-
: resolveCommand(params.argv[0] ?? "");
|
|
215
|
-
const useCmdWrapper = isWindowsBatchCommand(resolvedCommand);
|
|
216
|
-
|
|
217
|
-
return {
|
|
218
|
-
command: useCmdWrapper
|
|
219
|
-
? (process.env.ComSpec ?? "cmd.exe")
|
|
220
|
-
: resolvedCommand,
|
|
221
|
-
args: useCmdWrapper
|
|
222
|
-
? [
|
|
223
|
-
"/d",
|
|
224
|
-
"/s",
|
|
225
|
-
"/c",
|
|
226
|
-
buildCmdExeCommandLine(resolvedCommand, finalArgv.slice(1))
|
|
227
|
-
]
|
|
228
|
-
: finalArgv.slice(1),
|
|
229
|
-
usesWindowsExitCodeShim:
|
|
230
|
-
isWindows &&
|
|
231
|
-
(useCmdWrapper || finalArgv !== params.argv),
|
|
232
|
-
windowsHide: true,
|
|
233
|
-
windowsVerbatimArguments: useCmdWrapper
|
|
234
|
-
? true
|
|
235
|
-
: params.windowsVerbatimArguments
|
|
236
|
-
};`
|
|
237
198
|
}),
|
|
238
199
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
239
200
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
@@ -440,19 +401,40 @@ const { timeoutMs, cwd, input, env, noOutputTimeoutMs } = options;
|
|
|
440
401
|
const hasInput = input !== undefined;
|
|
441
402
|
const resolvedEnv = resolveCommandEnv({ argv, env });
|
|
442
403
|
const stdio = resolveCommandStdio({ hasInput, preferInherit: true });
|
|
443
|
-
const invocation = resolveChildProcessInvocation({
|
|
444
|
-
argv,
|
|
445
|
-
windowsVerbatimArguments: options.windowsVerbatimArguments
|
|
446
|
-
});
|
|
447
404
|
|
|
448
|
-
const
|
|
405
|
+
const finalArgv =
|
|
406
|
+
isWindows
|
|
407
|
+
? (resolveNpmArgvForWindows(argv) ?? argv)
|
|
408
|
+
: argv;
|
|
409
|
+
const resolvedCommand =
|
|
410
|
+
finalArgv !== argv
|
|
411
|
+
? (finalArgv[0] ?? "")
|
|
412
|
+
: resolveCommand(argv[0] ?? "");
|
|
413
|
+
const useCmdWrapper = isWindowsBatchCommand(resolvedCommand);
|
|
414
|
+
|
|
415
|
+
const child = _spawn(
|
|
416
|
+
useCmdWrapper
|
|
417
|
+
? (process.env.ComSpec ?? "cmd.exe")
|
|
418
|
+
: resolvedCommand,
|
|
419
|
+
useCmdWrapper
|
|
420
|
+
? [
|
|
421
|
+
"/d",
|
|
422
|
+
"/s",
|
|
423
|
+
"/c",
|
|
424
|
+
buildCmdExeCommandLine(resolvedCommand, finalArgv.slice(1))
|
|
425
|
+
]
|
|
426
|
+
: finalArgv.slice(1), {
|
|
449
427
|
stdio,
|
|
450
428
|
cwd,
|
|
451
429
|
env: resolvedEnv,
|
|
452
|
-
windowsHide:
|
|
453
|
-
windowsVerbatimArguments:
|
|
430
|
+
windowsHide: true,
|
|
431
|
+
windowsVerbatimArguments: useCmdWrapper
|
|
432
|
+
? true
|
|
433
|
+
: options.windowsVerbatimArguments,
|
|
454
434
|
...(shouldSpawnWithShell({
|
|
455
|
-
resolvedCommand:
|
|
435
|
+
resolvedCommand: useCmdWrapper
|
|
436
|
+
? (process.env.ComSpec ?? "cmd.exe")
|
|
437
|
+
: resolvedCommand,
|
|
456
438
|
platform: process.platform
|
|
457
439
|
})
|
|
458
440
|
? { shell: true }
|
|
@@ -574,7 +556,7 @@ return new Promise((resolve, reject) => {
|
|
|
574
556
|
explicitCode: childExitState?.code ?? code,
|
|
575
557
|
childExitCode: child.exitCode,
|
|
576
558
|
resolvedSignal,
|
|
577
|
-
usesWindowsExitCodeShim:
|
|
559
|
+
usesWindowsExitCodeShim: isWindows && (useCmdWrapper || finalArgv !== argv),
|
|
578
560
|
timedOut,
|
|
579
561
|
noOutputTimedOut,
|
|
580
562
|
killIssuedByTimeout
|
|
@@ -638,6 +620,90 @@ return new Promise((resolve, reject) => {
|
|
|
638
620
|
waitForExitState();
|
|
639
621
|
});
|
|
640
622
|
});`
|
|
623
|
+
}),
|
|
624
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
625
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
626
|
+
heading: "A helper function that executes a command and returns its stdout.",
|
|
627
|
+
get children() {
|
|
628
|
+
return [
|
|
629
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
630
|
+
name: "argv",
|
|
631
|
+
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.`
|
|
632
|
+
}),
|
|
633
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
634
|
+
name: "optionsOrTimeoutMs",
|
|
635
|
+
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.`
|
|
636
|
+
}),
|
|
637
|
+
(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." })
|
|
638
|
+
];
|
|
639
|
+
}
|
|
640
|
+
}),
|
|
641
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
642
|
+
"export": true,
|
|
643
|
+
async: true,
|
|
644
|
+
name: "exec",
|
|
645
|
+
parameters: [{
|
|
646
|
+
name: "argv",
|
|
647
|
+
type: "string[]"
|
|
648
|
+
}, {
|
|
649
|
+
name: "optionsOrTimeoutMs",
|
|
650
|
+
type: "number | SpawnOptions",
|
|
651
|
+
default: "300000"
|
|
652
|
+
}],
|
|
653
|
+
returnType: "Promise<string>",
|
|
654
|
+
children: _alloy_js_core.code`const spawnResult = await spawn(argv, optionsOrTimeoutMs);
|
|
655
|
+
if (spawnResult.code !== 0) {
|
|
656
|
+
throw Object.assign(new Error(
|
|
657
|
+
\`Command "\${argv.join(" ")}" exited with code \${spawnResult.code} and signal \${spawnResult.signal}\`
|
|
658
|
+
), spawnResult);
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
return spawnResult.stdout.trim(); `
|
|
662
|
+
}),
|
|
663
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
664
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
665
|
+
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.",
|
|
666
|
+
get children() {
|
|
667
|
+
return [
|
|
668
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
669
|
+
name: "argv",
|
|
670
|
+
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.`
|
|
671
|
+
}),
|
|
672
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
673
|
+
name: "options",
|
|
674
|
+
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.`
|
|
675
|
+
}),
|
|
676
|
+
(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." })
|
|
677
|
+
];
|
|
678
|
+
}
|
|
679
|
+
}),
|
|
680
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
681
|
+
"export": true,
|
|
682
|
+
name: "execSync",
|
|
683
|
+
parameters: [{
|
|
684
|
+
name: "argv",
|
|
685
|
+
type: "string[]"
|
|
686
|
+
}, {
|
|
687
|
+
name: "options",
|
|
688
|
+
type: "SpawnOptions",
|
|
689
|
+
optional: true
|
|
690
|
+
}],
|
|
691
|
+
returnType: "string",
|
|
692
|
+
children: _alloy_js_core.code`return execFileSync(argv.length > 0 ? argv[0] : "", argv.slice(1), {
|
|
693
|
+
encoding: "utf8",
|
|
694
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
695
|
+
timeout: options?.timeoutMs ?? 300000,
|
|
696
|
+
env: options?.env ? resolveCommandEnv({ argv, env: options.env }) : process.env,
|
|
697
|
+
cwd: options?.cwd,
|
|
698
|
+
windowsHide: true,
|
|
699
|
+
windowsVerbatimArguments: options?.windowsVerbatimArguments,
|
|
700
|
+
...(shouldSpawnWithShell({
|
|
701
|
+
resolvedCommand: argv[0] ?? "",
|
|
702
|
+
platform: process.platform
|
|
703
|
+
})
|
|
704
|
+
? { shell: true }
|
|
705
|
+
: {})
|
|
706
|
+
}).trim(); `
|
|
641
707
|
}),
|
|
642
708
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
643
709
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
@@ -652,5 +718,5 @@ return new Promise((resolve, reject) => {
|
|
|
652
718
|
}
|
|
653
719
|
|
|
654
720
|
//#endregion
|
|
655
|
-
exports.
|
|
656
|
-
//# sourceMappingURL=
|
|
721
|
+
exports.ExecBuiltin = ExecBuiltin;
|
|
722
|
+
//# sourceMappingURL=exec-builtin.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec-builtin.cjs","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\";\n\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\"]\n })}>\n <FunctionDeclaration\n name=\"resolveCommandEnv\"\n parameters={[\n {\n name: \"params\",\n type: \"{ argv: string[]; env?: NodeJS.ProcessEnv; baseEnv?: NodeJS.ProcessEnv; }\"\n }\n ]}\n returnType=\"NodeJS.ProcessEnv\">\n {code`const baseEnv = params.baseEnv ?? process.env;\nconst argv = params.argv;\nconst 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\nconst mergedEnv = params.env ? { ...baseEnv, ...params.env } : { ...baseEnv };\nconst resolvedEnv = Object.fromEntries(\n Object.entries(mergedEnv)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, String(value)])\n);\nif (shouldSuppressNpmFund) {\n resolvedEnv.NPM_CONFIG_FUND ??= \"false\";\n resolvedEnv.npm_config_fund ??= \"false\";\n}\nreturn resolvedEnv;`}\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}\nconst ext = extname(resolvedCommand).toLowerCase();\n\nreturn 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}\nif (!arg.includes(\" \") && !arg.includes('\"')) {\n return arg;\n}\nreturn \\`\"\\${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}\nconst base = basename(argv[0] ?? \"\")\n .toLowerCase()\n .replace(/\\.(?:cmd|exe|bat)$/, \"\");\nconst cliName =\n base === \"npx\" ? \"npx-cli.js\" : base === \"npm\" ? \"npm-cli.js\" : null;\nif (!cliName) {\n return null;\n}\nconst nodeDir = dirname(process.execPath);\nconst cliPath = join(nodeDir, \"node_modules\", \"npm\", \"bin\", cliName);\nif (!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}\nreturn [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}\nconst base = basename(command).toLowerCase();\nif (extname(base)) {\n return command;\n}\nif ([\"pnpm\", \"yarn\"].includes(base)) {\n return \\`\\${command}.cmd\\`;\n}\nreturn 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\nreturn [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.\nvoid params;\nreturn 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\" 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, cwd, input, env, noOutputTimeoutMs } = options;\nconst hasInput = input !== undefined;\nconst resolvedEnv = resolveCommandEnv({ argv, env });\nconst stdio = resolveCommandStdio({ hasInput, preferInherit: true });\n\nconst finalArgv =\n isWindows\n ? (resolveNpmArgvForWindows(argv) ?? argv)\n : argv;\nconst resolvedCommand =\n finalArgv !== argv\n ? (finalArgv[0] ?? \"\")\n : resolveCommand(argv[0] ?? \"\");\nconst useCmdWrapper = isWindowsBatchCommand(resolvedCommand);\n\nconst child = _spawn(\n useCmdWrapper\n ? (process.env.ComSpec ?? \"cmd.exe\")\n : resolvedCommand,\n useCmdWrapper\n ? [\n \"/d\",\n \"/s\",\n \"/c\",\n buildCmdExeCommandLine(resolvedCommand, finalArgv.slice(1))\n ]\n : finalArgv.slice(1), {\n stdio,\n cwd,\n env: resolvedEnv,\n windowsHide: true,\n windowsVerbatimArguments: useCmdWrapper\n ? true\n : options.windowsVerbatimArguments,\n ...(shouldSpawnWithShell({\n resolvedCommand: useCmdWrapper\n ? (process.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 (hasInput && 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 || finalArgv !== 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\", optional: true }\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: options?.env ? resolveCommandEnv({ argv, env: options.env }) : process.env,\n cwd: options?.cwd,\n windowsHide: true,\n windowsVerbatimArguments: options?.windowsVerbatimArguments,\n ...(shouldSpawnWithShell({\n resolvedCommand: argv[0] ?? \"\",\n platform: process.platform\n })\n ? { shell: true }\n : {})\n }).trim(); `}\n </FunctionDeclaration>\n <Spacing />\n\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgCA,SAAE,YAAiB,OAAA;CACjB,MAAA,CAAA,EACA,YACA,uCAAkB,OAAO,CAAK,WAAW,CAAC;AAC5C,wDAAuB,oHAAA;;EAEvB,aAAiB;EACf,EAAA,MAAA;EACC,IAAK,UAAE;AACP,4BAAA,KAAA,WAAA,EAAA,EAAA;;;;;;;IAED,WAAA,CAAA,aAAA;IACG,sBAAoB,CAAA;KACvB,MAAA;KACK,OAAS;KACP,EAAE,eAAY;;KAEd,MAAA;KACJ,SAAA;KACK,MAAI;KACR,CAAA;IACC,CAAC;;EAEJ,IAAI,iBAAe;AACjB,4BAAY,KAAG,kBAAY,EAAA,EAAA,EACzB,KAAK,CAAC,YAAA,EACP,CAAC;;EAEJ,IAAI,WAAC;AACH,UAAO;oDAAmB,0CAAmB;KAC3C,MAAA;KACF,YAAc,CAAC;MACb,MAAO;MACN,MAAA;MACF,CAAA;KACC,YAAM;KACN,UAAU,mBAAE;;;;;;;;;;;;;;;;;;;;;;;;;;KA0Bf,CAAG;oDAAoB,0DAAK,EAAM,CAAC;oDAAO,0CAAA;KAC9C,MAAA;KACG,YAAA,CAAA;MACF,MAAY;MACZ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|
|
|
1
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
3
|
+
|
|
4
|
+
//#region src/components/exec-builtin.d.ts
|
|
5
|
+
interface ExecBuiltinProps extends Omit<BuiltinFileProps, "id" | "description"> {}
|
|
6
|
+
/**
|
|
7
|
+
* A built-in module for handling command execution in Shell Shock.
|
|
8
|
+
*/
|
|
9
|
+
declare function ExecBuiltin(props: ExecBuiltinProps): _$_alloy_js_core0.Children;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { ExecBuiltin, ExecBuiltinProps };
|
|
12
|
+
//# sourceMappingURL=exec-builtin.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec-builtin.d.cts","names":[],"sources":["../../src/components/exec-builtin.tsx"],"mappings":";;;;UAsCiB,gBAAA,SAAyB,IAAA,CACxC,gBAAA;;AADF;;iBAQgB,WAAA,CAAY,KAAA,EAAO,gBAAA,GAAgB,iBAAA,CAAA,QAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
3
|
+
|
|
4
|
+
//#region src/components/exec-builtin.d.ts
|
|
5
|
+
interface ExecBuiltinProps extends Omit<BuiltinFileProps, "id" | "description"> {}
|
|
6
|
+
/**
|
|
7
|
+
* A built-in module for handling command execution in Shell Shock.
|
|
8
|
+
*/
|
|
9
|
+
declare function ExecBuiltin(props: ExecBuiltinProps): _$_alloy_js_core0.Children;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { ExecBuiltin, ExecBuiltinProps };
|
|
12
|
+
//# sourceMappingURL=exec-builtin.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec-builtin.d.mts","names":[],"sources":["../../src/components/exec-builtin.tsx"],"mappings":";;;;UAsCiB,gBAAA,SAAyB,IAAA,CACxC,gBAAA;;AADF;;iBAQgB,WAAA,CAAY,KAAA,EAAO,gBAAA,GAAgB,iBAAA,CAAA,QAAA"}
|
|
@@ -7,15 +7,15 @@ import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
|
7
7
|
import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
8
8
|
import { TSDoc, TSDocDefaultValue, TSDocParam, TSDocReturns } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
9
9
|
|
|
10
|
-
//#region src/components/
|
|
10
|
+
//#region src/components/exec-builtin.tsx
|
|
11
11
|
/**
|
|
12
|
-
* A built-in module for handling
|
|
12
|
+
* A built-in module for handling command execution in Shell Shock.
|
|
13
13
|
*/
|
|
14
|
-
function
|
|
14
|
+
function ExecBuiltin(props) {
|
|
15
15
|
const [{ children }, rest] = splitProps(props, ["children"]);
|
|
16
16
|
return createComponent(BuiltinFile, mergeProps({
|
|
17
|
-
id: "
|
|
18
|
-
description: "A module to handle
|
|
17
|
+
id: "exec",
|
|
18
|
+
description: "A module to handle command execution in a Shell Shock application."
|
|
19
19
|
}, rest, {
|
|
20
20
|
get imports() {
|
|
21
21
|
return defu$1(rest.imports ?? {}, {
|
|
@@ -29,7 +29,7 @@ function SpawnBuiltin(props) {
|
|
|
29
29
|
"node:child_process": [{
|
|
30
30
|
name: "spawn",
|
|
31
31
|
alias: "_spawn"
|
|
32
|
-
}],
|
|
32
|
+
}, "execFileSync"],
|
|
33
33
|
"node:stream": [{
|
|
34
34
|
name: "Stream",
|
|
35
35
|
default: true,
|
|
@@ -192,45 +192,6 @@ return command;`
|
|
|
192
192
|
: "pipe";
|
|
193
193
|
|
|
194
194
|
return [stdin, "pipe", "pipe"];`
|
|
195
|
-
}),
|
|
196
|
-
createComponent(Spacing, {}),
|
|
197
|
-
createComponent(FunctionDeclaration, {
|
|
198
|
-
name: "resolveChildProcessInvocation",
|
|
199
|
-
parameters: [{
|
|
200
|
-
name: "params",
|
|
201
|
-
type: "{ argv: string[]; windowsVerbatimArguments?: boolean; }"
|
|
202
|
-
}],
|
|
203
|
-
returnType: "{ args: string[]; command: string; usesWindowsExitCodeShim: boolean; windowsHide: true; windowsVerbatimArguments?: boolean; }",
|
|
204
|
-
children: code`const finalArgv =
|
|
205
|
-
isWindows
|
|
206
|
-
? (resolveNpmArgvForWindows(params.argv) ?? params.argv)
|
|
207
|
-
: params.argv;
|
|
208
|
-
const resolvedCommand =
|
|
209
|
-
finalArgv !== params.argv
|
|
210
|
-
? (finalArgv[0] ?? "")
|
|
211
|
-
: resolveCommand(params.argv[0] ?? "");
|
|
212
|
-
const useCmdWrapper = isWindowsBatchCommand(resolvedCommand);
|
|
213
|
-
|
|
214
|
-
return {
|
|
215
|
-
command: useCmdWrapper
|
|
216
|
-
? (process.env.ComSpec ?? "cmd.exe")
|
|
217
|
-
: resolvedCommand,
|
|
218
|
-
args: useCmdWrapper
|
|
219
|
-
? [
|
|
220
|
-
"/d",
|
|
221
|
-
"/s",
|
|
222
|
-
"/c",
|
|
223
|
-
buildCmdExeCommandLine(resolvedCommand, finalArgv.slice(1))
|
|
224
|
-
]
|
|
225
|
-
: finalArgv.slice(1),
|
|
226
|
-
usesWindowsExitCodeShim:
|
|
227
|
-
isWindows &&
|
|
228
|
-
(useCmdWrapper || finalArgv !== params.argv),
|
|
229
|
-
windowsHide: true,
|
|
230
|
-
windowsVerbatimArguments: useCmdWrapper
|
|
231
|
-
? true
|
|
232
|
-
: params.windowsVerbatimArguments
|
|
233
|
-
};`
|
|
234
195
|
}),
|
|
235
196
|
createComponent(Spacing, {}),
|
|
236
197
|
createComponent(FunctionDeclaration, {
|
|
@@ -437,19 +398,40 @@ const { timeoutMs, cwd, input, env, noOutputTimeoutMs } = options;
|
|
|
437
398
|
const hasInput = input !== undefined;
|
|
438
399
|
const resolvedEnv = resolveCommandEnv({ argv, env });
|
|
439
400
|
const stdio = resolveCommandStdio({ hasInput, preferInherit: true });
|
|
440
|
-
const invocation = resolveChildProcessInvocation({
|
|
441
|
-
argv,
|
|
442
|
-
windowsVerbatimArguments: options.windowsVerbatimArguments
|
|
443
|
-
});
|
|
444
401
|
|
|
445
|
-
const
|
|
402
|
+
const finalArgv =
|
|
403
|
+
isWindows
|
|
404
|
+
? (resolveNpmArgvForWindows(argv) ?? argv)
|
|
405
|
+
: argv;
|
|
406
|
+
const resolvedCommand =
|
|
407
|
+
finalArgv !== argv
|
|
408
|
+
? (finalArgv[0] ?? "")
|
|
409
|
+
: resolveCommand(argv[0] ?? "");
|
|
410
|
+
const useCmdWrapper = isWindowsBatchCommand(resolvedCommand);
|
|
411
|
+
|
|
412
|
+
const child = _spawn(
|
|
413
|
+
useCmdWrapper
|
|
414
|
+
? (process.env.ComSpec ?? "cmd.exe")
|
|
415
|
+
: resolvedCommand,
|
|
416
|
+
useCmdWrapper
|
|
417
|
+
? [
|
|
418
|
+
"/d",
|
|
419
|
+
"/s",
|
|
420
|
+
"/c",
|
|
421
|
+
buildCmdExeCommandLine(resolvedCommand, finalArgv.slice(1))
|
|
422
|
+
]
|
|
423
|
+
: finalArgv.slice(1), {
|
|
446
424
|
stdio,
|
|
447
425
|
cwd,
|
|
448
426
|
env: resolvedEnv,
|
|
449
|
-
windowsHide:
|
|
450
|
-
windowsVerbatimArguments:
|
|
427
|
+
windowsHide: true,
|
|
428
|
+
windowsVerbatimArguments: useCmdWrapper
|
|
429
|
+
? true
|
|
430
|
+
: options.windowsVerbatimArguments,
|
|
451
431
|
...(shouldSpawnWithShell({
|
|
452
|
-
resolvedCommand:
|
|
432
|
+
resolvedCommand: useCmdWrapper
|
|
433
|
+
? (process.env.ComSpec ?? "cmd.exe")
|
|
434
|
+
: resolvedCommand,
|
|
453
435
|
platform: process.platform
|
|
454
436
|
})
|
|
455
437
|
? { shell: true }
|
|
@@ -571,7 +553,7 @@ return new Promise((resolve, reject) => {
|
|
|
571
553
|
explicitCode: childExitState?.code ?? code,
|
|
572
554
|
childExitCode: child.exitCode,
|
|
573
555
|
resolvedSignal,
|
|
574
|
-
usesWindowsExitCodeShim:
|
|
556
|
+
usesWindowsExitCodeShim: isWindows && (useCmdWrapper || finalArgv !== argv),
|
|
575
557
|
timedOut,
|
|
576
558
|
noOutputTimedOut,
|
|
577
559
|
killIssuedByTimeout
|
|
@@ -635,6 +617,90 @@ return new Promise((resolve, reject) => {
|
|
|
635
617
|
waitForExitState();
|
|
636
618
|
});
|
|
637
619
|
});`
|
|
620
|
+
}),
|
|
621
|
+
createComponent(Spacing, {}),
|
|
622
|
+
createComponent(TSDoc, {
|
|
623
|
+
heading: "A helper function that executes a command and returns its stdout.",
|
|
624
|
+
get children() {
|
|
625
|
+
return [
|
|
626
|
+
createComponent(TSDocParam, {
|
|
627
|
+
name: "argv",
|
|
628
|
+
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.`
|
|
629
|
+
}),
|
|
630
|
+
createComponent(TSDocParam, {
|
|
631
|
+
name: "optionsOrTimeoutMs",
|
|
632
|
+
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.`
|
|
633
|
+
}),
|
|
634
|
+
createComponent(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." })
|
|
635
|
+
];
|
|
636
|
+
}
|
|
637
|
+
}),
|
|
638
|
+
createComponent(FunctionDeclaration, {
|
|
639
|
+
"export": true,
|
|
640
|
+
async: true,
|
|
641
|
+
name: "exec",
|
|
642
|
+
parameters: [{
|
|
643
|
+
name: "argv",
|
|
644
|
+
type: "string[]"
|
|
645
|
+
}, {
|
|
646
|
+
name: "optionsOrTimeoutMs",
|
|
647
|
+
type: "number | SpawnOptions",
|
|
648
|
+
default: "300000"
|
|
649
|
+
}],
|
|
650
|
+
returnType: "Promise<string>",
|
|
651
|
+
children: code`const spawnResult = await spawn(argv, optionsOrTimeoutMs);
|
|
652
|
+
if (spawnResult.code !== 0) {
|
|
653
|
+
throw Object.assign(new Error(
|
|
654
|
+
\`Command "\${argv.join(" ")}" exited with code \${spawnResult.code} and signal \${spawnResult.signal}\`
|
|
655
|
+
), spawnResult);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
return spawnResult.stdout.trim(); `
|
|
659
|
+
}),
|
|
660
|
+
createComponent(Spacing, {}),
|
|
661
|
+
createComponent(TSDoc, {
|
|
662
|
+
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.",
|
|
663
|
+
get children() {
|
|
664
|
+
return [
|
|
665
|
+
createComponent(TSDocParam, {
|
|
666
|
+
name: "argv",
|
|
667
|
+
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.`
|
|
668
|
+
}),
|
|
669
|
+
createComponent(TSDocParam, {
|
|
670
|
+
name: "options",
|
|
671
|
+
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.`
|
|
672
|
+
}),
|
|
673
|
+
createComponent(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." })
|
|
674
|
+
];
|
|
675
|
+
}
|
|
676
|
+
}),
|
|
677
|
+
createComponent(FunctionDeclaration, {
|
|
678
|
+
"export": true,
|
|
679
|
+
name: "execSync",
|
|
680
|
+
parameters: [{
|
|
681
|
+
name: "argv",
|
|
682
|
+
type: "string[]"
|
|
683
|
+
}, {
|
|
684
|
+
name: "options",
|
|
685
|
+
type: "SpawnOptions",
|
|
686
|
+
optional: true
|
|
687
|
+
}],
|
|
688
|
+
returnType: "string",
|
|
689
|
+
children: code`return execFileSync(argv.length > 0 ? argv[0] : "", argv.slice(1), {
|
|
690
|
+
encoding: "utf8",
|
|
691
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
692
|
+
timeout: options?.timeoutMs ?? 300000,
|
|
693
|
+
env: options?.env ? resolveCommandEnv({ argv, env: options.env }) : process.env,
|
|
694
|
+
cwd: options?.cwd,
|
|
695
|
+
windowsHide: true,
|
|
696
|
+
windowsVerbatimArguments: options?.windowsVerbatimArguments,
|
|
697
|
+
...(shouldSpawnWithShell({
|
|
698
|
+
resolvedCommand: argv[0] ?? "",
|
|
699
|
+
platform: process.platform
|
|
700
|
+
})
|
|
701
|
+
? { shell: true }
|
|
702
|
+
: {})
|
|
703
|
+
}).trim(); `
|
|
638
704
|
}),
|
|
639
705
|
createComponent(Spacing, {}),
|
|
640
706
|
createComponent(Show, {
|
|
@@ -649,5 +715,5 @@ return new Promise((resolve, reject) => {
|
|
|
649
715
|
}
|
|
650
716
|
|
|
651
717
|
//#endregion
|
|
652
|
-
export {
|
|
653
|
-
//# sourceMappingURL=
|
|
718
|
+
export { ExecBuiltin };
|
|
719
|
+
//# sourceMappingURL=exec-builtin.mjs.map
|
|
@@ -0,0 +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\";\n\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\"]\n })}>\n <FunctionDeclaration\n name=\"resolveCommandEnv\"\n parameters={[\n {\n name: \"params\",\n type: \"{ argv: string[]; env?: NodeJS.ProcessEnv; baseEnv?: NodeJS.ProcessEnv; }\"\n }\n ]}\n returnType=\"NodeJS.ProcessEnv\">\n {code`const baseEnv = params.baseEnv ?? process.env;\nconst argv = params.argv;\nconst 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\nconst mergedEnv = params.env ? { ...baseEnv, ...params.env } : { ...baseEnv };\nconst resolvedEnv = Object.fromEntries(\n Object.entries(mergedEnv)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, String(value)])\n);\nif (shouldSuppressNpmFund) {\n resolvedEnv.NPM_CONFIG_FUND ??= \"false\";\n resolvedEnv.npm_config_fund ??= \"false\";\n}\nreturn resolvedEnv;`}\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}\nconst ext = extname(resolvedCommand).toLowerCase();\n\nreturn 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}\nif (!arg.includes(\" \") && !arg.includes('\"')) {\n return arg;\n}\nreturn \\`\"\\${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}\nconst base = basename(argv[0] ?? \"\")\n .toLowerCase()\n .replace(/\\.(?:cmd|exe|bat)$/, \"\");\nconst cliName =\n base === \"npx\" ? \"npx-cli.js\" : base === \"npm\" ? \"npm-cli.js\" : null;\nif (!cliName) {\n return null;\n}\nconst nodeDir = dirname(process.execPath);\nconst cliPath = join(nodeDir, \"node_modules\", \"npm\", \"bin\", cliName);\nif (!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}\nreturn [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}\nconst base = basename(command).toLowerCase();\nif (extname(base)) {\n return command;\n}\nif ([\"pnpm\", \"yarn\"].includes(base)) {\n return \\`\\${command}.cmd\\`;\n}\nreturn 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\nreturn [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.\nvoid params;\nreturn 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\" 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, cwd, input, env, noOutputTimeoutMs } = options;\nconst hasInput = input !== undefined;\nconst resolvedEnv = resolveCommandEnv({ argv, env });\nconst stdio = resolveCommandStdio({ hasInput, preferInherit: true });\n\nconst finalArgv =\n isWindows\n ? (resolveNpmArgvForWindows(argv) ?? argv)\n : argv;\nconst resolvedCommand =\n finalArgv !== argv\n ? (finalArgv[0] ?? \"\")\n : resolveCommand(argv[0] ?? \"\");\nconst useCmdWrapper = isWindowsBatchCommand(resolvedCommand);\n\nconst child = _spawn(\n useCmdWrapper\n ? (process.env.ComSpec ?? \"cmd.exe\")\n : resolvedCommand,\n useCmdWrapper\n ? [\n \"/d\",\n \"/s\",\n \"/c\",\n buildCmdExeCommandLine(resolvedCommand, finalArgv.slice(1))\n ]\n : finalArgv.slice(1), {\n stdio,\n cwd,\n env: resolvedEnv,\n windowsHide: true,\n windowsVerbatimArguments: useCmdWrapper\n ? true\n : options.windowsVerbatimArguments,\n ...(shouldSpawnWithShell({\n resolvedCommand: useCmdWrapper\n ? (process.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 (hasInput && 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 || finalArgv !== 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\", optional: true }\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: options?.env ? resolveCommandEnv({ argv, env: options.env }) : process.env,\n cwd: options?.cwd,\n windowsHide: true,\n windowsVerbatimArguments: options?.windowsVerbatimArguments,\n ...(shouldSpawnWithShell({\n resolvedCommand: argv[0] ?? \"\",\n platform: process.platform\n })\n ? { shell: true }\n : {})\n }).trim(); `}\n </FunctionDeclaration>\n <Spacing />\n\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAgCA,SAAE,YAAiB,OAAA;CACjB,MAAA,CAAA,EACA,YACA,QAAO,WAAW,OAAO,CAAK,WAAW,CAAC;AAC5C,QAAO,gBAAgB,aAAA,WAAA;;EAEvB,aAAiB;EACf,EAAA,MAAA;EACC,IAAK,UAAE;AACP,UAAA,OAAA,KAAA,WAAA,EAAA,EAAA;;;;;;;IAED,WAAA,CAAA,aAAA;IACG,sBAAoB,CAAA;KACvB,MAAA;KACK,OAAS;KACP,EAAE,eAAY;;KAEd,MAAA;KACJ,SAAA;KACK,MAAI;KACR,CAAA;IACC,CAAC;;EAEJ,IAAI,iBAAe;AACjB,UAAO,OAAK,KAAG,kBAAY,EAAA,EAAA,EACzB,KAAK,CAAC,YAAA,EACP,CAAC;;EAEJ,IAAI,WAAC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