@shell-shock/core 0.17.10 → 0.17.12
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/api.cjs +31 -143
- package/dist/api.cjs.map +1 -0
- package/dist/api.d.cts +2 -77
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.mts +2 -76
- package/dist/api.d.mts.map +1 -1
- package/dist/api.mjs +30 -140
- package/dist/api.mjs.map +1 -1
- package/dist/components/command-validation-logic.cjs +14 -15
- package/dist/components/command-validation-logic.cjs.map +1 -0
- package/dist/components/command-validation-logic.d.cts +1 -3
- package/dist/components/command-validation-logic.d.cts.map +1 -1
- package/dist/components/command-validation-logic.d.mts +1 -3
- package/dist/components/command-validation-logic.d.mts.map +1 -1
- package/dist/components/command-validation-logic.mjs +12 -13
- package/dist/components/command-validation-logic.mjs.map +1 -1
- package/dist/components/docs.cjs +6 -6
- package/dist/components/docs.cjs.map +1 -0
- package/dist/components/docs.d.cts +4 -5
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts +4 -5
- package/dist/components/docs.d.mts.map +1 -1
- package/dist/components/docs.mjs +4 -4
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/exec-builtin.cjs +9 -11
- package/dist/components/exec-builtin.cjs.map +1 -0
- package/dist/components/exec-builtin.d.cts +1 -2
- package/dist/components/exec-builtin.d.cts.map +1 -1
- package/dist/components/exec-builtin.d.mts +1 -2
- package/dist/components/exec-builtin.d.mts.map +1 -1
- package/dist/components/exec-builtin.mjs +7 -10
- package/dist/components/exec-builtin.mjs.map +1 -1
- package/dist/components/helpers.cjs +4 -5
- package/dist/components/helpers.cjs.map +1 -0
- package/dist/components/helpers.d.cts +6 -8
- package/dist/components/helpers.d.cts.map +1 -1
- package/dist/components/helpers.d.mts +6 -8
- package/dist/components/helpers.d.mts.map +1 -1
- package/dist/components/helpers.mjs +2 -3
- package/dist/components/helpers.mjs.map +1 -1
- package/dist/components/options-parser-logic.cjs +29 -30
- package/dist/components/options-parser-logic.cjs.map +1 -0
- package/dist/components/options-parser-logic.d.cts +8 -9
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts +8 -9
- package/dist/components/options-parser-logic.d.mts.map +1 -1
- package/dist/components/options-parser-logic.mjs +27 -28
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/state-builtin.cjs +3 -2
- package/dist/components/state-builtin.cjs.map +1 -0
- package/dist/components/state-builtin.d.cts +4 -5
- package/dist/components/state-builtin.d.cts.map +1 -1
- package/dist/components/state-builtin.d.mts +4 -5
- package/dist/components/state-builtin.d.mts.map +1 -1
- package/dist/components/state-builtin.mjs +1 -1
- package/dist/components/state-builtin.mjs.map +1 -1
- package/dist/components/usage.cjs +4 -6
- package/dist/components/usage.cjs.map +1 -0
- package/dist/components/usage.d.cts +1 -2
- package/dist/components/usage.d.cts.map +1 -1
- package/dist/components/usage.d.mts +1 -2
- package/dist/components/usage.d.mts.map +1 -1
- package/dist/components/usage.mjs +2 -4
- package/dist/components/usage.mjs.map +1 -1
- package/dist/components/utils-builtin.cjs +5 -4
- package/dist/components/utils-builtin.cjs.map +1 -0
- package/dist/components/utils-builtin.d.cts +7 -8
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts +7 -8
- package/dist/components/utils-builtin.d.mts.map +1 -1
- package/dist/components/utils-builtin.mjs +3 -3
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/config.cjs +53 -19
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +29 -8
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +29 -8
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +51 -18
- package/dist/config.mjs.map +1 -1
- package/dist/contexts/command.cjs +2 -2
- package/dist/contexts/command.cjs.map +1 -0
- package/dist/contexts/command.d.cts.map +1 -1
- package/dist/contexts/command.d.mts.map +1 -1
- package/dist/contexts/command.mjs.map +1 -1
- package/dist/contexts/options.cjs +4 -4
- package/dist/contexts/options.cjs.map +1 -0
- package/dist/contexts/options.d.cts.map +1 -1
- package/dist/contexts/options.d.mts.map +1 -1
- package/dist/contexts/options.mjs +2 -3
- package/dist/contexts/options.mjs.map +1 -1
- package/dist/engine.cjs +138 -0
- package/dist/engine.cjs.map +1 -0
- package/dist/engine.d.cts +79 -0
- package/dist/engine.d.cts.map +1 -0
- package/dist/engine.d.mts +79 -0
- package/dist/engine.d.mts.map +1 -0
- package/dist/engine.mjs +136 -0
- package/dist/engine.mjs.map +1 -0
- package/dist/helpers/automd.cjs +6 -7
- package/dist/helpers/automd.cjs.map +1 -0
- package/dist/helpers/automd.mjs +2 -3
- package/dist/helpers/automd.mjs.map +1 -1
- package/dist/helpers/docs-helpers.cjs +2 -2
- package/dist/helpers/docs-helpers.cjs.map +1 -0
- package/dist/helpers/docs-helpers.mjs.map +1 -1
- package/dist/helpers/get-framework.cjs +24 -0
- package/dist/helpers/get-framework.cjs.map +1 -0
- package/dist/helpers/get-framework.mjs +24 -0
- package/dist/helpers/get-framework.mjs.map +1 -0
- package/dist/helpers/paths.cjs +5 -5
- package/dist/helpers/paths.cjs.map +1 -0
- package/dist/helpers/paths.mjs +4 -4
- package/dist/helpers/paths.mjs.map +1 -1
- package/dist/helpers/persistence.cjs +4 -6
- package/dist/helpers/persistence.cjs.map +1 -0
- package/dist/helpers/persistence.mjs +3 -3
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/helpers/update-package-json.cjs +2 -2
- package/dist/helpers/update-package-json.cjs.map +1 -0
- package/dist/helpers/update-package-json.mjs.map +1 -1
- package/dist/helpers/utilities.cjs +3 -3
- package/dist/helpers/utilities.cjs.map +1 -0
- package/dist/helpers/utilities.mjs +1 -1
- package/dist/helpers/utilities.mjs.map +1 -1
- package/dist/helpers/validations.cjs +3 -3
- package/dist/helpers/validations.cjs.map +1 -0
- package/dist/helpers/validations.mjs +1 -3
- package/dist/helpers/validations.mjs.map +1 -1
- package/dist/index.cjs +121 -51
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +80 -5
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +80 -5
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +118 -6
- package/dist/index.mjs.map +1 -0
- package/dist/package.cjs +12 -0
- package/dist/package.cjs.map +1 -0
- package/dist/package.mjs +6 -0
- package/dist/package.mjs.map +1 -0
- package/dist/plugin-utils/compute-bin.cjs +8 -10
- package/dist/plugin-utils/compute-bin.cjs.map +1 -0
- package/dist/plugin-utils/compute-bin.d.cts +2 -2
- package/dist/plugin-utils/compute-bin.d.cts.map +1 -1
- package/dist/plugin-utils/compute-bin.d.mts +2 -2
- package/dist/plugin-utils/compute-bin.d.mts.map +1 -1
- package/dist/plugin-utils/compute-bin.mjs +6 -8
- package/dist/plugin-utils/compute-bin.mjs.map +1 -1
- package/dist/plugin-utils/context-helpers.cjs +7 -14
- package/dist/plugin-utils/context-helpers.cjs.map +1 -0
- package/dist/plugin-utils/context-helpers.d.cts +4 -4
- package/dist/plugin-utils/context-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/context-helpers.d.mts +4 -4
- package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/context-helpers.mjs +5 -12
- package/dist/plugin-utils/context-helpers.mjs.map +1 -1
- package/dist/plugin-utils/deepkit.cjs +15 -16
- package/dist/plugin-utils/deepkit.cjs.map +1 -0
- package/dist/plugin-utils/deepkit.d.cts +5 -5
- package/dist/plugin-utils/deepkit.d.cts.map +1 -1
- package/dist/plugin-utils/deepkit.d.mts +5 -5
- package/dist/plugin-utils/deepkit.d.mts.map +1 -1
- package/dist/plugin-utils/deepkit.mjs +14 -15
- package/dist/plugin-utils/deepkit.mjs.map +1 -1
- package/dist/plugin-utils/description-helpers.cjs +2 -1
- package/dist/plugin-utils/description-helpers.cjs.map +1 -0
- package/dist/plugin-utils/description-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/description-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/description-helpers.mjs.map +1 -1
- package/dist/plugin-utils/get-command-tree.cjs +2 -1
- package/dist/plugin-utils/get-command-tree.cjs.map +1 -0
- package/dist/plugin-utils/get-command-tree.d.cts.map +1 -1
- package/dist/plugin-utils/get-command-tree.d.mts.map +1 -1
- package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +1 -1
- package/dist/plugin-utils/index.d.cts +2 -2
- package/dist/plugin-utils/index.d.mts +2 -2
- package/dist/plugin-utils/index.mjs +2 -2
- package/dist/plugin-utils/reflect.cjs +5 -5
- package/dist/plugin-utils/reflect.cjs.map +1 -0
- package/dist/plugin-utils/reflect.d.cts.map +1 -1
- package/dist/plugin-utils/reflect.d.mts.map +1 -1
- package/dist/plugin-utils/reflect.mjs +3 -5
- package/dist/plugin-utils/reflect.mjs.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.cjs +2 -1
- package/dist/plugin-utils/traverse-command-tree.cjs.map +1 -0
- package/dist/plugin-utils/traverse-command-tree.d.cts.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.d.mts.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/type-checks.cjs +146 -17
- package/dist/plugin-utils/type-checks.cjs.map +1 -0
- package/dist/plugin-utils/type-checks.d.cts +5 -5
- package/dist/plugin-utils/type-checks.d.cts.map +1 -1
- package/dist/plugin-utils/type-checks.d.mts +5 -5
- package/dist/plugin-utils/type-checks.d.mts.map +1 -1
- package/dist/plugin-utils/type-checks.mjs +145 -16
- package/dist/plugin-utils/type-checks.mjs.map +1 -1
- package/dist/plugin.cjs +80 -56
- package/dist/plugin.cjs.map +1 -0
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +75 -52
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/helpers.cjs +33 -24
- package/dist/resolver/helpers.cjs.map +1 -0
- package/dist/resolver/helpers.mjs +32 -22
- package/dist/resolver/helpers.mjs.map +1 -1
- package/dist/resolver/resolve.cjs +319 -61
- package/dist/resolver/resolve.cjs.map +1 -0
- package/dist/resolver/resolve.mjs +316 -58
- package/dist/resolver/resolve.mjs.map +1 -1
- package/dist/types/command.cjs +43 -82
- package/dist/types/command.cjs.map +1 -0
- package/dist/types/command.d.cts +61 -119
- package/dist/types/command.d.cts.map +1 -1
- package/dist/types/command.d.mts +61 -119
- package/dist/types/command.d.mts.map +1 -1
- package/dist/types/command.mjs +42 -80
- package/dist/types/command.mjs.map +1 -1
- package/dist/types/config.cjs +45 -4
- package/dist/types/config.cjs.map +1 -0
- package/dist/types/config.d.cts +16 -11
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +16 -11
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/config.mjs +40 -4
- package/dist/types/config.mjs.map +1 -1
- package/dist/types/context.cjs +9 -1
- package/dist/types/context.cjs.map +1 -0
- package/dist/types/context.d.cts +3 -2
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts +3 -2
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/context.mjs +7 -1
- package/dist/types/context.mjs.map +1 -1
- package/dist/types/env.cjs +2 -1
- package/dist/types/env.cjs.map +1 -0
- package/dist/types/env.d.cts.map +1 -1
- package/dist/types/env.d.mts.map +1 -1
- package/dist/types/env.mjs.map +1 -1
- package/dist/types/index.cjs +6 -3
- package/dist/types/index.d.cts +4 -4
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.mjs +4 -4
- package/dist/types/options.cjs +2 -1
- package/dist/types/options.cjs.map +1 -0
- package/dist/types/options.d.cts.map +1 -1
- package/dist/types/options.d.mts.map +1 -1
- package/dist/types/options.mjs.map +1 -1
- package/package.json +43 -35
- package/dist/resolver/deepkit.cjs +0 -135
- package/dist/resolver/deepkit.mjs +0 -135
- package/dist/resolver/deepkit.mjs.map +0 -1
- package/dist/resolver/module.cjs +0 -145
- package/dist/resolver/module.mjs +0 -145
- package/dist/resolver/module.mjs.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
3
|
-
import defu$1 from "defu";
|
|
4
2
|
import { Show, code, splitProps } from "@alloy-js/core";
|
|
3
|
+
import defu$1 from "defu";
|
|
5
4
|
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
6
5
|
import { FunctionDeclaration, InterfaceDeclaration, InterfaceMember, VarDeclaration } from "@alloy-js/typescript";
|
|
7
6
|
import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
@@ -327,10 +326,8 @@ function ExecBuiltin(props) {
|
|
|
327
326
|
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.",
|
|
328
327
|
get children() {
|
|
329
328
|
return createComponent(TSDocDefaultValue, {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
},
|
|
333
|
-
defaultValue: "300000"
|
|
329
|
+
type: "number",
|
|
330
|
+
defaultValue: "300_000"
|
|
334
331
|
});
|
|
335
332
|
}
|
|
336
333
|
}),
|
|
@@ -416,14 +413,14 @@ function ExecBuiltin(props) {
|
|
|
416
413
|
}, {
|
|
417
414
|
name: "optionsOrTimeoutMs",
|
|
418
415
|
type: "number | SpawnOptions",
|
|
419
|
-
default: "
|
|
416
|
+
default: "300_000"
|
|
420
417
|
}],
|
|
421
418
|
returnType: "Promise<SpawnResult>",
|
|
422
419
|
children: code`const options: SpawnOptions =
|
|
423
420
|
typeof optionsOrTimeoutMs === "number"
|
|
424
421
|
? { timeoutMs: optionsOrTimeoutMs }
|
|
425
422
|
: optionsOrTimeoutMs;
|
|
426
|
-
const { timeoutMs =
|
|
423
|
+
const { timeoutMs = 300_000, cwd, input, noOutputTimeoutMs } = options;
|
|
427
424
|
|
|
428
425
|
const resolvedArgv =
|
|
429
426
|
isWindows
|
|
@@ -671,7 +668,7 @@ return new Promise((resolve, reject) => {
|
|
|
671
668
|
}, {
|
|
672
669
|
name: "optionsOrTimeoutMs",
|
|
673
670
|
type: "number | SpawnOptions",
|
|
674
|
-
default: "
|
|
671
|
+
default: "300_000"
|
|
675
672
|
}],
|
|
676
673
|
returnType: "Promise<string>",
|
|
677
674
|
children: code`const spawnResult = await spawn(argv, optionsOrTimeoutMs);
|
|
@@ -715,7 +712,7 @@ return new Promise((resolve, reject) => {
|
|
|
715
712
|
children: code`return execFileSync(argv.length > 0 ? argv[0] : "", argv.slice(1), {
|
|
716
713
|
encoding: "utf8",
|
|
717
714
|
stdio: ["ignore", "pipe", "ignore"],
|
|
718
|
-
timeout: options.timeoutMs ??
|
|
715
|
+
timeout: options.timeoutMs ?? 300_000,
|
|
719
716
|
env: resolveCommandEnv({ argv, env: options.env }),
|
|
720
717
|
cwd: options.cwd || process.cwd(),
|
|
721
718
|
windowsHide: true
|
|
@@ -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\";\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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mB,SAAA,EAAA,CAAA;IAAA,gBAAA,OAAA;KACnB,SAAM;KACN,IAAE,WAAW;AACX,aAAO;OAAC,gBAAkB,YAAS;QACnC,MAAQ;QACR,UAAK;QACL,CAAA;OAAI,gBAAgB,YAAa;QACjC,MAAA;QACC,UAAS;QACZ,CAAA;OAAA,gBAAmB,cAAA,EACpB,UAAS;;;KAGV,CAAA;IAAA,gBAAW,qBAAA;KACd,UAAA;KACH,MAAA"}
|
|
1
|
+
{"version":3,"file":"exec-builtin.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_types_command = require('../types/command.cjs');
|
|
4
2
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
3
|
let _alloy_js_core = require("@alloy-js/core");
|
|
6
4
|
|
|
@@ -95,11 +93,11 @@ IsNotVerbose.__type = [
|
|
|
95
93
|
*/
|
|
96
94
|
function CommandParameterType(props) {
|
|
97
95
|
const { parameter } = props;
|
|
98
|
-
return _alloy_js_core.code`${(parameter.
|
|
96
|
+
return _alloy_js_core.code`${(parameter.type === "string" || parameter.type === "number") && parameter.choices && parameter.choices.length > 0 ? parameter.choices.map(__assignType((choice) => typeof choice === "string" ? `"${choice}"` : choice, [
|
|
99
97
|
"choice",
|
|
100
98
|
"",
|
|
101
99
|
"P\"2!\"/\""
|
|
102
|
-
])).join(" | ") : parameter.
|
|
100
|
+
])).join(" | ") : parameter.type === "boolean" ? "boolean" : parameter.type === "number" ? "number" : "string"}${parameter.variadic ? "[]" : ""}${!parameter.required ? " | undefined" : ""}`;
|
|
103
101
|
}
|
|
104
102
|
CommandParameterType.__type = [
|
|
105
103
|
"CommandParameter",
|
|
@@ -117,4 +115,5 @@ exports.IsDebug = IsDebug;
|
|
|
117
115
|
exports.IsNotDebug = IsNotDebug;
|
|
118
116
|
exports.IsNotVerbose = IsNotVerbose;
|
|
119
117
|
exports.IsVerbose = IsVerbose;
|
|
120
|
-
exports.__ΩBooleanInputParserLogicProps = __ΩBooleanInputParserLogicProps;
|
|
118
|
+
exports.__ΩBooleanInputParserLogicProps = __ΩBooleanInputParserLogicProps;
|
|
119
|
+
//# sourceMappingURL=helpers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.cjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { CommandParameter } from "../types/command.cjs";
|
|
2
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
|
-
|
|
4
2
|
//#region src/components/helpers.d.ts
|
|
5
3
|
interface BooleanInputParserLogicProps {
|
|
6
4
|
name: string;
|
|
@@ -8,35 +6,35 @@ interface BooleanInputParserLogicProps {
|
|
|
8
6
|
/**
|
|
9
7
|
* Parses a string input into a boolean value, interpreting common truthy and falsy string representations.
|
|
10
8
|
*/
|
|
11
|
-
declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps):
|
|
9
|
+
declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps): import("@alloy-js/core").Children;
|
|
12
10
|
/**
|
|
13
11
|
* Write the logic to determine if the application is running in debug mode.
|
|
14
12
|
*
|
|
15
13
|
* @remarks
|
|
16
14
|
* 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.
|
|
17
15
|
*/
|
|
18
|
-
declare function IsDebug():
|
|
16
|
+
declare function IsDebug(): import("@alloy-js/core").Children;
|
|
19
17
|
/**
|
|
20
18
|
* Write the logic to determine if the application is **not** running in debug mode.
|
|
21
19
|
*/
|
|
22
|
-
declare function IsNotDebug():
|
|
20
|
+
declare function IsNotDebug(): import("@alloy-js/core").Children;
|
|
23
21
|
/**
|
|
24
22
|
* Write the logic to determine if the application is running in verbose mode.
|
|
25
23
|
*
|
|
26
24
|
* @remarks
|
|
27
25
|
* 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.
|
|
28
26
|
*/
|
|
29
|
-
declare function IsVerbose():
|
|
27
|
+
declare function IsVerbose(): import("@alloy-js/core").Children;
|
|
30
28
|
/**
|
|
31
29
|
* Write the logic to determine if the application is **not** running in verbose mode.
|
|
32
30
|
*/
|
|
33
|
-
declare function IsNotVerbose():
|
|
31
|
+
declare function IsNotVerbose(): import("@alloy-js/core").Children;
|
|
34
32
|
/**
|
|
35
33
|
* Write the type declaration for a command parameter based on its configuration.
|
|
36
34
|
*/
|
|
37
35
|
declare function CommandParameterType(props: {
|
|
38
36
|
parameter: CommandParameter;
|
|
39
|
-
}):
|
|
37
|
+
}): import("@alloy-js/core").Children;
|
|
40
38
|
//#endregion
|
|
41
39
|
export { BooleanInputParserLogic, BooleanInputParserLogicProps, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose };
|
|
42
40
|
//# sourceMappingURL=helpers.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.cts","names":[],"sources":["../../src/components/helpers.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.cts","names":[],"sources":["../../src/components/helpers.tsx"],"mappings":";;UAqBiB,4BAAA;EACf,IAAI;AAAA;AADN;;;AAAA,iBAOgB,uBAAA,CAAwB,KAAA,EAAO,4BAA4B,4BAAA,QAAA;AANrE;AAMN;;;;;AANM,iBAgCU,OAAA,6BAAO,QAAA;;;AA1BoD;iBAiC3D,UAAA,6BAAU,QAAA;;;;AAPH;AAOvB;;iBAgBgB,SAAA,6BAAS,QAAA;;AAhBC;AAgB1B;iBAagB,YAAA,6BAAY,QAAA;;;AAbH;iBA0BT,oBAAA,CAAqB,KAAA;EAAS,SAAA,EAAW,gBAAgB;AAAA,6BAAE,QAAA"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { CommandParameter } from "../types/command.mjs";
|
|
2
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
|
-
|
|
4
2
|
//#region src/components/helpers.d.ts
|
|
5
3
|
interface BooleanInputParserLogicProps {
|
|
6
4
|
name: string;
|
|
@@ -8,35 +6,35 @@ interface BooleanInputParserLogicProps {
|
|
|
8
6
|
/**
|
|
9
7
|
* Parses a string input into a boolean value, interpreting common truthy and falsy string representations.
|
|
10
8
|
*/
|
|
11
|
-
declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps):
|
|
9
|
+
declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps): import("@alloy-js/core").Children;
|
|
12
10
|
/**
|
|
13
11
|
* Write the logic to determine if the application is running in debug mode.
|
|
14
12
|
*
|
|
15
13
|
* @remarks
|
|
16
14
|
* 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.
|
|
17
15
|
*/
|
|
18
|
-
declare function IsDebug():
|
|
16
|
+
declare function IsDebug(): import("@alloy-js/core").Children;
|
|
19
17
|
/**
|
|
20
18
|
* Write the logic to determine if the application is **not** running in debug mode.
|
|
21
19
|
*/
|
|
22
|
-
declare function IsNotDebug():
|
|
20
|
+
declare function IsNotDebug(): import("@alloy-js/core").Children;
|
|
23
21
|
/**
|
|
24
22
|
* Write the logic to determine if the application is running in verbose mode.
|
|
25
23
|
*
|
|
26
24
|
* @remarks
|
|
27
25
|
* 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.
|
|
28
26
|
*/
|
|
29
|
-
declare function IsVerbose():
|
|
27
|
+
declare function IsVerbose(): import("@alloy-js/core").Children;
|
|
30
28
|
/**
|
|
31
29
|
* Write the logic to determine if the application is **not** running in verbose mode.
|
|
32
30
|
*/
|
|
33
|
-
declare function IsNotVerbose():
|
|
31
|
+
declare function IsNotVerbose(): import("@alloy-js/core").Children;
|
|
34
32
|
/**
|
|
35
33
|
* Write the type declaration for a command parameter based on its configuration.
|
|
36
34
|
*/
|
|
37
35
|
declare function CommandParameterType(props: {
|
|
38
36
|
parameter: CommandParameter;
|
|
39
|
-
}):
|
|
37
|
+
}): import("@alloy-js/core").Children;
|
|
40
38
|
//#endregion
|
|
41
39
|
export { BooleanInputParserLogic, BooleanInputParserLogicProps, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose };
|
|
42
40
|
//# sourceMappingURL=helpers.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.mts","names":[],"sources":["../../src/components/helpers.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.mts","names":[],"sources":["../../src/components/helpers.tsx"],"mappings":""}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CommandParameterKinds } from "../types/command.mjs";
|
|
2
1
|
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
3
2
|
import { code } from "@alloy-js/core";
|
|
4
3
|
|
|
@@ -93,11 +92,11 @@ IsNotVerbose.__type = [
|
|
|
93
92
|
*/
|
|
94
93
|
function CommandParameterType(props) {
|
|
95
94
|
const { parameter } = props;
|
|
96
|
-
return code`${(parameter.
|
|
95
|
+
return code`${(parameter.type === "string" || parameter.type === "number") && parameter.choices && parameter.choices.length > 0 ? parameter.choices.map(__assignType((choice) => typeof choice === "string" ? `"${choice}"` : choice, [
|
|
97
96
|
"choice",
|
|
98
97
|
"",
|
|
99
98
|
"P\"2!\"/\""
|
|
100
|
-
])).join(" | ") : parameter.
|
|
99
|
+
])).join(" | ") : parameter.type === "boolean" ? "boolean" : parameter.type === "number" ? "number" : "string"}${parameter.variadic ? "[]" : ""}${!parameter.required ? " | undefined" : ""}`;
|
|
101
100
|
}
|
|
102
101
|
CommandParameterType.__type = [
|
|
103
102
|
"CommandParameter",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.mjs","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"helpers.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
2
|
const require_context_helpers = require('../plugin-utils/context-helpers.cjs');
|
|
4
|
-
const require_types_command = require('../types/command.cjs');
|
|
5
3
|
const require_contexts_options = require('../contexts/options.cjs');
|
|
6
4
|
const require_components_helpers = require('./helpers.cjs');
|
|
7
5
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
8
7
|
let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
9
8
|
let _stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
|
|
10
9
|
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
11
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
12
10
|
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
13
11
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
14
12
|
let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
@@ -183,10 +181,10 @@ function ArgumentsParserLogic(props) {
|
|
|
183
181
|
return arg.variadic;
|
|
184
182
|
},
|
|
185
183
|
get fallback() {
|
|
186
|
-
return arg.
|
|
184
|
+
return arg.type === "string" ? _alloy_js_core.code`"${arg.default}"` : _alloy_js_core.code`${arg.default}`;
|
|
187
185
|
},
|
|
188
186
|
get children() {
|
|
189
|
-
return _alloy_js_core.code`[${arg.default?.map(__assignType((value) => arg.
|
|
187
|
+
return _alloy_js_core.code`[${arg.default?.map(__assignType((value) => arg.type === "string" ? `"${value}"` : value, [
|
|
190
188
|
"value",
|
|
191
189
|
"",
|
|
192
190
|
"P\"2!\"/\""
|
|
@@ -211,7 +209,7 @@ function ArgumentsParserLogic(props) {
|
|
|
211
209
|
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} = `),
|
|
212
210
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
213
211
|
get when() {
|
|
214
|
-
return arg.
|
|
212
|
+
return arg.type === "string" || arg.type === "number";
|
|
215
213
|
},
|
|
216
214
|
get fallback() {
|
|
217
215
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.BooleanInputParserLogic, { name: `args[argsIndex + ${index}] ` });
|
|
@@ -224,7 +222,7 @@ function ArgumentsParserLogic(props) {
|
|
|
224
222
|
get fallback() {
|
|
225
223
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
226
224
|
get when() {
|
|
227
|
-
return arg.
|
|
225
|
+
return arg.type === "number";
|
|
228
226
|
},
|
|
229
227
|
fallback: _alloy_js_core.code`args[argsIndex + ${index}] `,
|
|
230
228
|
children: _alloy_js_core.code`Number(args[argsIndex + ${index}]) `
|
|
@@ -274,7 +272,7 @@ function OptionsMember({ option }) {
|
|
|
274
272
|
return [
|
|
275
273
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
276
274
|
get when() {
|
|
277
|
-
return option.
|
|
275
|
+
return option.type === "string";
|
|
278
276
|
},
|
|
279
277
|
get children() {
|
|
280
278
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
@@ -286,14 +284,14 @@ function OptionsMember({ option }) {
|
|
|
286
284
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: option });
|
|
287
285
|
},
|
|
288
286
|
get optional() {
|
|
289
|
-
return option.
|
|
287
|
+
return !option.required;
|
|
290
288
|
}
|
|
291
289
|
});
|
|
292
290
|
}
|
|
293
291
|
}),
|
|
294
292
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
295
293
|
get when() {
|
|
296
|
-
return option.
|
|
294
|
+
return option.type === "number";
|
|
297
295
|
},
|
|
298
296
|
get children() {
|
|
299
297
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
@@ -305,14 +303,14 @@ function OptionsMember({ option }) {
|
|
|
305
303
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: option });
|
|
306
304
|
},
|
|
307
305
|
get optional() {
|
|
308
|
-
return option.
|
|
306
|
+
return !option.required;
|
|
309
307
|
}
|
|
310
308
|
});
|
|
311
309
|
}
|
|
312
310
|
}),
|
|
313
311
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
314
312
|
get when() {
|
|
315
|
-
return option.
|
|
313
|
+
return option.type === "boolean";
|
|
316
314
|
},
|
|
317
315
|
get children() {
|
|
318
316
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
@@ -324,7 +322,7 @@ function OptionsMember({ option }) {
|
|
|
324
322
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_helpers.CommandParameterType, { parameter: option });
|
|
325
323
|
},
|
|
326
324
|
get optional() {
|
|
327
|
-
return option.
|
|
325
|
+
return !option.required;
|
|
328
326
|
}
|
|
329
327
|
});
|
|
330
328
|
}
|
|
@@ -365,7 +363,7 @@ function OptionsMemberParserLogic(props) {
|
|
|
365
363
|
])).join("|")})=/`;
|
|
366
364
|
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
367
365
|
get when() {
|
|
368
|
-
return option.
|
|
366
|
+
return option.type === "string" || option.type === "number";
|
|
369
367
|
},
|
|
370
368
|
get children() {
|
|
371
369
|
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
@@ -395,19 +393,19 @@ function OptionsMemberParserLogic(props) {
|
|
|
395
393
|
}),
|
|
396
394
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
397
395
|
get when() {
|
|
398
|
-
return option.
|
|
396
|
+
return option.type === "string";
|
|
399
397
|
},
|
|
400
398
|
children: _alloy_js_core.code`...arg.replace(${equalsRegex}, "").split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean) `
|
|
401
399
|
}),
|
|
402
400
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
403
401
|
get when() {
|
|
404
|
-
return option.
|
|
402
|
+
return option.type === "number";
|
|
405
403
|
},
|
|
406
404
|
children: _alloy_js_core.code`...arg.replace(${equalsRegex}, "").split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean).map(Number).filter(value => !Number.isNaN(value)) `
|
|
407
405
|
}),
|
|
408
406
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
409
407
|
get when() {
|
|
410
|
-
return (option.
|
|
408
|
+
return (option.type === "string" || option.type === "number") && option.choices && option.choices.length > 0;
|
|
411
409
|
},
|
|
412
410
|
get children() {
|
|
413
411
|
return _alloy_js_core.code` as ${option.choices?.map(__assignType((choice) => (0, _stryke_type_checks_is_set_string.isSetString)(choice) ? `"${choice}"` : choice, [
|
|
@@ -434,19 +432,19 @@ function OptionsMemberParserLogic(props) {
|
|
|
434
432
|
}),
|
|
435
433
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
436
434
|
get when() {
|
|
437
|
-
return option.
|
|
435
|
+
return option.type === "string";
|
|
438
436
|
},
|
|
439
437
|
children: _alloy_js_core.code`...args[++i].split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean) `
|
|
440
438
|
}),
|
|
441
439
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
442
440
|
get when() {
|
|
443
|
-
return option.
|
|
441
|
+
return option.type === "number";
|
|
444
442
|
},
|
|
445
443
|
children: _alloy_js_core.code`...args[++i].split(",").map(item => item.trim().replace(/^("|')/, "").replace(/("|')$/, "")).filter(Boolean).map(Number).filter(value => !Number.isNaN(value)) `
|
|
446
444
|
}),
|
|
447
445
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
448
446
|
get when() {
|
|
449
|
-
return (option.
|
|
447
|
+
return (option.type === "string" || option.type === "number") && option.choices && option.choices.length > 0;
|
|
450
448
|
},
|
|
451
449
|
get children() {
|
|
452
450
|
return _alloy_js_core.code` as ${option.choices?.map(__assignType((choice) => (0, _stryke_type_checks_is_set_string.isSetString)(choice) ? `"${choice}"` : choice, [
|
|
@@ -473,7 +471,7 @@ function OptionsMemberParserLogic(props) {
|
|
|
473
471
|
get children() {
|
|
474
472
|
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
475
473
|
get when() {
|
|
476
|
-
return option.
|
|
474
|
+
return option.type === "string";
|
|
477
475
|
},
|
|
478
476
|
get children() {
|
|
479
477
|
return [
|
|
@@ -502,7 +500,7 @@ function OptionsMemberParserLogic(props) {
|
|
|
502
500
|
}
|
|
503
501
|
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
504
502
|
get when() {
|
|
505
|
-
return option.
|
|
503
|
+
return option.type === "number";
|
|
506
504
|
},
|
|
507
505
|
get children() {
|
|
508
506
|
return [
|
|
@@ -546,7 +544,7 @@ function OptionsMemberParserLogic(props) {
|
|
|
546
544
|
get children() {
|
|
547
545
|
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
548
546
|
get when() {
|
|
549
|
-
return option.
|
|
547
|
+
return option.type === "string";
|
|
550
548
|
},
|
|
551
549
|
get children() {
|
|
552
550
|
return [
|
|
@@ -575,7 +573,7 @@ function OptionsMemberParserLogic(props) {
|
|
|
575
573
|
}
|
|
576
574
|
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
577
575
|
get when() {
|
|
578
|
-
return option.
|
|
576
|
+
return option.type === "number";
|
|
579
577
|
},
|
|
580
578
|
get children() {
|
|
581
579
|
return [
|
|
@@ -621,7 +619,7 @@ function OptionsMemberParserLogic(props) {
|
|
|
621
619
|
}
|
|
622
620
|
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
623
621
|
get when() {
|
|
624
|
-
return option.
|
|
622
|
+
return option.type === "boolean";
|
|
625
623
|
},
|
|
626
624
|
get children() {
|
|
627
625
|
return [
|
|
@@ -789,14 +787,14 @@ function OptionsParserLogic(props) {
|
|
|
789
787
|
name: "options",
|
|
790
788
|
get initializer() {
|
|
791
789
|
return _alloy_js_core.code` {
|
|
792
|
-
${segments.length > 0 ? "...useGlobalOptions(), " : ""}${Object.entries(options.value).filter(__assignType(([, option]) => option.env || option.default !== void 0 || (option.
|
|
790
|
+
${segments.length > 0 ? "...useGlobalOptions(), " : ""}${Object.entries(options.value).filter(__assignType(([, option]) => option.env || option.default !== void 0 || (option.type === "string" || option.type === "number") && option.variadic, [
|
|
793
791
|
"param0",
|
|
794
792
|
"",
|
|
795
793
|
"P\"2!\"/\""
|
|
796
794
|
])).map(__assignType(([name, option]) => {
|
|
797
|
-
if (option.
|
|
798
|
-
else if (option.
|
|
799
|
-
else if (option.
|
|
795
|
+
if (option.type === "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}"` : ""}, `;
|
|
796
|
+
else if (option.type === "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}` : ""}, `;
|
|
797
|
+
else if (option.type === "boolean") return ` ${name.includes("?") || name.includes("-") ? `"${name}"` : `${name}`}: ${option.env ? `env.${appSpecificEnvPrefix}_${option.env} ?? ` : ""}${option.default ? "true" : "false"},`;
|
|
800
798
|
return "";
|
|
801
799
|
}, [
|
|
802
800
|
"param0",
|
|
@@ -959,4 +957,5 @@ exports.__ΩCommandParserLogicProps = __ΩCommandParserLogicProps;
|
|
|
959
957
|
exports.__ΩDynamicSegmentsParserLogicProps = __ΩDynamicSegmentsParserLogicProps;
|
|
960
958
|
exports.__ΩOptionsMemberParserConditionProps = __ΩOptionsMemberParserConditionProps;
|
|
961
959
|
exports.__ΩOptionsMemberParserLogicProps = __ΩOptionsMemberParserLogicProps;
|
|
962
|
-
exports.__ΩOptionsParserLogicProps = __ΩOptionsParserLogicProps;
|
|
960
|
+
exports.__ΩOptionsParserLogicProps = __ΩOptionsParserLogicProps;
|
|
961
|
+
//# sourceMappingURL=options-parser-logic.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options-parser-logic.cjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CommandOption, CommandTree } from "../types/command.cjs";
|
|
2
2
|
import { PartialKeys } from "@stryke/types/base";
|
|
3
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
4
3
|
|
|
5
4
|
//#region src/components/options-parser-logic.d.ts
|
|
6
5
|
interface DynamicSegmentsParserLogicProps {
|
|
@@ -13,7 +12,7 @@ interface DynamicSegmentsParserLogicProps {
|
|
|
13
12
|
*/
|
|
14
13
|
isCaseSensitive: boolean;
|
|
15
14
|
}
|
|
16
|
-
declare function DynamicSegmentsParserLogic(props: DynamicSegmentsParserLogicProps):
|
|
15
|
+
declare function DynamicSegmentsParserLogic(props: DynamicSegmentsParserLogicProps): import("@alloy-js/core").Children;
|
|
17
16
|
interface ArgumentsParserLogicProps {
|
|
18
17
|
/**
|
|
19
18
|
* The command to generate the positional parameters parser logic for.
|
|
@@ -28,7 +27,7 @@ interface ArgumentsParserLogicProps {
|
|
|
28
27
|
*/
|
|
29
28
|
isCaseSensitive: boolean;
|
|
30
29
|
}
|
|
31
|
-
declare function ArgumentsParserLogic(props: ArgumentsParserLogicProps):
|
|
30
|
+
declare function ArgumentsParserLogic(props: ArgumentsParserLogicProps): import("@alloy-js/core").Children;
|
|
32
31
|
/**
|
|
33
32
|
* The command option interface property.
|
|
34
33
|
*/
|
|
@@ -36,7 +35,7 @@ declare function OptionsMember({
|
|
|
36
35
|
option
|
|
37
36
|
}: {
|
|
38
37
|
option: CommandOption;
|
|
39
|
-
}):
|
|
38
|
+
}): import("@alloy-js/core").Children;
|
|
40
39
|
interface OptionsMemberParserLogicProps {
|
|
41
40
|
/**
|
|
42
41
|
* The option name to generate the parser logic for.
|
|
@@ -56,7 +55,7 @@ interface OptionsMemberParserLogicProps {
|
|
|
56
55
|
/**
|
|
57
56
|
* The command option property parser logic.
|
|
58
57
|
*/
|
|
59
|
-
declare function OptionsMemberParserLogic(props: OptionsMemberParserLogicProps):
|
|
58
|
+
declare function OptionsMemberParserLogic(props: OptionsMemberParserLogicProps): import("@alloy-js/core").Children;
|
|
60
59
|
interface OptionsMemberParserConditionProps {
|
|
61
60
|
/**
|
|
62
61
|
* The option name to generate the parser logic for.
|
|
@@ -73,10 +72,10 @@ interface OptionsMemberParserConditionProps {
|
|
|
73
72
|
*/
|
|
74
73
|
isCaseSensitive: boolean;
|
|
75
74
|
}
|
|
76
|
-
declare function OptionsMemberParserCondition(props: OptionsMemberParserConditionProps):
|
|
75
|
+
declare function OptionsMemberParserCondition(props: OptionsMemberParserConditionProps): import("@alloy-js/core").Children;
|
|
77
76
|
declare function OptionsInterfaceDeclaration(props: {
|
|
78
77
|
command: CommandTree;
|
|
79
|
-
}):
|
|
78
|
+
}): import("@alloy-js/core").Children;
|
|
80
79
|
interface OptionsParserLogicProps extends PartialKeys<Pick<CommandTree, "segments" | "options" | "name">, "segments" | "name"> {
|
|
81
80
|
/**
|
|
82
81
|
* The environment variable prefix to use for options that have an associated environment variable. This prefix will be used in the generated code to access the environment variables (e.g., `env.${appSpecificEnvPrefix}_OPTION_NAME`).
|
|
@@ -92,7 +91,7 @@ interface OptionsParserLogicProps extends PartialKeys<Pick<CommandTree, "segment
|
|
|
92
91
|
/**
|
|
93
92
|
* The command options parser logic.
|
|
94
93
|
*/
|
|
95
|
-
declare function OptionsParserLogic(props: OptionsParserLogicProps):
|
|
94
|
+
declare function OptionsParserLogic(props: OptionsParserLogicProps): import("@alloy-js/core").Children;
|
|
96
95
|
interface CommandParserLogicProps {
|
|
97
96
|
/**
|
|
98
97
|
* The command to generate the parser logic for.
|
|
@@ -112,7 +111,7 @@ interface CommandParserLogicProps {
|
|
|
112
111
|
/**
|
|
113
112
|
* The command parser logic, which includes parsing dynamic path segments, positional parameters, and options.
|
|
114
113
|
*/
|
|
115
|
-
declare function CommandParserLogic(props: CommandParserLogicProps):
|
|
114
|
+
declare function CommandParserLogic(props: CommandParserLogicProps): import("@alloy-js/core").Children;
|
|
116
115
|
//#endregion
|
|
117
116
|
export { ArgumentsParserLogic, ArgumentsParserLogicProps, CommandParserLogic, CommandParserLogicProps, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps };
|
|
118
117
|
//# sourceMappingURL=options-parser-logic.d.cts.map
|