@shell-shock/core 0.16.2 → 0.17.1
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/command-validation-logic.cjs +1 -1
- package/dist/components/command-validation-logic.cjs.map +1 -1
- package/dist/components/command-validation-logic.mjs +1 -1
- package/dist/components/command-validation-logic.mjs.map +1 -1
- package/dist/components/{spawn-builtin.cjs → exec-builtin.cjs} +140 -75
- 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} +140 -75
- 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/options-parser-logic.cjs +14 -6
- package/dist/components/options-parser-logic.cjs.map +1 -1
- package/dist/components/options-parser-logic.d.cts +2 -5
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts +2 -5
- package/dist/components/options-parser-logic.d.mts.map +1 -1
- package/dist/components/options-parser-logic.mjs +14 -6
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/state-builtin.cjs +43 -8
- package/dist/components/state-builtin.cjs.map +1 -1
- package/dist/components/state-builtin.d.cts.map +1 -1
- package/dist/components/state-builtin.d.mts.map +1 -1
- package/dist/components/state-builtin.mjs +44 -9
- package/dist/components/state-builtin.mjs.map +1 -1
- package/dist/components/utils-builtin.cjs +154 -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 +155 -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/resolver/resolve.cjs +1 -1
- package/dist/resolver/resolve.cjs.map +1 -1
- package/dist/resolver/resolve.mjs +1 -1
- package/dist/resolver/resolve.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 +7 -1
- package/dist/types/env.d.cts.map +1 -1
- package/dist/types/env.d.mts +7 -1
- package/dist/types/env.d.mts.map +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
|
@@ -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,
|
|
@@ -38,7 +38,14 @@ function SpawnBuiltin(props) {
|
|
|
38
38
|
});
|
|
39
39
|
},
|
|
40
40
|
get builtinImports() {
|
|
41
|
-
return defu$1(rest.builtinImports ?? {}, { env: [
|
|
41
|
+
return defu$1(rest.builtinImports ?? {}, { env: [
|
|
42
|
+
"isWindows",
|
|
43
|
+
"env",
|
|
44
|
+
{
|
|
45
|
+
name: "Env",
|
|
46
|
+
type: true
|
|
47
|
+
}
|
|
48
|
+
] });
|
|
42
49
|
},
|
|
43
50
|
get children() {
|
|
44
51
|
return [
|
|
@@ -46,11 +53,10 @@ function SpawnBuiltin(props) {
|
|
|
46
53
|
name: "resolveCommandEnv",
|
|
47
54
|
parameters: [{
|
|
48
55
|
name: "params",
|
|
49
|
-
type: "{ argv: string[]; env?: NodeJS.ProcessEnv;
|
|
56
|
+
type: "{ argv: string[]; env?: NodeJS.ProcessEnv; }"
|
|
50
57
|
}],
|
|
51
58
|
returnType: "NodeJS.ProcessEnv",
|
|
52
|
-
children: code`const
|
|
53
|
-
const argv = params.argv;
|
|
59
|
+
children: code`const argv = params.argv;
|
|
54
60
|
const shouldSuppressNpmFund = (() => {
|
|
55
61
|
const cmd = basename(argv[0] ?? "");
|
|
56
62
|
if (cmd === "npm" || cmd === "npm.cmd" || cmd === "npm.exe") {
|
|
@@ -64,17 +70,19 @@ const shouldSuppressNpmFund = (() => {
|
|
|
64
70
|
return false;
|
|
65
71
|
})();
|
|
66
72
|
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
const result = Object.fromEntries(
|
|
74
|
+
Object.entries({
|
|
75
|
+
...env,
|
|
76
|
+
...(params.env ?? {})
|
|
77
|
+
})
|
|
78
|
+
.filter(([, value]) => value !== undefined)
|
|
79
|
+
.map(([key, value]) => [key, String(value)])
|
|
72
80
|
);
|
|
73
81
|
if (shouldSuppressNpmFund) {
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
result.NPM_CONFIG_FUND ??= "false";
|
|
83
|
+
result.npm_config_fund ??= "false";
|
|
76
84
|
}
|
|
77
|
-
return
|
|
85
|
+
return result; `
|
|
78
86
|
}),
|
|
79
87
|
createComponent(Spacing, {}),
|
|
80
88
|
createComponent(FunctionDeclaration, {
|
|
@@ -192,45 +200,6 @@ return command;`
|
|
|
192
200
|
: "pipe";
|
|
193
201
|
|
|
194
202
|
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
203
|
}),
|
|
235
204
|
createComponent(Spacing, {}),
|
|
236
205
|
createComponent(FunctionDeclaration, {
|
|
@@ -347,6 +316,7 @@ return false;`
|
|
|
347
316
|
}),
|
|
348
317
|
createComponent(InterfaceMember, {
|
|
349
318
|
name: "timeoutMs",
|
|
319
|
+
optional: true,
|
|
350
320
|
type: "number"
|
|
351
321
|
}),
|
|
352
322
|
createComponent(Spacing, {}),
|
|
@@ -433,23 +403,41 @@ return false;`
|
|
|
433
403
|
typeof optionsOrTimeoutMs === "number"
|
|
434
404
|
? { timeoutMs: optionsOrTimeoutMs }
|
|
435
405
|
: optionsOrTimeoutMs;
|
|
436
|
-
const { timeoutMs, cwd, input,
|
|
437
|
-
|
|
438
|
-
const
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
406
|
+
const { timeoutMs = 300000, cwd, input, noOutputTimeoutMs } = options;
|
|
407
|
+
|
|
408
|
+
const resolvedArgv =
|
|
409
|
+
isWindows
|
|
410
|
+
? (resolveNpmArgvForWindows(argv) ?? argv)
|
|
411
|
+
: argv;
|
|
412
|
+
const resolvedCommand =
|
|
413
|
+
resolvedArgv !== argv
|
|
414
|
+
? (resolvedArgv[0] ?? "")
|
|
415
|
+
: resolveCommand(argv[0] ?? "");
|
|
416
|
+
const useCmdWrapper = isWindowsBatchCommand(resolvedCommand);
|
|
444
417
|
|
|
445
|
-
const child = _spawn(
|
|
446
|
-
|
|
418
|
+
const child = _spawn(
|
|
419
|
+
useCmdWrapper
|
|
420
|
+
? (env.COMSPEC ?? "cmd.exe")
|
|
421
|
+
: resolvedCommand,
|
|
422
|
+
useCmdWrapper
|
|
423
|
+
? [
|
|
424
|
+
"/d",
|
|
425
|
+
"/s",
|
|
426
|
+
"/c",
|
|
427
|
+
buildCmdExeCommandLine(resolvedCommand, resolvedArgv.slice(1))
|
|
428
|
+
]
|
|
429
|
+
: resolvedArgv.slice(1), {
|
|
430
|
+
stdio: resolveCommandStdio({ hasInput: input !== undefined, preferInherit: true }),
|
|
447
431
|
cwd,
|
|
448
|
-
env:
|
|
449
|
-
windowsHide:
|
|
450
|
-
windowsVerbatimArguments:
|
|
432
|
+
env: resolveCommandEnv({ argv, env: options.env }),
|
|
433
|
+
windowsHide: true,
|
|
434
|
+
windowsVerbatimArguments: useCmdWrapper
|
|
435
|
+
? true
|
|
436
|
+
: options.windowsVerbatimArguments,
|
|
451
437
|
...(shouldSpawnWithShell({
|
|
452
|
-
resolvedCommand:
|
|
438
|
+
resolvedCommand: useCmdWrapper
|
|
439
|
+
? (env.COMSPEC ?? "cmd.exe")
|
|
440
|
+
: resolvedCommand,
|
|
453
441
|
platform: process.platform
|
|
454
442
|
})
|
|
455
443
|
? { shell: true }
|
|
@@ -518,7 +506,7 @@ return new Promise((resolve, reject) => {
|
|
|
518
506
|
}, timeoutMs >= 0 ? timeoutMs : Number.POSITIVE_INFINITY);
|
|
519
507
|
armNoOutputTimer();
|
|
520
508
|
|
|
521
|
-
if (
|
|
509
|
+
if (input !== undefined && child.stdin) {
|
|
522
510
|
child.stdin.write(input ?? "");
|
|
523
511
|
child.stdin.end();
|
|
524
512
|
}
|
|
@@ -571,7 +559,7 @@ return new Promise((resolve, reject) => {
|
|
|
571
559
|
explicitCode: childExitState?.code ?? code,
|
|
572
560
|
childExitCode: child.exitCode,
|
|
573
561
|
resolvedSignal,
|
|
574
|
-
usesWindowsExitCodeShim:
|
|
562
|
+
usesWindowsExitCodeShim: isWindows && (useCmdWrapper || resolvedArgv !== argv),
|
|
575
563
|
timedOut,
|
|
576
564
|
noOutputTimedOut,
|
|
577
565
|
killIssuedByTimeout
|
|
@@ -635,6 +623,83 @@ return new Promise((resolve, reject) => {
|
|
|
635
623
|
waitForExitState();
|
|
636
624
|
});
|
|
637
625
|
});`
|
|
626
|
+
}),
|
|
627
|
+
createComponent(Spacing, {}),
|
|
628
|
+
createComponent(TSDoc, {
|
|
629
|
+
heading: "A helper function that executes a command and returns its stdout.",
|
|
630
|
+
get children() {
|
|
631
|
+
return [
|
|
632
|
+
createComponent(TSDocParam, {
|
|
633
|
+
name: "argv",
|
|
634
|
+
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.`
|
|
635
|
+
}),
|
|
636
|
+
createComponent(TSDocParam, {
|
|
637
|
+
name: "optionsOrTimeoutMs",
|
|
638
|
+
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.`
|
|
639
|
+
}),
|
|
640
|
+
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." })
|
|
641
|
+
];
|
|
642
|
+
}
|
|
643
|
+
}),
|
|
644
|
+
createComponent(FunctionDeclaration, {
|
|
645
|
+
"export": true,
|
|
646
|
+
async: true,
|
|
647
|
+
name: "exec",
|
|
648
|
+
parameters: [{
|
|
649
|
+
name: "argv",
|
|
650
|
+
type: "string[]"
|
|
651
|
+
}, {
|
|
652
|
+
name: "optionsOrTimeoutMs",
|
|
653
|
+
type: "number | SpawnOptions",
|
|
654
|
+
default: "300000"
|
|
655
|
+
}],
|
|
656
|
+
returnType: "Promise<string>",
|
|
657
|
+
children: code`const spawnResult = await spawn(argv, optionsOrTimeoutMs);
|
|
658
|
+
if (spawnResult.code !== 0) {
|
|
659
|
+
throw Object.assign(new Error(
|
|
660
|
+
\`Command "\${argv.join(" ")}" exited with code \${spawnResult.code} and signal \${spawnResult.signal}\`
|
|
661
|
+
), spawnResult);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
return spawnResult.stdout.trim(); `
|
|
665
|
+
}),
|
|
666
|
+
createComponent(Spacing, {}),
|
|
667
|
+
createComponent(TSDoc, {
|
|
668
|
+
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.",
|
|
669
|
+
get children() {
|
|
670
|
+
return [
|
|
671
|
+
createComponent(TSDocParam, {
|
|
672
|
+
name: "argv",
|
|
673
|
+
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.`
|
|
674
|
+
}),
|
|
675
|
+
createComponent(TSDocParam, {
|
|
676
|
+
name: "options",
|
|
677
|
+
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.`
|
|
678
|
+
}),
|
|
679
|
+
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." })
|
|
680
|
+
];
|
|
681
|
+
}
|
|
682
|
+
}),
|
|
683
|
+
createComponent(FunctionDeclaration, {
|
|
684
|
+
"export": true,
|
|
685
|
+
name: "execSync",
|
|
686
|
+
parameters: [{
|
|
687
|
+
name: "argv",
|
|
688
|
+
type: "string[]"
|
|
689
|
+
}, {
|
|
690
|
+
name: "options",
|
|
691
|
+
type: "SpawnOptions",
|
|
692
|
+
default: "{}"
|
|
693
|
+
}],
|
|
694
|
+
returnType: "string",
|
|
695
|
+
children: code`return execFileSync(argv.length > 0 ? argv[0] : "", argv.slice(1), {
|
|
696
|
+
encoding: "utf8",
|
|
697
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
698
|
+
timeout: options.timeoutMs ?? 300000,
|
|
699
|
+
env: resolveCommandEnv({ argv, env: options.env }),
|
|
700
|
+
cwd: options.cwd || process.cwd(),
|
|
701
|
+
windowsHide: true
|
|
702
|
+
}).trim(); `
|
|
638
703
|
}),
|
|
639
704
|
createComponent(Spacing, {}),
|
|
640
705
|
createComponent(Show, {
|
|
@@ -649,5 +714,5 @@ return new Promise((resolve, reject) => {
|
|
|
649
714
|
}
|
|
650
715
|
|
|
651
716
|
//#endregion
|
|
652
|
-
export {
|
|
653
|
-
//# sourceMappingURL=
|
|
717
|
+
export { ExecBuiltin };
|
|
718
|
+
//# 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\", \"env\", { name: \"Env\", type: true }]\n })}>\n <FunctionDeclaration\n name=\"resolveCommandEnv\"\n parameters={[\n {\n name: \"params\",\n type: \"{ argv: string[]; env?: NodeJS.ProcessEnv; }\"\n }\n ]}\n returnType=\"NodeJS.ProcessEnv\">\n {code`const argv = params.argv;\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 result = Object.fromEntries(\n Object.entries({\n ...env,\n ...(params.env ?? {})\n})\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, String(value)])\n);\nif (shouldSuppressNpmFund) {\n result.NPM_CONFIG_FUND ??= \"false\";\n result.npm_config_fund ??= \"false\";\n}\nreturn result; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"isWindowsBatchCommand\"\n parameters={[{ name: \"resolvedCommand\", type: \"string\" }]}\n returnType=\"boolean\">\n {code`if (!isWindows) {\n return false;\n}\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\" optional type=\"number\" />\n <Spacing />\n <TSDoc heading=\"The current working directory of the child process.\" />\n <InterfaceMember name=\"cwd\" optional type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The input to be passed to the child process.\" />\n <InterfaceMember name=\"input\" optional type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The environment variables for the child process.\" />\n <InterfaceMember name=\"env\" optional type=\"NodeJS.ProcessEnv\" />\n <Spacing />\n <TSDoc heading=\"Whether to pass arguments to the child process verbatim on Windows.\" />\n <InterfaceMember\n name=\"windowsVerbatimArguments\"\n optional\n type=\"boolean\"\n />\n <Spacing />\n <TSDoc heading=\"The timeout in milliseconds for the child process to produce output on stdout or stderr. If the process produces no output for this duration, it will be killed and the spawn promise will reject with a no-output-timeout termination reason.\" />\n <InterfaceMember name=\"noOutputTimeoutMs\" optional type=\"number\" />\n </InterfaceDeclaration>\n <Spacing />\n <VarDeclaration\n const\n name=\"WINDOWS_CLOSE_STATE_SETTLE_TIMEOUT_MS\"\n initializer={code`250`}\n />\n <Spacing />\n <VarDeclaration\n const\n name=\"WINDOWS_CLOSE_STATE_POLL_MS\"\n initializer={code`10`}\n />\n <Spacing />\n <TSDoc heading=\"Spawns a child process with the given arguments and options, returning a promise that resolves with the result of the spawn operation.\">\n <TSDocParam name=\"argv\">\n {\"The command and its arguments to spawn.\"}\n </TSDocParam>\n <TSDocParam name=\"optionsOrTimeoutMs\">\n {`The options for spawning the command, or a number representing the timeout in milliseconds. This allows for a convenient shorthand when only a timeout is needed. Providing \\`-1\\` will disable the timeout. If no options or timeout are provided, a default timeout of 5 minutes will be used.`}\n </TSDocParam>\n <TSDocReturns>\n {\n \"A promise that resolves with the result of the spawn operation, including stdout, stderr, exit code, signal, and termination reason.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"spawn\"\n parameters={[\n { name: \"argv\", type: \"string[]\" },\n {\n name: \"optionsOrTimeoutMs\",\n type: \"number | SpawnOptions\",\n default: \"300000\"\n }\n ]}\n returnType=\"Promise<SpawnResult>\">\n {code`const options: SpawnOptions =\n typeof optionsOrTimeoutMs === \"number\"\n ? { timeoutMs: optionsOrTimeoutMs }\n : optionsOrTimeoutMs;\nconst { timeoutMs = 300000, cwd, input, noOutputTimeoutMs } = options;\n\nconst resolvedArgv =\n isWindows\n ? (resolveNpmArgvForWindows(argv) ?? argv)\n : argv;\nconst resolvedCommand =\n resolvedArgv !== argv\n ? (resolvedArgv[0] ?? \"\")\n : resolveCommand(argv[0] ?? \"\");\nconst useCmdWrapper = isWindowsBatchCommand(resolvedCommand);\n\nconst child = _spawn(\n useCmdWrapper\n ? (env.COMSPEC ?? \"cmd.exe\")\n : resolvedCommand,\n useCmdWrapper\n ? [\n \"/d\",\n \"/s\",\n \"/c\",\n buildCmdExeCommandLine(resolvedCommand, resolvedArgv.slice(1))\n ]\n : resolvedArgv.slice(1), {\n stdio: resolveCommandStdio({ hasInput: input !== undefined, preferInherit: true }),\n cwd,\n env: resolveCommandEnv({ argv, env: options.env }),\n windowsHide: true,\n windowsVerbatimArguments: useCmdWrapper\n ? true\n : options.windowsVerbatimArguments,\n ...(shouldSpawnWithShell({\n resolvedCommand: useCmdWrapper\n ? (env.COMSPEC ?? \"cmd.exe\")\n : resolvedCommand,\n platform: process.platform\n })\n ? { shell: true }\n : {})\n});\n\nreturn new Promise((resolve, reject) => {\n let stdout = \"\";\n let stderr = \"\";\n let settled = false;\n let timedOut = false;\n let noOutputTimedOut = false;\n let killIssuedByTimeout = false;\n let childExitState: {\n code: number | null;\n signal: NodeJS.Signals | null;\n } | null = null;\n let closeFallbackTimer: NodeJS.Timeout | null = null;\n let noOutputTimer: NodeJS.Timeout | null = null;\n const shouldTrackOutputTimeout =\n typeof noOutputTimeoutMs === \"number\" &&\n Number.isFinite(noOutputTimeoutMs) &&\n noOutputTimeoutMs > 0;\n\n const clearNoOutputTimer = () => {\n if (!noOutputTimer) {\n return;\n }\n clearTimeout(noOutputTimer);\n noOutputTimer = null;\n };\n\n const clearCloseFallbackTimer = () => {\n if (!closeFallbackTimer) {\n return;\n }\n clearTimeout(closeFallbackTimer);\n closeFallbackTimer = null;\n };\n\n const killChild = () => {\n if (settled || typeof child?.kill !== \"function\") {\n return;\n }\n killIssuedByTimeout = true;\n child.kill(\"SIGKILL\");\n };\n\n const armNoOutputTimer = () => {\n if (!shouldTrackOutputTimeout || settled) {\n return;\n }\n clearNoOutputTimer();\n noOutputTimer = setTimeout(() => {\n if (settled) {\n return;\n }\n noOutputTimedOut = true;\n killChild();\n }, Math.floor(noOutputTimeoutMs));\n };\n\n const timer = setTimeout(() => {\n timedOut = true;\n killChild();\n }, timeoutMs >= 0 ? timeoutMs : Number.POSITIVE_INFINITY);\n armNoOutputTimer();\n\n if (input !== undefined && child.stdin) {\n child.stdin.write(input ?? \"\");\n child.stdin.end();\n }\n\n child.stdout?.on(\"data\", (d: Stream) => {\n stdout += d.toString();\n armNoOutputTimer();\n });\n child.stderr?.on(\"data\", (d: Stream) => {\n stderr += d.toString();\n armNoOutputTimer();\n });\n child.on(\"error\", err => {\n if (settled) {\n return;\n }\n settled = true;\n clearTimeout(timer);\n clearNoOutputTimer();\n clearCloseFallbackTimer();\n reject(err);\n });\n child.on(\"exit\", (code, signal) => {\n childExitState = { code, signal };\n if (settled || closeFallbackTimer) {\n return;\n }\n closeFallbackTimer = setTimeout(() => {\n if (settled) {\n return;\n }\n child.stdout?.destroy();\n child.stderr?.destroy();\n }, 250);\n });\n const resolveFromClose = (\n code: number | null,\n signal: NodeJS.Signals | null\n ) => {\n if (settled) {\n return;\n }\n settled = true;\n clearTimeout(timer);\n clearNoOutputTimer();\n clearCloseFallbackTimer();\n const resolvedSignal =\n childExitState?.signal ?? signal ?? child.signalCode ?? null;\n const resolvedCode = resolveProcessExitCode({\n explicitCode: childExitState?.code ?? code,\n childExitCode: child.exitCode,\n resolvedSignal,\n usesWindowsExitCodeShim: isWindows && (useCmdWrapper || resolvedArgv !== argv),\n timedOut,\n noOutputTimedOut,\n killIssuedByTimeout\n });\n const termination = noOutputTimedOut\n ? \"no-output-timeout\"\n : timedOut\n ? \"timeout\"\n : resolvedSignal != null\n ? \"signal\"\n : \"exit\";\n const normalizedCode =\n termination === \"timeout\" || termination === \"no-output-timeout\"\n ? resolvedCode === 0\n ? 124\n : resolvedCode\n : resolvedCode;\n resolve({\n pid: child.pid ?? undefined,\n stdout,\n stderr,\n code: normalizedCode,\n signal: resolvedSignal,\n killed: child.killed,\n termination,\n noOutputTimedOut\n });\n };\n child.on(\"close\", (code, signal) => {\n if (\n !isWindows ||\n childExitState != null ||\n code != null ||\n signal != null ||\n child.exitCode != null ||\n child.signalCode != null\n ) {\n resolveFromClose(code, signal);\n return;\n }\n\n const startedAt = Date.now();\n const waitForExitState = () => {\n if (settled) {\n return;\n }\n if (\n childExitState != null ||\n child.exitCode != null ||\n child.signalCode != null\n ) {\n resolveFromClose(code, signal);\n return;\n }\n if (Date.now() - startedAt >= WINDOWS_CLOSE_STATE_SETTLE_TIMEOUT_MS) {\n resolveFromClose(code, signal);\n return;\n }\n setTimeout(waitForExitState, WINDOWS_CLOSE_STATE_POLL_MS);\n };\n waitForExitState();\n });\n});`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A helper function that executes a command and returns its stdout.\">\n <TSDocParam name=\"argv\">\n {`The command and its arguments to spawn. This is passed directly to the spawn function. Remember that on Windows, commands like \\`npm\\` or \\`pnpm\\` will be resolved to their .cmd shims, so you can just pass \\`npm\\` without worrying about the extension.`}\n </TSDocParam>\n <TSDocParam name=\"optionsOrTimeoutMs\">\n {`The options for spawning the command, or a number representing the timeout in milliseconds. This is passed directly to the spawn function. Providing \\`-1\\` will disable the timeout. If no options or timeout are provided, a default timeout of 5 minutes will be used.`}\n </TSDocParam>\n <TSDocReturns>\n {\n \"A promise that resolves with the result of the spawn operation if the command exits with code 0, or rejects with an error if the command exits with a non-zero code or if there is a problem spawning the process.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"exec\"\n parameters={[\n { name: \"argv\", type: \"string[]\" },\n {\n name: \"optionsOrTimeoutMs\",\n type: \"number | SpawnOptions\",\n default: \"300000\"\n }\n ]}\n returnType=\"Promise<string>\">\n {code`const spawnResult = await spawn(argv, optionsOrTimeoutMs);\n if (spawnResult.code !== 0) {\n throw Object.assign(new Error(\n \\`Command \"\\${argv.join(\" \")}\" exited with code \\${spawnResult.code} and signal \\${spawnResult.signal}\\`\n ), spawnResult);\n }\n\n return spawnResult.stdout.trim(); `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A helper function that executes a command synchronously and returns its stdout. This is a thin wrapper around \\`child_process.execFileSync\\` with some added Windows compatibility handling.\">\n <TSDocParam name=\"argv\">\n {`The command and its arguments to spawn. This is passed directly to \\`execFileSync\\` after Windows-specific resolution. Remember that on Windows, commands like \\`npm\\` or \\`pnpm\\` will be resolved to their .cmd shims, so you can just pass \\`npm\\` without worrying about the extension.`}\n </TSDocParam>\n <TSDocParam name=\"options\">\n {`The options for spawning the command. This is passed directly to \\`execFileSync\\` after some processing. The timeout option is supported, but note that it will throw an error if the process runs longer than the specified timeout. If no options are provided, a default timeout of 5 minutes will be used.`}\n </TSDocParam>\n <TSDocReturns>\n {\n \"The standard output produced by the command if it exits with code 0. If the command exits with a non-zero code or if there is a problem spawning the process, an error will be thrown.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"execSync\"\n parameters={[\n { name: \"argv\", type: \"string[]\" },\n { name: \"options\", type: \"SpawnOptions\", default: \"{}\" }\n ]}\n returnType=\"string\">\n {code`return execFileSync(argv.length > 0 ? argv[0] : \"\", argv.slice(1), {\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n timeout: options.timeoutMs ?? 300000,\n env: resolveCommandEnv({ argv, env: options.env }),\n cwd: options.cwd || process.cwd(),\n windowsHide: true\n }).trim(); `}\n </FunctionDeclaration>\n <Spacing />\n\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;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;IAAC;IAAa;IAAG;KACpB,MAAM;KACN,MAAC;KACF;IAAA,EACF,CAAC;;EAEJ,IAAE,WAAA;AACA,UAAO;IAAC,gBAAkB,qBAAqB;KAC7C,MAAC;KACF,YAAA,CAAA;MACC,MAAM;MACN,MAAA;MACC,CAAC;KACF,YAAW;KACX,UAAU,IAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BnB,CAAM;IAAC,gBAAmB,SAAQ,EAAA,CAAA;IAAA,gBAAA,qBAAA;KAC5B,MAAC;KACT,YAAA,CAAA;MACO,MAAS;MACR,MAAA;MACD,CAAA;KACA,YAAA;KACC,UAAM,IAAA;;;;;;KAMR,CAAA;IAAI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AK;QACL,UAAY;QACZ,CAAA;OAAA,gBAAa,YAAA;QACZ,MAAO;QACV,UAAA;QACD,CAAA;OAAO,gBAAE,cAAA,sMAEL,CAAC;OAAA;;KAET,CAAA;IAAA,gBAAA,qBAAA;KACH,UAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_components_usage = require('./usage.cjs');
|
|
3
3
|
const require_components_docs = require('./docs.cjs');
|
|
4
|
-
const
|
|
4
|
+
const require_components_exec_builtin = require('./exec-builtin.cjs');
|
|
5
5
|
const require_components_helpers = require('./helpers.cjs');
|
|
6
6
|
const require_components_options_parser_logic = require('./options-parser-logic.cjs');
|
|
7
7
|
const require_components_state_builtin = require('./state-builtin.cjs');
|
|
@@ -22,6 +22,7 @@ exports.CommandValidationLogic = require_components_command_validation_logic.Com
|
|
|
22
22
|
exports.ContextUtilities = require_components_state_builtin.ContextUtilities;
|
|
23
23
|
exports.DynamicSegmentsParserLogic = require_components_options_parser_logic.DynamicSegmentsParserLogic;
|
|
24
24
|
exports.EnvSupportUtilities = require_components_utils_builtin.EnvSupportUtilities;
|
|
25
|
+
exports.ExecBuiltin = require_components_exec_builtin.ExecBuiltin;
|
|
25
26
|
exports.FindSuggestionsDeclaration = require_components_utils_builtin.FindSuggestionsDeclaration;
|
|
26
27
|
exports.GlobalTypeDefinitions = require_components_state_builtin.GlobalTypeDefinitions;
|
|
27
28
|
exports.HyperlinkSupportUtilities = require_components_utils_builtin.HyperlinkSupportUtilities;
|
|
@@ -35,7 +36,7 @@ exports.OptionsMemberParserCondition = require_components_options_parser_logic.O
|
|
|
35
36
|
exports.OptionsMemberParserLogic = require_components_options_parser_logic.OptionsMemberParserLogic;
|
|
36
37
|
exports.OptionsParserLogic = require_components_options_parser_logic.OptionsParserLogic;
|
|
37
38
|
exports.ResolveModuleFunctionDeclaration = require_components_utils_builtin.ResolveModuleFunctionDeclaration;
|
|
38
|
-
exports.SpawnBuiltin = require_components_spawn_builtin.SpawnBuiltin;
|
|
39
39
|
exports.StateBuiltin = require_components_state_builtin.StateBuiltin;
|
|
40
|
+
exports.TerminalSizeDeclaration = require_components_utils_builtin.TerminalSizeDeclaration;
|
|
40
41
|
exports.Usage = require_components_usage.Usage;
|
|
41
42
|
exports.UtilsBuiltin = require_components_utils_builtin.UtilsBuiltin;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CommandValidationLogic, CommandValidationLogicProps } from "./command-validation-logic.cjs";
|
|
2
2
|
import { CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps } from "./docs.cjs";
|
|
3
|
+
import { ExecBuiltin, ExecBuiltinProps } from "./exec-builtin.cjs";
|
|
3
4
|
import { BooleanInputParserLogic, BooleanInputParserLogicProps, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose } from "./helpers.cjs";
|
|
4
5
|
import { ArgumentsParserLogic, ArgumentsParserLogicProps, CommandParserLogic, CommandParserLogicProps, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps } from "./options-parser-logic.cjs";
|
|
5
|
-
import { SpawnBuiltin, SpawnBuiltinProps } from "./spawn-builtin.cjs";
|
|
6
6
|
import { ArgsUtilities, ContextUtilities, GlobalTypeDefinitions, StateBuiltin, StateBuiltinProps } from "./state-builtin.cjs";
|
|
7
7
|
import { Usage, UsageProps } from "./usage.cjs";
|
|
8
|
-
import { ColorSupportUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, ResolveModuleFunctionDeclaration, UtilsBuiltin, UtilsBuiltinProps } from "./utils-builtin.cjs";
|
|
9
|
-
export { ArgsUtilities, ArgumentsParserLogic, ArgumentsParserLogicProps, BooleanInputParserLogic, BooleanInputParserLogicProps, ColorSupportUtilities, CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps, CommandParameterType, CommandParserLogic, CommandParserLogicProps, CommandValidationLogic, CommandValidationLogicProps, ContextUtilities, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, EnvSupportUtilities, FindSuggestionsDeclaration, GlobalTypeDefinitions, HyperlinkSupportUtilities, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps, ResolveModuleFunctionDeclaration,
|
|
8
|
+
import { ColorSupportUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, ResolveModuleFunctionDeclaration, TerminalSizeDeclaration, UtilsBuiltin, UtilsBuiltinProps } from "./utils-builtin.cjs";
|
|
9
|
+
export { ArgsUtilities, ArgumentsParserLogic, ArgumentsParserLogicProps, BooleanInputParserLogic, BooleanInputParserLogicProps, ColorSupportUtilities, CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps, CommandParameterType, CommandParserLogic, CommandParserLogicProps, CommandValidationLogic, CommandValidationLogicProps, ContextUtilities, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, EnvSupportUtilities, ExecBuiltin, ExecBuiltinProps, FindSuggestionsDeclaration, GlobalTypeDefinitions, HyperlinkSupportUtilities, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps, ResolveModuleFunctionDeclaration, StateBuiltin, StateBuiltinProps, TerminalSizeDeclaration, Usage, UsageProps, UtilsBuiltin, UtilsBuiltinProps };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CommandValidationLogic, CommandValidationLogicProps } from "./command-validation-logic.mjs";
|
|
2
2
|
import { CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps } from "./docs.mjs";
|
|
3
|
+
import { ExecBuiltin, ExecBuiltinProps } from "./exec-builtin.mjs";
|
|
3
4
|
import { BooleanInputParserLogic, BooleanInputParserLogicProps, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose } from "./helpers.mjs";
|
|
4
5
|
import { ArgumentsParserLogic, ArgumentsParserLogicProps, CommandParserLogic, CommandParserLogicProps, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps } from "./options-parser-logic.mjs";
|
|
5
|
-
import { SpawnBuiltin, SpawnBuiltinProps } from "./spawn-builtin.mjs";
|
|
6
6
|
import { ArgsUtilities, ContextUtilities, GlobalTypeDefinitions, StateBuiltin, StateBuiltinProps } from "./state-builtin.mjs";
|
|
7
7
|
import { Usage, UsageProps } from "./usage.mjs";
|
|
8
|
-
import { ColorSupportUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, ResolveModuleFunctionDeclaration, UtilsBuiltin, UtilsBuiltinProps } from "./utils-builtin.mjs";
|
|
9
|
-
export { ArgsUtilities, ArgumentsParserLogic, ArgumentsParserLogicProps, BooleanInputParserLogic, BooleanInputParserLogicProps, ColorSupportUtilities, CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps, CommandParameterType, CommandParserLogic, CommandParserLogicProps, CommandValidationLogic, CommandValidationLogicProps, ContextUtilities, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, EnvSupportUtilities, FindSuggestionsDeclaration, GlobalTypeDefinitions, HyperlinkSupportUtilities, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps, ResolveModuleFunctionDeclaration,
|
|
8
|
+
import { ColorSupportUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, ResolveModuleFunctionDeclaration, TerminalSizeDeclaration, UtilsBuiltin, UtilsBuiltinProps } from "./utils-builtin.mjs";
|
|
9
|
+
export { ArgsUtilities, ArgumentsParserLogic, ArgumentsParserLogicProps, BooleanInputParserLogic, BooleanInputParserLogicProps, ColorSupportUtilities, CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps, CommandParameterType, CommandParserLogic, CommandParserLogicProps, CommandValidationLogic, CommandValidationLogicProps, ContextUtilities, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, EnvSupportUtilities, ExecBuiltin, ExecBuiltinProps, FindSuggestionsDeclaration, GlobalTypeDefinitions, HyperlinkSupportUtilities, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps, ResolveModuleFunctionDeclaration, StateBuiltin, StateBuiltinProps, TerminalSizeDeclaration, Usage, UsageProps, UtilsBuiltin, UtilsBuiltinProps };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Usage } from "./usage.mjs";
|
|
2
2
|
import { CommandDocs, CommandDocsFile, CommandDocsUsageExample, CommandOptionsDocs } from "./docs.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { ExecBuiltin } from "./exec-builtin.mjs";
|
|
4
4
|
import { BooleanInputParserLogic, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose } from "./helpers.mjs";
|
|
5
5
|
import { ArgumentsParserLogic, CommandParserLogic, DynamicSegmentsParserLogic, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserLogic, OptionsParserLogic } from "./options-parser-logic.mjs";
|
|
6
6
|
import { ArgsUtilities, ContextUtilities, GlobalTypeDefinitions, StateBuiltin } from "./state-builtin.mjs";
|
|
7
|
-
import { ColorSupportUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, ResolveModuleFunctionDeclaration, UtilsBuiltin } from "./utils-builtin.mjs";
|
|
7
|
+
import { ColorSupportUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, ResolveModuleFunctionDeclaration, TerminalSizeDeclaration, UtilsBuiltin } from "./utils-builtin.mjs";
|
|
8
8
|
import { CommandValidationLogic } from "./command-validation-logic.mjs";
|
|
9
9
|
|
|
10
|
-
export { ArgsUtilities, ArgumentsParserLogic, BooleanInputParserLogic, ColorSupportUtilities, CommandDocs, CommandDocsFile, CommandDocsUsageExample, CommandOptionsDocs, CommandParameterType, CommandParserLogic, CommandValidationLogic, ContextUtilities, DynamicSegmentsParserLogic, EnvSupportUtilities, FindSuggestionsDeclaration, GlobalTypeDefinitions, HyperlinkSupportUtilities, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserLogic, OptionsParserLogic, ResolveModuleFunctionDeclaration,
|
|
10
|
+
export { ArgsUtilities, ArgumentsParserLogic, BooleanInputParserLogic, ColorSupportUtilities, CommandDocs, CommandDocsFile, CommandDocsUsageExample, CommandOptionsDocs, CommandParameterType, CommandParserLogic, CommandValidationLogic, ContextUtilities, DynamicSegmentsParserLogic, EnvSupportUtilities, ExecBuiltin, FindSuggestionsDeclaration, GlobalTypeDefinitions, HyperlinkSupportUtilities, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserLogic, OptionsParserLogic, ResolveModuleFunctionDeclaration, StateBuiltin, TerminalSizeDeclaration, Usage, UtilsBuiltin };
|
|
@@ -592,8 +592,8 @@ function OptionsInterfaceDeclaration(props) {
|
|
|
592
592
|
* The command options parser logic.
|
|
593
593
|
*/
|
|
594
594
|
function OptionsParserLogic(props) {
|
|
595
|
-
const {
|
|
596
|
-
const options = (0, _alloy_js_core.computed)(() => require_contexts_options.computedOptions(Object.entries(
|
|
595
|
+
const { segments = [], options: _options, name: _name, appSpecificEnvPrefix, isCaseSensitive = false } = props;
|
|
596
|
+
const options = (0, _alloy_js_core.computed)(() => require_contexts_options.computedOptions(Object.entries(_options).map(([name, option]) => ({
|
|
597
597
|
...option,
|
|
598
598
|
name
|
|
599
599
|
}))));
|
|
@@ -603,17 +603,17 @@ function OptionsParserLogic(props) {
|
|
|
603
603
|
name: "options",
|
|
604
604
|
get initializer() {
|
|
605
605
|
return _alloy_js_core.code` {
|
|
606
|
-
${Object.entries(options.value).filter(([, option]) => option.env || option.default !== void 0 || (option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number) && option.variadic).map(([name, option]) => {
|
|
606
|
+
${segments.length > 0 ? "...useGlobalOptions(), " : ""}${Object.entries(options.value).filter(([, option]) => option.env || option.default !== void 0 || (option.kind === require_types_command.CommandParameterKinds.string || option.kind === require_types_command.CommandParameterKinds.number) && option.variadic).map(([name, option]) => {
|
|
607
607
|
if (option.kind === require_types_command.CommandParameterKinds.string) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${appSpecificEnvPrefix}_${option.env}` : ""}${option.variadic ? option.default !== void 0 ? `${option.env ? " ?? " : ""}${JSON.stringify(option.default)}` : option.env ? " ?? []" : "[]" : option.default !== void 0 ? `${option.env ? " ?? " : ""}"${option.default}"` : ""}, `;
|
|
608
608
|
else if (option.kind === require_types_command.CommandParameterKinds.number) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${appSpecificEnvPrefix}_${option.env}` : ""}${option.variadic ? option.default && Array.isArray(option.default) ? `${option.env ? " ?? " : ""}${JSON.stringify(option.default)}` : option.env ? " ?? []" : "[]" : option.default !== void 0 ? `${option.env ? " ?? " : ""}${option.default}` : ""}, `;
|
|
609
609
|
else if (option.kind === require_types_command.CommandParameterKinds.boolean) return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${appSpecificEnvPrefix}_${option.env} ?? ` : ""}${option.default ? "true" : "false"},`;
|
|
610
610
|
return "";
|
|
611
611
|
}).join("")}
|
|
612
|
-
} as unknown as ${(0, _stryke_string_format_pascal_case.pascalCase)(
|
|
612
|
+
} as unknown as ${segments.length > 0 ? (0, _stryke_string_format_pascal_case.pascalCase)(_name) : "Global"}Options;`;
|
|
613
613
|
}
|
|
614
614
|
}),
|
|
615
615
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
616
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`for (let i = 0; i < args.slice(${
|
|
616
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`for (let i = 0; i < args.slice(${segments.filter((segment) => require_context_helpers.isDynamicPathSegment(segment)).length}).length; i++) { `),
|
|
617
617
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
618
618
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
619
619
|
"const": true,
|
|
@@ -692,7 +692,15 @@ function CommandParserLogic(props) {
|
|
|
692
692
|
}),
|
|
693
693
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
694
694
|
(0, _alloy_js_core_jsx_runtime.createComponent)(OptionsParserLogic, {
|
|
695
|
-
|
|
695
|
+
get name() {
|
|
696
|
+
return command.name;
|
|
697
|
+
},
|
|
698
|
+
get options() {
|
|
699
|
+
return command.options;
|
|
700
|
+
},
|
|
701
|
+
get segments() {
|
|
702
|
+
return command.segments;
|
|
703
|
+
},
|
|
696
704
|
appSpecificEnvPrefix,
|
|
697
705
|
isCaseSensitive
|
|
698
706
|
}),
|