@shell-shock/core 0.12.0 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/command-validation-logic.cjs +196 -0
- package/dist/components/command-validation-logic.cjs.map +1 -0
- package/dist/components/command-validation-logic.d.cts +15 -0
- package/dist/components/command-validation-logic.d.cts.map +1 -0
- package/dist/components/command-validation-logic.d.mts +15 -0
- package/dist/components/command-validation-logic.d.mts.map +1 -0
- package/dist/components/command-validation-logic.mjs +195 -0
- package/dist/components/command-validation-logic.mjs.map +1 -0
- package/dist/components/docs.d.cts +5 -5
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts +5 -5
- package/dist/components/docs.d.mts.map +1 -1
- package/dist/components/helpers.d.cts +7 -7
- package/dist/components/helpers.d.cts.map +1 -1
- package/dist/components/helpers.d.mts +7 -7
- package/dist/components/index.cjs +2 -0
- package/dist/components/index.d.cts +2 -1
- package/dist/components/index.d.mts +2 -1
- package/dist/components/index.mjs +2 -1
- package/dist/components/options-parser-logic.cjs.map +1 -1
- package/dist/components/options-parser-logic.d.cts +11 -11
- package/dist/components/options-parser-logic.d.mts +11 -11
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/usage.d.cts +2 -2
- package/dist/components/usage.d.mts +2 -2
- package/dist/components/utils-builtin.cjs +5 -9
- package/dist/components/utils-builtin.cjs.map +1 -1
- package/dist/components/utils-builtin.d.cts +9 -9
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts +9 -9
- package/dist/components/utils-builtin.d.mts.map +1 -1
- package/dist/components/utils-builtin.mjs +5 -9
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/helpers/automd.cjs +1 -1
- package/dist/helpers/automd.cjs.map +1 -1
- package/dist/helpers/automd.mjs +1 -1
- package/dist/helpers/automd.mjs.map +1 -1
- package/dist/plugin-utils/get-command-tree.cjs +26 -0
- package/dist/plugin-utils/get-command-tree.cjs.map +1 -1
- package/dist/plugin-utils/get-command-tree.d.cts +8 -1
- package/dist/plugin-utils/get-command-tree.d.cts.map +1 -1
- package/dist/plugin-utils/get-command-tree.d.mts +8 -1
- package/dist/plugin-utils/get-command-tree.d.mts.map +1 -1
- package/dist/plugin-utils/get-command-tree.mjs +26 -1
- package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +2 -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/type-checks.d.cts.map +1 -1
- package/dist/plugin.cjs +1 -1
- package/dist/plugin.mjs +1 -1
- package/dist/resolver/helpers.cjs +1 -1
- package/dist/resolver/helpers.cjs.map +1 -1
- package/dist/resolver/helpers.mjs +1 -1
- package/dist/resolver/helpers.mjs.map +1 -1
- package/dist/resolver/module.cjs +2 -2
- package/dist/resolver/module.cjs.map +1 -1
- package/dist/resolver/module.mjs +2 -2
- package/dist/resolver/module.mjs.map +1 -1
- package/package.json +35 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-builtin.cjs","names":["code","Show","splitProps","FunctionDeclaration","InterfaceDeclaration","InterfaceMember","TypeDeclaration","VarDeclaration","Spacing","usePowerlines","BuiltinFile","TSDoc","TSDocInternal","TSDocLink","TSDocParam","TSDocRemarks","TSDocReturns","defu","FindSuggestionsDeclaration","context","_$createComponent","name","initializer","heading","children","_$createIntrinsic","parameters","type","returnType","config","isCaseSensitive","_$memo","EnvSupportUtilities","doc","ColorSupportUtilities","default","HyperlinkSupportUtilities","ArgsUtilities","SpawnFunctionDeclaration","async","optional","ContextUtilities","UtilsBuiltin","props","rest","_$mergeProps","id","description","imports","alias","builtinImports","console","env","when","Boolean"],"sources":["../../src/components/utils-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 TypeDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/dist/core/contexts/context.mjs\";\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 TSDocInternal,\n TSDocLink,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport defu from \"defu\";\nimport type { Context } from \"../types/context\";\n\nexport interface UtilsBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {}\n\n/**\n * Generates the `findSuggestions` function for suggesting corrections for potentially misspelled options or commands.\n */\nexport function FindSuggestionsDeclaration() {\n const context = usePowerlines<Context>();\n\n return (\n <>\n <VarDeclaration\n const\n name=\"deburred\"\n initializer={code` {\n \"\\\\xc0\": \"A\", \"\\\\xc1\": \"A\", \"\\\\xc2\": \"A\", \"\\\\xc3\": \"A\", \"\\\\xc4\": \"A\", \"\\\\xc5\": \"A\",\n \"\\\\xe0\": \"a\", \"\\\\xe1\": \"a\", \"\\\\xe2\": \"a\", \"\\\\xe3\": \"a\", \"\\\\xe4\": \"a\", \"\\\\xe5\": \"a\",\n \"\\\\xc7\": \"C\", \"\\\\xe7\": \"c\",\n \"\\\\xd0\": \"D\", \"\\\\xf0\": \"d\",\n \"\\\\xc8\": \"E\", \"\\\\xc9\": \"E\", \"\\\\xca\": \"E\", \"\\\\xcb\": \"E\",\n \"\\\\xe8\": \"e\", \"\\\\xe9\": \"e\", \"\\\\xea\": \"e\", \"\\\\xeb\": \"e\",\n \"\\\\xcc\": \"I\", \"\\\\xcd\": \"I\", \"\\\\xce\": \"I\", \"\\\\xcf\": \"I\",\n \"\\\\xec\": \"i\", \"\\\\xed\": \"i\", \"\\\\xee\": \"i\", \"\\\\xef\": \"i\",\n \"\\\\xd1\": \"N\", \"\\\\xf1\": \"n\",\n \"\\\\xd2\": \"O\", \"\\\\xd3\": \"O\", \"\\\\xd4\": \"O\", \"\\\\xd5\": \"O\", \"\\\\xd6\": \"O\", \"\\\\xd8\": \"O\",\n \"\\\\xf2\": \"o\", \"\\\\xf3\": \"o\", \"\\\\xf4\": \"o\", \"\\\\xf5\": \"o\", \"\\\\xf6\": \"o\", \"\\\\xf8\": \"o\",\n \"\\\\xd9\": \"U\", \"\\\\xda\": \"U\", \"\\\\xdb\": \"U\", \"\\\\xdc\": \"U\",\n \"\\\\xf9\": \"u\", \"\\\\xfa\": \"u\", \"\\\\xfb\": \"u\", \"\\\\xfc\": \"u\",\n \"\\\\xdd\": \"Y\", \"\\\\xfd\": \"y\", \"\\\\xff\": \"y\",\n \"\\\\xc6\": \"Ae\", \"\\\\xe6\": \"ae\",\n \"\\\\xde\": \"Th\", \"\\\\xfe\": \"th\",\n \"\\\\xdf\": \"ss\",\n \"\\\\u0100\": \"A\", \"\\\\u0102\": \"A\", \"\\\\u0104\": \"A\",\n \"\\\\u0101\": \"a\", \"\\\\u0103\": \"a\", \"\\\\u0105\": \"a\",\n \"\\\\u0106\": \"C\", \"\\\\u0108\": \"C\", \"\\\\u010a\": \"C\", \"\\\\u010c\": \"C\",\n \"\\\\u0107\": \"c\", \"\\\\u0109\": \"c\", \"\\\\u010b\": \"c\", \"\\\\u010d\": \"c\",\n \"\\\\u010e\": \"D\", \"\\\\u0110\": \"D\", \"\\\\u010f\": \"d\", \"\\\\u0111\": \"d\",\n \"\\\\u0112\": \"E\", \"\\\\u0114\": \"E\", \"\\\\u0116\": \"E\", \"\\\\u0118\": \"E\", \"\\\\u011a\": \"E\",\n \"\\\\u0113\": \"e\", \"\\\\u0115\": \"e\", \"\\\\u0117\": \"e\", \"\\\\u0119\": \"e\", \"\\\\u011b\": \"e\",\n \"\\\\u011c\": \"G\", \"\\\\u011e\": \"G\", \"\\\\u0120\": \"G\", \"\\\\u0122\": \"G\",\n \"\\\\u011d\": \"g\", \"\\\\u011f\": \"g\", \"\\\\u0121\": \"g\", \"\\\\u0123\": \"g\",\n \"\\\\u0124\": \"H\", \"\\\\u0126\": \"H\", \"\\\\u0125\": \"h\", \"\\\\u0127\": \"h\",\n \"\\\\u0128\": \"I\", \"\\\\u012a\": \"I\", \"\\\\u012c\": \"I\", \"\\\\u012e\": \"I\", \"\\\\u0130\": \"I\",\n \"\\\\u0129\": \"i\", \"\\\\u012b\": \"i\", \"\\\\u012d\": \"i\", \"\\\\u012f\": \"i\", \"\\\\u0131\": \"i\",\n \"\\\\u0134\": \"J\", \"\\\\u0135\": \"j\",\n \"\\\\u0136\": \"K\", \"\\\\u0137\": \"k\", \"\\\\u0138\": \"k\",\n \"\\\\u0139\": \"L\", \"\\\\u013b\": \"L\", \"\\\\u013d\": \"L\", \"\\\\u013f\": \"L\", \"\\\\u0141\": \"L\",\n \"\\\\u013a\": \"l\", \"\\\\u013c\": \"l\", \"\\\\u013e\": \"l\", \"\\\\u0140\": \"l\", \"\\\\u0142\": \"l\",\n \"\\\\u0143\": \"N\", \"\\\\u0145\": \"N\", \"\\\\u0147\": \"N\", \"\\\\u014a\": \"N\",\n \"\\\\u0144\": \"n\", \"\\\\u0146\": \"n\", \"\\\\u0148\": \"n\", \"\\\\u014b\": \"n\",\n \"\\\\u014c\": \"O\", \"\\\\u014e\": \"O\", \"\\\\u0150\": \"O\",\n \"\\\\u014d\": \"o\", \"\\\\u014f\": \"o\", \"\\\\u0151\": \"o\",\n \"\\\\u0154\": \"R\", \"\\\\u0156\": \"R\", \"\\\\u0158\": \"R\",\n \"\\\\u0155\": \"r\", \"\\\\u0157\": \"r\", \"\\\\u0159\": \"r\",\n \"\\\\u015a\": \"S\", \"\\\\u015c\": \"S\", \"\\\\u015e\": \"S\", \"\\\\u0160\": \"S\",\n \"\\\\u015b\": \"s\", \"\\\\u015d\": \"s\", \"\\\\u015f\": \"s\", \"\\\\u0161\": \"s\",\n \"\\\\u0162\": \"T\", \"\\\\u0164\": \"T\", \"\\\\u0166\": \"T\",\n \"\\\\u0163\": \"t\", \"\\\\u0165\": \"t\", \"\\\\u0167\": \"t\",\n \"\\\\u0168\": \"U\", \"\\\\u016a\": \"U\", \"\\\\u016c\": \"U\", \"\\\\u016e\": \"U\", \"\\\\u0170\": \"U\", \"\\\\u0172\": \"U\",\n \"\\\\u0169\": \"u\", \"\\\\u016b\": \"u\", \"\\\\u016d\": \"u\", \"\\\\u016f\": \"u\", \"\\\\u0171\": \"u\", \"\\\\u0173\": \"u\",\n \"\\\\u0174\": \"W\", \"\\\\u0175\": \"w\",\n \"\\\\u0176\": \"Y\", \"\\\\u0177\": \"y\", \"\\\\u0178\": \"Y\",\n \"\\\\u0179\": \"Z\", \"\\\\u017b\": \"Z\", \"\\\\u017d\": \"Z\",\n \"\\\\u017a\": \"z\", \"\\\\u017c\": \"z\", \"\\\\u017e\": \"z\",\n \"\\\\u0132\": \"IJ\", \"\\\\u0133\": \"ij\",\n \"\\\\u0152\": \"Oe\", \"\\\\u0153\": \"oe\",\n \"\\\\u0149\": \"n\", \"\\\\u017f\": \"s\"\n } as Record<string, string>; `}\n />\n <Spacing />\n <TSDoc heading=\"A utility function that takes an input string and a list of possible matches, and returns a list of suggested matches based on the Levenshtein distance between the input and the possible matches.\">\n <TSDocRemarks>\n {\n \"This function is intended to be used to suggest corrections for potentially misspelled options or commands.\"\n }\n </TSDocRemarks>\n <hbr />\n <hbr />\n <TSDocInternal />\n <hbr />\n <hbr />\n <TSDocParam name=\"input\">\n {\"The input string to check for potential matches.\"}\n </TSDocParam>\n <TSDocParam name=\"options\">\n {\"A list of possible matches to compare against the input.\"}\n </TSDocParam>\n <TSDocReturns>\n {\"A list of suggested matches based on the Levenshtein distance.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"findSuggestions\"\n parameters={[\n {\n name: \"input\",\n type: \"string\"\n },\n {\n name: \"options\",\n type: \"string[]\"\n }\n ]}\n returnType=\"string[]\">\n <VarDeclaration\n const\n name=\"normalizedInput\"\n initializer={code`String(input ?? \"\")${\n context.config.isCaseSensitive ? \"\" : \".toLowerCase()\"\n }.trim().replaceAll(/[\\\\s\\\\-_\\\\.]+/gu, \" \").replace(/[\\\\\\\\xc0-\\\\\\\\xd6\\\\\\\\xd8-\\\\\\\\xf6\\\\\\\\xf8-\\\\\\\\xff\\\\\\\\u0100-\\\\\\\\u017f]/g, key => deburred[key]).replace(/[\\\\\\\\u0300-\\\\\\\\u036f\\\\\\\\ufe20-\\\\\\\\ufe2f\\\\\\\\u20d0-\\\\\\\\u20ff]/g, \"\"); `}\n />\n <Spacing />\n {code`\n if (!normalizedInput || options.length === 0) {\n return [];\n }\n\n const threshold = Math.ceil(normalizedInput.length * 0.25) || 1;\n const results: Array<{ option: string; distance: number }> = [];\n\n for (const option of options) {\n const normalizedOption = String(option ?? \"\")${\n context.config.isCaseSensitive ? \"\" : \".toLowerCase()\"\n }.trim().replaceAll(/[\\\\s\\\\-_\\\\.]+/gu, \" \").replace(/[\\\\\\\\xc0-\\\\\\\\xd6\\\\\\\\xd8-\\\\\\\\xf6\\\\\\\\xf8-\\\\\\\\xff\\\\\\\\u0100-\\\\\\\\u017f]/g, key => deburred[key]).replace(/[\\\\\\\\u0300-\\\\\\\\u036f\\\\\\\\ufe20-\\\\\\\\ufe2f\\\\\\\\u20d0-\\\\\\\\u20ff]/g, \"\");\n\n if (!normalizedOption) {\n continue;\n }\n\n const lenA = normalizedInput.length;\n const lenB = normalizedOption.length;\n\n if (Math.abs(lenA - lenB) > threshold) {\n continue;\n }\n\n let distance: number;\n if (lenA === 0) {\n distance = lenB;\n } else if (lenB === 0) {\n distance = lenA;\n } else if (lenA <= 32) {\n const peq: Record<string, number> = {};\n for (let i = 0; i < lenA; i++) {\n const c = normalizedInput[i]!;\n peq[c] = (peq[c] || 0) | (1 << i);\n }\n\n let pv = -1;\n let mv = 0;\n let score = lenA;\n\n for (let j = 0; j < lenB; j++) {\n const eq = peq[normalizedOption[j]!] || 0;\n const xv = eq | mv;\n const xh = ((eq & pv) + pv) ^ pv ^ eq;\n let ph = mv | ~(xh | pv);\n let mh = pv & xh;\n\n if ((ph >>> (lenA - 1)) & 1) {\n score++;\n }\n if ((mh >>> (lenA - 1)) & 1) {\n score--;\n }\n\n ph = (ph << 1) | 1;\n mh = mh << 1;\n pv = mh | ~(xv | ph);\n mv = ph & xv;\n }\n\n distance = score;\n } else {\n const row = new Array(lenB + 1);\n for (let j = 0; j <= lenB; j++) {\n row[j] = j;\n }\n\n for (let i = 1; i <= lenA; i++) {\n let prev = i;\n for (let j = 1; j <= lenB; j++) {\n const val = normalizedInput[i - 1] === normalizedOption[j - 1]\n ? row[j - 1]\n : Math.min(row[j - 1], prev, row[j]) + 1;\n row[j - 1] = prev;\n prev = val;\n }\n row[lenB] = prev;\n }\n\n distance = row[lenB];\n }\n\n if (distance <= threshold) {\n results.push({ option, distance });\n }\n }\n\n return results.sort((a, b) => a.distance - b.distance).map(r => r.option);\n `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function EnvSupportUtilities() {\n return (\n <>\n <VarDeclaration\n export\n const\n name=\"isTTY\"\n doc=\"Detect if stdout.TTY is available\"\n initializer={code`Boolean(process.stdout && process.stdout.isTTY);`}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isMinimal\"\n doc=\"Detect if the current environment is minimal (CI, non-TTY, etc.)\"\n initializer={code` env.MINIMAL || isCI || isTest || !isTTY; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isInteractive\"\n doc=\"Detect if the current environment is interactive\"\n initializer={code` !isMinimal && process.stdin?.isTTY && env.TERM !== \"dumb\" && !hasFlag([\"no-interactive\", \"non-interactive\", \"no-interact\"]); `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ColorSupportUtilities() {\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"GetColorSupportLevelOptions\"\n doc=\"Options for the getColorSupportLevel function\">\n <InterfaceMember\n name=\"ignoreFlags\"\n type=\"boolean\"\n doc=\"Indicates if the function should skip checking command-line flags for color support\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Checks if a specific flag is present in the command-line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {'The flag to check for, e.g., \"color\", \"no-color\".'}\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command-line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getColorSupportLevel\"\n parameters={[\n { name: \"stream\", type: \"NodeJS.WriteStream & { fd: 1 | 2; }\" },\n {\n name: \"options\",\n type: \"GetColorSupportLevelOptions\",\n default: \"{ ignoreFlags: false }\"\n }\n ]}>\n {code`const { ignoreFlags } = options;\n\n let forceColor: number | undefined;\n if (env.FORCE_COLOR !== undefined) {\n forceColor = !env.FORCE_COLOR\n ? 0\n : typeof env.FORCE_COLOR === \"boolean\"\n ? 1\n : typeof env.FORCE_COLOR === \"number\" &&\n [0, 1, 2, 3].includes(Math.min(env.FORCE_COLOR as number, 3))\n ? Math.min(env.FORCE_COLOR as number, 3)\n : undefined;\n }\n\n if (ignoreFlags !== true && forceColor === undefined) {\n if (\n hasFlag(\"no-color\") ||\n hasFlag(\"no-colors\") ||\n hasFlag(\"color=false\") ||\n hasFlag(\"color=never\")\n ) {\n return 0;\n }\n\n if (\n hasFlag(\"color=16m\") ||\n hasFlag(\"color=full\") ||\n hasFlag(\"color=truecolor\")\n ) {\n return 3;\n }\n\n if (hasFlag(\"color=256\")) {\n return 2;\n }\n\n if (\n hasFlag(\"color\") ||\n hasFlag(\"colors\") ||\n hasFlag(\"color=true\") ||\n hasFlag(\"color=always\")\n ) {\n forceColor = 1;\n }\n }\n\n const level = Boolean(env.TF_BUILD) || Boolean(env.AGENT_NAME)\n ? 1\n : stream &&\n !(isTTY || (stream && stream.isTTY)) &&\n forceColor === undefined\n ? 0\n : env.TERM === \"dumb\"\n ? forceColor || 0\n : isWindows\n ? Number(os.release().split(\".\")[0]) >= 10 &&\n Number(os.release().split(\".\")[2]) >= 10_586\n ? Number(os.release().split(\".\")[2]) >= 14_931\n ? 3\n : 2\n : 1\n : isCI\n ? Boolean(env.GITHUB_ACTIONS) ||\n Boolean(env.GITEA_ACTIONS) ||\n Boolean(env.CIRCLECI)\n ? 3\n : Boolean(env.TRAVIS) ||\n Boolean(env.APPVEYOR) ||\n Boolean(env.GITLAB_CI) ||\n Boolean(env.BUILDKITE) ||\n Boolean(env.DRONE) ||\n env.CI_NAME === \"codeship\"\n ? 1\n : forceColor || 0\n : Boolean(env.TEAMCITY_VERSION)\n ? /^(?:9\\.0*[1-9]\\d*\\.|\\d{2,}\\.)/.test(String(env.TEAMCITY_VERSION) || \"\")\n ? 1\n : 0\n : String(env.COLORTERM) === \"truecolor\" ||\n env.TERM === \"xterm-kitty\"\n ? 3\n : Boolean(env.TERM_PROGRAM)\n ? env.TERM_PROGRAM === \"iTerm.app\"\n ? Number.parseInt(\n (env.TERM_PROGRAM_VERSION || \"\").split(\".\")[0] as string,\n 10\n ) >= 3\n ? 3\n : 2\n : env.TERM_PROGRAM === \"Apple_Terminal\"\n ? 2\n : 0\n : /-256(?:color)?$/i.test(env.TERM || \"\")\n ? 2\n : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(\n env.TERM || \"\"\n )\n ? 1\n : Boolean(env.COLORTERM);\n\n return typeof level === \"boolean\" || level === 0\n ? false\n : {\n level,\n hasBasic: true,\n has256: level >= 2,\n has16m: level >= 3,\n };\n\n `}\n </FunctionDeclaration>\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"colorSupportLevels\"\n doc=\"Detect the terminal color support level in the current environment\"\n initializer={code` {\n stdout: getColorSupportLevel(process.stdout),\n stderr: getColorSupportLevel(process.stderr),\n }; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isColorSupported\"\n doc=\"Detect if terminal color is supported in the current environment\"\n initializer={code` Boolean(colorSupportLevels.stdout); `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isUnicodeSupported\"\n doc=\"Detect if Unicode characters are supported in the current environment\"\n initializer={code` !isWindows\n ? env.TERM !== \"linux\"\n : Boolean(env.WT_SESSION) ||\n Boolean(env.TERMINUS_SUBLIME) ||\n env.ConEmuTask === \"{cmd::Cmder}\" ||\n env.TERM_PROGRAM === \"Terminus-Sublime\" ||\n env.TERM_PROGRAM === \"vscode\" ||\n env.TERM === \"xterm-256color\" ||\n env.TERM === \"alacritty\" ||\n env.TERM === \"rxvt-unicode\" ||\n env.TERM === \"rxvt-unicode-256color\" ||\n env.TERMINAL_EMULATOR === \"JetBrains-JediTerm\"; `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\n\nexport function HyperlinkSupportUtilities() {\n return (\n <>\n <FunctionDeclaration\n name=\"parseVersion\"\n parameters={[{ name: \"version\", type: \"string\", default: '\"\"' }]}>\n {code`if (/^\\d{3,4}$/.test(version)) {\n const match = /(\\d{1,2})(\\d{2})/.exec(version) ?? [];\n\n return {\n major: 0,\n minor: Number.parseInt(match[1]!, 10),\n patch: Number.parseInt(match[2]!, 10)\n };\n }\n\n const versionParts = (version ?? \"\")\n .split(\".\")\n .map(n => Number.parseInt(n, 10));\n\n return {\n major: versionParts[0],\n minor: versionParts[1],\n patch: versionParts[2]\n }; `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"Check if the current environment/terminal supports hyperlinks in the terminal.\">\n <TSDocReturns>\n {\"True if the current environment/terminal supports hyperlinks.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"isHyperlinkSupported\"\n returnType=\"boolean\">\n {code`if (Boolean(env.FORCE_HYPERLINK)) {\n return true;\n }\n\n if (Boolean(env.NETLIFY)) {\n return true;\n } else if (isColorSupported || isTTY) {\n return false;\n } else if (Boolean(env.WT_SESSION)) {\n return true;\n } else if (isWindows || isMinimal || Boolean(env.TEAMCITY_VERSION)) {\n return false;\n } else if (Boolean(env.TERM_PROGRAM)) {\n const version = parseVersion(env.TERM_PROGRAM_VERSION);\n\n switch (String(env.TERM_PROGRAM)) {\n case \"iTerm.app\": {\n if (version.major === 3) {\n return version.minor !== undefined && version.minor >= 1;\n }\n\n return version.major !== undefined && version.major > 3;\n }\n case \"WezTerm\": {\n return version.major !== undefined && version.major >= 20_200_620;\n }\n\n case \"vscode\": {\n if (Boolean(env.CURSOR_TRACE_ID)) {\n return true;\n }\n\n return (\n version.minor !== undefined &&\n version.major !== undefined &&\n (version.major > 1 || (version.major === 1 && version.minor >= 72))\n );\n }\n\n case \"ghostty\": {\n return true;\n }\n }\n }\n\n if (Boolean(env.VTE_VERSION)) {\n if (env.VTE_VERSION === \"0.50.0\") {\n return false;\n }\n\n const version = parseVersion(env.VTE_VERSION);\n return (\n (version.major !== undefined && version.major > 0) ||\n (version.minor !== undefined && version.minor >= 50)\n );\n }\n\n if (String(env.TERM) === \"alacritty\") {\n return true;\n }\n\n return false; `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ArgsUtilities() {\n return (\n <>\n <TSDoc heading=\"Retrieves the command-line arguments from Deno or Node.js environments.\">\n <TSDocRemarks>\n {\n \"This function is only intended for internal use. Please use `useArgs()` instead.\"\n }\n </TSDocRemarks>\n <hbr />\n <hbr />\n <TSDocInternal />\n <hbr />\n <hbr />\n <TSDocReturns>\n {\n \"An array of command-line arguments from Deno or Node.js environments.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"getArgs\" returnType=\"string[]\">\n {code`return ((globalThis as { Deno?: { args: string[] } })?.Deno?.args ?? process.argv ?? []) as string[];`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"Checks if a specific flag is present in the command-line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {\n 'The flag (or an array of flags/aliases) to check for, e.g., \"color\", \"no-color\".'\n }\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command-line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"hasFlag\"\n parameters={[\n { name: \"flag\", type: \"string | string[]\" },\n {\n name: \"argv\",\n type: \"string[]\",\n default: \"useArgs()\"\n }\n ]}>\n <VarDeclaration\n const\n name=\"position\"\n type=\"number\"\n initializer={code`(Array.isArray(flag) ? flag : [flag]).reduce((ret, f) => {\n const pos = argv.findIndex(arg => (f.startsWith(\"-\") ? \"\" : (f.length === 1 ? \"-\" : \"--\") + f)?.toLowerCase() === arg?.toLowerCase() || arg?.toLowerCase().startsWith((f.length === 1 ? \"-\" : \"--\") + f + \"=\"));\n return pos !== -1 ? pos : ret;\n }, -1);`}\n />\n <hbr />\n {code`return position !== -1 && argv.indexOf(\"--\") === -1 || position < argv.indexOf(\"--\");`}\n </FunctionDeclaration>\n <Spacing />\n <VarDeclaration\n export\n name=\"isHelp\"\n type=\"boolean\"\n initializer={code` !isCI && hasFlag([\"help\", \"h\", \"?\"]); `}\n />\n </>\n );\n}\n\n/**\n * Generates the `spawn` function declaration, which is a cross-platform utility for spawning child processes with proper color support and environment variable handling.\n */\nexport function SpawnFunctionDeclaration() {\n return (\n <>\n <FunctionDeclaration\n async\n name=\"resolveCommand\"\n parameters={[\n {\n name: \"command\",\n type: \"string\"\n },\n {\n name: \"options\",\n type: \"Record<string, any>\",\n default: \"{}\"\n },\n {\n name: \"pathExt\",\n type: \"string\",\n default:\n 'process.env.PATHEXT || [\".EXE\", \".CMD\", \".BAT\", \".COM\"].join(delimiter)'\n }\n ]}>\n {code`const env = options.env || process.env;\n const cwd = process.cwd();\n if (!!options.cwd && process.chdir !== undefined && !(process.chdir as any).disabled) {\n try {\n process.chdir(options.cwd);\n } catch (err) {\n // Do nothing\n }\n }\n\n let resolved;\n try {\n let extensions = [\"\"];\n if (isWindows) {\n extensions = pathExt.split(delimiter).flatMap((item) => [item, item.toLowerCase()]);\n if (command.includes(\".\") && extensions[0] !== \"\") {\n extensions.unshift(\"\");\n }\n }\n\n for (const envPart of (command.match(new RegExp(\\`[\\${posix.sep}\\${sep === posix.sep ? \"\" : sep}]\\`.replace(/(\\\\\\\\)/g, \"\\\\\\\\$1\"))))\n ? [...(isWindows ? [process.cwd()] : []), ...(process.env.PATH || \"\").split(delimiter)]\n : [\"\"]\n ) {\n const part = \\`\\${!(/^\".*\"$/.test(envPart) ? envPart.slice(1, -1) : envPart) && new RegExp(\\`^\\\\.\\${new RegExp(\\`[\\${posix.sep}\\${sep === posix.sep ? \"\" : sep}]\\`.replace(/(\\\\\\\\)/g, \"\\\\\\\\$1\")).source}\\`).test(command) ? command.slice(0, 2) : \"\"}\\${join(/^\".*\"$/.test(envPart) ? envPart.slice(1, -1) : envPart, command)}\\`;\n for (const extension of extensions) {\n if (isWindows) {\n const filePath = part + extension;\n if ((await stat(filePath)).isFile() && extensions.some((ext) => filePath.substring(filePath.length - ext.length).toLowerCase() === ext.toLowerCase())) {\n resolved = filePath;\n break;\n }\n } else {\n const file = await stat(part + extension);\n if (file.isFile() && (file.mode & 0o111) !== 0) {\n resolved = part + extension;\n break;\n }\n }\n }\n }\n } catch (err) {\n // Do nothing\n } finally {\n if (!!options.cwd && process.chdir !== undefined && !(process.chdir as any).disabled) {\n process.chdir(cwd);\n }\n }\n\n\n if (resolved) {\n resolved = resolve(\n options.cwd ? options.cwd : \"\",\n resolved\n );\n }\n\n return resolved; `}\n </FunctionDeclaration>\n <Spacing />\n <InterfaceDeclaration\n name=\"SpawnBaseOptions\"\n doc=\"Options for the `spawn` handler function.\">\n <InterfaceMember\n name=\"stdout\"\n optional\n type=\"(data: string) => void\"\n doc=\"The writable stream to use for prompt output, defaults to process.stdout\"\n />\n <hbr />\n <InterfaceMember\n name=\"stderr\"\n optional\n type=\"(data: string) => void\"\n doc=\"The writable stream to use for prompt error output, defaults to process.stderr\"\n />\n <hbr />\n <InterfaceMember\n name=\"rejectOnError\"\n optional\n type=\"boolean\"\n doc=\"Whether to reject the promise on error. Defaults to false.\"\n />\n <hbr />\n <InterfaceMember\n name=\"file\"\n optional\n type=\"string\"\n doc=\"The file to execute.\"\n />\n <hbr />\n <InterfaceMember\n name=\"shell\"\n optional\n type=\"boolean | string\"\n doc=\"If true, runs command inside of a shell. Uses '/bin/sh' on UNIX, and process.env.ComSpec on Windows. If a string is provided, it specifies the shell to use.\"\n />\n <hbr />\n <InterfaceMember\n name=\"forceShell\"\n optional\n type=\"boolean\"\n doc=\"If true, forces the command to run inside of a shell, even if the command is a file.\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <TypeDeclaration export name=\"SpawnOptions\">\n {code`SpawnBaseOptions & Parameters<typeof _spawn>[1]`}\n </TypeDeclaration>\n <Spacing />\n <TSDoc heading=\"A function to spawn child processes with proper color support and environment variable handling.\">\n <TSDocParam name=\"command\">{`The command to execute.`}</TSDocParam>\n <TSDocParam name=\"args\">\n {`The command-line arguments to pass to the command. Defaults to an empty array.`}\n </TSDocParam>\n <TSDocParam name=\"options\">\n {`Additional options for spawning the process, such as the current working directory (\\`cwd\\`).`}\n </TSDocParam>\n <TSDocReturns>{`The result of the spawned process.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"spawn\"\n parameters={[\n { name: \"command\", type: \"string\" },\n {\n name: \"args\",\n type: \"string[] | SpawnOptions\",\n default: \"{} as SpawnOptions\"\n },\n {\n name: \"options\",\n type: \"SpawnOptions\",\n default: \"{} as SpawnOptions\"\n }\n ]}>\n {code`const normalized = {\n command,\n args: [] as string[],\n options: options as SpawnOptions | any,\n file: undefined as string | undefined,\n original: {\n command,\n args,\n },\n };\n\n if (args) {\n if (Array.isArray(args)) {\n if (args.length > 0) {\n normalized.args = args.slice(0);\n }\n } else {\n normalized.options = { ...args } as SpawnOptions | any;\n normalized.args = [];\n }\n }\n\n if (!normalized.options.shell && isWindows) {\n normalized.file = (await resolveCommand(normalized.command, normalized.options)) || (await resolveCommand(normalized.command, normalized.options, delimiter));\n\n let commandFile = normalized.file;\n if (normalized.file) {\n let shebang: string | undefined;\n const buffer = Buffer.alloc(150);\n\n try {\n const fd = openSync(normalized.file, \"r\");\n await promisify(read)(fd, buffer, 0, 150, 0);\n closeSync(fd);\n } catch (err) {\n // Do nothing\n }\n\n const matched = buffer.toString().match(/^#!(.*)/);\n if (matched) {\n const [path, argument] = matched[0].replace(/#! ?/, \"\").split(\" \");\n\t const binary = path.split(\"/\").pop();\n if (binary === \"env\") {\n shebang = argument;\n } else {\n shebang = argument ? \\`\\${binary} \\${argument}\\` : binary;\n }\n }\n\n if (shebang) {\n normalized.args.unshift(normalized.file);\n normalized.command = shebang;\n\n commandFile = await resolveCommand(normalized.command, normalized.options);\n }\n }\n\n if (commandFile && (normalized.options.forceShell || /\\\\.(?:com|exe)$/i.test(commandFile))) {\n normalized.command = normalize(normalized.command).replace(/([()\\\\][%!^\"\\`<>&|;, *?])/g, \"^$1\");\n\n normalized.args = [\"/d\", \"/s\", \"/c\", \\`\"\\${normalized.command} \\${normalized.args.map(arg =>\n \\`\\${arg}\\`.replace(/(?=(\\\\\\\\+?)?)\\\\1\"/g, \"$1$1\\\\\"\").replace(/(?=(\\\\\\\\+?)?)\\\\1$/, \"$1$1\")\n ).map(arg =>\n \\`\"\\${arg}\"\\`.replace(/([()\\\\][%!^\"\\`<>&|;, *?])/g, \"^$1\")\n ).map(arg =>\n /node_modules[\\\\\\\\/].bin[\\\\\\\\/][^\\\\\\\\/]+\\\\.cmd$/i.test(commandFile) ? arg.replace(/([()\\\\][%!^\"\\`<>&|;, *?])/g, \"^$1\") : arg\n ).join(\" \")}\"\\`];\n normalized.command = process.env.comspec || \"cmd.exe\";\n normalized.options.windowsVerbatimArguments = true;\n }\n }\n\n let stdout = \"\";\n let stderr = \"\";\n\n const child = _spawn(normalized.command, normalized.args, {\n cwd: process.cwd(),\n env: {\n ...process.env,\n FORCE_COLOR: isColorSupported ? \"1\" : \"0\",\n },\n ...normalized.options,\n }) as ReturnType<typeof _spawn>;\n\n if (isWindows) {\n const emit = child.emit;\n child.emit = (eventName: string | symbol, ...eventArgs: any[]) => {\n if (eventName === \"exit\") {\n let err: Error | null = null;\n if (eventArgs[0] === 1 && !normalized.file) {\n err = Object.assign(new Error(\\`spawn \\${normalized.original.command} ENOENT\\`), {\n code: \"ENOENT\",\n errno: \"ENOENT\",\n syscall: \\`spawn \\${normalized.original.command}\\`,\n path: normalized.original.command,\n spawnargs: normalized.original.args,\n });\n }\n\n if (err) {\n return emit.call(child, \"error\", err);\n }\n }\n\n return emit.apply(child, [eventName, ...eventArgs]);\n };\n }\n\n return new Promise((resolve, reject) => {\n if (normalized.options.stdin !== undefined) {\n child.stdin?.write(normalized.options.stdin);\n }\n\n child.stdin?.end();\n\n child.stdout?.on(\"data\", data => {\n stdout += data;\n if (normalized.options.stdout) {\n normalized.options.stdout(data);\n }\n });\n\n child.stderr?.on(\"data\", data => {\n stderr += data;\n if (normalized.options.stderr) {\n normalized.options.stderr(data);\n }\n });\n\n if (normalized.options.rejectOnError) {\n child.addListener(\"error\", reject);\n }\n\n child.on(\"close\", code => {\n if (code !== 0 && normalized.options.rejectOnError) {\n reject(stderr);\n } else {\n resolve({ stdout, stderr });\n }\n });\n }); `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport function ContextUtilities() {\n return code`\n /**\n * The global Shell Shock - Application context instance.\n *\n * @internal\n */\n export let internal_appContext = new AsyncLocalStorage<Map<string, any>>();\n\n /**\n * Get the Shell Shock - Application context for the current application.\n *\n * @param options - The options to use when getting the context.\n * @returns The Shell Shock - Application context for the current application or undefined if the context is not available.\n */\n export function useApp(): Map<string, any> | undefined {\n return internal_appContext.getStore();\n }\n\n /**\n * A utility hook function to get the command line arguments from the application context.\n *\n * @returns An array of command-line arguments from the application context.\n * @throws If the application context is not available.\n */\n export function useArgs(): string[] {\n return useApp()?.get(\"args\") ?? getArgs();\n }\n\n /**\n * The context object for the current command execution, containing the command path and segments.\n */\n export interface CommandContext {\n path: string;\n segments: string[];\n }\n\n /**\n * The global Shell Shock - Command context instance.\n *\n * @internal\n */\n export let internal_commandContext = new AsyncLocalStorage<CommandContext>();\n\n /**\n * Get the Shell Shock - Command context for the current application.\n *\n * @param options - The options to use when getting the context.\n * @returns The Shell Shock - Command context for the current application.\n * @throws If the Shell Shock - Command context is not available.\n */\n export function useCommand(): CommandContext {\n const result = internal_commandContext.getStore();\n if (!result) {\n throw new Error(\n \\`The Shell Shock - Command context is not available. Make sure to call useCommand() within a valid context scope.\\`\n );\n }\n return result;\n }\n\n /**\n * A utility hook function to get the individual segments of the current command path.\n *\n * @returns An array of command path segments.\n * @throws If the command context is not available.\n */\n export function useSegments(): string[] {\n return useCommand().segments;\n }\n\n /**\n * A utility hook function to get the full command path as a string.\n *\n * @returns The full command path as a string.\n * @throws If the command context is not available.\n */\n export function usePath(): string {\n return useCommand().path;\n }\n `;\n}\n\n/**\n * A built-in utilities module for Shell Shock.\n */\nexport function UtilsBuiltin(props: UtilsBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <BuiltinFile\n id=\"utils\"\n description=\"A collection of helper utilities that ease command-line application development.\"\n {...rest}\n imports={defu(rest.imports ?? {}, {\n \"node:os\": \"os\",\n \"node:process\": \"process\",\n \"node:path\": [\n \"resolve\",\n \"delimiter\",\n \"normalize\",\n \"join\",\n \"posix\",\n \"sep\"\n ],\n \"node:fs\": [\"openSync\", \"closeSync\", \"read\"],\n \"node:fs/promises\": [\"stat\"],\n \"node:util\": [\"promisify\"],\n \"node:child_process\": [{ name: \"spawn\", alias: \"_spawn\" }],\n \"node:async_hooks\": [\"AsyncLocalStorage\"]\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n console: [\"error\", \"verbose\", \"writeLine\"],\n env: [\"env\", \"isCI\", \"isTest\", \"isWindows\", \"isDevelopment\", \"isDebug\"]\n })}>\n <Spacing />\n <ContextUtilities />\n <Spacing />\n <ArgsUtilities />\n <Spacing />\n <EnvSupportUtilities />\n <Spacing />\n <HyperlinkSupportUtilities />\n <Spacing />\n <ColorSupportUtilities />\n <Spacing />\n <SpawnFunctionDeclaration />\n <Spacing />\n <FindSuggestionsDeclaration />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiDA,SAAgBkB,6BAA6B;CAC3C,MAAMC,uFAAkC;AAExC,QAAA;mDAEKZ,sCAAc;GAAA,SAAA;GAEbc,MAAI;GACJC,aAAatB,oBAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDa,CAAA;mDAE/BQ,2DAAO,EAAA,CAAA;mDACPG,6DAAK;GAACY,SAAO;GAAA,IAAAC,WAAA;AAAA,WAAA;sDACXT,oEAAY,EAAAS,UAET,+GAA6G,CAAA;sDAAA,OAAA,EAAA,CAAA;sDAAA,OAAA,EAAA,CAAA;sDAKhHZ,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|
1
|
+
{"version":3,"file":"utils-builtin.cjs","names":["code","Show","splitProps","FunctionDeclaration","InterfaceDeclaration","InterfaceMember","TypeDeclaration","VarDeclaration","Spacing","usePowerlines","BuiltinFile","TSDoc","TSDocInternal","TSDocLink","TSDocParam","TSDocRemarks","TSDocReturns","defu","FindSuggestionsDeclaration","context","_$createComponent","name","initializer","heading","children","parameters","type","returnType","config","isCaseSensitive","_$memo","EnvSupportUtilities","doc","ColorSupportUtilities","default","HyperlinkSupportUtilities","ArgsUtilities","_$createIntrinsic","SpawnFunctionDeclaration","async","optional","ContextUtilities","UtilsBuiltin","props","rest","_$mergeProps","id","description","imports","alias","builtinImports","console","env","when","Boolean"],"sources":["../../src/components/utils-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 TypeDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/dist/core/contexts/context.mjs\";\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 TSDocInternal,\n TSDocLink,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport defu from \"defu\";\nimport type { Context } from \"../types/context\";\n\nexport interface UtilsBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {}\n\n/**\n * Generates the `findSuggestions` function for suggesting corrections for potentially misspelled options or commands.\n */\nexport function FindSuggestionsDeclaration() {\n const context = usePowerlines<Context>();\n\n return (\n <>\n <VarDeclaration\n const\n name=\"deburred\"\n initializer={code` {\n \"\\\\xc0\": \"A\", \"\\\\xc1\": \"A\", \"\\\\xc2\": \"A\", \"\\\\xc3\": \"A\", \"\\\\xc4\": \"A\", \"\\\\xc5\": \"A\",\n \"\\\\xe0\": \"a\", \"\\\\xe1\": \"a\", \"\\\\xe2\": \"a\", \"\\\\xe3\": \"a\", \"\\\\xe4\": \"a\", \"\\\\xe5\": \"a\",\n \"\\\\xc7\": \"C\", \"\\\\xe7\": \"c\",\n \"\\\\xd0\": \"D\", \"\\\\xf0\": \"d\",\n \"\\\\xc8\": \"E\", \"\\\\xc9\": \"E\", \"\\\\xca\": \"E\", \"\\\\xcb\": \"E\",\n \"\\\\xe8\": \"e\", \"\\\\xe9\": \"e\", \"\\\\xea\": \"e\", \"\\\\xeb\": \"e\",\n \"\\\\xcc\": \"I\", \"\\\\xcd\": \"I\", \"\\\\xce\": \"I\", \"\\\\xcf\": \"I\",\n \"\\\\xec\": \"i\", \"\\\\xed\": \"i\", \"\\\\xee\": \"i\", \"\\\\xef\": \"i\",\n \"\\\\xd1\": \"N\", \"\\\\xf1\": \"n\",\n \"\\\\xd2\": \"O\", \"\\\\xd3\": \"O\", \"\\\\xd4\": \"O\", \"\\\\xd5\": \"O\", \"\\\\xd6\": \"O\", \"\\\\xd8\": \"O\",\n \"\\\\xf2\": \"o\", \"\\\\xf3\": \"o\", \"\\\\xf4\": \"o\", \"\\\\xf5\": \"o\", \"\\\\xf6\": \"o\", \"\\\\xf8\": \"o\",\n \"\\\\xd9\": \"U\", \"\\\\xda\": \"U\", \"\\\\xdb\": \"U\", \"\\\\xdc\": \"U\",\n \"\\\\xf9\": \"u\", \"\\\\xfa\": \"u\", \"\\\\xfb\": \"u\", \"\\\\xfc\": \"u\",\n \"\\\\xdd\": \"Y\", \"\\\\xfd\": \"y\", \"\\\\xff\": \"y\",\n \"\\\\xc6\": \"Ae\", \"\\\\xe6\": \"ae\",\n \"\\\\xde\": \"Th\", \"\\\\xfe\": \"th\",\n \"\\\\xdf\": \"ss\",\n \"\\\\u0100\": \"A\", \"\\\\u0102\": \"A\", \"\\\\u0104\": \"A\",\n \"\\\\u0101\": \"a\", \"\\\\u0103\": \"a\", \"\\\\u0105\": \"a\",\n \"\\\\u0106\": \"C\", \"\\\\u0108\": \"C\", \"\\\\u010a\": \"C\", \"\\\\u010c\": \"C\",\n \"\\\\u0107\": \"c\", \"\\\\u0109\": \"c\", \"\\\\u010b\": \"c\", \"\\\\u010d\": \"c\",\n \"\\\\u010e\": \"D\", \"\\\\u0110\": \"D\", \"\\\\u010f\": \"d\", \"\\\\u0111\": \"d\",\n \"\\\\u0112\": \"E\", \"\\\\u0114\": \"E\", \"\\\\u0116\": \"E\", \"\\\\u0118\": \"E\", \"\\\\u011a\": \"E\",\n \"\\\\u0113\": \"e\", \"\\\\u0115\": \"e\", \"\\\\u0117\": \"e\", \"\\\\u0119\": \"e\", \"\\\\u011b\": \"e\",\n \"\\\\u011c\": \"G\", \"\\\\u011e\": \"G\", \"\\\\u0120\": \"G\", \"\\\\u0122\": \"G\",\n \"\\\\u011d\": \"g\", \"\\\\u011f\": \"g\", \"\\\\u0121\": \"g\", \"\\\\u0123\": \"g\",\n \"\\\\u0124\": \"H\", \"\\\\u0126\": \"H\", \"\\\\u0125\": \"h\", \"\\\\u0127\": \"h\",\n \"\\\\u0128\": \"I\", \"\\\\u012a\": \"I\", \"\\\\u012c\": \"I\", \"\\\\u012e\": \"I\", \"\\\\u0130\": \"I\",\n \"\\\\u0129\": \"i\", \"\\\\u012b\": \"i\", \"\\\\u012d\": \"i\", \"\\\\u012f\": \"i\", \"\\\\u0131\": \"i\",\n \"\\\\u0134\": \"J\", \"\\\\u0135\": \"j\",\n \"\\\\u0136\": \"K\", \"\\\\u0137\": \"k\", \"\\\\u0138\": \"k\",\n \"\\\\u0139\": \"L\", \"\\\\u013b\": \"L\", \"\\\\u013d\": \"L\", \"\\\\u013f\": \"L\", \"\\\\u0141\": \"L\",\n \"\\\\u013a\": \"l\", \"\\\\u013c\": \"l\", \"\\\\u013e\": \"l\", \"\\\\u0140\": \"l\", \"\\\\u0142\": \"l\",\n \"\\\\u0143\": \"N\", \"\\\\u0145\": \"N\", \"\\\\u0147\": \"N\", \"\\\\u014a\": \"N\",\n \"\\\\u0144\": \"n\", \"\\\\u0146\": \"n\", \"\\\\u0148\": \"n\", \"\\\\u014b\": \"n\",\n \"\\\\u014c\": \"O\", \"\\\\u014e\": \"O\", \"\\\\u0150\": \"O\",\n \"\\\\u014d\": \"o\", \"\\\\u014f\": \"o\", \"\\\\u0151\": \"o\",\n \"\\\\u0154\": \"R\", \"\\\\u0156\": \"R\", \"\\\\u0158\": \"R\",\n \"\\\\u0155\": \"r\", \"\\\\u0157\": \"r\", \"\\\\u0159\": \"r\",\n \"\\\\u015a\": \"S\", \"\\\\u015c\": \"S\", \"\\\\u015e\": \"S\", \"\\\\u0160\": \"S\",\n \"\\\\u015b\": \"s\", \"\\\\u015d\": \"s\", \"\\\\u015f\": \"s\", \"\\\\u0161\": \"s\",\n \"\\\\u0162\": \"T\", \"\\\\u0164\": \"T\", \"\\\\u0166\": \"T\",\n \"\\\\u0163\": \"t\", \"\\\\u0165\": \"t\", \"\\\\u0167\": \"t\",\n \"\\\\u0168\": \"U\", \"\\\\u016a\": \"U\", \"\\\\u016c\": \"U\", \"\\\\u016e\": \"U\", \"\\\\u0170\": \"U\", \"\\\\u0172\": \"U\",\n \"\\\\u0169\": \"u\", \"\\\\u016b\": \"u\", \"\\\\u016d\": \"u\", \"\\\\u016f\": \"u\", \"\\\\u0171\": \"u\", \"\\\\u0173\": \"u\",\n \"\\\\u0174\": \"W\", \"\\\\u0175\": \"w\",\n \"\\\\u0176\": \"Y\", \"\\\\u0177\": \"y\", \"\\\\u0178\": \"Y\",\n \"\\\\u0179\": \"Z\", \"\\\\u017b\": \"Z\", \"\\\\u017d\": \"Z\",\n \"\\\\u017a\": \"z\", \"\\\\u017c\": \"z\", \"\\\\u017e\": \"z\",\n \"\\\\u0132\": \"IJ\", \"\\\\u0133\": \"ij\",\n \"\\\\u0152\": \"Oe\", \"\\\\u0153\": \"oe\",\n \"\\\\u0149\": \"n\", \"\\\\u017f\": \"s\"\n } as Record<string, string>; `}\n />\n <Spacing />\n <TSDoc heading=\"A utility function that takes an input string and a list of possible matches, and returns a list of suggested matches based on the Levenshtein distance between the input and the possible matches.\">\n <TSDocRemarks>\n {\n \"This function is intended to be used to suggest corrections for potentially misspelled options or commands.\"\n }\n </TSDocRemarks>\n <Spacing />\n <TSDocInternal />\n <Spacing />\n <TSDocParam name=\"input\">\n {\"The input string to check for potential matches.\"}\n </TSDocParam>\n <TSDocParam name=\"options\">\n {\"A list of possible matches to compare against the input.\"}\n </TSDocParam>\n <TSDocReturns>\n {\"A list of suggested matches based on the Levenshtein distance.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"findSuggestions\"\n parameters={[\n {\n name: \"input\",\n type: \"string\"\n },\n {\n name: \"options\",\n type: \"string[]\"\n }\n ]}\n returnType=\"string[]\">\n <VarDeclaration\n const\n name=\"normalizedInput\"\n initializer={code`String(input ?? \"\")${\n context.config.isCaseSensitive ? \"\" : \".toLowerCase()\"\n }.trim().replaceAll(/[\\\\s\\\\-_\\\\.]+/gu, \" \").replace(/[\\\\\\\\xc0-\\\\\\\\xd6\\\\\\\\xd8-\\\\\\\\xf6\\\\\\\\xf8-\\\\\\\\xff\\\\\\\\u0100-\\\\\\\\u017f]/g, key => deburred[key]).replace(/[\\\\\\\\u0300-\\\\\\\\u036f\\\\\\\\ufe20-\\\\\\\\ufe2f\\\\\\\\u20d0-\\\\\\\\u20ff]/g, \"\"); `}\n />\n <Spacing />\n {code`\n if (!normalizedInput || options.length === 0) {\n return [];\n }\n\n const threshold = Math.ceil(normalizedInput.length * 0.25) || 1;\n const results: Array<{ option: string; distance: number }> = [];\n\n for (const option of options) {\n const normalizedOption = String(option ?? \"\")${\n context.config.isCaseSensitive ? \"\" : \".toLowerCase()\"\n }.trim().replaceAll(/[\\\\s\\\\-_\\\\.]+/gu, \" \").replace(/[\\\\\\\\xc0-\\\\\\\\xd6\\\\\\\\xd8-\\\\\\\\xf6\\\\\\\\xf8-\\\\\\\\xff\\\\\\\\u0100-\\\\\\\\u017f]/g, key => deburred[key]).replace(/[\\\\\\\\u0300-\\\\\\\\u036f\\\\\\\\ufe20-\\\\\\\\ufe2f\\\\\\\\u20d0-\\\\\\\\u20ff]/g, \"\");\n\n if (!normalizedOption) {\n continue;\n }\n\n const lenA = normalizedInput.length;\n const lenB = normalizedOption.length;\n\n if (Math.abs(lenA - lenB) > threshold) {\n continue;\n }\n\n let distance: number;\n if (lenA === 0) {\n distance = lenB;\n } else if (lenB === 0) {\n distance = lenA;\n } else if (lenA <= 32) {\n const peq: Record<string, number> = {};\n for (let i = 0; i < lenA; i++) {\n const c = normalizedInput[i]!;\n peq[c] = (peq[c] || 0) | (1 << i);\n }\n\n let pv = -1;\n let mv = 0;\n let score = lenA;\n\n for (let j = 0; j < lenB; j++) {\n const eq = peq[normalizedOption[j]!] || 0;\n const xv = eq | mv;\n const xh = ((eq & pv) + pv) ^ pv ^ eq;\n let ph = mv | ~(xh | pv);\n let mh = pv & xh;\n\n if ((ph >>> (lenA - 1)) & 1) {\n score++;\n }\n if ((mh >>> (lenA - 1)) & 1) {\n score--;\n }\n\n ph = (ph << 1) | 1;\n mh = mh << 1;\n pv = mh | ~(xv | ph);\n mv = ph & xv;\n }\n\n distance = score;\n } else {\n const row = new Array(lenB + 1);\n for (let j = 0; j <= lenB; j++) {\n row[j] = j;\n }\n\n for (let i = 1; i <= lenA; i++) {\n let prev = i;\n for (let j = 1; j <= lenB; j++) {\n const val = normalizedInput[i - 1] === normalizedOption[j - 1]\n ? row[j - 1]\n : Math.min(row[j - 1], prev, row[j]) + 1;\n row[j - 1] = prev;\n prev = val;\n }\n row[lenB] = prev;\n }\n\n distance = row[lenB];\n }\n\n if (distance <= threshold) {\n results.push({ option, distance });\n }\n }\n\n return results.sort((a, b) => a.distance - b.distance).map(r => r.option);\n `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function EnvSupportUtilities() {\n return (\n <>\n <VarDeclaration\n export\n const\n name=\"isTTY\"\n doc=\"Detect if stdout.TTY is available\"\n initializer={code`Boolean(process.stdout && process.stdout.isTTY);`}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isMinimal\"\n doc=\"Detect if the current environment is minimal (CI, non-TTY, etc.)\"\n initializer={code` env.MINIMAL || isCI || isTest || !isTTY; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isInteractive\"\n doc=\"Detect if the current environment is interactive\"\n initializer={code` !isMinimal && process.stdin?.isTTY && env.TERM !== \"dumb\" && !hasFlag([\"no-interactive\", \"non-interactive\", \"no-interact\"]); `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ColorSupportUtilities() {\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"GetColorSupportLevelOptions\"\n doc=\"Options for the getColorSupportLevel function\">\n <InterfaceMember\n name=\"ignoreFlags\"\n type=\"boolean\"\n doc=\"Indicates if the function should skip checking command-line flags for color support\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Checks if a specific flag is present in the command-line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {'The flag to check for, e.g., \"color\", \"no-color\".'}\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command-line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getColorSupportLevel\"\n parameters={[\n { name: \"stream\", type: \"NodeJS.WriteStream & { fd: 1 | 2; }\" },\n {\n name: \"options\",\n type: \"GetColorSupportLevelOptions\",\n default: \"{ ignoreFlags: false }\"\n }\n ]}>\n {code`const { ignoreFlags } = options;\n\n let forceColor: number | undefined;\n if (env.FORCE_COLOR !== undefined) {\n forceColor = !env.FORCE_COLOR\n ? 0\n : typeof env.FORCE_COLOR === \"boolean\"\n ? 1\n : typeof env.FORCE_COLOR === \"number\" &&\n [0, 1, 2, 3].includes(Math.min(env.FORCE_COLOR as number, 3))\n ? Math.min(env.FORCE_COLOR as number, 3)\n : undefined;\n }\n\n if (ignoreFlags !== true && forceColor === undefined) {\n if (\n hasFlag(\"no-color\") ||\n hasFlag(\"no-colors\") ||\n hasFlag(\"color=false\") ||\n hasFlag(\"color=never\")\n ) {\n return 0;\n }\n\n if (\n hasFlag(\"color=16m\") ||\n hasFlag(\"color=full\") ||\n hasFlag(\"color=truecolor\")\n ) {\n return 3;\n }\n\n if (hasFlag(\"color=256\")) {\n return 2;\n }\n\n if (\n hasFlag(\"color\") ||\n hasFlag(\"colors\") ||\n hasFlag(\"color=true\") ||\n hasFlag(\"color=always\")\n ) {\n forceColor = 1;\n }\n }\n\n const level = Boolean(env.TF_BUILD) || Boolean(env.AGENT_NAME)\n ? 1\n : stream &&\n !(isTTY || (stream && stream.isTTY)) &&\n forceColor === undefined\n ? 0\n : env.TERM === \"dumb\"\n ? forceColor || 0\n : isWindows\n ? Number(os.release().split(\".\")[0]) >= 10 &&\n Number(os.release().split(\".\")[2]) >= 10_586\n ? Number(os.release().split(\".\")[2]) >= 14_931\n ? 3\n : 2\n : 1\n : isCI\n ? Boolean(env.GITHUB_ACTIONS) ||\n Boolean(env.GITEA_ACTIONS) ||\n Boolean(env.CIRCLECI)\n ? 3\n : Boolean(env.TRAVIS) ||\n Boolean(env.APPVEYOR) ||\n Boolean(env.GITLAB_CI) ||\n Boolean(env.BUILDKITE) ||\n Boolean(env.DRONE) ||\n env.CI_NAME === \"codeship\"\n ? 1\n : forceColor || 0\n : Boolean(env.TEAMCITY_VERSION)\n ? /^(?:9\\.0*[1-9]\\d*\\.|\\d{2,}\\.)/.test(String(env.TEAMCITY_VERSION) || \"\")\n ? 1\n : 0\n : String(env.COLORTERM) === \"truecolor\" ||\n env.TERM === \"xterm-kitty\"\n ? 3\n : Boolean(env.TERM_PROGRAM)\n ? env.TERM_PROGRAM === \"iTerm.app\"\n ? Number.parseInt(\n (env.TERM_PROGRAM_VERSION || \"\").split(\".\")[0] as string,\n 10\n ) >= 3\n ? 3\n : 2\n : env.TERM_PROGRAM === \"Apple_Terminal\"\n ? 2\n : 0\n : /-256(?:color)?$/i.test(env.TERM || \"\")\n ? 2\n : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(\n env.TERM || \"\"\n )\n ? 1\n : Boolean(env.COLORTERM);\n\n return typeof level === \"boolean\" || level === 0\n ? false\n : {\n level,\n hasBasic: true,\n has256: level >= 2,\n has16m: level >= 3,\n };\n\n `}\n </FunctionDeclaration>\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"colorSupportLevels\"\n doc=\"Detect the terminal color support level in the current environment\"\n initializer={code` {\n stdout: getColorSupportLevel(process.stdout),\n stderr: getColorSupportLevel(process.stderr),\n }; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isColorSupported\"\n doc=\"Detect if terminal color is supported in the current environment\"\n initializer={code` Boolean(colorSupportLevels.stdout); `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isUnicodeSupported\"\n doc=\"Detect if Unicode characters are supported in the current environment\"\n initializer={code` !isWindows\n ? env.TERM !== \"linux\"\n : Boolean(env.WT_SESSION) ||\n Boolean(env.TERMINUS_SUBLIME) ||\n env.ConEmuTask === \"{cmd::Cmder}\" ||\n env.TERM_PROGRAM === \"Terminus-Sublime\" ||\n env.TERM_PROGRAM === \"vscode\" ||\n env.TERM === \"xterm-256color\" ||\n env.TERM === \"alacritty\" ||\n env.TERM === \"rxvt-unicode\" ||\n env.TERM === \"rxvt-unicode-256color\" ||\n env.TERMINAL_EMULATOR === \"JetBrains-JediTerm\"; `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\n\nexport function HyperlinkSupportUtilities() {\n return (\n <>\n <FunctionDeclaration\n name=\"parseVersion\"\n parameters={[{ name: \"version\", type: \"string\", default: '\"\"' }]}>\n {code`if (/^\\d{3,4}$/.test(version)) {\n const match = /(\\d{1,2})(\\d{2})/.exec(version) ?? [];\n\n return {\n major: 0,\n minor: Number.parseInt(match[1]!, 10),\n patch: Number.parseInt(match[2]!, 10)\n };\n }\n\n const versionParts = (version ?? \"\")\n .split(\".\")\n .map(n => Number.parseInt(n, 10));\n\n return {\n major: versionParts[0],\n minor: versionParts[1],\n patch: versionParts[2]\n }; `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"Check if the current environment/terminal supports hyperlinks in the terminal.\">\n <TSDocReturns>\n {\"True if the current environment/terminal supports hyperlinks.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"isHyperlinkSupported\"\n returnType=\"boolean\">\n {code`if (Boolean(env.FORCE_HYPERLINK)) {\n return true;\n }\n\n if (Boolean(env.NETLIFY)) {\n return true;\n } else if (isColorSupported || isTTY) {\n return false;\n } else if (Boolean(env.WT_SESSION)) {\n return true;\n } else if (isWindows || isMinimal || Boolean(env.TEAMCITY_VERSION)) {\n return false;\n } else if (Boolean(env.TERM_PROGRAM)) {\n const version = parseVersion(env.TERM_PROGRAM_VERSION);\n\n switch (String(env.TERM_PROGRAM)) {\n case \"iTerm.app\": {\n if (version.major === 3) {\n return version.minor !== undefined && version.minor >= 1;\n }\n\n return version.major !== undefined && version.major > 3;\n }\n case \"WezTerm\": {\n return version.major !== undefined && version.major >= 20_200_620;\n }\n\n case \"vscode\": {\n if (Boolean(env.CURSOR_TRACE_ID)) {\n return true;\n }\n\n return (\n version.minor !== undefined &&\n version.major !== undefined &&\n (version.major > 1 || (version.major === 1 && version.minor >= 72))\n );\n }\n\n case \"ghostty\": {\n return true;\n }\n }\n }\n\n if (Boolean(env.VTE_VERSION)) {\n if (env.VTE_VERSION === \"0.50.0\") {\n return false;\n }\n\n const version = parseVersion(env.VTE_VERSION);\n return (\n (version.major !== undefined && version.major > 0) ||\n (version.minor !== undefined && version.minor >= 50)\n );\n }\n\n if (String(env.TERM) === \"alacritty\") {\n return true;\n }\n\n return false; `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ArgsUtilities() {\n return (\n <>\n <TSDoc heading=\"Retrieves the command-line arguments from Deno or Node.js environments.\">\n <TSDocRemarks>\n {\n \"This function is only intended for internal use. Please use `useArgs()` instead.\"\n }\n </TSDocRemarks>\n <Spacing />\n <TSDocInternal />\n <Spacing />\n <TSDocReturns>\n {\n \"An array of command-line arguments from Deno or Node.js environments.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"getArgs\" returnType=\"string[]\">\n {code`return ((globalThis as { Deno?: { args: string[] } })?.Deno?.args ?? process.argv ?? []) as string[];`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"Checks if a specific flag is present in the command-line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {\n 'The flag (or an array of flags/aliases) to check for, e.g., \"color\", \"no-color\".'\n }\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command-line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"hasFlag\"\n parameters={[\n { name: \"flag\", type: \"string | string[]\" },\n {\n name: \"argv\",\n type: \"string[]\",\n default: \"useArgs()\"\n }\n ]}>\n <VarDeclaration\n const\n name=\"position\"\n type=\"number\"\n initializer={code`(Array.isArray(flag) ? flag : [flag]).reduce((ret, f) => {\n const pos = argv.findIndex(arg => (f.startsWith(\"-\") ? \"\" : (f.length === 1 ? \"-\" : \"--\") + f)?.toLowerCase() === arg?.toLowerCase() || arg?.toLowerCase().startsWith((f.length === 1 ? \"-\" : \"--\") + f + \"=\"));\n return pos !== -1 ? pos : ret;\n }, -1);`}\n />\n <hbr />\n {code`return position !== -1 && argv.indexOf(\"--\") === -1 || position < argv.indexOf(\"--\");`}\n </FunctionDeclaration>\n <Spacing />\n <VarDeclaration\n export\n name=\"isHelp\"\n type=\"boolean\"\n initializer={code` !isCI && hasFlag([\"help\", \"h\", \"?\"]); `}\n />\n </>\n );\n}\n\n/**\n * Generates the `spawn` function declaration, which is a cross-platform utility for spawning child processes with proper color support and environment variable handling.\n */\nexport function SpawnFunctionDeclaration() {\n return (\n <>\n <FunctionDeclaration\n async\n name=\"resolveCommand\"\n parameters={[\n {\n name: \"command\",\n type: \"string\"\n },\n {\n name: \"options\",\n type: \"Record<string, any>\",\n default: \"{}\"\n },\n {\n name: \"pathExt\",\n type: \"string\",\n default:\n 'process.env.PATHEXT || [\".EXE\", \".CMD\", \".BAT\", \".COM\"].join(delimiter)'\n }\n ]}>\n {code`const env = options.env || process.env;\n const cwd = process.cwd();\n if (!!options.cwd && process.chdir !== undefined && !(process.chdir as any).disabled) {\n try {\n process.chdir(options.cwd);\n } catch (err) {\n // Do nothing\n }\n }\n\n let resolved;\n try {\n let extensions = [\"\"];\n if (isWindows) {\n extensions = pathExt.split(delimiter).flatMap((item) => [item, item.toLowerCase()]);\n if (command.includes(\".\") && extensions[0] !== \"\") {\n extensions.unshift(\"\");\n }\n }\n\n for (const envPart of (command.match(new RegExp(\\`[\\${posix.sep}\\${sep === posix.sep ? \"\" : sep}]\\`.replace(/(\\\\\\\\)/g, \"\\\\\\\\$1\"))))\n ? [...(isWindows ? [process.cwd()] : []), ...(process.env.PATH || \"\").split(delimiter)]\n : [\"\"]\n ) {\n const part = \\`\\${!(/^\".*\"$/.test(envPart) ? envPart.slice(1, -1) : envPart) && new RegExp(\\`^\\\\.\\${new RegExp(\\`[\\${posix.sep}\\${sep === posix.sep ? \"\" : sep}]\\`.replace(/(\\\\\\\\)/g, \"\\\\\\\\$1\")).source}\\`).test(command) ? command.slice(0, 2) : \"\"}\\${join(/^\".*\"$/.test(envPart) ? envPart.slice(1, -1) : envPart, command)}\\`;\n for (const extension of extensions) {\n if (isWindows) {\n const filePath = part + extension;\n if ((await stat(filePath)).isFile() && extensions.some((ext) => filePath.substring(filePath.length - ext.length).toLowerCase() === ext.toLowerCase())) {\n resolved = filePath;\n break;\n }\n } else {\n const file = await stat(part + extension);\n if (file.isFile() && (file.mode & 0o111) !== 0) {\n resolved = part + extension;\n break;\n }\n }\n }\n }\n } catch (err) {\n // Do nothing\n } finally {\n if (!!options.cwd && process.chdir !== undefined && !(process.chdir as any).disabled) {\n process.chdir(cwd);\n }\n }\n\n\n if (resolved) {\n resolved = resolve(\n options.cwd ? options.cwd : \"\",\n resolved\n );\n }\n\n return resolved; `}\n </FunctionDeclaration>\n <Spacing />\n <InterfaceDeclaration\n name=\"SpawnBaseOptions\"\n doc=\"Options for the `spawn` handler function.\">\n <InterfaceMember\n name=\"stdout\"\n optional\n type=\"(data: string) => void\"\n doc=\"The writable stream to use for prompt output, defaults to process.stdout\"\n />\n <hbr />\n <InterfaceMember\n name=\"stderr\"\n optional\n type=\"(data: string) => void\"\n doc=\"The writable stream to use for prompt error output, defaults to process.stderr\"\n />\n <hbr />\n <InterfaceMember\n name=\"rejectOnError\"\n optional\n type=\"boolean\"\n doc=\"Whether to reject the promise on error. Defaults to false.\"\n />\n <hbr />\n <InterfaceMember\n name=\"file\"\n optional\n type=\"string\"\n doc=\"The file to execute.\"\n />\n <hbr />\n <InterfaceMember\n name=\"shell\"\n optional\n type=\"boolean | string\"\n doc=\"If true, runs command inside of a shell. Uses '/bin/sh' on UNIX, and process.env.ComSpec on Windows. If a string is provided, it specifies the shell to use.\"\n />\n <hbr />\n <InterfaceMember\n name=\"forceShell\"\n optional\n type=\"boolean\"\n doc=\"If true, forces the command to run inside of a shell, even if the command is a file.\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <TypeDeclaration export name=\"SpawnOptions\">\n {code`SpawnBaseOptions & Parameters<typeof _spawn>[1]`}\n </TypeDeclaration>\n <Spacing />\n <TSDoc heading=\"A function to spawn child processes with proper color support and environment variable handling.\">\n <TSDocParam name=\"command\">{`The command to execute.`}</TSDocParam>\n <TSDocParam name=\"args\">\n {`The command-line arguments to pass to the command. Defaults to an empty array.`}\n </TSDocParam>\n <TSDocParam name=\"options\">\n {`Additional options for spawning the process, such as the current working directory (\\`cwd\\`).`}\n </TSDocParam>\n <TSDocReturns>{`The result of the spawned process.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"spawn\"\n parameters={[\n { name: \"command\", type: \"string\" },\n {\n name: \"args\",\n type: \"string[] | SpawnOptions\",\n default: \"{} as SpawnOptions\"\n },\n {\n name: \"options\",\n type: \"SpawnOptions\",\n default: \"{} as SpawnOptions\"\n }\n ]}>\n {code`const normalized = {\n command,\n args: [] as string[],\n options: options as SpawnOptions | any,\n file: undefined as string | undefined,\n original: {\n command,\n args,\n },\n };\n\n if (args) {\n if (Array.isArray(args)) {\n if (args.length > 0) {\n normalized.args = args.slice(0);\n }\n } else {\n normalized.options = { ...args } as SpawnOptions | any;\n normalized.args = [];\n }\n }\n\n if (!normalized.options.shell && isWindows) {\n normalized.file = (await resolveCommand(normalized.command, normalized.options)) || (await resolveCommand(normalized.command, normalized.options, delimiter));\n\n let commandFile = normalized.file;\n if (normalized.file) {\n let shebang: string | undefined;\n const buffer = Buffer.alloc(150);\n\n try {\n const fd = openSync(normalized.file, \"r\");\n await promisify(read)(fd, buffer, 0, 150, 0);\n closeSync(fd);\n } catch (err) {\n // Do nothing\n }\n\n const matched = buffer.toString().match(/^#!(.*)/);\n if (matched) {\n const [path, argument] = matched[0].replace(/#! ?/, \"\").split(\" \");\n\t const binary = path.split(\"/\").pop();\n if (binary === \"env\") {\n shebang = argument;\n } else {\n shebang = argument ? \\`\\${binary} \\${argument}\\` : binary;\n }\n }\n\n if (shebang) {\n normalized.args.unshift(normalized.file);\n normalized.command = shebang;\n\n commandFile = await resolveCommand(normalized.command, normalized.options);\n }\n }\n\n if (commandFile && (normalized.options.forceShell || /\\\\.(?:com|exe)$/i.test(commandFile))) {\n normalized.command = normalize(normalized.command).replace(/([()\\\\][%!^\"\\`<>&|;, *?])/g, \"^$1\");\n\n normalized.args = [\"/d\", \"/s\", \"/c\", \\`\"\\${normalized.command} \\${normalized.args.map(arg =>\n \\`\\${arg}\\`.replace(/(?=(\\\\\\\\+?)?)\\\\1\"/g, \"$1$1\\\\\"\").replace(/(?=(\\\\\\\\+?)?)\\\\1$/, \"$1$1\")\n ).map(arg =>\n \\`\"\\${arg}\"\\`.replace(/([()\\\\][%!^\"\\`<>&|;, *?])/g, \"^$1\")\n ).map(arg =>\n /node_modules[\\\\\\\\/].bin[\\\\\\\\/][^\\\\\\\\/]+\\\\.cmd$/i.test(commandFile) ? arg.replace(/([()\\\\][%!^\"\\`<>&|;, *?])/g, \"^$1\") : arg\n ).join(\" \")}\"\\`];\n normalized.command = process.env.comspec || \"cmd.exe\";\n normalized.options.windowsVerbatimArguments = true;\n }\n }\n\n let stdout = \"\";\n let stderr = \"\";\n\n const child = _spawn(normalized.command, normalized.args, {\n cwd: process.cwd(),\n env: {\n ...process.env,\n FORCE_COLOR: isColorSupported ? \"1\" : \"0\",\n },\n ...normalized.options,\n }) as ReturnType<typeof _spawn>;\n\n if (isWindows) {\n const emit = child.emit;\n child.emit = (eventName: string | symbol, ...eventArgs: any[]) => {\n if (eventName === \"exit\") {\n let err: Error | null = null;\n if (eventArgs[0] === 1 && !normalized.file) {\n err = Object.assign(new Error(\\`spawn \\${normalized.original.command} ENOENT\\`), {\n code: \"ENOENT\",\n errno: \"ENOENT\",\n syscall: \\`spawn \\${normalized.original.command}\\`,\n path: normalized.original.command,\n spawnargs: normalized.original.args,\n });\n }\n\n if (err) {\n return emit.call(child, \"error\", err);\n }\n }\n\n return emit.apply(child, [eventName, ...eventArgs]);\n };\n }\n\n return new Promise((resolve, reject) => {\n if (normalized.options.stdin !== undefined) {\n child.stdin?.write(normalized.options.stdin);\n }\n\n child.stdin?.end();\n\n child.stdout?.on(\"data\", data => {\n stdout += data;\n if (normalized.options.stdout) {\n normalized.options.stdout(data);\n }\n });\n\n child.stderr?.on(\"data\", data => {\n stderr += data;\n if (normalized.options.stderr) {\n normalized.options.stderr(data);\n }\n });\n\n if (normalized.options.rejectOnError) {\n child.addListener(\"error\", reject);\n }\n\n child.on(\"close\", code => {\n if (code !== 0 && normalized.options.rejectOnError) {\n reject(stderr);\n } else {\n resolve({ stdout, stderr });\n }\n });\n }); `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport function ContextUtilities() {\n return code`\n /**\n * The global Shell Shock - Application context instance.\n *\n * @internal\n */\n export let internal_appContext = new AsyncLocalStorage<Map<string, any>>();\n\n /**\n * Get the Shell Shock - Application context for the current application.\n *\n * @param options - The options to use when getting the context.\n * @returns The Shell Shock - Application context for the current application or undefined if the context is not available.\n */\n export function useApp(): Map<string, any> | undefined {\n return internal_appContext.getStore();\n }\n\n /**\n * A utility hook function to get the command-line arguments from the application context.\n *\n * @returns An array of command-line arguments from the application context.\n * @throws If the application context is not available.\n */\n export function useArgs(): string[] {\n return useApp()?.get(\"args\") ?? getArgs();\n }\n\n /**\n * The context object for the current command execution, containing the command path and segments.\n */\n export interface CommandContext {\n path: string;\n segments: string[];\n }\n\n /**\n * The global Shell Shock - Command context instance.\n *\n * @internal\n */\n export let internal_commandContext = new AsyncLocalStorage<CommandContext>();\n\n /**\n * Get the Shell Shock - Command context for the current application.\n *\n * @param options - The options to use when getting the context.\n * @returns The Shell Shock - Command context for the current application.\n * @throws If the Shell Shock - Command context is not available.\n */\n export function useCommand(): CommandContext {\n const result = internal_commandContext.getStore();\n if (!result) {\n throw new Error(\n \\`The Shell Shock - Command context is not available. Make sure to call useCommand() within a valid context scope.\\`\n );\n }\n return result;\n }\n\n /**\n * A utility hook function to get the individual segments of the current command path.\n *\n * @returns An array of command path segments.\n * @throws If the command context is not available.\n */\n export function useSegments(): string[] {\n return useCommand().segments;\n }\n\n /**\n * A utility hook function to get the full command path as a string.\n *\n * @returns The full command path as a string.\n * @throws If the command context is not available.\n */\n export function usePath(): string {\n return useCommand().path;\n }\n `;\n}\n\n/**\n * A built-in utilities module for Shell Shock.\n */\nexport function UtilsBuiltin(props: UtilsBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <BuiltinFile\n id=\"utils\"\n description=\"A collection of helper utilities that ease command-line application development.\"\n {...rest}\n imports={defu(rest.imports ?? {}, {\n \"node:os\": \"os\",\n \"node:process\": \"process\",\n \"node:path\": [\n \"resolve\",\n \"delimiter\",\n \"normalize\",\n \"join\",\n \"posix\",\n \"sep\"\n ],\n \"node:fs\": [\"openSync\", \"closeSync\", \"read\"],\n \"node:fs/promises\": [\"stat\"],\n \"node:util\": [\"promisify\"],\n \"node:child_process\": [{ name: \"spawn\", alias: \"_spawn\" }],\n \"node:async_hooks\": [\"AsyncLocalStorage\"]\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n console: [\"error\", \"verbose\", \"writeLine\"],\n env: [\"env\", \"isCI\", \"isTest\", \"isWindows\", \"isDevelopment\", \"isDebug\"]\n })}>\n <Spacing />\n <ContextUtilities />\n <Spacing />\n <ArgsUtilities />\n <Spacing />\n <EnvSupportUtilities />\n <Spacing />\n <HyperlinkSupportUtilities />\n <Spacing />\n <ColorSupportUtilities />\n <Spacing />\n <SpawnFunctionDeclaration />\n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,EAAA,CAAA;qDACPuB,qBAAmB,EAAA,CAAA;qDACnBvB,2DAAO,EAAA,CAAA;qDACP2B,2BAAyB,EAAA,CAAA;qDACzB3B,2DAAO,EAAA,CAAA;qDACPyB,uBAAqB,EAAA,CAAA;qDACrBzB,2DAAO,EAAA,CAAA;qDACP8B,0BAAwB,EAAA,CAAA;qDACxB9B,2DAAO,EAAA,CAAA;qDACPU,4BAA0B,EAAA,CAAA;qDAC1BV,2DAAO,EAAA,CAAA;qDACPP,sBAAI;KAAA,IAACoD,OAAI;AAAA,aAAEC,QAAQ9B,SAAS;;KAAGA;KAAQ,CAAA;IAAA;;EAAA,CAAA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
2
|
import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
3
3
|
|
|
4
4
|
//#region src/components/utils-builtin.d.ts
|
|
@@ -6,32 +6,32 @@ interface UtilsBuiltinProps extends Omit<BuiltinFileProps, "id" | "description">
|
|
|
6
6
|
/**
|
|
7
7
|
* Generates the `findSuggestions` function for suggesting corrections for potentially misspelled options or commands.
|
|
8
8
|
*/
|
|
9
|
-
declare function FindSuggestionsDeclaration():
|
|
9
|
+
declare function FindSuggestionsDeclaration(): _alloy_js_core0.Children;
|
|
10
10
|
/**
|
|
11
11
|
* Generates utilities for detecting terminal color support.
|
|
12
12
|
*/
|
|
13
|
-
declare function EnvSupportUtilities():
|
|
13
|
+
declare function EnvSupportUtilities(): _alloy_js_core0.Children;
|
|
14
14
|
/**
|
|
15
15
|
* Generates utilities for detecting terminal color support.
|
|
16
16
|
*/
|
|
17
|
-
declare function ColorSupportUtilities():
|
|
17
|
+
declare function ColorSupportUtilities(): _alloy_js_core0.Children;
|
|
18
18
|
/**
|
|
19
19
|
* Generates utilities for detecting terminal color support.
|
|
20
20
|
*/
|
|
21
|
-
declare function HyperlinkSupportUtilities():
|
|
21
|
+
declare function HyperlinkSupportUtilities(): _alloy_js_core0.Children;
|
|
22
22
|
/**
|
|
23
23
|
* Generates utilities for detecting terminal color support.
|
|
24
24
|
*/
|
|
25
|
-
declare function ArgsUtilities():
|
|
25
|
+
declare function ArgsUtilities(): _alloy_js_core0.Children;
|
|
26
26
|
/**
|
|
27
27
|
* Generates the `spawn` function declaration, which is a cross-platform utility for spawning child processes with proper color support and environment variable handling.
|
|
28
28
|
*/
|
|
29
|
-
declare function SpawnFunctionDeclaration():
|
|
30
|
-
declare function ContextUtilities():
|
|
29
|
+
declare function SpawnFunctionDeclaration(): _alloy_js_core0.Children;
|
|
30
|
+
declare function ContextUtilities(): _alloy_js_core0.Children;
|
|
31
31
|
/**
|
|
32
32
|
* A built-in utilities module for Shell Shock.
|
|
33
33
|
*/
|
|
34
|
-
declare function UtilsBuiltin(props: UtilsBuiltinProps):
|
|
34
|
+
declare function UtilsBuiltin(props: UtilsBuiltinProps): _alloy_js_core0.Children;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { ArgsUtilities, ColorSupportUtilities, ContextUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, SpawnFunctionDeclaration, UtilsBuiltin, UtilsBuiltinProps };
|
|
37
37
|
//# sourceMappingURL=utils-builtin.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-builtin.d.cts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UAyCiB,iBAAA,SAA0B,KACzC;;AADF;AAQA;
|
|
1
|
+
{"version":3,"file":"utils-builtin.d.cts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UAyCiB,iBAAA,SAA0B,KACzC;;AADF;AAQA;AA0MgB,iBA1MA,0BAAA,CAAA,CA0MmB,EA1MO,eAAA,CAAA,QA0MP;AAiCnC;AAsMA;AA0GA;AA6EgB,iBA9ZA,mBAAA,CAAA,CA8ZwB,EA9ZL,eAAA,CAAA,QA8ZK;AAkTxC;AAsFA;;iBArwBgB,qBAAA,CAAA,GAAqB,eAAA,CAAA;;;;iBAsMrB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA0GzB,aAAA,CAAA,GAAa,eAAA,CAAA;;;;iBA6Eb,wBAAA,CAAA,GAAwB,eAAA,CAAA;iBAkTxB,gBAAA,CAAA,GAAgB,eAAA,CAAA;;;;iBAsFhB,YAAA,QAAoB,oBAAiB,eAAA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
2
|
import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
3
3
|
|
|
4
4
|
//#region src/components/utils-builtin.d.ts
|
|
@@ -6,32 +6,32 @@ interface UtilsBuiltinProps extends Omit<BuiltinFileProps, "id" | "description">
|
|
|
6
6
|
/**
|
|
7
7
|
* Generates the `findSuggestions` function for suggesting corrections for potentially misspelled options or commands.
|
|
8
8
|
*/
|
|
9
|
-
declare function FindSuggestionsDeclaration():
|
|
9
|
+
declare function FindSuggestionsDeclaration(): _alloy_js_core0.Children;
|
|
10
10
|
/**
|
|
11
11
|
* Generates utilities for detecting terminal color support.
|
|
12
12
|
*/
|
|
13
|
-
declare function EnvSupportUtilities():
|
|
13
|
+
declare function EnvSupportUtilities(): _alloy_js_core0.Children;
|
|
14
14
|
/**
|
|
15
15
|
* Generates utilities for detecting terminal color support.
|
|
16
16
|
*/
|
|
17
|
-
declare function ColorSupportUtilities():
|
|
17
|
+
declare function ColorSupportUtilities(): _alloy_js_core0.Children;
|
|
18
18
|
/**
|
|
19
19
|
* Generates utilities for detecting terminal color support.
|
|
20
20
|
*/
|
|
21
|
-
declare function HyperlinkSupportUtilities():
|
|
21
|
+
declare function HyperlinkSupportUtilities(): _alloy_js_core0.Children;
|
|
22
22
|
/**
|
|
23
23
|
* Generates utilities for detecting terminal color support.
|
|
24
24
|
*/
|
|
25
|
-
declare function ArgsUtilities():
|
|
25
|
+
declare function ArgsUtilities(): _alloy_js_core0.Children;
|
|
26
26
|
/**
|
|
27
27
|
* Generates the `spawn` function declaration, which is a cross-platform utility for spawning child processes with proper color support and environment variable handling.
|
|
28
28
|
*/
|
|
29
|
-
declare function SpawnFunctionDeclaration():
|
|
30
|
-
declare function ContextUtilities():
|
|
29
|
+
declare function SpawnFunctionDeclaration(): _alloy_js_core0.Children;
|
|
30
|
+
declare function ContextUtilities(): _alloy_js_core0.Children;
|
|
31
31
|
/**
|
|
32
32
|
* A built-in utilities module for Shell Shock.
|
|
33
33
|
*/
|
|
34
|
-
declare function UtilsBuiltin(props: UtilsBuiltinProps):
|
|
34
|
+
declare function UtilsBuiltin(props: UtilsBuiltinProps): _alloy_js_core0.Children;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { ArgsUtilities, ColorSupportUtilities, ContextUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, SpawnFunctionDeclaration, UtilsBuiltin, UtilsBuiltinProps };
|
|
37
37
|
//# sourceMappingURL=utils-builtin.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-builtin.d.mts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UAyCiB,iBAAA,SAA0B,KACzC;;AADF;AAQA;
|
|
1
|
+
{"version":3,"file":"utils-builtin.d.mts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UAyCiB,iBAAA,SAA0B,KACzC;;AADF;AAQA;AA0MgB,iBA1MA,0BAAA,CAAA,CA0MmB,EA1MO,eAAA,CAAA,QA0MP;AAiCnC;AAsMA;AA0GA;AA6EgB,iBA9ZA,mBAAA,CAAA,CA8ZwB,EA9ZL,eAAA,CAAA,QA8ZK;AAkTxC;AAsFA;;iBArwBgB,qBAAA,CAAA,GAAqB,eAAA,CAAA;;;;iBAsMrB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA0GzB,aAAA,CAAA,GAAa,eAAA,CAAA;;;;iBA6Eb,wBAAA,CAAA,GAAwB,eAAA,CAAA;iBAkTxB,gBAAA,CAAA,GAAgB,eAAA,CAAA;;;;iBAsFhB,YAAA,QAAoB,oBAAiB,eAAA,CAAA"}
|
|
@@ -78,11 +78,9 @@ function FindSuggestionsDeclaration() {
|
|
|
78
78
|
get children() {
|
|
79
79
|
return [
|
|
80
80
|
createComponent(TSDocRemarks, { children: "This function is intended to be used to suggest corrections for potentially misspelled options or commands." }),
|
|
81
|
-
|
|
82
|
-
createIntrinsic("hbr", {}),
|
|
81
|
+
createComponent(Spacing, {}),
|
|
83
82
|
createComponent(TSDocInternal, {}),
|
|
84
|
-
|
|
85
|
-
createIntrinsic("hbr", {}),
|
|
83
|
+
createComponent(Spacing, {}),
|
|
86
84
|
createComponent(TSDocParam, {
|
|
87
85
|
name: "input",
|
|
88
86
|
children: "The input string to check for potential matches."
|
|
@@ -553,11 +551,9 @@ function ArgsUtilities() {
|
|
|
553
551
|
get children() {
|
|
554
552
|
return [
|
|
555
553
|
createComponent(TSDocRemarks, { children: "This function is only intended for internal use. Please use `useArgs()` instead." }),
|
|
556
|
-
|
|
557
|
-
createIntrinsic("hbr", {}),
|
|
554
|
+
createComponent(Spacing, {}),
|
|
558
555
|
createComponent(TSDocInternal, {}),
|
|
559
|
-
|
|
560
|
-
createIntrinsic("hbr", {}),
|
|
556
|
+
createComponent(Spacing, {}),
|
|
561
557
|
createComponent(TSDocReturns, { children: "An array of command-line arguments from Deno or Node.js environments." })
|
|
562
558
|
];
|
|
563
559
|
}
|
|
@@ -966,7 +962,7 @@ function ContextUtilities() {
|
|
|
966
962
|
}
|
|
967
963
|
|
|
968
964
|
/**
|
|
969
|
-
* A utility hook function to get the command
|
|
965
|
+
* A utility hook function to get the command-line arguments from the application context.
|
|
970
966
|
*
|
|
971
967
|
* @returns An array of command-line arguments from the application context.
|
|
972
968
|
* @throws If the application context is not available.
|