@shell-shock/core 0.17.5 → 0.17.7
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/README.md +1 -1
- package/dist/components/command-validation-logic.cjs +214 -152
- package/dist/components/command-validation-logic.mjs +213 -152
- package/dist/components/command-validation-logic.mjs.map +1 -1
- package/dist/components/docs.cjs +113 -9
- package/dist/components/docs.mjs +109 -9
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/exec-builtin.cjs +36 -1
- package/dist/components/exec-builtin.d.cts.map +1 -1
- package/dist/components/exec-builtin.d.mts.map +1 -1
- package/dist/components/exec-builtin.mjs +35 -1
- package/dist/components/exec-builtin.mjs.map +1 -1
- package/dist/components/helpers.cjs +51 -2
- package/dist/components/helpers.mjs +50 -2
- package/dist/components/helpers.mjs.map +1 -1
- package/dist/components/index.cjs +17 -1
- package/dist/components/index.mjs +9 -9
- package/dist/components/options-parser-logic.cjs +411 -174
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts.map +1 -1
- package/dist/components/options-parser-logic.mjs +405 -174
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/state-builtin.cjs +61 -5
- package/dist/components/state-builtin.mjs +60 -5
- package/dist/components/state-builtin.mjs.map +1 -1
- package/dist/components/usage.cjs +46 -3
- package/dist/components/usage.mjs +45 -3
- package/dist/components/usage.mjs.map +1 -1
- package/dist/components/utils-builtin.cjs +68 -3
- package/dist/components/utils-builtin.mjs +67 -3
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/helpers/automd.cjs +28 -13
- package/dist/helpers/automd.mjs +28 -13
- package/dist/helpers/automd.mjs.map +1 -1
- package/dist/index.cjs +11 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/plugin-utils/compute-bin.cjs +50 -0
- package/dist/plugin-utils/compute-bin.d.cts +13 -0
- package/dist/plugin-utils/compute-bin.d.cts.map +1 -0
- package/dist/plugin-utils/compute-bin.d.mts +13 -0
- package/dist/plugin-utils/compute-bin.d.mts.map +1 -0
- package/dist/plugin-utils/compute-bin.mjs +50 -0
- package/dist/plugin-utils/compute-bin.mjs.map +1 -0
- package/dist/plugin-utils/get-command-tree.cjs +50 -0
- package/dist/plugin-utils/get-command-tree.d.cts +15 -1
- package/dist/plugin-utils/get-command-tree.d.cts.map +1 -1
- package/dist/plugin-utils/get-command-tree.d.mts +15 -1
- package/dist/plugin-utils/get-command-tree.d.mts.map +1 -1
- package/dist/plugin-utils/get-command-tree.mjs +49 -1
- package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +4 -0
- package/dist/plugin-utils/index.d.cts +3 -2
- package/dist/plugin-utils/index.d.mts +3 -2
- package/dist/plugin-utils/index.mjs +3 -2
- package/dist/plugin.cjs +170 -52
- package/dist/plugin.mjs +170 -52
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/deepkit.cjs +1 -1
- package/dist/resolver/deepkit.mjs +1 -1
- package/dist/resolver/deepkit.mjs.map +1 -1
- package/dist/types/command.cjs +120 -10
- package/dist/types/command.d.cts +95 -8
- package/dist/types/command.d.cts.map +1 -1
- package/dist/types/command.d.mts +95 -8
- package/dist/types/command.d.mts.map +1 -1
- package/dist/types/command.mjs +109 -10
- package/dist/types/command.mjs.map +1 -1
- package/dist/types/index.cjs +12 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +2 -2
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec-builtin.mjs","names":[],"sources":["../../src/components/exec-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show, splitProps } from \"@alloy-js/core\";\nimport {\n FunctionDeclaration,\n InterfaceDeclaration,\n InterfaceMember,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\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\"]\n })}>\n <FunctionDeclaration\n name=\"resolveCommandEnv\"\n parameters={[\n {\n name: \"params\",\n type: \"{ argv: string[]; env?: NodeJS.ProcessEnv; }\"\n }\n ]}\n returnType=\"NodeJS.ProcessEnv\">\n {code`const argv = params.argv;\n const shouldSuppressNpmFund = (() => {\n const cmd = basename(argv[0] ?? \"\");\n if (cmd === \"npm\" || cmd === \"npm.cmd\" || cmd === \"npm.exe\") {\n return true;\n }\n if (cmd === \"node\" || cmd === \"node.exe\") {\n const script = argv[1] ?? \"\";\n\n return script.includes(\"npm-cli.js\");\n }\n return false;\n })();\n\n const result = Object.fromEntries(\n Object.entries({\n ...env,\n ...(params.env ?? {})\n })\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, String(value)])\n );\n if (shouldSuppressNpmFund) {\n result.NPM_CONFIG_FUND ??= \"false\";\n result.npm_config_fund ??= \"false\";\n }\n return result; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"isWindowsBatchCommand\"\n parameters={[{ name: \"resolvedCommand\", type: \"string\" }]}\n returnType=\"boolean\">\n {code`if (!isWindows) {\n return false;\n }\n const ext = extname(resolvedCommand).toLowerCase();\n\n return ext === \".cmd\" || ext === \".bat\"; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"escapeForCmdExe\"\n parameters={[{ name: \"arg\", type: \"string\" }]}\n returnType=\"string\">\n {code`if (/[&|<>^%\\\\\\\\r\\\\\\\\n]/.test(arg)) {\n throw new Error(\n \\`Unsafe Windows cmd.exe argument detected: \\${JSON.stringify(arg)}. \\` +\n \"Pass an explicit shell-wrapper argv at the call site instead.\"\n );\n }\n if (!arg.includes(\" \") && !arg.includes('\"')) {\n return arg;\n }\n return \\`\"\\${arg.replace(/\"/g, '\"\"')}\"\\`; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"buildCmdExeCommandLine\"\n parameters={[\n { name: \"resolvedCommand\", type: \"string\" },\n { name: \"args\", type: \"string[]\" }\n ]}\n returnType=\"string\">\n {code`return [escapeForCmdExe(resolvedCommand), ...args.map(escapeForCmdExe)].join(\n \" \"\n ); `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveNpmArgvForWindows\"\n doc=\"On Windows, Node 18.20.2+ (CVE-2024-27980) rejects spawning .cmd/.bat directly without shell, causing EINVAL. Resolve npm/npx to node + cli script so we spawn node.exe instead of npm.cmd.\"\n parameters={[{ name: \"argv\", type: \"string[]\" }]}\n returnType=\"string[] | null\">\n {code`if (!isWindows || argv.length === 0) {\n return null;\n }\n const base = basename(argv[0] ?? \"\")\n .toLowerCase()\n .replace(/\\.(?:cmd|exe|bat)$/, \"\");\n const cliName =\n base === \"npx\" ? \"npx-cli.js\" : base === \"npm\" ? \"npm-cli.js\" : null;\n if (!cliName) {\n return null;\n }\n const nodeDir = dirname(process.execPath);\n const cliPath = join(nodeDir, \"node_modules\", \"npm\", \"bin\", cliName);\n if (!existsSync(cliPath)) {\n const command = argv[0] ?? \"\";\n const ext = extname(command).toLowerCase();\n const shimmedCommand = ext ? command : \\`\\${command}.cmd\\`;\n\n return [shimmedCommand, ...argv.slice(1)];\n }\n return [process.execPath, cliPath, ...argv.slice(1)]; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveCommand\"\n doc=\"Resolves a command for Windows compatibility. On Windows, non-.exe commands (like pnpm, yarn) are resolved to .cmd; npm/npx are handled by resolveNpmArgvForWindows to avoid spawn EINVAL (no direct .cmd).\"\n parameters={[{ name: \"command\", type: \"string\" }]}\n returnType=\"string\">\n {code`if (!isWindows) {\n return command;\n }\n const base = basename(command).toLowerCase();\n if (extname(base)) {\n return command;\n }\n if ([\"pnpm\", \"yarn\"].includes(base)) {\n return \\`\\${command}.cmd\\`;\n }\n return command; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveCommandStdio\"\n parameters={[\n {\n name: \"params\",\n type: \"{ hasInput: boolean; preferInherit: boolean; }\"\n }\n ]}\n returnType='[\"pipe\" | \"inherit\" | \"ignore\", \"pipe\", \"pipe\"]'>\n {code`const stdin = params.hasInput\n ? \"pipe\"\n : params.preferInherit\n ? \"inherit\"\n : \"pipe\";\n\n return [stdin, \"pipe\", \"pipe\"]; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveProcessExitCode\"\n parameters={[\n {\n name: \"params\",\n type: \"{ explicitCode: number | null | undefined; childExitCode: number | null | undefined; resolvedSignal: NodeJS.Signals | null; usesWindowsExitCodeShim: boolean; timedOut: boolean; noOutputTimedOut: boolean; killIssuedByTimeout: boolean; }\"\n }\n ]}\n returnType=\"number | null\">\n {code`return (\n params.explicitCode ??\n params.childExitCode ??\n (params.usesWindowsExitCodeShim &&\n params.resolvedSignal == null &&\n !params.timedOut &&\n !params.noOutputTimedOut &&\n !params.killIssuedByTimeout\n ? 0\n : null)\n ); `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"shouldSpawnWithShell\"\n parameters={[\n {\n name: \"params\",\n type: \"{ resolvedCommand: string; platform: NodeJS.Platform; }\"\n }\n ]}\n returnType=\"boolean\">\n {code`// SECURITY: never enable \\`shell\\` for argv-based execution.\n // \\`shell\\` routes through cmd.exe on Windows, which turns untrusted argv values\n // (like chat prompts passed as CLI args) into command-injection primitives.\n // If you need a shell, use an explicit shell-wrapper argv (e.g. \\`cmd.exe /c ...\\`)\n // and validate/escape at the call site.\n void params;\n return false; `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"The result of a spawn operation.\" />\n <InterfaceDeclaration export name=\"SpawnResult\">\n <TSDoc heading=\"The PID of the spawned child process, if available.\" />\n <InterfaceMember name=\"pid\" optional type=\"number\" />\n <Spacing />\n <TSDoc heading=\"The standard output produced by the child process.\" />\n <InterfaceMember name=\"stdout\" type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The standard error produced by the child process.\" />\n <InterfaceMember name=\"stderr\" type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The exit code of the child process, if available.\" />\n <InterfaceMember name=\"code\" type=\"number | null\" />\n <Spacing />\n <TSDoc heading=\"The signal that caused the child process to terminate, if it was killed by a signal.\" />\n <InterfaceMember name=\"signal\" type=\"NodeJS.Signals | null\" />\n <Spacing />\n <TSDoc heading=\"Whether the child process was killed.\" />\n <InterfaceMember name=\"killed\" type=\"boolean\" />\n <Spacing />\n <TSDoc heading=\"The reason for the child process termination.\" />\n <InterfaceMember\n name=\"termination\"\n type={code`\"exit\" | \"timeout\" | \"no-output-timeout\" | \"signal\"`}\n />\n <Spacing />\n <TSDoc heading=\"Whether the child process timed out due to no output.\" />\n <InterfaceMember name=\"noOutputTimedOut\" optional type=\"boolean\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Options for spawning a child process.\" />\n <InterfaceDeclaration export name=\"SpawnOptions\">\n <TSDoc heading=\"The timeout in milliseconds for the spawn operation. If the process runs longer than this, it will be killed and the spawn promise will reject. This can also be provided as a number directly to the spawn function for convenience. Providing \\`-1\\` will disable the timeout.\">\n <TSDocDefaultValue\n type={ReflectionKind.number}\n defaultValue=\"300000\"\n />\n </TSDoc>\n <InterfaceMember name=\"timeoutMs\" optional type=\"number\" />\n <Spacing />\n <TSDoc heading=\"The current working directory of the child process.\" />\n <InterfaceMember name=\"cwd\" optional type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The input to be passed to the child process.\" />\n <InterfaceMember name=\"input\" optional type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The environment variables for the child process.\" />\n <InterfaceMember name=\"env\" optional type=\"NodeJS.ProcessEnv\" />\n <Spacing />\n <TSDoc heading=\"Whether to pass arguments to the child process verbatim on Windows.\" />\n <InterfaceMember\n name=\"windowsVerbatimArguments\"\n optional\n type=\"boolean\"\n />\n <Spacing />\n <TSDoc heading=\"The timeout in milliseconds for the child process to produce output on stdout or stderr. If the process produces no output for this duration, it will be killed and the spawn promise will reject with a no-output-timeout termination reason.\" />\n <InterfaceMember name=\"noOutputTimeoutMs\" optional type=\"number\" />\n </InterfaceDeclaration>\n <Spacing />\n <VarDeclaration\n const\n name=\"WINDOWS_CLOSE_STATE_SETTLE_TIMEOUT_MS\"\n initializer={code`250`}\n />\n <Spacing />\n <VarDeclaration\n const\n name=\"WINDOWS_CLOSE_STATE_POLL_MS\"\n initializer={code`10`}\n />\n <Spacing />\n <TSDoc heading=\"Spawns a child process with the given arguments and options, returning a promise that resolves with the result of the spawn operation.\">\n <TSDocParam name=\"argv\">\n {\"The command and its arguments to spawn.\"}\n </TSDocParam>\n <TSDocParam name=\"optionsOrTimeoutMs\">\n {`The options for spawning the command, or a number representing the timeout in milliseconds. This allows for a convenient shorthand when only a timeout is needed. Providing \\`-1\\` will disable the timeout. If no options or timeout are provided, a default timeout of 5 minutes will be used.`}\n </TSDocParam>\n <TSDocReturns>\n {\n \"A promise that resolves with the result of the spawn operation, including stdout, stderr, exit code, signal, and termination reason.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"spawn\"\n parameters={[\n { name: \"argv\", type: \"string[]\" },\n {\n name: \"optionsOrTimeoutMs\",\n type: \"number | SpawnOptions\",\n default: \"300000\"\n }\n ]}\n returnType=\"Promise<SpawnResult>\">\n {code`const options: SpawnOptions =\n typeof optionsOrTimeoutMs === \"number\"\n ? { timeoutMs: optionsOrTimeoutMs }\n : optionsOrTimeoutMs;\nconst { timeoutMs = 300000, cwd, input, noOutputTimeoutMs } = options;\n\nconst resolvedArgv =\n isWindows\n ? (resolveNpmArgvForWindows(argv) ?? argv)\n : argv;\nconst resolvedCommand =\n resolvedArgv !== argv\n ? (resolvedArgv[0] ?? \"\")\n : resolveCommand(argv[0] ?? \"\");\nconst useCmdWrapper = isWindowsBatchCommand(resolvedCommand);\n\nconst child = _spawn(\n useCmdWrapper\n ? (env.COMSPEC ?? \"cmd.exe\")\n : resolvedCommand,\n useCmdWrapper\n ? [\n \"/d\",\n \"/s\",\n \"/c\",\n buildCmdExeCommandLine(resolvedCommand, resolvedArgv.slice(1))\n ]\n : resolvedArgv.slice(1), {\n stdio: resolveCommandStdio({ hasInput: input !== undefined, preferInherit: true }),\n cwd,\n env: resolveCommandEnv({ argv, env: options.env }),\n windowsHide: true,\n windowsVerbatimArguments: useCmdWrapper\n ? true\n : options.windowsVerbatimArguments,\n ...(shouldSpawnWithShell({\n resolvedCommand: useCmdWrapper\n ? (env.COMSPEC ?? \"cmd.exe\")\n : resolvedCommand,\n platform: process.platform\n })\n ? { shell: true }\n : {})\n});\n\nreturn new Promise((resolve, reject) => {\n let stdout = \"\";\n let stderr = \"\";\n let settled = false;\n let timedOut = false;\n let noOutputTimedOut = false;\n let killIssuedByTimeout = false;\n let childExitState: {\n code: number | null;\n signal: NodeJS.Signals | null;\n } | null = null;\n let closeFallbackTimer: NodeJS.Timeout | null = null;\n let noOutputTimer: NodeJS.Timeout | null = null;\n const shouldTrackOutputTimeout =\n typeof noOutputTimeoutMs === \"number\" &&\n Number.isFinite(noOutputTimeoutMs) &&\n noOutputTimeoutMs > 0;\n\n const clearNoOutputTimer = () => {\n if (!noOutputTimer) {\n return;\n }\n clearTimeout(noOutputTimer);\n noOutputTimer = null;\n };\n\n const clearCloseFallbackTimer = () => {\n if (!closeFallbackTimer) {\n return;\n }\n clearTimeout(closeFallbackTimer);\n closeFallbackTimer = null;\n };\n\n const killChild = () => {\n if (settled || typeof child?.kill !== \"function\") {\n return;\n }\n killIssuedByTimeout = true;\n child.kill(\"SIGKILL\");\n };\n\n const armNoOutputTimer = () => {\n if (!shouldTrackOutputTimeout || settled) {\n return;\n }\n clearNoOutputTimer();\n noOutputTimer = setTimeout(() => {\n if (settled) {\n return;\n }\n noOutputTimedOut = true;\n killChild();\n }, Math.floor(noOutputTimeoutMs));\n };\n\n const timer = setTimeout(() => {\n timedOut = true;\n killChild();\n }, timeoutMs >= 0 ? timeoutMs : Number.POSITIVE_INFINITY);\n armNoOutputTimer();\n\n if (input !== undefined && child.stdin) {\n child.stdin.write(input ?? \"\");\n child.stdin.end();\n }\n\n child.stdout?.on(\"data\", (d: Stream) => {\n stdout += d.toString();\n armNoOutputTimer();\n });\n child.stderr?.on(\"data\", (d: Stream) => {\n stderr += d.toString();\n armNoOutputTimer();\n });\n child.on(\"error\", err => {\n if (settled) {\n return;\n }\n settled = true;\n clearTimeout(timer);\n clearNoOutputTimer();\n clearCloseFallbackTimer();\n reject(err);\n });\n child.on(\"exit\", (code, signal) => {\n childExitState = { code, signal };\n if (settled || closeFallbackTimer) {\n return;\n }\n closeFallbackTimer = setTimeout(() => {\n if (settled) {\n return;\n }\n child.stdout?.destroy();\n child.stderr?.destroy();\n }, 250);\n });\n const resolveFromClose = (\n code: number | null,\n signal: NodeJS.Signals | null\n ) => {\n if (settled) {\n return;\n }\n settled = true;\n clearTimeout(timer);\n clearNoOutputTimer();\n clearCloseFallbackTimer();\n const resolvedSignal =\n childExitState?.signal ?? signal ?? child.signalCode ?? null;\n const resolvedCode = resolveProcessExitCode({\n explicitCode: childExitState?.code ?? code,\n childExitCode: child.exitCode,\n resolvedSignal,\n usesWindowsExitCodeShim: isWindows && (useCmdWrapper || resolvedArgv !== argv),\n timedOut,\n noOutputTimedOut,\n killIssuedByTimeout\n });\n const termination = noOutputTimedOut\n ? \"no-output-timeout\"\n : timedOut\n ? \"timeout\"\n : resolvedSignal != null\n ? \"signal\"\n : \"exit\";\n const normalizedCode =\n termination === \"timeout\" || termination === \"no-output-timeout\"\n ? resolvedCode === 0\n ? 124\n : resolvedCode\n : resolvedCode;\n resolve({\n pid: child.pid ?? undefined,\n stdout,\n stderr,\n code: normalizedCode,\n signal: resolvedSignal,\n killed: child.killed,\n termination,\n noOutputTimedOut\n });\n };\n child.on(\"close\", (code, signal) => {\n if (\n !isWindows ||\n childExitState != null ||\n code != null ||\n signal != null ||\n child.exitCode != null ||\n child.signalCode != null\n ) {\n resolveFromClose(code, signal);\n return;\n }\n\n const startedAt = Date.now();\n const waitForExitState = () => {\n if (settled) {\n return;\n }\n if (\n childExitState != null ||\n child.exitCode != null ||\n child.signalCode != null\n ) {\n resolveFromClose(code, signal);\n return;\n }\n if (Date.now() - startedAt >= WINDOWS_CLOSE_STATE_SETTLE_TIMEOUT_MS) {\n resolveFromClose(code, signal);\n return;\n }\n setTimeout(waitForExitState, WINDOWS_CLOSE_STATE_POLL_MS);\n };\n waitForExitState();\n });\n});`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A helper function that executes a command and returns its stdout.\">\n <TSDocParam name=\"argv\">\n {`The command and its arguments to spawn. This is passed directly to the spawn function. Remember that on Windows, commands like \\`npm\\` or \\`pnpm\\` will be resolved to their .cmd shims, so you can just pass \\`npm\\` without worrying about the extension.`}\n </TSDocParam>\n <TSDocParam name=\"optionsOrTimeoutMs\">\n {`The options for spawning the command, or a number representing the timeout in milliseconds. This is passed directly to the spawn function. Providing \\`-1\\` will disable the timeout. If no options or timeout are provided, a default timeout of 5 minutes will be used.`}\n </TSDocParam>\n <TSDocReturns>\n {\n \"A promise that resolves with the result of the spawn operation if the command exits with code 0, or rejects with an error if the command exits with a non-zero code or if there is a problem spawning the process.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"exec\"\n parameters={[\n { name: \"argv\", type: \"string[]\" },\n {\n name: \"optionsOrTimeoutMs\",\n type: \"number | SpawnOptions\",\n default: \"300000\"\n }\n ]}\n returnType=\"Promise<string>\">\n {code`const spawnResult = await spawn(argv, optionsOrTimeoutMs);\n if (spawnResult.code !== 0) {\n throw Object.assign(new Error(\n \\`Command \"\\${argv.join(\" \")}\" exited with code \\${spawnResult.code} and signal \\${spawnResult.signal}\\`\n ), spawnResult);\n }\n\n return spawnResult.stdout.trim(); `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A helper function that executes a command synchronously and returns its stdout. This is a thin wrapper around \\`child_process.execFileSync\\` with some added Windows compatibility handling.\">\n <TSDocParam name=\"argv\">\n {`The command and its arguments to spawn. This is passed directly to \\`execFileSync\\` after Windows-specific resolution. Remember that on Windows, commands like \\`npm\\` or \\`pnpm\\` will be resolved to their .cmd shims, so you can just pass \\`npm\\` without worrying about the extension.`}\n </TSDocParam>\n <TSDocParam name=\"options\">\n {`The options for spawning the command. This is passed directly to \\`execFileSync\\` after some processing. The timeout option is supported, but note that it will throw an error if the process runs longer than the specified timeout. If no options are provided, a default timeout of 5 minutes will be used.`}\n </TSDocParam>\n <TSDocReturns>\n {\n \"The standard output produced by the command if it exits with code 0. If the command exits with a non-zero code or if there is a problem spawning the process, an error will be thrown.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"execSync\"\n parameters={[\n { name: \"argv\", type: \"string[]\" },\n { name: \"options\", type: \"SpawnOptions\", default: \"{}\" }\n ]}\n returnType=\"string\">\n {code`return execFileSync(argv.length > 0 ? argv[0] : \"\", argv.slice(1), {\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n timeout: options.timeoutMs ?? 300000,\n env: resolveCommandEnv({ argv, env: options.env }),\n cwd: options.cwd || process.cwd(),\n windowsHide: true\n }).trim(); `}\n </FunctionDeclaration>\n <Spacing />\n\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAgCA,SAAE,YAAiB,OAAA;CACjB,MAAA,CAAA,EACA,YACA,QAAO,WAAW,OAAO,CAAK,WAAW,CAAC;AAC5C,QAAO,gBAAgB,aAAA,WAAA;;EAEvB,aAAiB;EACf,EAAA,MAAA;EACC,IAAK,UAAE;AACP,UAAA,OAAA,KAAA,WAAA,EAAA,EAAA;;;;;;;IAED,WAAA,CAAA,aAAA;IACG,sBAAoB,CAAA;KACvB,MAAA;KACK,OAAS;KACP,EAAE,eAAY;;KAEd,MAAA;KACJ,SAAA;KACK,MAAI;KACR,CAAA;IACC,CAAC;;EAEJ,IAAI,iBAAe;AACjB,UAAO,OAAK,KAAG,kBAAY,EAAA,EAAA,EACzB,KAAK,CAAC,aAAa,MAAG,EACvB,CAAC;;EAEJ,IAAI,WAAC;AACH,UAAO;IAAC,gBAAkB,qBAAmB;KAC3C,MAAA;KACF,YAAc,CAAC;MACb,MAAO;MACN,MA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,UAAA;KACD,OAAQ;KACR,MAAM;KACL,YAAY,CAAA;MACV,MAAM;MACN,MAAA;MACD,EAAA;MACC,MAAM;MACN,MAAA;MACD,SAAA;MACA,CAAC;KACF,YAAS;KACT,UAAE,IAAA;;;;;;;;KAQH,CAAC;IAAE,gBAAkB,SAAQ,EAAA,CAAA;IAAA,gBAAwB,OAAK;KACzD,SAAC;KACD,IAAA,WAAY;AACX,aAAK;OAAA,gBAAoB,YAAc;QACtC,MAAQ;QACR,UAAS;QACT,CAAA;OAAA,gBAAiB,YAAa;QAC9B,MAAK;QACL,UAAY;QACZ,CAAA;OAAA,gBAAa,cAAA,EACZ,UAAS,0LACZ,CAAA;OAAA;;;;KAGD,UAAW;KACZ,MAAA;KACH,YAAA,CAAA;MACH,MAAA"}
|
|
1
|
+
{"version":3,"file":"exec-builtin.mjs","names":[],"sources":["../../src/components/exec-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show, splitProps } from \"@alloy-js/core\";\nimport {\n FunctionDeclaration,\n InterfaceDeclaration,\n InterfaceMember,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport type { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport { BuiltinFile } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport {\n TSDoc,\n TSDocDefaultValue,\n TSDocParam,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport defu from \"defu\";\n\nexport interface ExecBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {}\n\n/**\n * A built-in module for handling command execution in Shell Shock.\n */\nexport function ExecBuiltin(props: ExecBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <BuiltinFile\n id=\"exec\"\n description=\"A module to handle command execution in a Shell Shock application.\"\n {...rest}\n imports={defu(rest.imports ?? {}, {\n \"node:path\": [\"basename\", \"extname\", \"dirname\", \"join\"],\n \"node:fs\": [\"existsSync\"],\n \"node:child_process\": [\n { name: \"spawn\", alias: \"_spawn\" },\n \"execFileSync\"\n ],\n \"node:stream\": [{ name: \"Stream\", default: true, type: true }]\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n env: [\"isWindows\", \"env\"]\n })}>\n <FunctionDeclaration\n name=\"resolveCommandEnv\"\n parameters={[\n {\n name: \"params\",\n type: \"{ argv: string[]; env?: NodeJS.ProcessEnv; }\"\n }\n ]}\n returnType=\"NodeJS.ProcessEnv\">\n {code`const argv = params.argv;\n const shouldSuppressNpmFund = (() => {\n const cmd = basename(argv[0] ?? \"\");\n if (cmd === \"npm\" || cmd === \"npm.cmd\" || cmd === \"npm.exe\") {\n return true;\n }\n if (cmd === \"node\" || cmd === \"node.exe\") {\n const script = argv[1] ?? \"\";\n\n return script.includes(\"npm-cli.js\");\n }\n return false;\n })();\n\n const result = Object.fromEntries(\n Object.entries({\n ...env,\n ...(params.env ?? {})\n })\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, String(value)])\n );\n if (shouldSuppressNpmFund) {\n result.NPM_CONFIG_FUND ??= \"false\";\n result.npm_config_fund ??= \"false\";\n }\n return result; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"isWindowsBatchCommand\"\n parameters={[{ name: \"resolvedCommand\", type: \"string\" }]}\n returnType=\"boolean\">\n {code`if (!isWindows) {\n return false;\n }\n const ext = extname(resolvedCommand).toLowerCase();\n\n return ext === \".cmd\" || ext === \".bat\"; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"escapeForCmdExe\"\n parameters={[{ name: \"arg\", type: \"string\" }]}\n returnType=\"string\">\n {code`if (/[&|<>^%\\\\\\\\r\\\\\\\\n]/.test(arg)) {\n throw new Error(\n \\`Unsafe Windows cmd.exe argument detected: \\${JSON.stringify(arg)}. \\` +\n \"Pass an explicit shell-wrapper argv at the call site instead.\"\n );\n }\n if (!arg.includes(\" \") && !arg.includes('\"')) {\n return arg;\n }\n return \\`\"\\${arg.replace(/\"/g, '\"\"')}\"\\`; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"buildCmdExeCommandLine\"\n parameters={[\n { name: \"resolvedCommand\", type: \"string\" },\n { name: \"args\", type: \"string[]\" }\n ]}\n returnType=\"string\">\n {code`return [escapeForCmdExe(resolvedCommand), ...args.map(escapeForCmdExe)].join(\n \" \"\n ); `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveNpmArgvForWindows\"\n doc=\"On Windows, Node 18.20.2+ (CVE-2024-27980) rejects spawning .cmd/.bat directly without shell, causing EINVAL. Resolve npm/npx to node + cli script so we spawn node.exe instead of npm.cmd.\"\n parameters={[{ name: \"argv\", type: \"string[]\" }]}\n returnType=\"string[] | null\">\n {code`if (!isWindows || argv.length === 0) {\n return null;\n }\n const base = basename(argv[0] ?? \"\")\n .toLowerCase()\n .replace(/\\.(?:cmd|exe|bat)$/, \"\");\n const cliName =\n base === \"npx\" ? \"npx-cli.js\" : base === \"npm\" ? \"npm-cli.js\" : null;\n if (!cliName) {\n return null;\n }\n const nodeDir = dirname(process.execPath);\n const cliPath = join(nodeDir, \"node_modules\", \"npm\", \"bin\", cliName);\n if (!existsSync(cliPath)) {\n const command = argv[0] ?? \"\";\n const ext = extname(command).toLowerCase();\n const shimmedCommand = ext ? command : \\`\\${command}.cmd\\`;\n\n return [shimmedCommand, ...argv.slice(1)];\n }\n return [process.execPath, cliPath, ...argv.slice(1)]; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveCommand\"\n doc=\"Resolves a command for Windows compatibility. On Windows, non-.exe commands (like pnpm, yarn) are resolved to .cmd; npm/npx are handled by resolveNpmArgvForWindows to avoid spawn EINVAL (no direct .cmd).\"\n parameters={[{ name: \"command\", type: \"string\" }]}\n returnType=\"string\">\n {code`if (!isWindows) {\n return command;\n }\n const base = basename(command).toLowerCase();\n if (extname(base)) {\n return command;\n }\n if ([\"pnpm\", \"yarn\"].includes(base)) {\n return \\`\\${command}.cmd\\`;\n }\n return command; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveCommandStdio\"\n parameters={[\n {\n name: \"params\",\n type: \"{ hasInput: boolean; preferInherit: boolean; }\"\n }\n ]}\n returnType='[\"pipe\" | \"inherit\" | \"ignore\", \"pipe\", \"pipe\"]'>\n {code`const stdin = params.hasInput\n ? \"pipe\"\n : params.preferInherit\n ? \"inherit\"\n : \"pipe\";\n\n return [stdin, \"pipe\", \"pipe\"]; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveProcessExitCode\"\n parameters={[\n {\n name: \"params\",\n type: \"{ explicitCode: number | null | undefined; childExitCode: number | null | undefined; resolvedSignal: NodeJS.Signals | null; usesWindowsExitCodeShim: boolean; timedOut: boolean; noOutputTimedOut: boolean; killIssuedByTimeout: boolean; }\"\n }\n ]}\n returnType=\"number | null\">\n {code`return (\n params.explicitCode ??\n params.childExitCode ??\n (params.usesWindowsExitCodeShim &&\n params.resolvedSignal == null &&\n !params.timedOut &&\n !params.noOutputTimedOut &&\n !params.killIssuedByTimeout\n ? 0\n : null)\n ); `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"shouldSpawnWithShell\"\n parameters={[\n {\n name: \"params\",\n type: \"{ resolvedCommand: string; platform: NodeJS.Platform; }\"\n }\n ]}\n returnType=\"boolean\">\n {code`// SECURITY: never enable \\`shell\\` for argv-based execution.\n // \\`shell\\` routes through cmd.exe on Windows, which turns untrusted argv values\n // (like chat prompts passed as CLI args) into command-injection primitives.\n // If you need a shell, use an explicit shell-wrapper argv (e.g. \\`cmd.exe /c ...\\`)\n // and validate/escape at the call site.\n void params;\n return false; `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"The result of a spawn operation.\" />\n <InterfaceDeclaration export name=\"SpawnResult\">\n <TSDoc heading=\"The PID of the spawned child process, if available.\" />\n <InterfaceMember name=\"pid\" optional type=\"number\" />\n <Spacing />\n <TSDoc heading=\"The standard output produced by the child process.\" />\n <InterfaceMember name=\"stdout\" type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The standard error produced by the child process.\" />\n <InterfaceMember name=\"stderr\" type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The exit code of the child process, if available.\" />\n <InterfaceMember name=\"code\" type=\"number | null\" />\n <Spacing />\n <TSDoc heading=\"The signal that caused the child process to terminate, if it was killed by a signal.\" />\n <InterfaceMember name=\"signal\" type=\"NodeJS.Signals | null\" />\n <Spacing />\n <TSDoc heading=\"Whether the child process was killed.\" />\n <InterfaceMember name=\"killed\" type=\"boolean\" />\n <Spacing />\n <TSDoc heading=\"The reason for the child process termination.\" />\n <InterfaceMember\n name=\"termination\"\n type={code`\"exit\" | \"timeout\" | \"no-output-timeout\" | \"signal\"`}\n />\n <Spacing />\n <TSDoc heading=\"Whether the child process timed out due to no output.\" />\n <InterfaceMember name=\"noOutputTimedOut\" optional type=\"boolean\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Options for spawning a child process.\" />\n <InterfaceDeclaration export name=\"SpawnOptions\">\n <TSDoc heading=\"The timeout in milliseconds for the spawn operation. If the process runs longer than this, it will be killed and the spawn promise will reject. This can also be provided as a number directly to the spawn function for convenience. Providing \\`-1\\` will disable the timeout.\">\n <TSDocDefaultValue\n type={ReflectionKind.number}\n defaultValue=\"300000\"\n />\n </TSDoc>\n <InterfaceMember name=\"timeoutMs\" optional type=\"number\" />\n <Spacing />\n <TSDoc heading=\"The current working directory of the child process.\" />\n <InterfaceMember name=\"cwd\" optional type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The input to be passed to the child process.\" />\n <InterfaceMember name=\"input\" optional type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The environment variables for the child process.\" />\n <InterfaceMember name=\"env\" optional type=\"NodeJS.ProcessEnv\" />\n <Spacing />\n <TSDoc heading=\"Whether to pass arguments to the child process verbatim on Windows.\" />\n <InterfaceMember\n name=\"windowsVerbatimArguments\"\n optional\n type=\"boolean\"\n />\n <Spacing />\n <TSDoc heading=\"The timeout in milliseconds for the child process to produce output on stdout or stderr. If the process produces no output for this duration, it will be killed and the spawn promise will reject with a no-output-timeout termination reason.\" />\n <InterfaceMember name=\"noOutputTimeoutMs\" optional type=\"number\" />\n </InterfaceDeclaration>\n <Spacing />\n <VarDeclaration\n const\n name=\"WINDOWS_CLOSE_STATE_SETTLE_TIMEOUT_MS\"\n initializer={code`250`}\n />\n <Spacing />\n <VarDeclaration\n const\n name=\"WINDOWS_CLOSE_STATE_POLL_MS\"\n initializer={code`10`}\n />\n <Spacing />\n <TSDoc heading=\"Spawns a child process with the given arguments and options, returning a promise that resolves with the result of the spawn operation.\">\n <TSDocParam name=\"argv\">\n {\"The command and its arguments to spawn.\"}\n </TSDocParam>\n <TSDocParam name=\"optionsOrTimeoutMs\">\n {`The options for spawning the command, or a number representing the timeout in milliseconds. This allows for a convenient shorthand when only a timeout is needed. Providing \\`-1\\` will disable the timeout. If no options or timeout are provided, a default timeout of 5 minutes will be used.`}\n </TSDocParam>\n <TSDocReturns>\n {\n \"A promise that resolves with the result of the spawn operation, including stdout, stderr, exit code, signal, and termination reason.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"spawn\"\n parameters={[\n { name: \"argv\", type: \"string[]\" },\n {\n name: \"optionsOrTimeoutMs\",\n type: \"number | SpawnOptions\",\n default: \"300000\"\n }\n ]}\n returnType=\"Promise<SpawnResult>\">\n {code`const options: SpawnOptions =\n typeof optionsOrTimeoutMs === \"number\"\n ? { timeoutMs: optionsOrTimeoutMs }\n : optionsOrTimeoutMs;\nconst { timeoutMs = 300000, cwd, input, noOutputTimeoutMs } = options;\n\nconst resolvedArgv =\n isWindows\n ? (resolveNpmArgvForWindows(argv) ?? argv)\n : argv;\nconst resolvedCommand =\n resolvedArgv !== argv\n ? (resolvedArgv[0] ?? \"\")\n : resolveCommand(argv[0] ?? \"\");\nconst useCmdWrapper = isWindowsBatchCommand(resolvedCommand);\n\nconst child = _spawn(\n useCmdWrapper\n ? (env.COMSPEC ?? \"cmd.exe\")\n : resolvedCommand,\n useCmdWrapper\n ? [\n \"/d\",\n \"/s\",\n \"/c\",\n buildCmdExeCommandLine(resolvedCommand, resolvedArgv.slice(1))\n ]\n : resolvedArgv.slice(1), {\n stdio: resolveCommandStdio({ hasInput: input !== undefined, preferInherit: true }),\n cwd,\n env: resolveCommandEnv({ argv, env: options.env }),\n windowsHide: true,\n windowsVerbatimArguments: useCmdWrapper\n ? true\n : options.windowsVerbatimArguments,\n ...(shouldSpawnWithShell({\n resolvedCommand: useCmdWrapper\n ? (env.COMSPEC ?? \"cmd.exe\")\n : resolvedCommand,\n platform: process.platform\n })\n ? { shell: true }\n : {})\n});\n\nreturn new Promise((resolve, reject) => {\n let stdout = \"\";\n let stderr = \"\";\n let settled = false;\n let timedOut = false;\n let noOutputTimedOut = false;\n let killIssuedByTimeout = false;\n let childExitState: {\n code: number | null;\n signal: NodeJS.Signals | null;\n } | null = null;\n let closeFallbackTimer: NodeJS.Timeout | null = null;\n let noOutputTimer: NodeJS.Timeout | null = null;\n const shouldTrackOutputTimeout =\n typeof noOutputTimeoutMs === \"number\" &&\n Number.isFinite(noOutputTimeoutMs) &&\n noOutputTimeoutMs > 0;\n\n const clearNoOutputTimer = () => {\n if (!noOutputTimer) {\n return;\n }\n clearTimeout(noOutputTimer);\n noOutputTimer = null;\n };\n\n const clearCloseFallbackTimer = () => {\n if (!closeFallbackTimer) {\n return;\n }\n clearTimeout(closeFallbackTimer);\n closeFallbackTimer = null;\n };\n\n const killChild = () => {\n if (settled || typeof child?.kill !== \"function\") {\n return;\n }\n killIssuedByTimeout = true;\n child.kill(\"SIGKILL\");\n };\n\n const armNoOutputTimer = () => {\n if (!shouldTrackOutputTimeout || settled) {\n return;\n }\n clearNoOutputTimer();\n noOutputTimer = setTimeout(() => {\n if (settled) {\n return;\n }\n noOutputTimedOut = true;\n killChild();\n }, Math.floor(noOutputTimeoutMs));\n };\n\n const timer = setTimeout(() => {\n timedOut = true;\n killChild();\n }, timeoutMs >= 0 ? timeoutMs : Number.POSITIVE_INFINITY);\n armNoOutputTimer();\n\n if (input !== undefined && child.stdin) {\n child.stdin.write(input ?? \"\");\n child.stdin.end();\n }\n\n child.stdout?.on(\"data\", (d: Stream) => {\n stdout += d.toString();\n armNoOutputTimer();\n });\n child.stderr?.on(\"data\", (d: Stream) => {\n stderr += d.toString();\n armNoOutputTimer();\n });\n child.on(\"error\", err => {\n if (settled) {\n return;\n }\n settled = true;\n clearTimeout(timer);\n clearNoOutputTimer();\n clearCloseFallbackTimer();\n reject(err);\n });\n child.on(\"exit\", (code, signal) => {\n childExitState = { code, signal };\n if (settled || closeFallbackTimer) {\n return;\n }\n closeFallbackTimer = setTimeout(() => {\n if (settled) {\n return;\n }\n child.stdout?.destroy();\n child.stderr?.destroy();\n }, 250);\n });\n const resolveFromClose = (\n code: number | null,\n signal: NodeJS.Signals | null\n ) => {\n if (settled) {\n return;\n }\n settled = true;\n clearTimeout(timer);\n clearNoOutputTimer();\n clearCloseFallbackTimer();\n const resolvedSignal =\n childExitState?.signal ?? signal ?? child.signalCode ?? null;\n const resolvedCode = resolveProcessExitCode({\n explicitCode: childExitState?.code ?? code,\n childExitCode: child.exitCode,\n resolvedSignal,\n usesWindowsExitCodeShim: isWindows && (useCmdWrapper || resolvedArgv !== argv),\n timedOut,\n noOutputTimedOut,\n killIssuedByTimeout\n });\n const termination = noOutputTimedOut\n ? \"no-output-timeout\"\n : timedOut\n ? \"timeout\"\n : resolvedSignal != null\n ? \"signal\"\n : \"exit\";\n const normalizedCode =\n termination === \"timeout\" || termination === \"no-output-timeout\"\n ? resolvedCode === 0\n ? 124\n : resolvedCode\n : resolvedCode;\n resolve({\n pid: child.pid ?? undefined,\n stdout,\n stderr,\n code: normalizedCode,\n signal: resolvedSignal,\n killed: child.killed,\n termination,\n noOutputTimedOut\n });\n };\n child.on(\"close\", (code, signal) => {\n if (\n !isWindows ||\n childExitState != null ||\n code != null ||\n signal != null ||\n child.exitCode != null ||\n child.signalCode != null\n ) {\n resolveFromClose(code, signal);\n return;\n }\n\n const startedAt = Date.now();\n const waitForExitState = () => {\n if (settled) {\n return;\n }\n if (\n childExitState != null ||\n child.exitCode != null ||\n child.signalCode != null\n ) {\n resolveFromClose(code, signal);\n return;\n }\n if (Date.now() - startedAt >= WINDOWS_CLOSE_STATE_SETTLE_TIMEOUT_MS) {\n resolveFromClose(code, signal);\n return;\n }\n setTimeout(waitForExitState, WINDOWS_CLOSE_STATE_POLL_MS);\n };\n waitForExitState();\n });\n});`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A helper function that executes a command and returns its stdout.\">\n <TSDocParam name=\"argv\">\n {`The command and its arguments to spawn. This is passed directly to the spawn function. Remember that on Windows, commands like \\`npm\\` or \\`pnpm\\` will be resolved to their .cmd shims, so you can just pass \\`npm\\` without worrying about the extension.`}\n </TSDocParam>\n <TSDocParam name=\"optionsOrTimeoutMs\">\n {`The options for spawning the command, or a number representing the timeout in milliseconds. This is passed directly to the spawn function. Providing \\`-1\\` will disable the timeout. If no options or timeout are provided, a default timeout of 5 minutes will be used.`}\n </TSDocParam>\n <TSDocReturns>\n {\n \"A promise that resolves with the result of the spawn operation if the command exits with code 0, or rejects with an error if the command exits with a non-zero code or if there is a problem spawning the process.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"exec\"\n parameters={[\n { name: \"argv\", type: \"string[]\" },\n {\n name: \"optionsOrTimeoutMs\",\n type: \"number | SpawnOptions\",\n default: \"300000\"\n }\n ]}\n returnType=\"Promise<string>\">\n {code`const spawnResult = await spawn(argv, optionsOrTimeoutMs);\n if (spawnResult.code !== 0) {\n throw Object.assign(new Error(\n \\`Command \"\\${argv.join(\" \")}\" exited with code \\${spawnResult.code} and signal \\${spawnResult.signal}\\`\n ), spawnResult);\n }\n\n return spawnResult.stdout.trim(); `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A helper function that executes a command synchronously and returns its stdout. This is a thin wrapper around \\`child_process.execFileSync\\` with some added Windows compatibility handling.\">\n <TSDocParam name=\"argv\">\n {`The command and its arguments to spawn. This is passed directly to \\`execFileSync\\` after Windows-specific resolution. Remember that on Windows, commands like \\`npm\\` or \\`pnpm\\` will be resolved to their .cmd shims, so you can just pass \\`npm\\` without worrying about the extension.`}\n </TSDocParam>\n <TSDocParam name=\"options\">\n {`The options for spawning the command. This is passed directly to \\`execFileSync\\` after some processing. The timeout option is supported, but note that it will throw an error if the process runs longer than the specified timeout. If no options are provided, a default timeout of 5 minutes will be used.`}\n </TSDocParam>\n <TSDocReturns>\n {\n \"The standard output produced by the command if it exits with code 0. If the command exits with a non-zero code or if there is a problem spawning the process, an error will be thrown.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"execSync\"\n parameters={[\n { name: \"argv\", type: \"string[]\" },\n { name: \"options\", type: \"SpawnOptions\", default: \"{}\" }\n ]}\n returnType=\"string\">\n {code`return execFileSync(argv.length > 0 ? argv[0] : \"\", argv.slice(1), {\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n timeout: options.timeoutMs ?? 300000,\n env: resolveCommandEnv({ argv, env: options.env }),\n cwd: options.cwd || process.cwd(),\n windowsHide: true\n }).trim(); `}\n </FunctionDeclaration>\n <Spacing />\n\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAEA,MAAM,UAAU;CAAC;CAAG;CAAM;CAAS;CAAQ;;;;;;;AA0B3C,MAAM,sBAAsB;OAAE;CAAW;CAAO;CAAiB;CAAmB;CAAK;;;;AAKzF,SAAE,YAAA,OAAA;CACA,MAAM,CAAC,EACT;AAEA,QAAO,gBAAU,aAAiB,WAAY;EAC5C,IAAA;EACC,aAAO;EACP,EAAA,MAAA;;AAED,UAAA,OAAA,KAAA,WAAA,EAAA,EAAA;IACG,aAAgB;KAAA;KAAa;KAAQ;KAAa;KAAM;IAC3D,WAAA,CAAA,aAAA;IACK,sBAAqB,CAAA;KAClB,MAAC;;KAEF,EAAA,eAAA;IACJ,eAAA,CAAA;KACK,MAAI;KACR,SAAa;KACT,MAAI;KACR,CAAA;IACC,CAAC;;EAEJ,IAAI,iBAAM;AACR,UAAM,OAAM,KAAC,kBAAsB,EAAE,EAAC,EACpC,KAAG,CAAA,aAAY,MAAA,EAChB,CAAC;;EAEJ,IAAI,WAAA;AACF,UAAA;IAAA,gBAA0B,qBAAqB;KAC7C,MAAM;KACN,YAAC,CAAA;MACF,MAAA;MACC,MAAM;MACN,CAAA;KACA,YAAE;KACF,UAAU,IAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BZ,CAAC;IAAE,gBAAI,SAAuB,EAAA,CAAA;IAAA,gBAAA,qBAAA;KAC7B,MAAI;KACJ,YAAW,CAAA;MACT,MAAA;MACA,MAAM;MACR,CAAA;KACD,YAAS;KACT,UAAA,IAAA;;;;;;KAMA,CAAC;IAAE,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,qBAAA;KACF,MAAE;;MAEA,MAAM;MACR,MAAA;MACD,CAAA;KACA,YAAA;KACC,UAAM,IAAA;;;;;;;;;;KAUP,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S;;;KAGV,CAAA;IAAA,gBAAW,qBAAA;KACd,UAAA;KACH,MAAA"}
|
|
@@ -5,6 +5,15 @@ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
|
5
5
|
let _alloy_js_core = require("@alloy-js/core");
|
|
6
6
|
|
|
7
7
|
//#region src/components/helpers.tsx
|
|
8
|
+
function __assignType(fn, args) {
|
|
9
|
+
fn.__type = args;
|
|
10
|
+
return fn;
|
|
11
|
+
}
|
|
12
|
+
const __ΩBooleanInputParserLogicProps = [
|
|
13
|
+
"name",
|
|
14
|
+
"BooleanInputParserLogicProps",
|
|
15
|
+
"P&4!Mw\"y"
|
|
16
|
+
];
|
|
8
17
|
/**
|
|
9
18
|
* Parses a string input into a boolean value, interpreting common truthy and falsy string representations.
|
|
10
19
|
*/
|
|
@@ -12,6 +21,13 @@ function BooleanInputParserLogic(props) {
|
|
|
12
21
|
const { name } = props;
|
|
13
22
|
return [_alloy_js_core.code` !!${name} && ${name}.toLowerCase() !== "false" && ${name}.toLowerCase() !== "f" && ${name}.toLowerCase() !== "no" && ${name} !== "n" && ${name}.toLowerCase() !== "0" && ${name}.toLowerCase() !== "off" && ${name} !== "disable" && ${name}.toLowerCase() !== "disabled" && ${name}.toLowerCase() !== "never" && (Number.isNaN(Number.parseFloat(${name})) || Number.parseFloat(${name}) > 0) `];
|
|
14
23
|
}
|
|
24
|
+
BooleanInputParserLogic.__type = [
|
|
25
|
+
() => __ΩBooleanInputParserLogicProps,
|
|
26
|
+
"props",
|
|
27
|
+
"BooleanInputParserLogic",
|
|
28
|
+
"Parses a string input into a boolean value, interpreting common truthy and falsy string representations.",
|
|
29
|
+
"Pn!2\"\"/#?$"
|
|
30
|
+
];
|
|
15
31
|
/**
|
|
16
32
|
* Write the logic to determine if the application is running in debug mode.
|
|
17
33
|
*
|
|
@@ -21,6 +37,11 @@ function BooleanInputParserLogic(props) {
|
|
|
21
37
|
function IsDebug() {
|
|
22
38
|
return _alloy_js_core.code`isDevelopment || isDebug || env.LOG_LEVEL === "debug"`;
|
|
23
39
|
}
|
|
40
|
+
IsDebug.__type = [
|
|
41
|
+
"IsDebug",
|
|
42
|
+
"Write the logic to determine if the application is running in debug mode.",
|
|
43
|
+
"P\"/!?\""
|
|
44
|
+
];
|
|
24
45
|
/**
|
|
25
46
|
* Write the logic to determine if the application is **not** running in debug mode.
|
|
26
47
|
*/
|
|
@@ -31,6 +52,11 @@ function IsNotDebug() {
|
|
|
31
52
|
_alloy_js_core.code`)`
|
|
32
53
|
];
|
|
33
54
|
}
|
|
55
|
+
IsNotDebug.__type = [
|
|
56
|
+
"IsNotDebug",
|
|
57
|
+
"Write the logic to determine if the application is **not** running in debug mode.",
|
|
58
|
+
"P\"/!?\""
|
|
59
|
+
];
|
|
34
60
|
/**
|
|
35
61
|
* Write the logic to determine if the application is running in verbose mode.
|
|
36
62
|
*
|
|
@@ -44,6 +70,11 @@ function IsVerbose() {
|
|
|
44
70
|
_alloy_js_core.code`|| hasFlag(["verbose", "verbose=true", "verbose=always"]))`
|
|
45
71
|
];
|
|
46
72
|
}
|
|
73
|
+
IsVerbose.__type = [
|
|
74
|
+
"IsVerbose",
|
|
75
|
+
"Write the logic to determine if the application is running in verbose mode.",
|
|
76
|
+
"P\"/!?\""
|
|
77
|
+
];
|
|
47
78
|
/**
|
|
48
79
|
* Write the logic to determine if the application is **not** running in verbose mode.
|
|
49
80
|
*/
|
|
@@ -54,13 +85,30 @@ function IsNotVerbose() {
|
|
|
54
85
|
_alloy_js_core.code`)`
|
|
55
86
|
];
|
|
56
87
|
}
|
|
88
|
+
IsNotVerbose.__type = [
|
|
89
|
+
"IsNotVerbose",
|
|
90
|
+
"Write the logic to determine if the application is **not** running in verbose mode.",
|
|
91
|
+
"P\"/!?\""
|
|
92
|
+
];
|
|
57
93
|
/**
|
|
58
94
|
* Write the type declaration for a command parameter based on its configuration.
|
|
59
95
|
*/
|
|
60
96
|
function CommandParameterType(props) {
|
|
61
97
|
const { parameter } = props;
|
|
62
|
-
return _alloy_js_core.code`${(parameter.kind === require_types_command.CommandParameterKinds.string || parameter.kind === require_types_command.CommandParameterKinds.number) && parameter.choices && parameter.choices.length > 0 ? parameter.choices.map((choice) => typeof choice === "string" ? `"${choice}"` : choice
|
|
98
|
+
return _alloy_js_core.code`${(parameter.kind === require_types_command.CommandParameterKinds.string || parameter.kind === require_types_command.CommandParameterKinds.number) && parameter.choices && parameter.choices.length > 0 ? parameter.choices.map(__assignType((choice) => typeof choice === "string" ? `"${choice}"` : choice, [
|
|
99
|
+
"choice",
|
|
100
|
+
"",
|
|
101
|
+
"P\"2!\"/\""
|
|
102
|
+
])).join(" | ") : parameter.kind === require_types_command.CommandParameterKinds.boolean ? "boolean" : parameter.kind === require_types_command.CommandParameterKinds.number ? "number" : "string"}${parameter.variadic ? "[]" : ""}${parameter.optional ? " | undefined" : ""}`;
|
|
63
103
|
}
|
|
104
|
+
CommandParameterType.__type = [
|
|
105
|
+
"CommandParameter",
|
|
106
|
+
"parameter",
|
|
107
|
+
"props",
|
|
108
|
+
"CommandParameterType",
|
|
109
|
+
"Write the type declaration for a command parameter based on its configuration.",
|
|
110
|
+
"PP\"w!4\"M2#\"/$?%"
|
|
111
|
+
];
|
|
64
112
|
|
|
65
113
|
//#endregion
|
|
66
114
|
exports.BooleanInputParserLogic = BooleanInputParserLogic;
|
|
@@ -68,4 +116,5 @@ exports.CommandParameterType = CommandParameterType;
|
|
|
68
116
|
exports.IsDebug = IsDebug;
|
|
69
117
|
exports.IsNotDebug = IsNotDebug;
|
|
70
118
|
exports.IsNotVerbose = IsNotVerbose;
|
|
71
|
-
exports.IsVerbose = IsVerbose;
|
|
119
|
+
exports.IsVerbose = IsVerbose;
|
|
120
|
+
exports.__ΩBooleanInputParserLogicProps = __ΩBooleanInputParserLogicProps;
|
|
@@ -3,6 +3,15 @@ import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
|
3
3
|
import { code } from "@alloy-js/core";
|
|
4
4
|
|
|
5
5
|
//#region src/components/helpers.tsx
|
|
6
|
+
function __assignType(fn, args) {
|
|
7
|
+
fn.__type = args;
|
|
8
|
+
return fn;
|
|
9
|
+
}
|
|
10
|
+
const __ΩBooleanInputParserLogicProps = [
|
|
11
|
+
"name",
|
|
12
|
+
"BooleanInputParserLogicProps",
|
|
13
|
+
"P&4!Mw\"y"
|
|
14
|
+
];
|
|
6
15
|
/**
|
|
7
16
|
* Parses a string input into a boolean value, interpreting common truthy and falsy string representations.
|
|
8
17
|
*/
|
|
@@ -10,6 +19,13 @@ function BooleanInputParserLogic(props) {
|
|
|
10
19
|
const { name } = props;
|
|
11
20
|
return [code` !!${name} && ${name}.toLowerCase() !== "false" && ${name}.toLowerCase() !== "f" && ${name}.toLowerCase() !== "no" && ${name} !== "n" && ${name}.toLowerCase() !== "0" && ${name}.toLowerCase() !== "off" && ${name} !== "disable" && ${name}.toLowerCase() !== "disabled" && ${name}.toLowerCase() !== "never" && (Number.isNaN(Number.parseFloat(${name})) || Number.parseFloat(${name}) > 0) `];
|
|
12
21
|
}
|
|
22
|
+
BooleanInputParserLogic.__type = [
|
|
23
|
+
() => __ΩBooleanInputParserLogicProps,
|
|
24
|
+
"props",
|
|
25
|
+
"BooleanInputParserLogic",
|
|
26
|
+
"Parses a string input into a boolean value, interpreting common truthy and falsy string representations.",
|
|
27
|
+
"Pn!2\"\"/#?$"
|
|
28
|
+
];
|
|
13
29
|
/**
|
|
14
30
|
* Write the logic to determine if the application is running in debug mode.
|
|
15
31
|
*
|
|
@@ -19,6 +35,11 @@ function BooleanInputParserLogic(props) {
|
|
|
19
35
|
function IsDebug() {
|
|
20
36
|
return code`isDevelopment || isDebug || env.LOG_LEVEL === "debug"`;
|
|
21
37
|
}
|
|
38
|
+
IsDebug.__type = [
|
|
39
|
+
"IsDebug",
|
|
40
|
+
"Write the logic to determine if the application is running in debug mode.",
|
|
41
|
+
"P\"/!?\""
|
|
42
|
+
];
|
|
22
43
|
/**
|
|
23
44
|
* Write the logic to determine if the application is **not** running in debug mode.
|
|
24
45
|
*/
|
|
@@ -29,6 +50,11 @@ function IsNotDebug() {
|
|
|
29
50
|
code`)`
|
|
30
51
|
];
|
|
31
52
|
}
|
|
53
|
+
IsNotDebug.__type = [
|
|
54
|
+
"IsNotDebug",
|
|
55
|
+
"Write the logic to determine if the application is **not** running in debug mode.",
|
|
56
|
+
"P\"/!?\""
|
|
57
|
+
];
|
|
32
58
|
/**
|
|
33
59
|
* Write the logic to determine if the application is running in verbose mode.
|
|
34
60
|
*
|
|
@@ -42,6 +68,11 @@ function IsVerbose() {
|
|
|
42
68
|
code`|| hasFlag(["verbose", "verbose=true", "verbose=always"]))`
|
|
43
69
|
];
|
|
44
70
|
}
|
|
71
|
+
IsVerbose.__type = [
|
|
72
|
+
"IsVerbose",
|
|
73
|
+
"Write the logic to determine if the application is running in verbose mode.",
|
|
74
|
+
"P\"/!?\""
|
|
75
|
+
];
|
|
45
76
|
/**
|
|
46
77
|
* Write the logic to determine if the application is **not** running in verbose mode.
|
|
47
78
|
*/
|
|
@@ -52,14 +83,31 @@ function IsNotVerbose() {
|
|
|
52
83
|
code`)`
|
|
53
84
|
];
|
|
54
85
|
}
|
|
86
|
+
IsNotVerbose.__type = [
|
|
87
|
+
"IsNotVerbose",
|
|
88
|
+
"Write the logic to determine if the application is **not** running in verbose mode.",
|
|
89
|
+
"P\"/!?\""
|
|
90
|
+
];
|
|
55
91
|
/**
|
|
56
92
|
* Write the type declaration for a command parameter based on its configuration.
|
|
57
93
|
*/
|
|
58
94
|
function CommandParameterType(props) {
|
|
59
95
|
const { parameter } = props;
|
|
60
|
-
return code`${(parameter.kind === CommandParameterKinds.string || parameter.kind === CommandParameterKinds.number) && parameter.choices && parameter.choices.length > 0 ? parameter.choices.map((choice) => typeof choice === "string" ? `"${choice}"` : choice
|
|
96
|
+
return code`${(parameter.kind === CommandParameterKinds.string || parameter.kind === CommandParameterKinds.number) && parameter.choices && parameter.choices.length > 0 ? parameter.choices.map(__assignType((choice) => typeof choice === "string" ? `"${choice}"` : choice, [
|
|
97
|
+
"choice",
|
|
98
|
+
"",
|
|
99
|
+
"P\"2!\"/\""
|
|
100
|
+
])).join(" | ") : parameter.kind === CommandParameterKinds.boolean ? "boolean" : parameter.kind === CommandParameterKinds.number ? "number" : "string"}${parameter.variadic ? "[]" : ""}${parameter.optional ? " | undefined" : ""}`;
|
|
61
101
|
}
|
|
102
|
+
CommandParameterType.__type = [
|
|
103
|
+
"CommandParameter",
|
|
104
|
+
"parameter",
|
|
105
|
+
"props",
|
|
106
|
+
"CommandParameterType",
|
|
107
|
+
"Write the type declaration for a command parameter based on its configuration.",
|
|
108
|
+
"PP\"w!4\"M2#\"/$?%"
|
|
109
|
+
];
|
|
62
110
|
|
|
63
111
|
//#endregion
|
|
64
|
-
export { BooleanInputParserLogic, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose };
|
|
112
|
+
export { BooleanInputParserLogic, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose, __ΩBooleanInputParserLogicProps };
|
|
65
113
|
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.mjs","names":[],"sources":["../../src/components/helpers.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code } from \"@alloy-js/core\";\nimport type { CommandParameter } from \"../types\";\nimport { CommandParameterKinds } from \"../types\";\n\nexport interface BooleanInputParserLogicProps {\n name: string;\n}\n\n/**\n * Parses a string input into a boolean value, interpreting common truthy and falsy string representations.\n */\nexport function BooleanInputParserLogic(props: BooleanInputParserLogicProps) {\n const { name } = props;\n\n return (\n <>{code` !!${name} && ${name}.toLowerCase() !== \"false\" && ${\n name\n }.toLowerCase() !== \"f\" && ${name}.toLowerCase() !== \"no\" && ${\n name\n } !== \"n\" && ${name}.toLowerCase() !== \"0\" && ${\n name\n }.toLowerCase() !== \"off\" && ${\n name\n } !== \"disable\" && ${name}.toLowerCase() !== \"disabled\" && ${\n name\n }.toLowerCase() !== \"never\" && (Number.isNaN(Number.parseFloat(${\n name\n })) || Number.parseFloat(${name}) > 0) `}</>\n );\n}\n\n/**\n * Write the logic to determine if the application is running in debug mode.\n *\n * @remarks\n * This is used to conditionally include debug-only logic in the generated application, such as additional logging or development tools. The logic should check for common indicators of debug mode, such as environment variables or the presence of a debugger.\n */\nexport function IsDebug() {\n return code`isDevelopment || isDebug || env.LOG_LEVEL === \"debug\"`;\n}\n\n/**\n * Write the logic to determine if the application is **not** running in debug mode.\n */\nexport function IsNotDebug() {\n return (\n <>\n {code`!(`}\n <IsDebug />\n {code`)`}\n </>\n );\n}\n\n/**\n * Write the logic to determine if the application is running in verbose mode.\n *\n * @remarks\n * This is used to conditionally include verbose-only logic in the generated application, such as additional logging or detailed output. The logic should check for common indicators of verbose mode, such as environment variables or command-line flags.\n */\nexport function IsVerbose() {\n return (\n <>\n {code`( `}\n <IsDebug />\n {code`|| hasFlag([\"verbose\", \"verbose=true\", \"verbose=always\"]))`}\n </>\n );\n}\n\n/**\n * Write the logic to determine if the application is **not** running in verbose mode.\n */\nexport function IsNotVerbose() {\n return (\n <>\n {code`!(`}\n <IsVerbose />\n {code`)`}\n </>\n );\n}\n\n/**\n * Write the type declaration for a command parameter based on its configuration.\n */\nexport function CommandParameterType(props: { parameter: CommandParameter }) {\n const { parameter } = props;\n\n return code`${\n (parameter.kind === CommandParameterKinds.string ||\n parameter.kind === CommandParameterKinds.number) &&\n parameter.choices &&\n parameter.choices.length > 0\n ? parameter.choices\n .map(choice => (typeof choice === \"string\" ? `\"${choice}\"` : choice))\n .join(\" | \")\n : parameter.kind === CommandParameterKinds.boolean\n ? \"boolean\"\n : parameter.kind === CommandParameterKinds.number\n ? \"number\"\n : \"string\"\n }${\n parameter.variadic ? \"[]\" : \"\"\n }${parameter.optional ? \" | undefined\" : \"\"}`;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.mjs","names":[],"sources":["../../src/components/helpers.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code } from \"@alloy-js/core\";\nimport type { CommandParameter } from \"../types\";\nimport { CommandParameterKinds } from \"../types\";\n\nexport interface BooleanInputParserLogicProps {\n name: string;\n}\n\n/**\n * Parses a string input into a boolean value, interpreting common truthy and falsy string representations.\n */\nexport function BooleanInputParserLogic(props: BooleanInputParserLogicProps) {\n const { name } = props;\n\n return (\n <>{code` !!${name} && ${name}.toLowerCase() !== \"false\" && ${\n name\n }.toLowerCase() !== \"f\" && ${name}.toLowerCase() !== \"no\" && ${\n name\n } !== \"n\" && ${name}.toLowerCase() !== \"0\" && ${\n name\n }.toLowerCase() !== \"off\" && ${\n name\n } !== \"disable\" && ${name}.toLowerCase() !== \"disabled\" && ${\n name\n }.toLowerCase() !== \"never\" && (Number.isNaN(Number.parseFloat(${\n name\n })) || Number.parseFloat(${name}) > 0) `}</>\n );\n}\n\n/**\n * Write the logic to determine if the application is running in debug mode.\n *\n * @remarks\n * This is used to conditionally include debug-only logic in the generated application, such as additional logging or development tools. The logic should check for common indicators of debug mode, such as environment variables or the presence of a debugger.\n */\nexport function IsDebug() {\n return code`isDevelopment || isDebug || env.LOG_LEVEL === \"debug\"`;\n}\n\n/**\n * Write the logic to determine if the application is **not** running in debug mode.\n */\nexport function IsNotDebug() {\n return (\n <>\n {code`!(`}\n <IsDebug />\n {code`)`}\n </>\n );\n}\n\n/**\n * Write the logic to determine if the application is running in verbose mode.\n *\n * @remarks\n * This is used to conditionally include verbose-only logic in the generated application, such as additional logging or detailed output. The logic should check for common indicators of verbose mode, such as environment variables or command-line flags.\n */\nexport function IsVerbose() {\n return (\n <>\n {code`( `}\n <IsDebug />\n {code`|| hasFlag([\"verbose\", \"verbose=true\", \"verbose=always\"]))`}\n </>\n );\n}\n\n/**\n * Write the logic to determine if the application is **not** running in verbose mode.\n */\nexport function IsNotVerbose() {\n return (\n <>\n {code`!(`}\n <IsVerbose />\n {code`)`}\n </>\n );\n}\n\n/**\n * Write the type declaration for a command parameter based on its configuration.\n */\nexport function CommandParameterType(props: { parameter: CommandParameter }) {\n const { parameter } = props;\n\n return code`${\n (parameter.kind === CommandParameterKinds.string ||\n parameter.kind === CommandParameterKinds.number) &&\n parameter.choices &&\n parameter.choices.length > 0\n ? parameter.choices\n .map(choice => (typeof choice === \"string\" ? `\"${choice}\"` : choice))\n .join(\" | \")\n : parameter.kind === CommandParameterKinds.boolean\n ? \"boolean\"\n : parameter.kind === CommandParameterKinds.number\n ? \"number\"\n : \"string\"\n }${\n parameter.variadic ? \"[]\" : \"\"\n }${parameter.optional ? \" | undefined\" : \"\"}`;\n}\n"],"mappings":";;;;;;AAEE,IAAG,SAAS;;;AAsBd,MAAA,kCAAA;CAAA;CAAA;CAAA;CAAA;;;;AAKA,SAAgB,wBAAwB,OAAO;CAC7C,MAAM,WAEN;AACA,QAAK,CAAA,IAAO,MAAG,KAAQ,MAAG,KAAM,gCAA8B,KAAA,4BAAA,KAAA,6BAAA,KAAA,cAAA,KAAA,4BAAA,KAAA,8BAAA,K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40
40
|
exports.TerminalSizeDeclaration = require_components_utils_builtin.TerminalSizeDeclaration;
|
|
41
41
|
exports.Usage = require_components_usage.Usage;
|
|
42
|
-
exports.UtilsBuiltin = require_components_utils_builtin.UtilsBuiltin;
|
|
42
|
+
exports.UtilsBuiltin = require_components_utils_builtin.UtilsBuiltin;
|
|
43
|
+
exports.__ΩArgumentsParserLogicProps = require_components_options_parser_logic.__ΩArgumentsParserLogicProps;
|
|
44
|
+
exports.__ΩBooleanInputParserLogicProps = require_components_helpers.__ΩBooleanInputParserLogicProps;
|
|
45
|
+
exports.__ΩCommandDocsFileProps = require_components_docs.__ΩCommandDocsFileProps;
|
|
46
|
+
exports.__ΩCommandDocsProps = require_components_docs.__ΩCommandDocsProps;
|
|
47
|
+
exports.__ΩCommandDocsUsageExampleProps = require_components_docs.__ΩCommandDocsUsageExampleProps;
|
|
48
|
+
exports.__ΩCommandOptionsDocsProps = require_components_docs.__ΩCommandOptionsDocsProps;
|
|
49
|
+
exports.__ΩCommandParserLogicProps = require_components_options_parser_logic.__ΩCommandParserLogicProps;
|
|
50
|
+
exports.__ΩCommandValidationLogicProps = require_components_command_validation_logic.__ΩCommandValidationLogicProps;
|
|
51
|
+
exports.__ΩDynamicSegmentsParserLogicProps = require_components_options_parser_logic.__ΩDynamicSegmentsParserLogicProps;
|
|
52
|
+
exports.__ΩExecBuiltinProps = require_components_exec_builtin.__ΩExecBuiltinProps;
|
|
53
|
+
exports.__ΩOptionsMemberParserConditionProps = require_components_options_parser_logic.__ΩOptionsMemberParserConditionProps;
|
|
54
|
+
exports.__ΩOptionsMemberParserLogicProps = require_components_options_parser_logic.__ΩOptionsMemberParserLogicProps;
|
|
55
|
+
exports.__ΩOptionsParserLogicProps = require_components_options_parser_logic.__ΩOptionsParserLogicProps;
|
|
56
|
+
exports.__ΩStateBuiltinProps = require_components_state_builtin.__ΩStateBuiltinProps;
|
|
57
|
+
exports.__ΩUsageProps = require_components_usage.__ΩUsageProps;
|
|
58
|
+
exports.__ΩUtilsBuiltinProps = require_components_utils_builtin.__ΩUtilsBuiltinProps;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Usage } from "./usage.mjs";
|
|
2
|
-
import { CommandDocs, CommandDocsFile, CommandDocsUsageExample, CommandOptionsDocs } from "./docs.mjs";
|
|
3
|
-
import { ExecBuiltin } from "./exec-builtin.mjs";
|
|
4
|
-
import { BooleanInputParserLogic, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose } from "./helpers.mjs";
|
|
5
|
-
import { ArgumentsParserLogic, CommandParserLogic, DynamicSegmentsParserLogic, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserLogic, OptionsParserLogic } from "./options-parser-logic.mjs";
|
|
6
|
-
import { ArgsUtilities, ContextUtilities, GlobalTypeDefinitions, StateBuiltin } from "./state-builtin.mjs";
|
|
7
|
-
import { ColorSupportUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, ResolveModuleFunctionDeclaration, TerminalSizeDeclaration, UtilsBuiltin } from "./utils-builtin.mjs";
|
|
8
|
-
import { CommandValidationLogic } from "./command-validation-logic.mjs";
|
|
1
|
+
import { Usage, __ΩUsageProps } from "./usage.mjs";
|
|
2
|
+
import { CommandDocs, CommandDocsFile, CommandDocsUsageExample, CommandOptionsDocs, __ΩCommandDocsFileProps, __ΩCommandDocsProps, __ΩCommandDocsUsageExampleProps, __ΩCommandOptionsDocsProps } from "./docs.mjs";
|
|
3
|
+
import { ExecBuiltin, __ΩExecBuiltinProps } from "./exec-builtin.mjs";
|
|
4
|
+
import { BooleanInputParserLogic, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose, __ΩBooleanInputParserLogicProps } from "./helpers.mjs";
|
|
5
|
+
import { ArgumentsParserLogic, CommandParserLogic, DynamicSegmentsParserLogic, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserLogic, OptionsParserLogic, __ΩArgumentsParserLogicProps, __ΩCommandParserLogicProps, __ΩDynamicSegmentsParserLogicProps, __ΩOptionsMemberParserConditionProps, __ΩOptionsMemberParserLogicProps, __ΩOptionsParserLogicProps } from "./options-parser-logic.mjs";
|
|
6
|
+
import { ArgsUtilities, ContextUtilities, GlobalTypeDefinitions, StateBuiltin, __ΩStateBuiltinProps } from "./state-builtin.mjs";
|
|
7
|
+
import { ColorSupportUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, ResolveModuleFunctionDeclaration, TerminalSizeDeclaration, UtilsBuiltin, __ΩUtilsBuiltinProps } from "./utils-builtin.mjs";
|
|
8
|
+
import { CommandValidationLogic, __ΩCommandValidationLogicProps } from "./command-validation-logic.mjs";
|
|
9
9
|
|
|
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 };
|
|
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, __ΩArgumentsParserLogicProps, __ΩBooleanInputParserLogicProps, __ΩCommandDocsFileProps, __ΩCommandDocsProps, __ΩCommandDocsUsageExampleProps, __ΩCommandOptionsDocsProps, __ΩCommandParserLogicProps, __ΩCommandValidationLogicProps, __ΩDynamicSegmentsParserLogicProps, __ΩExecBuiltinProps, __ΩOptionsMemberParserConditionProps, __ΩOptionsMemberParserLogicProps, __ΩOptionsParserLogicProps, __ΩStateBuiltinProps, __ΩUsageProps, __ΩUtilsBuiltinProps };
|