@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.
- package/dist/_virtual/_rolldown/runtime.cjs +29 -1
- package/dist/api.cjs +36 -1
- package/dist/api.cjs.map +1 -0
- package/dist/api.d.cts +2 -77
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.mts +2 -76
- package/dist/api.d.mts.map +1 -1
- package/dist/api.mjs +35 -1
- package/dist/api.mjs.map +1 -1
- package/dist/components/command-validation-logic.cjs +291 -1
- package/dist/components/command-validation-logic.cjs.map +1 -0
- package/dist/components/command-validation-logic.d.cts +1 -3
- package/dist/components/command-validation-logic.d.cts.map +1 -1
- package/dist/components/command-validation-logic.d.mts +1 -3
- package/dist/components/command-validation-logic.d.mts.map +1 -1
- package/dist/components/command-validation-logic.mjs +288 -1
- package/dist/components/command-validation-logic.mjs.map +1 -1
- package/dist/components/docs.cjs +265 -1
- package/dist/components/docs.cjs.map +1 -0
- package/dist/components/docs.d.cts +4 -5
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts +4 -5
- package/dist/components/docs.d.mts.map +1 -1
- package/dist/components/docs.mjs +256 -1
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/exec-builtin.cjs +429 -15
- package/dist/components/exec-builtin.cjs.map +1 -0
- package/dist/components/exec-builtin.d.cts +1 -2
- package/dist/components/exec-builtin.d.cts.map +1 -1
- package/dist/components/exec-builtin.d.mts +1 -2
- package/dist/components/exec-builtin.d.mts.map +1 -1
- package/dist/components/exec-builtin.mjs +424 -15
- package/dist/components/exec-builtin.mjs.map +1 -1
- package/dist/components/helpers.cjs +119 -1
- package/dist/components/helpers.cjs.map +1 -0
- package/dist/components/helpers.d.cts +6 -8
- package/dist/components/helpers.d.cts.map +1 -1
- package/dist/components/helpers.d.mts +6 -8
- package/dist/components/helpers.d.mts.map +1 -1
- package/dist/components/helpers.mjs +111 -1
- package/dist/components/helpers.mjs.map +1 -1
- package/dist/components/index.cjs +58 -1
- package/dist/components/index.mjs +10 -1
- package/dist/components/options-parser-logic.cjs +959 -5
- package/dist/components/options-parser-logic.cjs.map +1 -0
- package/dist/components/options-parser-logic.d.cts +8 -9
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts +8 -9
- package/dist/components/options-parser-logic.d.mts.map +1 -1
- package/dist/components/options-parser-logic.mjs +944 -5
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/state-builtin.cjs +630 -8
- package/dist/components/state-builtin.cjs.map +1 -0
- package/dist/components/state-builtin.d.cts +4 -5
- package/dist/components/state-builtin.d.cts.map +1 -1
- package/dist/components/state-builtin.d.mts +4 -5
- package/dist/components/state-builtin.d.mts.map +1 -1
- package/dist/components/state-builtin.mjs +622 -8
- package/dist/components/state-builtin.mjs.map +1 -1
- package/dist/components/usage.cjs +116 -1
- package/dist/components/usage.cjs.map +1 -0
- package/dist/components/usage.d.cts +1 -2
- package/dist/components/usage.d.cts.map +1 -1
- package/dist/components/usage.d.mts +1 -2
- package/dist/components/usage.d.mts.map +1 -1
- package/dist/components/usage.mjs +113 -1
- package/dist/components/usage.mjs.map +1 -1
- package/dist/components/utils-builtin.cjs +839 -33
- package/dist/components/utils-builtin.cjs.map +1 -0
- package/dist/components/utils-builtin.d.cts +7 -8
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts +7 -8
- package/dist/components/utils-builtin.d.mts.map +1 -1
- package/dist/components/utils-builtin.mjs +828 -33
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/config.cjs +65 -1
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +29 -8
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +29 -8
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +62 -1
- package/dist/config.mjs.map +1 -1
- package/dist/contexts/command.cjs +26 -1
- package/dist/contexts/command.cjs.map +1 -0
- package/dist/contexts/command.d.cts.map +1 -1
- package/dist/contexts/command.d.mts.map +1 -1
- package/dist/contexts/command.mjs +23 -1
- package/dist/contexts/command.mjs.map +1 -1
- package/dist/contexts/index.cjs +9 -1
- package/dist/contexts/index.mjs +4 -1
- package/dist/contexts/options.cjs +63 -1
- package/dist/contexts/options.cjs.map +1 -0
- package/dist/contexts/options.d.cts.map +1 -1
- package/dist/contexts/options.d.mts.map +1 -1
- package/dist/contexts/options.mjs +57 -1
- package/dist/contexts/options.mjs.map +1 -1
- package/dist/engine.cjs +138 -0
- package/dist/engine.cjs.map +1 -0
- package/dist/engine.d.cts +79 -0
- package/dist/engine.d.cts.map +1 -0
- package/dist/engine.d.mts +79 -0
- package/dist/engine.d.mts.map +1 -0
- package/dist/engine.mjs +136 -0
- package/dist/engine.mjs.map +1 -0
- package/dist/helpers/automd.cjs +70 -1
- package/dist/helpers/automd.cjs.map +1 -0
- package/dist/helpers/automd.mjs +69 -1
- package/dist/helpers/automd.mjs.map +1 -1
- package/dist/helpers/docs-helpers.cjs +23 -1
- package/dist/helpers/docs-helpers.cjs.map +1 -0
- package/dist/helpers/docs-helpers.mjs +22 -1
- package/dist/helpers/docs-helpers.mjs.map +1 -1
- package/dist/helpers/get-framework.cjs +24 -0
- package/dist/helpers/get-framework.cjs.map +1 -0
- package/dist/helpers/get-framework.mjs +24 -0
- package/dist/helpers/get-framework.mjs.map +1 -0
- package/dist/helpers/paths.cjs +137 -1
- package/dist/helpers/paths.cjs.map +1 -0
- package/dist/helpers/paths.mjs +133 -1
- package/dist/helpers/paths.mjs.map +1 -1
- package/dist/helpers/persistence.cjs +113 -1
- package/dist/helpers/persistence.cjs.map +1 -0
- package/dist/helpers/persistence.mjs +112 -1
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/helpers/update-package-json.cjs +65 -1
- package/dist/helpers/update-package-json.cjs.map +1 -0
- package/dist/helpers/update-package-json.mjs +63 -1
- package/dist/helpers/update-package-json.mjs.map +1 -1
- package/dist/helpers/utilities.cjs +95 -1
- package/dist/helpers/utilities.cjs.map +1 -0
- package/dist/helpers/utilities.mjs +93 -1
- package/dist/helpers/utilities.mjs.map +1 -1
- package/dist/helpers/validations.cjs +71 -1
- package/dist/helpers/validations.cjs.map +1 -0
- package/dist/helpers/validations.mjs +69 -1
- package/dist/helpers/validations.mjs.map +1 -1
- package/dist/index.cjs +123 -1
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +80 -5
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +80 -5
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +119 -1
- package/dist/index.mjs.map +1 -0
- package/dist/package.cjs +12 -0
- package/dist/package.cjs.map +1 -0
- package/dist/package.mjs +6 -0
- package/dist/package.mjs.map +1 -0
- package/dist/plugin-utils/compute-bin.cjs +48 -1
- package/dist/plugin-utils/compute-bin.cjs.map +1 -0
- package/dist/plugin-utils/compute-bin.d.cts +2 -2
- package/dist/plugin-utils/compute-bin.d.cts.map +1 -1
- package/dist/plugin-utils/compute-bin.d.mts +2 -2
- package/dist/plugin-utils/compute-bin.d.mts.map +1 -1
- package/dist/plugin-utils/compute-bin.mjs +47 -1
- package/dist/plugin-utils/compute-bin.mjs.map +1 -1
- package/dist/plugin-utils/context-helpers.cjs +224 -1
- package/dist/plugin-utils/context-helpers.cjs.map +1 -0
- package/dist/plugin-utils/context-helpers.d.cts +4 -4
- package/dist/plugin-utils/context-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/context-helpers.d.mts +4 -4
- package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/context-helpers.mjs +214 -1
- package/dist/plugin-utils/context-helpers.mjs.map +1 -1
- package/dist/plugin-utils/deepkit.cjs +70 -1
- package/dist/plugin-utils/deepkit.cjs.map +1 -0
- package/dist/plugin-utils/deepkit.d.cts +5 -5
- package/dist/plugin-utils/deepkit.d.cts.map +1 -1
- package/dist/plugin-utils/deepkit.d.mts +5 -5
- package/dist/plugin-utils/deepkit.d.mts.map +1 -1
- package/dist/plugin-utils/deepkit.mjs +68 -1
- package/dist/plugin-utils/deepkit.mjs.map +1 -1
- package/dist/plugin-utils/description-helpers.cjs +112 -2
- package/dist/plugin-utils/description-helpers.cjs.map +1 -0
- package/dist/plugin-utils/description-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/description-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/description-helpers.mjs +107 -2
- package/dist/plugin-utils/description-helpers.mjs.map +1 -1
- package/dist/plugin-utils/get-command-tree.cjs +118 -1
- package/dist/plugin-utils/get-command-tree.cjs.map +1 -0
- package/dist/plugin-utils/get-command-tree.d.cts.map +1 -1
- package/dist/plugin-utils/get-command-tree.d.mts.map +1 -1
- package/dist/plugin-utils/get-command-tree.mjs +114 -1
- package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +39 -1
- package/dist/plugin-utils/index.d.cts +2 -2
- package/dist/plugin-utils/index.d.mts +2 -2
- package/dist/plugin-utils/index.mjs +10 -1
- package/dist/plugin-utils/reflect.cjs +52 -1
- package/dist/plugin-utils/reflect.cjs.map +1 -0
- package/dist/plugin-utils/reflect.d.cts.map +1 -1
- package/dist/plugin-utils/reflect.d.mts.map +1 -1
- package/dist/plugin-utils/reflect.mjs +50 -1
- package/dist/plugin-utils/reflect.mjs.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.cjs +65 -1
- package/dist/plugin-utils/traverse-command-tree.cjs.map +1 -0
- package/dist/plugin-utils/traverse-command-tree.d.cts.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.d.mts.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.mjs +62 -1
- package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/type-checks.cjs +222 -1
- package/dist/plugin-utils/type-checks.cjs.map +1 -0
- package/dist/plugin-utils/type-checks.d.cts +5 -5
- package/dist/plugin-utils/type-checks.d.cts.map +1 -1
- package/dist/plugin-utils/type-checks.d.mts +5 -5
- package/dist/plugin-utils/type-checks.d.mts.map +1 -1
- package/dist/plugin-utils/type-checks.mjs +217 -1
- package/dist/plugin-utils/type-checks.mjs.map +1 -1
- package/dist/plugin.cjs +495 -4
- package/dist/plugin.cjs.map +1 -0
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +488 -4
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/helpers.cjs +182 -1
- package/dist/resolver/helpers.cjs.map +1 -0
- package/dist/resolver/helpers.mjs +178 -1
- package/dist/resolver/helpers.mjs.map +1 -1
- package/dist/resolver/resolve.cjs +479 -1
- package/dist/resolver/resolve.cjs.map +1 -0
- package/dist/resolver/resolve.mjs +478 -1
- package/dist/resolver/resolve.mjs.map +1 -1
- package/dist/types/command.cjs +402 -1
- package/dist/types/command.cjs.map +1 -0
- package/dist/types/command.d.cts +61 -119
- package/dist/types/command.d.cts.map +1 -1
- package/dist/types/command.d.mts +61 -119
- package/dist/types/command.d.mts.map +1 -1
- package/dist/types/command.mjs +367 -1
- package/dist/types/command.mjs.map +1 -1
- package/dist/types/config.cjs +175 -1
- package/dist/types/config.cjs.map +1 -0
- package/dist/types/config.d.cts +19 -12
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +19 -12
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/config.mjs +163 -1
- package/dist/types/config.mjs.map +1 -1
- package/dist/types/context.cjs +45 -1
- package/dist/types/context.cjs.map +1 -0
- package/dist/types/context.d.cts +3 -2
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts +3 -2
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/context.mjs +40 -1
- package/dist/types/context.mjs.map +1 -1
- package/dist/types/env.cjs +53 -1
- package/dist/types/env.cjs.map +1 -0
- package/dist/types/env.d.cts +1 -1
- package/dist/types/env.d.cts.map +1 -1
- package/dist/types/env.d.mts +1 -1
- package/dist/types/env.d.mts.map +1 -1
- package/dist/types/env.mjs +50 -1
- package/dist/types/env.mjs.map +1 -1
- package/dist/types/index.cjs +53 -1
- package/dist/types/index.d.cts +4 -4
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.mjs +6 -1
- package/dist/types/options.cjs +13 -1
- package/dist/types/options.cjs.map +1 -0
- package/dist/types/options.d.cts.map +1 -1
- package/dist/types/options.d.mts.map +1 -1
- package/dist/types/options.mjs +10 -1
- package/dist/types/options.mjs.map +1 -1
- package/package.json +43 -34
- package/dist/resolver/deepkit.cjs +0 -1
- package/dist/resolver/deepkit.mjs +0 -2
- package/dist/resolver/deepkit.mjs.map +0 -1
- package/dist/resolver/module.cjs +0 -1
- package/dist/resolver/module.mjs +0 -2
- package/dist/resolver/module.mjs.map +0 -1
|
@@ -1,4 +1,84 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
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; `
|
|
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"; `
|
|
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, '""')}"\`; `
|
|
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
|
-
); `
|
|
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)]; `
|
|
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; `
|
|
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"]; `
|
|
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
|
-
); `
|
|
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; `
|
|
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 =
|
|
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
|
-
});`
|
|
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(); `
|
|
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 ??
|
|
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(); `
|
|
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):
|
|
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":"
|
|
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):
|
|
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":"
|
|
1
|
+
{"version":3,"file":"exec-builtin.d.mts","names":[],"sources":["../../src/components/exec-builtin.tsx"],"mappings":""}
|