@shell-shock/core 0.17.1 → 0.17.3

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.
Files changed (131) hide show
  1. package/dist/api.cjs +5 -4
  2. package/dist/api.mjs +4 -2
  3. package/dist/api.mjs.map +1 -1
  4. package/dist/components/command-validation-logic.cjs +44 -11
  5. package/dist/components/command-validation-logic.mjs +44 -10
  6. package/dist/components/command-validation-logic.mjs.map +1 -1
  7. package/dist/components/docs.cjs +1 -2
  8. package/dist/components/exec-builtin.cjs +1 -2
  9. package/dist/components/helpers.cjs +1 -2
  10. package/dist/components/options-parser-logic.cjs +1 -2
  11. package/dist/components/state-builtin.cjs +1 -2
  12. package/dist/components/state-builtin.mjs +1 -1
  13. package/dist/components/usage.cjs +1 -2
  14. package/dist/components/utils-builtin.cjs +1 -7
  15. package/dist/components/utils-builtin.mjs +0 -5
  16. package/dist/components/utils-builtin.mjs.map +1 -1
  17. package/dist/config.cjs +3 -3
  18. package/dist/config.mjs +2 -1
  19. package/dist/contexts/command.cjs +6 -3
  20. package/dist/contexts/command.mjs +5 -1
  21. package/dist/contexts/command.mjs.map +1 -1
  22. package/dist/contexts/options.cjs +6 -3
  23. package/dist/contexts/options.mjs +5 -1
  24. package/dist/contexts/options.mjs.map +1 -1
  25. package/dist/helpers/automd.cjs +1 -2
  26. package/dist/helpers/docs-helpers.cjs +3 -3
  27. package/dist/helpers/docs-helpers.mjs +2 -1
  28. package/dist/helpers/docs-helpers.mjs.map +1 -1
  29. package/dist/helpers/paths.cjs +3 -3
  30. package/dist/helpers/paths.mjs +2 -1
  31. package/dist/helpers/paths.mjs.map +1 -1
  32. package/dist/helpers/persistence.cjs +7 -5
  33. package/dist/helpers/persistence.mjs +6 -3
  34. package/dist/helpers/persistence.mjs.map +1 -1
  35. package/dist/helpers/update-package-json.cjs +1 -2
  36. package/dist/helpers/utilities.cjs +3 -3
  37. package/dist/helpers/utilities.mjs +2 -1
  38. package/dist/helpers/utilities.mjs.map +1 -1
  39. package/dist/helpers/validations.cjs +1 -2
  40. package/dist/plugin-utils/context-helpers.cjs +21 -12
  41. package/dist/plugin-utils/context-helpers.mjs +20 -10
  42. package/dist/plugin-utils/context-helpers.mjs.map +1 -1
  43. package/dist/plugin-utils/deepkit.cjs +5 -6
  44. package/dist/plugin-utils/deepkit.mjs +5 -5
  45. package/dist/plugin-utils/deepkit.mjs.map +1 -1
  46. package/dist/plugin-utils/description-helpers.cjs +14 -8
  47. package/dist/plugin-utils/description-helpers.mjs +13 -6
  48. package/dist/plugin-utils/description-helpers.mjs.map +1 -1
  49. package/dist/plugin-utils/get-command-tree.cjs +5 -4
  50. package/dist/plugin-utils/get-command-tree.mjs +4 -2
  51. package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
  52. package/dist/plugin-utils/reflect.cjs +3 -3
  53. package/dist/plugin-utils/reflect.mjs +2 -1
  54. package/dist/plugin-utils/traverse-command-tree.cjs +5 -4
  55. package/dist/plugin-utils/traverse-command-tree.mjs +4 -2
  56. package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
  57. package/dist/plugin-utils/type-checks.cjs +11 -7
  58. package/dist/plugin-utils/type-checks.mjs +10 -5
  59. package/dist/plugin-utils/type-checks.mjs.map +1 -1
  60. package/dist/plugin.cjs +5 -5
  61. package/dist/plugin.mjs +5 -4
  62. package/dist/plugin.mjs.map +1 -1
  63. package/dist/resolver/deepkit.cjs +4 -9
  64. package/dist/resolver/deepkit.mjs +4 -8
  65. package/dist/resolver/deepkit.mjs.map +1 -1
  66. package/dist/resolver/helpers.cjs +5 -4
  67. package/dist/resolver/helpers.mjs +4 -2
  68. package/dist/resolver/helpers.mjs.map +1 -1
  69. package/dist/resolver/module.cjs +1 -2
  70. package/dist/resolver/resolve.cjs +8 -5
  71. package/dist/resolver/resolve.mjs +7 -3
  72. package/dist/resolver/resolve.mjs.map +1 -1
  73. package/dist/types/command.cjs +65 -12
  74. package/dist/types/command.d.cts +9 -1
  75. package/dist/types/command.d.cts.map +1 -1
  76. package/dist/types/command.d.mts +9 -1
  77. package/dist/types/command.d.mts.map +1 -1
  78. package/dist/types/command.mjs +64 -10
  79. package/dist/types/command.mjs.map +1 -1
  80. package/dist/types/config.cjs +19 -7
  81. package/dist/types/config.d.cts +1 -1
  82. package/dist/types/config.d.mts +1 -1
  83. package/dist/types/config.mjs +18 -5
  84. package/dist/types/config.mjs.map +1 -1
  85. package/dist/types/context.cjs +6 -3
  86. package/dist/types/context.mjs +5 -1
  87. package/dist/types/env.cjs +8 -3
  88. package/dist/types/env.d.cts +3 -1
  89. package/dist/types/env.d.cts.map +1 -1
  90. package/dist/types/env.d.mts +3 -1
  91. package/dist/types/env.d.mts.map +1 -1
  92. package/dist/types/env.mjs +7 -1
  93. package/dist/types/env.mjs.map +1 -1
  94. package/dist/types/options.cjs +1 -2
  95. package/package.json +11 -11
  96. package/dist/api.cjs.map +0 -1
  97. package/dist/components/command-validation-logic.cjs.map +0 -1
  98. package/dist/components/docs.cjs.map +0 -1
  99. package/dist/components/exec-builtin.cjs.map +0 -1
  100. package/dist/components/helpers.cjs.map +0 -1
  101. package/dist/components/options-parser-logic.cjs.map +0 -1
  102. package/dist/components/state-builtin.cjs.map +0 -1
  103. package/dist/components/usage.cjs.map +0 -1
  104. package/dist/components/utils-builtin.cjs.map +0 -1
  105. package/dist/config.cjs.map +0 -1
  106. package/dist/contexts/command.cjs.map +0 -1
  107. package/dist/contexts/options.cjs.map +0 -1
  108. package/dist/helpers/automd.cjs.map +0 -1
  109. package/dist/helpers/docs-helpers.cjs.map +0 -1
  110. package/dist/helpers/paths.cjs.map +0 -1
  111. package/dist/helpers/persistence.cjs.map +0 -1
  112. package/dist/helpers/update-package-json.cjs.map +0 -1
  113. package/dist/helpers/utilities.cjs.map +0 -1
  114. package/dist/helpers/validations.cjs.map +0 -1
  115. package/dist/plugin-utils/context-helpers.cjs.map +0 -1
  116. package/dist/plugin-utils/deepkit.cjs.map +0 -1
  117. package/dist/plugin-utils/description-helpers.cjs.map +0 -1
  118. package/dist/plugin-utils/get-command-tree.cjs.map +0 -1
  119. package/dist/plugin-utils/reflect.cjs.map +0 -1
  120. package/dist/plugin-utils/traverse-command-tree.cjs.map +0 -1
  121. package/dist/plugin-utils/type-checks.cjs.map +0 -1
  122. package/dist/plugin.cjs.map +0 -1
  123. package/dist/resolver/deepkit.cjs.map +0 -1
  124. package/dist/resolver/helpers.cjs.map +0 -1
  125. package/dist/resolver/module.cjs.map +0 -1
  126. package/dist/resolver/resolve.cjs.map +0 -1
  127. package/dist/types/command.cjs.map +0 -1
  128. package/dist/types/config.cjs.map +0 -1
  129. package/dist/types/context.cjs.map +0 -1
  130. package/dist/types/env.cjs.map +0 -1
  131. package/dist/types/options.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"utils-builtin.mjs","names":[],"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 IfStatement,\n InterfaceDeclaration,\n InterfaceMember,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\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 size and whether the process is running in the foreground, which can be used to determine how to render output (e.g., whether to use a progress bar or spinner).\n */\nexport function TerminalSizeDeclaration() {\n return (\n <>\n <VarDeclaration\n export\n const\n name=\"DEFAULT_TERMINAL_COLUMNS\"\n doc=\"Default number of terminal columns\"\n initializer={code`80`}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"DEFAULT_TERMINAL_ROWS\"\n doc=\"Default number of terminal rows\"\n initializer={code`24`}\n />\n <Spacing />\n <FunctionDeclaration name=\"isForegroundProcess\">\n {code`if (isLinux) {\n return true;\n }\n\n try {\n const statContents = readFileSync(\"/proc/self/stat\", \"utf8\");\n const closingParenthesisIndex = statContents.lastIndexOf(') ');\n\n if (closingParenthesisIndex === -1) {\n return false;\n }\n\n const statFields = statContents.slice(closingParenthesisIndex + 2).trim().split(/\\\\s+/);\n const processGroupId = Number.parseInt(statFields[2], 10);\n const foregroundProcessGroupId = Number.parseInt(statFields[5], 10);\n\n if (Number.isNaN(processGroupId) || Number.isNaN(foregroundProcessGroupId)) {\n return false;\n }\n\n if (foregroundProcessGroupId <= 0) {\n return false;\n }\n\n return processGroupId === foregroundProcessGroupId;\n } catch {\n return false;\n } `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration name=\"tput\">\n {code`try {\n const columns = execSync([\"tput\", \"cols\"], { env: { TERM: 'dumb', ...process.env } });\n const rows = execSync([\"tput\", \"lines\"], { env: { TERM: 'dumb', ...process.env } });\n\n if (columns && rows) {\n return { columns: Number.parseInt(columns.toString().trim(), 10), rows: Number.parseInt(rows.toString().trim(), 10) };\n }\n } catch {} `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration name=\"devTty\">\n {code`try {\n const writeStream = new WriteStream(\n openSync(\n \"/dev/tty\",\n fsConstants.O_NONBLOCK\n )\n ).getWindowSize();\n\n return { columns: writeStream[0], rows: writeStream[1] };\n } catch {} `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A utility function that attempts to determine the size of the terminal (number of columns and rows) using various methods, and falls back to default values if it cannot be determined. This can be used to adjust output formatting based on the available terminal size.\">\n <TSDocRemarks>\n {\n \"The function first checks if the process is running in a TTY environment and if the stdout or stderr streams provide column and row information. If not, it attempts to use platform-specific methods (like reading from /proc/self/stat on Linux, using tput on Unix-like systems, or checking /dev/tty) to determine the terminal size. If all else fails, it returns default values.\"\n }\n </TSDocRemarks>\n <Spacing />\n <TSDocReturns>\n {\n \"An object containing the number of columns and rows of the terminal.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getTerminalSize\"\n returnType=\"{ columns: number; rows: number; }\">\n <IfStatement\n condition={code`process.stdout?.columns && process.stdout?.rows`}>\n {code`return { columns: process.stdout.columns, rows: process.stdout.rows }; `}\n </IfStatement>\n <IfStatement\n condition={code`process.stderr?.columns && process.stderr?.rows`}>\n {code`return { columns: process.stderr.columns, rows: process.stderr.rows };`}\n </IfStatement>\n <Spacing />\n <IfStatement condition={code`isWindows`}>\n {code`return tput() ?? {\n columns: DEFAULT_TERMINAL_COLUMNS,\n rows: DEFAULT_TERMINAL_ROWS,\n }; `}\n </IfStatement>\n <IfStatement condition={code`isMacOS`}>\n {code`return devTty() ?? tput() ?? {\n columns: DEFAULT_TERMINAL_COLUMNS,\n rows: DEFAULT_TERMINAL_ROWS,\n }; `}\n </IfStatement>\n <Spacing />\n <VarDeclaration\n let\n name=\"result\"\n initializer={code`devTty() ?? tput(); `}\n />\n <IfStatement condition={code`!result && isForegroundProcess()`}>\n {code`try {\n const size = execSync([\"resize\", \"-u\"]).match(/\\\\d+/g);\n if (size.length === 2) {\n result = { columns: Number.parseInt(size[0], 10), rows: Number.parseInt(size[1], 10) };\n }\n } catch {} `}\n </IfStatement>\n <Spacing />\n {code`return result ?? {\n columns: DEFAULT_TERMINAL_COLUMNS,\n rows: DEFAULT_TERMINAL_ROWS,\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 the `resolveModule` function declaration, which is a utility for resolving file paths across different platforms.\n */\nexport function ResolveModuleFunctionDeclaration() {\n const context = usePowerlines<Context>();\n\n return (\n <>\n <Spacing />\n <InterfaceDeclaration\n name=\"ResolveModuleOptions\"\n doc=\"Options for the `resolve` handler function.\">\n <InterfaceMember\n name=\"parentURL\"\n optional\n type=\"string\"\n doc=\"The parent URL to use for resolving paths.\"\n />\n <hbr />\n <InterfaceMember\n name=\"conditions\"\n optional\n type=\"string[]\"\n doc=\"The conditions to use for resolving paths.\"\n />\n <hbr />\n </InterfaceDeclaration>\n <Spacing />\n <InterfaceDeclaration\n name=\"PackageConfig\"\n doc=\"Parsed package.json configuration for module resolution.\">\n <InterfaceMember\n name=\"pjsonPath\"\n type=\"string\"\n doc=\"The path to the package.json file.\"\n />\n <hbr />\n <InterfaceMember\n name=\"exists\"\n type=\"boolean\"\n doc=\"Whether the package.json file exists.\"\n />\n <hbr />\n <InterfaceMember\n name=\"main\"\n optional\n type=\"string\"\n doc=\"The main entry point of the package.\"\n />\n <hbr />\n <InterfaceMember\n name=\"name\"\n optional\n type=\"string\"\n doc=\"The name of the package.\"\n />\n <hbr />\n <InterfaceMember\n name=\"type\"\n optional\n type={`\"commonjs\" | \"module\" | \"none\"`}\n doc=\"The module type of the package.\"\n />\n <hbr />\n <InterfaceMember\n name=\"exports\"\n optional\n type=\"Record<string, unknown>\"\n doc=\"The exports map of the package.\"\n />\n <hbr />\n <InterfaceMember\n name=\"imports\"\n optional\n type=\"Record<string, unknown>\"\n doc=\"The imports map of the package.\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <VarDeclaration\n const\n name=\"DEFAULT_CONDITIONS_SET\"\n initializer={code`new Set([\"node\", \"import\"]);`}\n />\n <Spacing />\n <VarDeclaration\n const\n name=\"DEFAULT_EXTENSIONS\"\n initializer={code`[\".mjs\", \".cjs\", \".js\", \".json\", \".node\"];`}\n />\n <Spacing />\n <VarDeclaration\n const\n name=\"invalidPackageNameRegEx\"\n initializer={code`/^\\\\.|\\\\/|%/;`}\n />\n <Spacing />\n <FunctionDeclaration\n name=\"readPackageConfig\"\n parameters={[{ name: \"jsonPath\", type: \"string\" }]}\n returnType=\"PackageConfig\">\n {code`const result: PackageConfig = {\n pjsonPath: jsonPath,\n exists: false,\n main: undefined,\n name: undefined,\n type: \"none\",\n exports: undefined,\n imports: undefined\n };\n\n let content: string;\n try {\n content = readFileSync(jsonPath, \"utf8\");\n } catch (err: any) {\n if (err?.code === \"ENOENT\") {\n return result;\n }\n throw err;\n }\n\n let parsed: Record<string, unknown>;\n try {\n parsed = JSON.parse(content);\n } catch {\n return result;\n }\n\n result.exists = true;\n\n if (typeof parsed.name === \"string\") {\n result.name = parsed.name;\n }\n if (typeof parsed.main === \"string\") {\n result.main = parsed.main;\n }\n if (parsed.exports !== undefined && parsed.exports !== null) {\n result.exports = parsed.exports as Record<string, unknown>;\n }\n if (parsed.imports !== undefined && parsed.imports !== null) {\n result.imports = parsed.imports as Record<string, unknown>;\n }\n if (parsed.type === \"commonjs\" || parsed.type === \"module\") {\n result.type = parsed.type;\n }\n\n return result;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"getPackageScopeConfig\"\n parameters={[{ name: \"resolved\", type: \"URL | string\" }]}\n returnType=\"PackageConfig\">\n {code`let packageJSONUrl = new URL(\"package.json\", resolved);\n\n while (true) {\n const packageJSONPath = packageJSONUrl.pathname;\n if (packageJSONPath.endsWith(\"node_modules/package.json\")) {\n break;\n }\n\n const packageConfig = readPackageConfig(fileURLToPath(packageJSONUrl));\n if (packageConfig.exists) {\n return packageConfig;\n }\n\n const lastPackageJSONUrl = packageJSONUrl;\n packageJSONUrl = new URL(\"../package.json\", packageJSONUrl);\n\n if (packageJSONUrl.pathname === lastPackageJSONUrl.pathname) {\n break;\n }\n }\n\n return {\n pjsonPath: fileURLToPath(packageJSONUrl),\n exists: false,\n type: \"none\"\n };`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"isConditionalExportsMainSugar\"\n parameters={[{ name: \"exports\", type: \"unknown\" }]}\n returnType=\"boolean\">\n {code`if (typeof exports === \"string\" || Array.isArray(exports)) {\n return true;\n }\n if (typeof exports !== \"object\" || exports === null) {\n return false;\n }\n\n const keys = Object.getOwnPropertyNames(exports);\n let isConditionalSugar = false;\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]!;\n const currentIsConditionalSugar = key === \"\" || key[0] !== \".\";\n if (i === 0) {\n isConditionalSugar = currentIsConditionalSugar;\n } else if (isConditionalSugar !== currentIsConditionalSugar) {\n throw new Error(\n '\"exports\" cannot contain some keys starting with \\\\'.\\\\' and some not.'\n );\n }\n }\n\n return isConditionalSugar;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolvePackageTarget\"\n parameters={[\n { name: \"packageJsonUrl\", type: \"URL\" },\n { name: \"target\", type: \"unknown\" },\n { name: \"subpath\", type: \"string\" },\n { name: \"packageSubpath\", type: \"string\" },\n { name: \"base\", type: \"URL\" },\n { name: \"pattern\", type: \"boolean\" },\n { name: \"internal\", type: \"boolean\" },\n { name: \"conditions\", type: \"Set<string>\" }\n ]}\n returnType=\"URL | null | undefined\">\n {code`if (typeof target === \"string\") {\n if (!target.startsWith(\"./\")) {\n if (internal && !target.startsWith(\"../\") && !target.startsWith(\"/\")) {\n let isURL = false;\n try {\n new URL(target);\n isURL = true;\n } catch {}\n\n if (!isURL) {\n const exportTarget = pattern\n ? target.replace(/\\\\*/g, () => subpath)\n : target + subpath;\n return packageResolve(exportTarget, packageJsonUrl, conditions);\n }\n }\n return null;\n }\n\n const resolved = new URL(target, packageJsonUrl);\n const resolvedPath = resolved.pathname;\n const packagePath = new URL(\".\", packageJsonUrl).pathname;\n\n if (!resolvedPath.startsWith(packagePath)) {\n return null;\n }\n\n if (subpath === \"\") {\n return resolved;\n }\n\n if (pattern) {\n return new URL(resolved.href.replace(/\\\\*/g, () => subpath));\n }\n\n return new URL(subpath, resolved);\n }\n\n if (Array.isArray(target)) {\n if (target.length === 0) {\n return null;\n }\n\n let lastException: Error | null | undefined;\n for (const targetItem of target) {\n let resolveResult: URL | null | undefined;\n try {\n resolveResult = resolvePackageTarget(\n packageJsonUrl, targetItem, subpath, packageSubpath,\n base, pattern, internal, conditions\n );\n } catch (error: any) {\n lastException = error;\n if (error?.code === \"ERR_INVALID_PACKAGE_TARGET\") {\n continue;\n }\n throw error;\n }\n\n if (resolveResult === undefined) {\n continue;\n }\n if (resolveResult === null) {\n lastException = null;\n continue;\n }\n return resolveResult;\n }\n\n if (lastException === undefined || lastException === null) {\n return null;\n }\n throw lastException;\n }\n\n if (typeof target === \"object\" && target !== null) {\n const keys = Object.getOwnPropertyNames(target);\n for (const key of keys) {\n if (key === \"default\" || conditions.has(key)) {\n const conditionalTarget = (target as Record<string, unknown>)[key];\n const resolveResult = resolvePackageTarget(\n packageJsonUrl, conditionalTarget, subpath, packageSubpath,\n base, pattern, internal, conditions\n );\n if (resolveResult === undefined) {\n continue;\n }\n return resolveResult;\n }\n }\n return null;\n }\n\n if (target === null) {\n return null;\n }\n\n return null;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"packageExportsResolve\"\n parameters={[\n { name: \"packageJsonUrl\", type: \"URL\" },\n { name: \"packageSubpath\", type: \"string\" },\n { name: \"packageConfig\", type: \"PackageConfig\" },\n { name: \"base\", type: \"URL\" },\n { name: \"conditions\", type: \"Set<string>\" }\n ]}\n returnType=\"URL | null | undefined\">\n {code`let exports = packageConfig.exports;\n if (isConditionalExportsMainSugar(exports)) {\n exports = { \".\": exports } as Record<string, unknown>;\n }\n\n if (\n exports !== undefined &&\n exports !== null &&\n typeof exports === \"object\" &&\n Object.prototype.hasOwnProperty.call(exports, packageSubpath) &&\n !packageSubpath.includes(\"*\") &&\n !packageSubpath.endsWith(\"/\")\n ) {\n const target = (exports as Record<string, unknown>)[packageSubpath];\n const resolveResult = resolvePackageTarget(\n packageJsonUrl, target, \"\", packageSubpath,\n base, false, false, conditions\n );\n if (resolveResult === null || resolveResult === undefined) {\n const err = new Error(\n \\`Package subpath '\\${packageSubpath}' is not defined by \"exports\" in \\${fileURLToPath(packageJsonUrl)}\\`\n );\n (err as any).code = \"ERR_PACKAGE_PATH_NOT_EXPORTED\";\n throw err;\n }\n return resolveResult;\n }\n\n let bestMatch = \"\";\n let bestMatchSubpath = \"\";\n const keys = exports ? Object.getOwnPropertyNames(exports) : [];\n\n for (const key of keys) {\n const patternIndex = key.indexOf(\"*\");\n if (\n patternIndex !== -1 &&\n packageSubpath.startsWith(key.slice(0, patternIndex))\n ) {\n const patternTrailer = key.slice(patternIndex + 1);\n if (\n packageSubpath.length >= key.length &&\n packageSubpath.endsWith(patternTrailer) &&\n patternKeyCompare(bestMatch, key) === 1 &&\n key.lastIndexOf(\"*\") === patternIndex\n ) {\n bestMatch = key;\n bestMatchSubpath = packageSubpath.slice(\n patternIndex,\n packageSubpath.length - patternTrailer.length\n );\n }\n }\n }\n\n if (bestMatch) {\n const target = (exports as Record<string, unknown>)[bestMatch];\n const resolveResult = resolvePackageTarget(\n packageJsonUrl, target, bestMatchSubpath, bestMatch,\n base, true, false, conditions\n );\n if (resolveResult === null || resolveResult === undefined) {\n const err = new Error(\n \\`Package subpath '\\${packageSubpath}' is not defined by \"exports\" in \\${fileURLToPath(packageJsonUrl)}\\`\n );\n (err as any).code = \"ERR_PACKAGE_PATH_NOT_EXPORTED\";\n throw err;\n }\n return resolveResult;\n }\n\n const err = new Error(\n \\`Package subpath '\\${packageSubpath}' is not defined by \"exports\" in \\${fileURLToPath(packageJsonUrl)}\\`\n );\n (err as any).code = \"ERR_PACKAGE_PATH_NOT_EXPORTED\";\n throw err;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"patternKeyCompare\"\n parameters={[\n { name: \"a\", type: \"string\" },\n { name: \"b\", type: \"string\" }\n ]}\n returnType=\"number\">\n {code`const aPatternIndex = a.indexOf(\"*\");\n const bPatternIndex = b.indexOf(\"*\");\n const baseLengthA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;\n const baseLengthB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;\n if (baseLengthA > baseLengthB) return -1;\n if (baseLengthB > baseLengthA) return 1;\n if (aPatternIndex === -1) return 1;\n if (bPatternIndex === -1) return -1;\n if (a.length > b.length) return -1;\n if (b.length > a.length) return 1;\n return 0;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"legacyMainResolve\"\n parameters={[\n { name: \"packageJsonUrl\", type: \"URL\" },\n { name: \"packageConfig\", type: \"PackageConfig\" }\n ]}\n returnType=\"URL | undefined\">\n {code`let guess: URL | undefined;\n const tries: string[] = [];\n\n if (packageConfig.main !== undefined) {\n tries.push(\n \\`./\\${packageConfig.main}\\`,\n \\`./\\${packageConfig.main}.js\\`,\n \\`./\\${packageConfig.main}.json\\`,\n \\`./\\${packageConfig.main}.node\\`,\n \\`./\\${packageConfig.main}/index.js\\`,\n \\`./\\${packageConfig.main}/index.json\\`,\n \\`./\\${packageConfig.main}/index.node\\`\n );\n }\n\n tries.push(\"./index.js\", \"./index.json\", \"./index.node\");\n\n for (const entry of tries) {\n guess = new URL(entry, packageJsonUrl);\n try {\n const s = statSync(fileURLToPath(guess));\n if (s.isFile()) {\n return guess;\n }\n } catch {}\n guess = undefined;\n }\n\n return undefined;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"parsePackageName\"\n parameters={[\n { name: \"specifier\", type: \"string\" },\n { name: \"base\", type: \"URL\" }\n ]}\n returnType=\"{ packageName: string; packageSubpath: string; isScoped: boolean }\">\n {code`let separatorIndex = specifier.indexOf(\"/\");\n let validPackageName = true;\n let isScoped = false;\n\n if (specifier[0] === \"@\") {\n isScoped = true;\n if (separatorIndex === -1 || specifier.length === 0) {\n validPackageName = false;\n } else {\n separatorIndex = specifier.indexOf(\"/\", separatorIndex + 1);\n }\n }\n\n const packageName = separatorIndex === -1\n ? specifier\n : specifier.slice(0, separatorIndex);\n\n if (invalidPackageNameRegEx.exec(packageName) !== null) {\n validPackageName = false;\n }\n\n if (!validPackageName) {\n const err = new Error(\n \\`Invalid module \\\\\\`\\${specifier}\\\\\\` is not a valid package name imported from \\${fileURLToPath(base)}\\`\n );\n (err as any).code = \"ERR_INVALID_MODULE_SPECIFIER\";\n throw err;\n }\n\n const packageSubpath = \".\" + (separatorIndex === -1\n ? \"\"\n : specifier.slice(separatorIndex));\n\n return { packageName, packageSubpath, isScoped };`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"packageResolve\"\n parameters={[\n { name: \"specifier\", type: \"string\" },\n { name: \"base\", type: \"URL\" },\n { name: \"conditions\", type: \"Set<string>\" }\n ]}\n returnType=\"URL\">\n {code`if (builtinModules.includes(specifier)) {\n return new URL(\"node:\" + specifier);\n }\n\n const { packageName, packageSubpath, isScoped } = parsePackageName(specifier, base);\n\n // Self-resolution: check if the specifier matches the current package name\n const selfConfig = getPackageScopeConfig(base);\n if (\n selfConfig.exists &&\n selfConfig.name === packageName &&\n selfConfig.exports !== undefined &&\n selfConfig.exports !== null\n ) {\n const packageJsonUrl = pathToFileURL(selfConfig.pjsonPath);\n const result = packageExportsResolve(\n packageJsonUrl, packageSubpath, selfConfig, base, conditions\n );\n if (result) {\n return result;\n }\n }\n\n let packageJsonUrl = new URL(\n \"./node_modules/\" + packageName + \"/package.json\",\n base\n );\n let packageJsonPath = fileURLToPath(packageJsonUrl);\n let lastPath: string;\n\n do {\n let stat: ReturnType<typeof statSync> | undefined;\n try {\n stat = statSync(packageJsonPath.slice(0, -13));\n } catch {}\n\n if (!stat || !stat.isDirectory()) {\n lastPath = packageJsonPath;\n packageJsonUrl = new URL(\n (isScoped ? \"../../../../node_modules/\" : \"../../../node_modules/\") +\n packageName +\n \"/package.json\",\n packageJsonUrl\n );\n packageJsonPath = fileURLToPath(packageJsonUrl);\n continue;\n }\n\n const packageConfig = readPackageConfig(packageJsonPath);\n\n if (packageConfig.exports !== undefined && packageConfig.exports !== null) {\n const result = packageExportsResolve(\n packageJsonUrl, packageSubpath, packageConfig, base, conditions\n );\n if (result) {\n return result;\n }\n }\n\n if (packageSubpath === \".\") {\n const legacyResult = legacyMainResolve(packageJsonUrl, packageConfig);\n if (legacyResult) {\n return legacyResult;\n }\n\n return new URL(\".\", packageJsonUrl);\n }\n\n return new URL(packageSubpath, packageJsonUrl);\n } while (packageJsonPath.length !== lastPath!.length);\n\n const err = new Error(\\`Cannot find package \\\\\\`\\${packageName}\\\\\\`\\`);\n (err as any).code = \"ERR_MODULE_NOT_FOUND\";\n\n throw err;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"finalizeResolution\"\n parameters={[\n { name: \"resolved\", type: \"URL\" },\n { name: \"base\", type: \"URL\" }\n ]}\n returnType=\"URL\">\n {code`if (/%2f|%5c/i.test(resolved.pathname)) {\n const err = new Error(\n \\`Invalid module \\\\\\`\\${resolved.pathname}\\\\\\` must not include encoded \"/\" or \"\\\\\\\\\" characters imported from \\${fileURLToPath(base)}\\`\n );\n (err as any).code = \"ERR_INVALID_MODULE_SPECIFIER\";\n\n throw err;\n }\n\n const filePath = fileURLToPath(resolved);\n\n let stat: ReturnType<typeof statSync> | undefined;\n try {\n stat = statSync(filePath.endsWith(\"/\") ? filePath.slice(0, -1) : filePath);\n } catch {}\n\n if (stat && stat.isDirectory()) {\n const err = new Error(\n \\`Directory import \\\\\\`\\${filePath}\\\\\\` is not supported resolving ES modules imported from \\${fileURLToPath(base)}\\`\n );\n (err as any).code = \"ERR_UNSUPPORTED_DIR_IMPORT\";\n throw err;\n }\n\n if (!stat || !stat.isFile()) {\n const err = new Error(\n \\`Cannot find module \\\\\\`\\${filePath}\\\\\\` imported from \\${fileURLToPath(base)}\\`\n );\n (err as any).code = \"ERR_MODULE_NOT_FOUND\";\n throw err;\n }\n\n const real = realpathSync(filePath);\n const { search, hash } = resolved;\n const realUrl = pathToFileURL(real + (filePath.endsWith(sep) ? \"/\" : \"\"));\n realUrl.search = search;\n realUrl.hash = hash;\n\n return realUrl;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"moduleResolve\"\n parameters={[\n { name: \"specifier\", type: \"string\" },\n { name: \"base\", type: \"URL\" },\n { name: \"conditions\", type: \"Set<string>\" }\n ]}\n returnType=\"URL\">\n {code`let resolved: URL | undefined;\n\n if (\n specifier[0] === \"/\" ||\n (specifier[0] === \".\" &&\n (specifier.length === 1 ||\n specifier[1] === \"/\" ||\n (specifier[1] === \".\" && (specifier.length === 2 || specifier[2] === \"/\"))))\n ) {\n try {\n resolved = new URL(specifier, base);\n } catch (error_: any) {\n const err = new Error(\n \\`Failed to resolve module specifier \\\\\\`\\${specifier}\\\\\\` from \"\\${base}\": Invalid relative URL or base scheme is not hierarchical.\\`\n );\n err.cause = error_;\n throw err;\n }\n } else if (base.protocol === \"file:\" && specifier[0] === \"#\") {\n const packageConfig = getPackageScopeConfig(base);\n if (packageConfig.exists && packageConfig.imports) {\n const packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);\n const imports = packageConfig.imports;\n if (Object.prototype.hasOwnProperty.call(imports, specifier) && !specifier.includes(\"*\")) {\n const resolveResult = resolvePackageTarget(\n packageJsonUrl, imports[specifier], \"\", specifier,\n base, false, true, conditions\n );\n if (resolveResult !== null && resolveResult !== undefined) {\n resolved = resolveResult;\n }\n }\n\n if (!resolved) {\n let bestMatch = \"\";\n let bestMatchSubpath = \"\";\n const keys = Object.getOwnPropertyNames(imports);\n\n for (const key of keys) {\n const patternIndex = key.indexOf(\"*\");\n if (patternIndex !== -1 && specifier.startsWith(key.slice(0, -1))) {\n const patternTrailer = key.slice(patternIndex + 1);\n if (\n specifier.length >= key.length &&\n specifier.endsWith(patternTrailer) &&\n patternKeyCompare(bestMatch, key) === 1 &&\n key.lastIndexOf(\"*\") === patternIndex\n ) {\n bestMatch = key;\n bestMatchSubpath = specifier.slice(\n patternIndex,\n specifier.length - patternTrailer.length\n );\n }\n }\n }\n\n if (bestMatch) {\n const target = imports[bestMatch];\n const resolveResult = resolvePackageTarget(\n packageJsonUrl, target, bestMatchSubpath, bestMatch,\n base, true, true, conditions\n );\n if (resolveResult !== null && resolveResult !== undefined) {\n resolved = resolveResult;\n }\n }\n }\n }\n\n if (!resolved) {\n const err = new Error(\n \\`Package import specifier \\\\\\`\\${specifier}\\\\\\` is not defined in package imported from \\${fileURLToPath(base)}\\`\n );\n (err as any).code = \"ERR_PACKAGE_IMPORT_NOT_DEFINED\";\n throw err;\n }\n } else {\n try {\n resolved = new URL(specifier);\n } catch {\n resolved = packageResolve(specifier, base, conditions);\n }\n }\n\n if (resolved.protocol !== \"file:\") {\n return resolved;\n }\n\n return finalizeResolution(resolved, base);`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"tryModuleResolve\"\n parameters={[\n { name: \"id\", type: \"string\" },\n { name: \"url\", type: \"URL\" },\n { name: \"conditions\", type: \"Set<string>\" }\n ]}\n returnType=\"URL | undefined\">\n {code`try {\n return moduleResolve(id, url, conditions);\n } catch (error: any) {\n if (\n !(error as { code: string })?.code &&\n ![\n \"ERR_MODULE_NOT_FOUND\",\n \"ERR_UNSUPPORTED_DIR_IMPORT\",\n \"MODULE_NOT_FOUND\",\n \"ERR_PACKAGE_PATH_NOT_EXPORTED\"\n ].includes(error?.code)\n ) {\n throw error;\n }\n }`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A function to resolve module specifiers to URLs.\">\n <TSDocParam name=\"specifier\">{`The module specifier to resolve.`}</TSDocParam>\n <TSDocParam name=\"options\">\n {`The options for resolving the module. Defaults to an empty object.`}\n </TSDocParam>\n <TSDocReturns>{`The result of the resolve operation.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n async\n export\n name=\"resolveModule\"\n parameters={[\n { name: \"specifier\", type: \"string\" },\n {\n name: \"options\",\n type: \"ResolveModuleOptions\",\n default: \"{} as ResolveModuleOptions\"\n }\n ]}\n returnType=\"Promise<string>\">\n {code`const parentURL = options.parentURL ? new URL(options.parentURL) : undefined;\n const conditionsSet = options.conditions?.length\n ? new Set(options.conditions)\n : DEFAULT_CONDITIONS_SET;\n\n // Handle protocol-prefixed specifiers (node:, data:, http:, https:, ${context.config.framework}:)\n if (/^(?:node|data|https?|${context.config.framework}):/.test(specifier)) {\n return specifier;\n }\n\n const bareSpecifier = specifier.replace(/^node:/, \"\");\n if (builtinModules.includes(bareSpecifier)) {\n return \"node:\" + bareSpecifier;\n }\n\n if (specifier.startsWith(\"file://\")) {\n return specifier;\n }\n\n if (isAbsolute(specifier)) {\n try {\n const s = statSync(specifier);\n if (s.isFile()) {\n return pathToFileURL(realpathSync(specifier)).href;\n }\n } catch (err: any) {\n if (err?.code !== \"ENOENT\") {\n throw err;\n }\n }\n }\n\n const roots = [parentURL ?? pathToFileURL(join(process.cwd(), \"_\"))];\n\n const projectRootURL = pathToFileURL(\"${context.config.root}\");\n if (!roots.some(root => root.href === projectRootURL.href)) {\n roots.push(projectRootURL);\n }\n\n const workspaceRootURL = pathToFileURL(\"${\n context.workspaceConfig.workspaceRoot\n }\");\n if (!roots.some(root => root.href === workspaceRootURL.href)) {\n roots.push(workspaceRootURL);\n }\n\n let resolved: URL | undefined;\n for (const root of roots) {\n const _urls: URL[] = [];\n _urls.push(root);\n if (root.protocol === \"file:\") {\n _urls.push(\n new URL(\"./\", root),\n new URL(join(root.pathname, \"_index.js\"), root),\n new URL(\"node_modules\", root)\n );\n }\n\n for (const url of _urls) {\n resolved = tryModuleResolve(specifier, url, conditionsSet);\n if (resolved) {\n break;\n }\n\n for (const prefix of [\"\", \"/index\"]) {\n for (const extension of DEFAULT_EXTENSIONS) {\n resolved = tryModuleResolve(\n specifier + prefix + extension,\n url,\n conditionsSet\n );\n if (resolved) {\n break;\n }\n }\n if (resolved) {\n break;\n }\n }\n if (resolved) {\n break;\n }\n }\n\n if (resolved) {\n break;\n }\n }\n\n if (!resolved) {\n const err = new Error(\n \\`Cannot find module \\\\\\`\\${specifier}\\\\\\`\\`\n );\n (err as any).code = \"ERR_MODULE_NOT_FOUND\";\n\n throw err;\n }\n\n return pathToFileURL(fileURLToPath(resolved)).href;\n `}\n </FunctionDeclaration>\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 \"dirname\",\n \"isAbsolute\"\n ],\n \"node:fs\": [\n { name: \"constants\", alias: \"fsConstants\" },\n \"openSync\",\n \"closeSync\",\n \"read\",\n \"readFileSync\",\n \"statSync\",\n \"realpathSync\"\n ],\n \"node:fs/promises\": [\"stat\"],\n \"node:tty\": [\"WriteStream\"],\n \"node:util\": [\"promisify\"],\n \"node:url\": [\"fileURLToPath\", \"pathToFileURL\"],\n \"node:module\": [\"builtinModules\"]\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n console: [\"error\", \"verbose\", \"writeLine\"],\n env: [\n \"env\",\n \"isCI\",\n \"isTest\",\n \"isWindows\",\n \"isLinux\",\n \"isMacOS\",\n \"isDevelopment\",\n \"isDebug\"\n ],\n exec: [\"execSync\"],\n state: [\"hasFlag\"]\n })}>\n <TSDoc heading=\"A utility function to pause execution for a specified duration, which can be used in prompt interactions to create delays or timeouts. The function returns a promise that resolves after the specified duration in milliseconds, allowing it to be used with async/await syntax for easier handling of asynchronous prompt logic.\">\n <TSDocParam name=\"durationMs\">\n {`The duration to sleep in milliseconds.`}\n </TSDocParam>\n <TSDocReturns>\n {`A promise that resolves after the specified duration, allowing for asynchronous delays in prompt interactions.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"sleep\"\n parameters={[{ name: \"durationMs\", type: \"number\" }]}\n returnType=\"Promise<void>\">{code`return new Promise((resolve) => setTimeout(resolve, durationMs)); `}</FunctionDeclaration>\n <Spacing />\n <TerminalSizeDeclaration />\n <Spacing />\n <EnvSupportUtilities />\n <Spacing />\n <HyperlinkSupportUtilities />\n <Spacing />\n <ColorSupportUtilities />\n <Spacing />\n <ResolveModuleFunctionDeclaration />\n <Spacing />\n <FindSuggestionsDeclaration />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAiCA,SAAW,6BAAA;CACT,MAAA,UAAU,eAAA;AACV,QAAA;EAAA,gBAAY,gBAAA;GACZ,SAAA;GACA,MAAO;GACT,aAAiB,IAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDf,CAAC;EAAE,gBAAkB,SAAM,EAAK,CAAC;EAAE,gBAAkB,OAAM;GAC1D,SAAS;GACT,IAAI,WAAW;AACb,WAAO;KAAA,gBAAiB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IAClB,KAAK;KAAC;KAAK;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IACX,MAAI,CAAA,WAAA;IACJ,OAAE,CAAA,UAAA;;;EAGN,IAAI,WAAS;AACX,UAAI;IAAA,gBAAA,OAAA;KACF,SAAA;;AAEE,aAAG,CAAA,gBAAU,YAAA;OACb,MAAM;OACJ,UAAS;OACV,CAAA,EAAA,gBAAA,cAAA,EACA,UAAW;;KAGf,CAAC;IAAA,gBAAA,qBAAA;;KAEA,MAAM;KACN,YAAC,CAAA;MACD,MAAA;MACF,MAAA;MACH,CAAA;KACH,YAAA;;KAEE,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,yBAAA,EAAA,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,qBAAA,EAAA,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,2BAAA,EAAA,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,uBAAA,EAAA,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,kCAAA,EAAA,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,4BAAA,EAAA,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,MAAA;KACG,IAAM,OAAG;AACZ,aAAA,QAAA,SAAA;;KAES;;;;EAGR,CAAC,CAAC"}
1
+ {"version":3,"file":"utils-builtin.mjs","names":[],"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 IfStatement,\n InterfaceDeclaration,\n InterfaceMember,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\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 size and whether the process is running in the foreground, which can be used to determine how to render output (e.g., whether to use a progress bar or spinner).\n */\nexport function TerminalSizeDeclaration() {\n return (\n <>\n <VarDeclaration\n export\n const\n name=\"DEFAULT_TERMINAL_COLUMNS\"\n doc=\"Default number of terminal columns\"\n initializer={code`80`}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"DEFAULT_TERMINAL_ROWS\"\n doc=\"Default number of terminal rows\"\n initializer={code`24`}\n />\n <Spacing />\n <FunctionDeclaration name=\"isForegroundProcess\">\n {code`if (isLinux) {\n return true;\n }\n\n try {\n const statContents = readFileSync(\"/proc/self/stat\", \"utf8\");\n const closingParenthesisIndex = statContents.lastIndexOf(') ');\n\n if (closingParenthesisIndex === -1) {\n return false;\n }\n\n const statFields = statContents.slice(closingParenthesisIndex + 2).trim().split(/\\\\s+/);\n const processGroupId = Number.parseInt(statFields[2], 10);\n const foregroundProcessGroupId = Number.parseInt(statFields[5], 10);\n\n if (Number.isNaN(processGroupId) || Number.isNaN(foregroundProcessGroupId)) {\n return false;\n }\n\n if (foregroundProcessGroupId <= 0) {\n return false;\n }\n\n return processGroupId === foregroundProcessGroupId;\n } catch {\n return false;\n } `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration name=\"tput\">\n {code`try {\n const columns = execSync([\"tput\", \"cols\"], { env: { TERM: 'dumb', ...process.env } });\n const rows = execSync([\"tput\", \"lines\"], { env: { TERM: 'dumb', ...process.env } });\n\n if (columns && rows) {\n return { columns: Number.parseInt(columns.toString().trim(), 10), rows: Number.parseInt(rows.toString().trim(), 10) };\n }\n } catch {} `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration name=\"devTty\">\n {code`try {\n const writeStream = new WriteStream(\n openSync(\n \"/dev/tty\",\n fsConstants.O_NONBLOCK\n )\n ).getWindowSize();\n\n return { columns: writeStream[0], rows: writeStream[1] };\n } catch {} `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A utility function that attempts to determine the size of the terminal (number of columns and rows) using various methods, and falls back to default values if it cannot be determined. This can be used to adjust output formatting based on the available terminal size.\">\n <TSDocRemarks>\n {\n \"The function first checks if the process is running in a TTY environment and if the stdout or stderr streams provide column and row information. If not, it attempts to use platform-specific methods (like reading from /proc/self/stat on Linux, using tput on Unix-like systems, or checking /dev/tty) to determine the terminal size. If all else fails, it returns default values.\"\n }\n </TSDocRemarks>\n <Spacing />\n <TSDocReturns>\n {\n \"An object containing the number of columns and rows of the terminal.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getTerminalSize\"\n returnType=\"{ columns: number; rows: number; }\">\n <IfStatement\n condition={code`process.stdout?.columns && process.stdout?.rows`}>\n {code`return { columns: process.stdout.columns, rows: process.stdout.rows }; `}\n </IfStatement>\n <IfStatement\n condition={code`process.stderr?.columns && process.stderr?.rows`}>\n {code`return { columns: process.stderr.columns, rows: process.stderr.rows };`}\n </IfStatement>\n <Spacing />\n <IfStatement condition={code`isWindows`}>\n {code`return tput() ?? {\n columns: DEFAULT_TERMINAL_COLUMNS,\n rows: DEFAULT_TERMINAL_ROWS,\n }; `}\n </IfStatement>\n <IfStatement condition={code`isMacOS`}>\n {code`return devTty() ?? tput() ?? {\n columns: DEFAULT_TERMINAL_COLUMNS,\n rows: DEFAULT_TERMINAL_ROWS,\n }; `}\n </IfStatement>\n <Spacing />\n <VarDeclaration\n let\n name=\"result\"\n initializer={code`devTty() ?? tput(); `}\n />\n <IfStatement condition={code`!result && isForegroundProcess()`}>\n {code`try {\n const size = execSync([\"resize\", \"-u\"]).match(/\\\\d+/g);\n if (size.length === 2) {\n result = { columns: Number.parseInt(size[0], 10), rows: Number.parseInt(size[1], 10) };\n }\n } catch {} `}\n </IfStatement>\n <Spacing />\n {code`return result ?? {\n columns: DEFAULT_TERMINAL_COLUMNS,\n rows: DEFAULT_TERMINAL_ROWS,\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 the `resolveModule` function declaration, which is a utility for resolving file paths across different platforms.\n */\nexport function ResolveModuleFunctionDeclaration() {\n const context = usePowerlines<Context>();\n\n return (\n <>\n <Spacing />\n <InterfaceDeclaration\n name=\"ResolveModuleOptions\"\n doc=\"Options for the `resolve` handler function.\">\n <InterfaceMember\n name=\"parentURL\"\n optional\n type=\"string\"\n doc=\"The parent URL to use for resolving paths.\"\n />\n <hbr />\n <InterfaceMember\n name=\"conditions\"\n optional\n type=\"string[]\"\n doc=\"The conditions to use for resolving paths.\"\n />\n <hbr />\n </InterfaceDeclaration>\n <Spacing />\n <InterfaceDeclaration\n name=\"PackageConfig\"\n doc=\"Parsed package.json configuration for module resolution.\">\n <InterfaceMember\n name=\"pjsonPath\"\n type=\"string\"\n doc=\"The path to the package.json file.\"\n />\n <hbr />\n <InterfaceMember\n name=\"exists\"\n type=\"boolean\"\n doc=\"Whether the package.json file exists.\"\n />\n <hbr />\n <InterfaceMember\n name=\"main\"\n optional\n type=\"string\"\n doc=\"The main entry point of the package.\"\n />\n <hbr />\n <InterfaceMember\n name=\"name\"\n optional\n type=\"string\"\n doc=\"The name of the package.\"\n />\n <hbr />\n <InterfaceMember\n name=\"type\"\n optional\n type={`\"commonjs\" | \"module\" | \"none\"`}\n doc=\"The module type of the package.\"\n />\n <hbr />\n <InterfaceMember\n name=\"exports\"\n optional\n type=\"Record<string, unknown>\"\n doc=\"The exports map of the package.\"\n />\n <hbr />\n <InterfaceMember\n name=\"imports\"\n optional\n type=\"Record<string, unknown>\"\n doc=\"The imports map of the package.\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <VarDeclaration\n const\n name=\"DEFAULT_CONDITIONS_SET\"\n initializer={code`new Set([\"node\", \"import\"]);`}\n />\n <Spacing />\n <VarDeclaration\n const\n name=\"DEFAULT_EXTENSIONS\"\n initializer={code`[\".mjs\", \".cjs\", \".js\", \".json\", \".node\"];`}\n />\n <Spacing />\n <VarDeclaration\n const\n name=\"invalidPackageNameRegEx\"\n initializer={code`/^\\\\.|\\\\/|%/;`}\n />\n <Spacing />\n <FunctionDeclaration\n name=\"readPackageConfig\"\n parameters={[{ name: \"jsonPath\", type: \"string\" }]}\n returnType=\"PackageConfig\">\n {code`const result: PackageConfig = {\n pjsonPath: jsonPath,\n exists: false,\n main: undefined,\n name: undefined,\n type: \"none\",\n exports: undefined,\n imports: undefined\n };\n\n let content: string;\n try {\n content = readFileSync(jsonPath, \"utf8\");\n } catch (err: any) {\n if (err?.code === \"ENOENT\") {\n return result;\n }\n throw err;\n }\n\n let parsed: Record<string, unknown>;\n try {\n parsed = JSON.parse(content);\n } catch {\n return result;\n }\n\n result.exists = true;\n\n if (typeof parsed.name === \"string\") {\n result.name = parsed.name;\n }\n if (typeof parsed.main === \"string\") {\n result.main = parsed.main;\n }\n if (parsed.exports !== undefined && parsed.exports !== null) {\n result.exports = parsed.exports as Record<string, unknown>;\n }\n if (parsed.imports !== undefined && parsed.imports !== null) {\n result.imports = parsed.imports as Record<string, unknown>;\n }\n if (parsed.type === \"commonjs\" || parsed.type === \"module\") {\n result.type = parsed.type;\n }\n\n return result;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"getPackageScopeConfig\"\n parameters={[{ name: \"resolved\", type: \"URL | string\" }]}\n returnType=\"PackageConfig\">\n {code`let packageJSONUrl = new URL(\"package.json\", resolved);\n\n while (true) {\n const packageJSONPath = packageJSONUrl.pathname;\n if (packageJSONPath.endsWith(\"node_modules/package.json\")) {\n break;\n }\n\n const packageConfig = readPackageConfig(fileURLToPath(packageJSONUrl));\n if (packageConfig.exists) {\n return packageConfig;\n }\n\n const lastPackageJSONUrl = packageJSONUrl;\n packageJSONUrl = new URL(\"../package.json\", packageJSONUrl);\n\n if (packageJSONUrl.pathname === lastPackageJSONUrl.pathname) {\n break;\n }\n }\n\n return {\n pjsonPath: fileURLToPath(packageJSONUrl),\n exists: false,\n type: \"none\"\n };`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"isConditionalExportsMainSugar\"\n parameters={[{ name: \"exports\", type: \"unknown\" }]}\n returnType=\"boolean\">\n {code`if (typeof exports === \"string\" || Array.isArray(exports)) {\n return true;\n }\n if (typeof exports !== \"object\" || exports === null) {\n return false;\n }\n\n const keys = Object.getOwnPropertyNames(exports);\n let isConditionalSugar = false;\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]!;\n const currentIsConditionalSugar = key === \"\" || key[0] !== \".\";\n if (i === 0) {\n isConditionalSugar = currentIsConditionalSugar;\n } else if (isConditionalSugar !== currentIsConditionalSugar) {\n throw new Error(\n '\"exports\" cannot contain some keys starting with \\\\'.\\\\' and some not.'\n );\n }\n }\n\n return isConditionalSugar;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolvePackageTarget\"\n parameters={[\n { name: \"packageJsonUrl\", type: \"URL\" },\n { name: \"target\", type: \"unknown\" },\n { name: \"subpath\", type: \"string\" },\n { name: \"packageSubpath\", type: \"string\" },\n { name: \"base\", type: \"URL\" },\n { name: \"pattern\", type: \"boolean\" },\n { name: \"internal\", type: \"boolean\" },\n { name: \"conditions\", type: \"Set<string>\" }\n ]}\n returnType=\"URL | null | undefined\">\n {code`if (typeof target === \"string\") {\n if (!target.startsWith(\"./\")) {\n if (internal && !target.startsWith(\"../\") && !target.startsWith(\"/\")) {\n let isURL = false;\n try {\n new URL(target);\n isURL = true;\n } catch {}\n\n if (!isURL) {\n const exportTarget = pattern\n ? target.replace(/\\\\*/g, () => subpath)\n : target + subpath;\n return packageResolve(exportTarget, packageJsonUrl, conditions);\n }\n }\n return null;\n }\n\n const resolved = new URL(target, packageJsonUrl);\n const resolvedPath = resolved.pathname;\n const packagePath = new URL(\".\", packageJsonUrl).pathname;\n\n if (!resolvedPath.startsWith(packagePath)) {\n return null;\n }\n\n if (subpath === \"\") {\n return resolved;\n }\n\n if (pattern) {\n return new URL(resolved.href.replace(/\\\\*/g, () => subpath));\n }\n\n return new URL(subpath, resolved);\n }\n\n if (Array.isArray(target)) {\n if (target.length === 0) {\n return null;\n }\n\n let lastException: Error | null | undefined;\n for (const targetItem of target) {\n let resolveResult: URL | null | undefined;\n try {\n resolveResult = resolvePackageTarget(\n packageJsonUrl, targetItem, subpath, packageSubpath,\n base, pattern, internal, conditions\n );\n } catch (error: any) {\n lastException = error;\n if (error?.code === \"ERR_INVALID_PACKAGE_TARGET\") {\n continue;\n }\n throw error;\n }\n\n if (resolveResult === undefined) {\n continue;\n }\n if (resolveResult === null) {\n lastException = null;\n continue;\n }\n return resolveResult;\n }\n\n if (lastException === undefined || lastException === null) {\n return null;\n }\n throw lastException;\n }\n\n if (typeof target === \"object\" && target !== null) {\n const keys = Object.getOwnPropertyNames(target);\n for (const key of keys) {\n if (key === \"default\" || conditions.has(key)) {\n const conditionalTarget = (target as Record<string, unknown>)[key];\n const resolveResult = resolvePackageTarget(\n packageJsonUrl, conditionalTarget, subpath, packageSubpath,\n base, pattern, internal, conditions\n );\n if (resolveResult === undefined) {\n continue;\n }\n return resolveResult;\n }\n }\n return null;\n }\n\n if (target === null) {\n return null;\n }\n\n return null;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"packageExportsResolve\"\n parameters={[\n { name: \"packageJsonUrl\", type: \"URL\" },\n { name: \"packageSubpath\", type: \"string\" },\n { name: \"packageConfig\", type: \"PackageConfig\" },\n { name: \"base\", type: \"URL\" },\n { name: \"conditions\", type: \"Set<string>\" }\n ]}\n returnType=\"URL | null | undefined\">\n {code`let exports = packageConfig.exports;\n if (isConditionalExportsMainSugar(exports)) {\n exports = { \".\": exports } as Record<string, unknown>;\n }\n\n if (\n exports !== undefined &&\n exports !== null &&\n typeof exports === \"object\" &&\n Object.prototype.hasOwnProperty.call(exports, packageSubpath) &&\n !packageSubpath.includes(\"*\") &&\n !packageSubpath.endsWith(\"/\")\n ) {\n const target = (exports as Record<string, unknown>)[packageSubpath];\n const resolveResult = resolvePackageTarget(\n packageJsonUrl, target, \"\", packageSubpath,\n base, false, false, conditions\n );\n if (resolveResult === null || resolveResult === undefined) {\n const err = new Error(\n \\`Package subpath '\\${packageSubpath}' is not defined by \"exports\" in \\${fileURLToPath(packageJsonUrl)}\\`\n );\n (err as any).code = \"ERR_PACKAGE_PATH_NOT_EXPORTED\";\n throw err;\n }\n return resolveResult;\n }\n\n let bestMatch = \"\";\n let bestMatchSubpath = \"\";\n const keys = exports ? Object.getOwnPropertyNames(exports) : [];\n\n for (const key of keys) {\n const patternIndex = key.indexOf(\"*\");\n if (\n patternIndex !== -1 &&\n packageSubpath.startsWith(key.slice(0, patternIndex))\n ) {\n const patternTrailer = key.slice(patternIndex + 1);\n if (\n packageSubpath.length >= key.length &&\n packageSubpath.endsWith(patternTrailer) &&\n patternKeyCompare(bestMatch, key) === 1 &&\n key.lastIndexOf(\"*\") === patternIndex\n ) {\n bestMatch = key;\n bestMatchSubpath = packageSubpath.slice(\n patternIndex,\n packageSubpath.length - patternTrailer.length\n );\n }\n }\n }\n\n if (bestMatch) {\n const target = (exports as Record<string, unknown>)[bestMatch];\n const resolveResult = resolvePackageTarget(\n packageJsonUrl, target, bestMatchSubpath, bestMatch,\n base, true, false, conditions\n );\n if (resolveResult === null || resolveResult === undefined) {\n const err = new Error(\n \\`Package subpath '\\${packageSubpath}' is not defined by \"exports\" in \\${fileURLToPath(packageJsonUrl)}\\`\n );\n (err as any).code = \"ERR_PACKAGE_PATH_NOT_EXPORTED\";\n throw err;\n }\n return resolveResult;\n }\n\n const err = new Error(\n \\`Package subpath '\\${packageSubpath}' is not defined by \"exports\" in \\${fileURLToPath(packageJsonUrl)}\\`\n );\n (err as any).code = \"ERR_PACKAGE_PATH_NOT_EXPORTED\";\n throw err;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"patternKeyCompare\"\n parameters={[\n { name: \"a\", type: \"string\" },\n { name: \"b\", type: \"string\" }\n ]}\n returnType=\"number\">\n {code`const aPatternIndex = a.indexOf(\"*\");\n const bPatternIndex = b.indexOf(\"*\");\n const baseLengthA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;\n const baseLengthB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;\n if (baseLengthA > baseLengthB) return -1;\n if (baseLengthB > baseLengthA) return 1;\n if (aPatternIndex === -1) return 1;\n if (bPatternIndex === -1) return -1;\n if (a.length > b.length) return -1;\n if (b.length > a.length) return 1;\n return 0;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"legacyMainResolve\"\n parameters={[\n { name: \"packageJsonUrl\", type: \"URL\" },\n { name: \"packageConfig\", type: \"PackageConfig\" }\n ]}\n returnType=\"URL | undefined\">\n {code`let guess: URL | undefined;\n const tries: string[] = [];\n\n if (packageConfig.main !== undefined) {\n tries.push(\n \\`./\\${packageConfig.main}\\`,\n \\`./\\${packageConfig.main}.js\\`,\n \\`./\\${packageConfig.main}.json\\`,\n \\`./\\${packageConfig.main}.node\\`,\n \\`./\\${packageConfig.main}/index.js\\`,\n \\`./\\${packageConfig.main}/index.json\\`,\n \\`./\\${packageConfig.main}/index.node\\`\n );\n }\n\n tries.push(\"./index.js\", \"./index.json\", \"./index.node\");\n\n for (const entry of tries) {\n guess = new URL(entry, packageJsonUrl);\n try {\n const s = statSync(fileURLToPath(guess));\n if (s.isFile()) {\n return guess;\n }\n } catch {}\n guess = undefined;\n }\n\n return undefined;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"parsePackageName\"\n parameters={[\n { name: \"specifier\", type: \"string\" },\n { name: \"base\", type: \"URL\" }\n ]}\n returnType=\"{ packageName: string; packageSubpath: string; isScoped: boolean }\">\n {code`let separatorIndex = specifier.indexOf(\"/\");\n let validPackageName = true;\n let isScoped = false;\n\n if (specifier[0] === \"@\") {\n isScoped = true;\n if (separatorIndex === -1 || specifier.length === 0) {\n validPackageName = false;\n } else {\n separatorIndex = specifier.indexOf(\"/\", separatorIndex + 1);\n }\n }\n\n const packageName = separatorIndex === -1\n ? specifier\n : specifier.slice(0, separatorIndex);\n\n if (invalidPackageNameRegEx.exec(packageName) !== null) {\n validPackageName = false;\n }\n\n if (!validPackageName) {\n const err = new Error(\n \\`Invalid module \\\\\\`\\${specifier}\\\\\\` is not a valid package name imported from \\${fileURLToPath(base)}\\`\n );\n (err as any).code = \"ERR_INVALID_MODULE_SPECIFIER\";\n throw err;\n }\n\n const packageSubpath = \".\" + (separatorIndex === -1\n ? \"\"\n : specifier.slice(separatorIndex));\n\n return { packageName, packageSubpath, isScoped };`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"packageResolve\"\n parameters={[\n { name: \"specifier\", type: \"string\" },\n { name: \"base\", type: \"URL\" },\n { name: \"conditions\", type: \"Set<string>\" }\n ]}\n returnType=\"URL\">\n {code`if (builtinModules.includes(specifier)) {\n return new URL(\"node:\" + specifier);\n }\n\n const { packageName, packageSubpath, isScoped } = parsePackageName(specifier, base);\n\n // Self-resolution: check if the specifier matches the current package name\n const selfConfig = getPackageScopeConfig(base);\n if (\n selfConfig.exists &&\n selfConfig.name === packageName &&\n selfConfig.exports !== undefined &&\n selfConfig.exports !== null\n ) {\n const packageJsonUrl = pathToFileURL(selfConfig.pjsonPath);\n const result = packageExportsResolve(\n packageJsonUrl, packageSubpath, selfConfig, base, conditions\n );\n if (result) {\n return result;\n }\n }\n\n let packageJsonUrl = new URL(\n \"./node_modules/\" + packageName + \"/package.json\",\n base\n );\n let packageJsonPath = fileURLToPath(packageJsonUrl);\n let lastPath: string;\n\n do {\n let stat: ReturnType<typeof statSync> | undefined;\n try {\n stat = statSync(packageJsonPath.slice(0, -13));\n } catch {}\n\n if (!stat || !stat.isDirectory()) {\n lastPath = packageJsonPath;\n packageJsonUrl = new URL(\n (isScoped ? \"../../../../node_modules/\" : \"../../../node_modules/\") +\n packageName +\n \"/package.json\",\n packageJsonUrl\n );\n packageJsonPath = fileURLToPath(packageJsonUrl);\n continue;\n }\n\n const packageConfig = readPackageConfig(packageJsonPath);\n\n if (packageConfig.exports !== undefined && packageConfig.exports !== null) {\n const result = packageExportsResolve(\n packageJsonUrl, packageSubpath, packageConfig, base, conditions\n );\n if (result) {\n return result;\n }\n }\n\n if (packageSubpath === \".\") {\n const legacyResult = legacyMainResolve(packageJsonUrl, packageConfig);\n if (legacyResult) {\n return legacyResult;\n }\n\n return new URL(\".\", packageJsonUrl);\n }\n\n return new URL(packageSubpath, packageJsonUrl);\n } while (packageJsonPath.length !== lastPath!.length);\n\n const err = new Error(\\`Cannot find package \\\\\\`\\${packageName}\\\\\\`\\`);\n (err as any).code = \"ERR_MODULE_NOT_FOUND\";\n\n throw err;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"finalizeResolution\"\n parameters={[\n { name: \"resolved\", type: \"URL\" },\n { name: \"base\", type: \"URL\" }\n ]}\n returnType=\"URL\">\n {code`if (/%2f|%5c/i.test(resolved.pathname)) {\n const err = new Error(\n \\`Invalid module \\\\\\`\\${resolved.pathname}\\\\\\` must not include encoded \"/\" or \"\\\\\\\\\" characters imported from \\${fileURLToPath(base)}\\`\n );\n (err as any).code = \"ERR_INVALID_MODULE_SPECIFIER\";\n\n throw err;\n }\n\n const filePath = fileURLToPath(resolved);\n\n let stat: ReturnType<typeof statSync> | undefined;\n try {\n stat = statSync(filePath.endsWith(\"/\") ? filePath.slice(0, -1) : filePath);\n } catch {}\n\n if (stat && stat.isDirectory()) {\n const err = new Error(\n \\`Directory import \\\\\\`\\${filePath}\\\\\\` is not supported resolving ES modules imported from \\${fileURLToPath(base)}\\`\n );\n (err as any).code = \"ERR_UNSUPPORTED_DIR_IMPORT\";\n throw err;\n }\n\n if (!stat || !stat.isFile()) {\n const err = new Error(\n \\`Cannot find module \\\\\\`\\${filePath}\\\\\\` imported from \\${fileURLToPath(base)}\\`\n );\n (err as any).code = \"ERR_MODULE_NOT_FOUND\";\n throw err;\n }\n\n const real = realpathSync(filePath);\n const { search, hash } = resolved;\n const realUrl = pathToFileURL(real + (filePath.endsWith(sep) ? \"/\" : \"\"));\n realUrl.search = search;\n realUrl.hash = hash;\n\n return realUrl;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"moduleResolve\"\n parameters={[\n { name: \"specifier\", type: \"string\" },\n { name: \"base\", type: \"URL\" },\n { name: \"conditions\", type: \"Set<string>\" }\n ]}\n returnType=\"URL\">\n {code`let resolved: URL | undefined;\n\n if (\n specifier[0] === \"/\" ||\n (specifier[0] === \".\" &&\n (specifier.length === 1 ||\n specifier[1] === \"/\" ||\n (specifier[1] === \".\" && (specifier.length === 2 || specifier[2] === \"/\"))))\n ) {\n try {\n resolved = new URL(specifier, base);\n } catch (error_: any) {\n const err = new Error(\n \\`Failed to resolve module specifier \\\\\\`\\${specifier}\\\\\\` from \"\\${base}\": Invalid relative URL or base scheme is not hierarchical.\\`\n );\n err.cause = error_;\n throw err;\n }\n } else if (base.protocol === \"file:\" && specifier[0] === \"#\") {\n const packageConfig = getPackageScopeConfig(base);\n if (packageConfig.exists && packageConfig.imports) {\n const packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);\n const imports = packageConfig.imports;\n if (Object.prototype.hasOwnProperty.call(imports, specifier) && !specifier.includes(\"*\")) {\n const resolveResult = resolvePackageTarget(\n packageJsonUrl, imports[specifier], \"\", specifier,\n base, false, true, conditions\n );\n if (resolveResult !== null && resolveResult !== undefined) {\n resolved = resolveResult;\n }\n }\n\n if (!resolved) {\n let bestMatch = \"\";\n let bestMatchSubpath = \"\";\n const keys = Object.getOwnPropertyNames(imports);\n\n for (const key of keys) {\n const patternIndex = key.indexOf(\"*\");\n if (patternIndex !== -1 && specifier.startsWith(key.slice(0, -1))) {\n const patternTrailer = key.slice(patternIndex + 1);\n if (\n specifier.length >= key.length &&\n specifier.endsWith(patternTrailer) &&\n patternKeyCompare(bestMatch, key) === 1 &&\n key.lastIndexOf(\"*\") === patternIndex\n ) {\n bestMatch = key;\n bestMatchSubpath = specifier.slice(\n patternIndex,\n specifier.length - patternTrailer.length\n );\n }\n }\n }\n\n if (bestMatch) {\n const target = imports[bestMatch];\n const resolveResult = resolvePackageTarget(\n packageJsonUrl, target, bestMatchSubpath, bestMatch,\n base, true, true, conditions\n );\n if (resolveResult !== null && resolveResult !== undefined) {\n resolved = resolveResult;\n }\n }\n }\n }\n\n if (!resolved) {\n const err = new Error(\n \\`Package import specifier \\\\\\`\\${specifier}\\\\\\` is not defined in package imported from \\${fileURLToPath(base)}\\`\n );\n (err as any).code = \"ERR_PACKAGE_IMPORT_NOT_DEFINED\";\n throw err;\n }\n } else {\n try {\n resolved = new URL(specifier);\n } catch {\n resolved = packageResolve(specifier, base, conditions);\n }\n }\n\n if (resolved.protocol !== \"file:\") {\n return resolved;\n }\n\n return finalizeResolution(resolved, base);`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"tryModuleResolve\"\n parameters={[\n { name: \"id\", type: \"string\" },\n { name: \"url\", type: \"URL\" },\n { name: \"conditions\", type: \"Set<string>\" }\n ]}\n returnType=\"URL | undefined\">\n {code`try {\n return moduleResolve(id, url, conditions);\n } catch (error: any) {\n if (\n !(error as { code: string })?.code &&\n ![\n \"ERR_MODULE_NOT_FOUND\",\n \"ERR_UNSUPPORTED_DIR_IMPORT\",\n \"MODULE_NOT_FOUND\",\n \"ERR_PACKAGE_PATH_NOT_EXPORTED\"\n ].includes(error?.code)\n ) {\n throw error;\n }\n }`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A function to resolve module specifiers to URLs.\">\n <TSDocParam name=\"specifier\">{`The module specifier to resolve.`}</TSDocParam>\n <TSDocParam name=\"options\">\n {`The options for resolving the module. Defaults to an empty object.`}\n </TSDocParam>\n <TSDocReturns>{`The result of the resolve operation.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n async\n export\n name=\"resolveModule\"\n parameters={[\n { name: \"specifier\", type: \"string\" },\n {\n name: \"options\",\n type: \"ResolveModuleOptions\",\n default: \"{} as ResolveModuleOptions\"\n }\n ]}\n returnType=\"Promise<string>\">\n {code`const parentURL = options.parentURL ? new URL(options.parentURL) : undefined;\n const conditionsSet = options.conditions?.length\n ? new Set(options.conditions)\n : DEFAULT_CONDITIONS_SET;\n\n // Handle protocol-prefixed specifiers (node:, data:, http:, https:, ${context.config.framework}:)\n if (/^(?:node|data|https?|${context.config.framework}):/.test(specifier)) {\n return specifier;\n }\n\n const bareSpecifier = specifier.replace(/^node:/, \"\");\n if (builtinModules.includes(bareSpecifier)) {\n return \"node:\" + bareSpecifier;\n }\n\n if (specifier.startsWith(\"file://\")) {\n return specifier;\n }\n\n if (isAbsolute(specifier)) {\n try {\n const s = statSync(specifier);\n if (s.isFile()) {\n return pathToFileURL(realpathSync(specifier)).href;\n }\n } catch (err: any) {\n if (err?.code !== \"ENOENT\") {\n throw err;\n }\n }\n }\n\n const roots = [parentURL ?? pathToFileURL(join(process.cwd(), \"_\"))];\n\n const projectRootURL = pathToFileURL(\"${context.config.root}\");\n if (!roots.some(root => root.href === projectRootURL.href)) {\n roots.push(projectRootURL);\n }\n\n const workspaceRootURL = pathToFileURL(\"${\n context.workspaceConfig.workspaceRoot\n }\");\n if (!roots.some(root => root.href === workspaceRootURL.href)) {\n roots.push(workspaceRootURL);\n }\n\n let resolved: URL | undefined;\n for (const root of roots) {\n const _urls: URL[] = [];\n _urls.push(root);\n if (root.protocol === \"file:\") {\n _urls.push(\n new URL(\"./\", root),\n new URL(join(root.pathname, \"_index.js\"), root),\n new URL(\"node_modules\", root)\n );\n }\n\n for (const url of _urls) {\n resolved = tryModuleResolve(specifier, url, conditionsSet);\n if (resolved) {\n break;\n }\n\n for (const prefix of [\"\", \"/index\"]) {\n for (const extension of DEFAULT_EXTENSIONS) {\n resolved = tryModuleResolve(\n specifier + prefix + extension,\n url,\n conditionsSet\n );\n if (resolved) {\n break;\n }\n }\n if (resolved) {\n break;\n }\n }\n if (resolved) {\n break;\n }\n }\n\n if (resolved) {\n break;\n }\n }\n\n if (!resolved) {\n const err = new Error(\n \\`Cannot find module \\\\\\`\\${specifier}\\\\\\`\\`\n );\n (err as any).code = \"ERR_MODULE_NOT_FOUND\";\n\n throw err;\n }\n\n return pathToFileURL(fileURLToPath(resolved)).href;\n `}\n </FunctionDeclaration>\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 \"dirname\",\n \"isAbsolute\"\n ],\n \"node:fs\": [\n { name: \"constants\", alias: \"fsConstants\" },\n \"openSync\",\n \"closeSync\",\n \"read\",\n \"readFileSync\",\n \"statSync\",\n \"realpathSync\"\n ],\n \"node:fs/promises\": [\"stat\"],\n \"node:tty\": [\"WriteStream\"],\n \"node:util\": [\"promisify\"],\n \"node:url\": [\"fileURLToPath\", \"pathToFileURL\"],\n \"node:module\": [\"builtinModules\"]\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n env: [\n \"env\",\n \"isCI\",\n \"isTest\",\n \"isWindows\",\n \"isLinux\",\n \"isMacOS\",\n \"isDevelopment\",\n \"isDebug\"\n ],\n exec: [\"execSync\"],\n state: [\"hasFlag\"]\n })}>\n <TSDoc heading=\"A utility function to pause execution for a specified duration, which can be used in prompt interactions to create delays or timeouts. The function returns a promise that resolves after the specified duration in milliseconds, allowing it to be used with async/await syntax for easier handling of asynchronous prompt logic.\">\n <TSDocParam name=\"durationMs\">\n {`The duration to sleep in milliseconds.`}\n </TSDocParam>\n <TSDocReturns>\n {`A promise that resolves after the specified duration, allowing for asynchronous delays in prompt interactions.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"sleep\"\n parameters={[{ name: \"durationMs\", type: \"number\" }]}\n returnType=\"Promise<void>\">{code`return new Promise((resolve) => setTimeout(resolve, durationMs)); `}</FunctionDeclaration>\n <Spacing />\n <TerminalSizeDeclaration />\n <Spacing />\n <EnvSupportUtilities />\n <Spacing />\n <HyperlinkSupportUtilities />\n <Spacing />\n <ColorSupportUtilities />\n <Spacing />\n <ResolveModuleFunctionDeclaration />\n <Spacing />\n <FindSuggestionsDeclaration />\n <Spac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KAAM;KAAa;KAAoB;KAAA;KAAA;KAAA;KAAA;KAAA;IAClD,WAAQ;KAAA;MACN,MAAM;MACN,OAAO;MACR;KAAE;KAAO;KAAA;KAAA;KAAA;KAAA;KAAA;IACV,oBAAS,CAAA,OAAA;IACT,YAAY,CAAA,cAAU;IACtB,aAAU,CAAA,YAAK;IACf,YAAQ,CAAA,iBAAA,gBAAA;IACR,eAAM,CAAA,iBAAA;IACP,CAAC;;EAEJ,IAAI,iBAAM;AACR,UAAM,OAAA,KAAA,kBAAA,EAAA,EAAA;IACJ,KAAI;KAAE;KAAE;KAAU;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAClB,MAAM,CAAA,WAAK;IACX,OAAI,CAAA,UAAA;IACL,CAAC;;EAEJ,IAAI,WAAM;AACR,UAAM;IAAA,gBAAK,OAAA;KACT,SAAE;KACF,IAAA,WAAA;;OAEI,MAAC;OACH,UAAY;OACX,CAAC,EAAE,gBAAkB,cAAQ,EAC7B,UAAA,kHACA,CAAA,CAAA;;KAEJ,CAAC;IAAE,gBAAS,qBAAA;KACX,UAAA;;KAEA,YAAO,CAAA;MACN,MAAA;MACD,MAAA;MACF,CAAA;KACH,YAAA;KACH,UAAA,IAAA;;;;;;;;;;;;;;;;KAEE,IAAA,OAAA;AACQ,aAAI,QAAU,SAAU;;KAElB;KACT,CAAC;IAAC;;EAEP,CAAA,CAAA"}
package/dist/config.cjs CHANGED
@@ -23,9 +23,9 @@ defineConfig.__type = [
23
23
  "UserConfig",
24
24
  "config",
25
25
  "defineConfig",
26
- "P\"w\"o!\"2#\"w\"/$"
26
+ "A utility function to define a Shell Shock user configuration.",
27
+ "P\"w\"o!\"2#\"w\"/$?%"
27
28
  ];
28
29
 
29
30
  //#endregion
30
- exports.defineConfig = defineConfig;
31
- //# sourceMappingURL=config.cjs.map
31
+ exports.defineConfig = defineConfig;
package/dist/config.mjs CHANGED
@@ -21,7 +21,8 @@ defineConfig.__type = [
21
21
  "UserConfig",
22
22
  "config",
23
23
  "defineConfig",
24
- "P\"w\"o!\"2#\"w\"/$"
24
+ "A utility function to define a Shell Shock user configuration.",
25
+ "P\"w\"o!\"2#\"w\"/$?%"
25
26
  ];
26
27
 
27
28
  //#endregion
@@ -15,9 +15,12 @@ const CommandContext = (_alloy_js_core.createNamedContext.Ω = [["CommandTree",
15
15
  function useCommand() {
16
16
  return _alloy_js_core.useContext.Ω = [["CommandTree", "P\"w!-J"]], (0, _alloy_js_core.useContext)(CommandContext);
17
17
  }
18
- useCommand.__type = ["useCommand", "P\"/!"];
18
+ useCommand.__type = [
19
+ "useCommand",
20
+ "Hook to access the Command context.",
21
+ "P\"/!?\""
22
+ ];
19
23
 
20
24
  //#endregion
21
25
  exports.CommandContext = CommandContext;
22
- exports.useCommand = useCommand;
23
- //# sourceMappingURL=command.cjs.map
26
+ exports.useCommand = useCommand;
@@ -13,7 +13,11 @@ const CommandContext = (createNamedContext.Ω = [["CommandTree", "P\"w!-J"]], cr
13
13
  function useCommand() {
14
14
  return useContext.Ω = [["CommandTree", "P\"w!-J"]], useContext(CommandContext);
15
15
  }
16
- useCommand.__type = ["useCommand", "P\"/!"];
16
+ useCommand.__type = [
17
+ "useCommand",
18
+ "Hook to access the Command context.",
19
+ "P\"/!?\""
20
+ ];
17
21
 
18
22
  //#endregion
19
23
  export { CommandContext, useCommand };
@@ -1 +1 @@
1
- {"version":3,"file":"command.mjs","names":[],"sources":["../../src/contexts/command.ts"],"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 type { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport type { CommandTree } from \"../types/command\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const CommandContext: ComponentContext<CommandTree | undefined> =\n createNamedContext<CommandTree | undefined>(\"Command\");\n\n/**\n * Hook to access the Command context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useCommand() {\n return useContext<CommandTree | undefined>(CommandContext)!;\n}\n"],"mappings":";;;;;;;;;;;;;AA4BE,QAAA,WAAA,IAAA,CAAA,CAAA,eAAA,UAAA,CAAA,EAAA,WAAA,eAAA;;AAEF,WAAC,SAAA,CAAA,cAAA,QAAA"}
1
+ {"version":3,"file":"command.mjs","names":[],"sources":["../../src/contexts/command.ts"],"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 type { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport type { CommandTree } from \"../types/command\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const CommandContext: ComponentContext<CommandTree | undefined> =\n createNamedContext<CommandTree | undefined>(\"Command\");\n\n/**\n * Hook to access the Command context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useCommand() {\n return useContext<CommandTree | undefined>(CommandContext)!;\n}\n"],"mappings":";;;;;;;;;;;;;AA4BE,QAAA,WAAA,IAAA,CAAA,CAAA,eAAA,UAAA,CAAA,EAAA,WAAA,eAAA;;AAEF,WAAC,SAAA;CAAA;CAAA;CAAA;CAAA"}
@@ -27,7 +27,11 @@ const ExistingOptionsContext = (_alloy_js_core.createNamedContext.Ω = [["&F"]],
27
27
  function useExistingOptions() {
28
28
  return _alloy_js_core.useContext.Ω = [["&F"]], (0, _alloy_js_core.useContext)(ExistingOptionsContext);
29
29
  }
30
- useExistingOptions.__type = ["useExistingOptions", "P\"/!"];
30
+ useExistingOptions.__type = [
31
+ "useExistingOptions",
32
+ "Hook to access the ExistingOptions context.",
33
+ "P\"/!?\""
34
+ ];
31
35
  function computedOptions(options) {
32
36
  return options.reduce(__assignType((ret, option) => {
33
37
  ret[(0, _stryke_string_format_camel_case.camelCase)(option.name)] ??= (0, defu.default)({ name: (0, _stryke_string_format_camel_case.camelCase)(option.name) }, ret[option.name] ?? {}, option);
@@ -56,5 +60,4 @@ computedOptions.__type = [
56
60
  //#endregion
57
61
  exports.ExistingOptionsContext = ExistingOptionsContext;
58
62
  exports.computedOptions = computedOptions;
59
- exports.useExistingOptions = useExistingOptions;
60
- //# sourceMappingURL=options.cjs.map
63
+ exports.useExistingOptions = useExistingOptions;
@@ -24,7 +24,11 @@ const ExistingOptionsContext = (createNamedContext.Ω = [["&F"]], createNamedCon
24
24
  function useExistingOptions() {
25
25
  return useContext.Ω = [["&F"]], useContext(ExistingOptionsContext);
26
26
  }
27
- useExistingOptions.__type = ["useExistingOptions", "P\"/!"];
27
+ useExistingOptions.__type = [
28
+ "useExistingOptions",
29
+ "Hook to access the ExistingOptions context.",
30
+ "P\"/!?\""
31
+ ];
28
32
  function computedOptions(options) {
29
33
  return options.reduce(__assignType((ret, option) => {
30
34
  ret[camelCase(option.name)] ??= defu$1({ name: camelCase(option.name) }, ret[option.name] ?? {}, option);
@@ -1 +1 @@
1
- {"version":3,"file":"options.mjs","names":[],"sources":["../../src/contexts/options.ts"],"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 type { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport type { BooleanCommandOption, CommandOption } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ExistingOptionsContext: ComponentContext<string[]> =\n createNamedContext<string[]>(\"ExistingOptions\", []);\n\n/**\n * Hook to access the ExistingOptions context.\n *\n * @remarks\n * This context provides a list of option names that already exist on the interface definition.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useExistingOptions() {\n return useContext<string[]>(ExistingOptionsContext)!;\n}\n\nexport function computedOptions(options: CommandOption[]) {\n return options.reduce(\n (ret, option) => {\n ret[camelCase(option.name)] ??= defu(\n {\n name: camelCase(option.name)\n },\n ret[option.name] ?? {},\n option\n ) as CommandOption;\n\n if (\n option.kind === CommandParameterKinds.boolean &&\n option.isNegativeOf\n ) {\n ret[camelCase(option.isNegativeOf)] = defu(\n {\n name: camelCase(option.isNegativeOf)\n },\n ret[option.isNegativeOf] ?? {},\n {\n ...option,\n env: isSetString(option.env) ? `NO_${option.env}` : false,\n description: `${option.description.replace(\n /\\.+$/,\n \"\"\n )}. This property is the negative form of ${option.name}.`,\n isNegativeOf: camelCase(option.name),\n default: !option.default\n }\n ) as BooleanCommandOption;\n }\n\n return ret;\n },\n {} as Record<string, CommandOption>\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;AAUX,MAAa,0BAAsB,mBAAkB,IAAA,CAAA,CAAA,KAAA,CAAA,EAAA,mBAAA,mBAAA,EAAA,CAAA;;;;;;;;;AASrD,SAAS,qBAA4B;AACrC,QAAY,WAAW,IAAA,CAAA,CAAA,KAAA,CAAA,EAAA,WAAA,uBAAA;;AAEvB,mBAAS,SAAA,CAAA,sBAAuC,QAAQ;;AAEtD,QAAA,QAAA,OAAA,cAAA,KAAA,WAAA;AACK,MAAA,UAAW,OAAU,KAAA,MAAY,OAAI,EAC1C,MAAA,UAAA,OAAA,KAAA,EACK,EAAA,IAAM,OAAA,SAAA,EAAA,EAAsB,OAAE;AACnC,MAAA,OAAA,SAA0B,sBAAsB,+BAEhD,KAAA,UAAA,OAAA,aAAA,IAAA,OAAA,EACS,MAAW,UAAA,OAAgB,aAAO,EAC5C,EAAA,IAAA,OAAA,iBAAA,EAAA,EAAA;GACG,GAAA;GACY,KAAA,YAAgB,OAAG,IAAO,GAAK,MAAM,OAAO,QAAO;GAClE,aAAA,GAAA,OAAA,YAAA,QAAA,QAAA,GAAA,CAAA,0CAAA,OAAA,KAAA;GACa,cAAgB,UAAQ,OAAQ,KAAA;GAC5C,SAAA,CAAA,OAAA;GACK,CAAA;AAEP,SAAA;;;;;;;;AAGA,gBAAgB,SAAO;CAAA;CAAA;CAAA;CAAA;CAAA"}
1
+ {"version":3,"file":"options.mjs","names":[],"sources":["../../src/contexts/options.ts"],"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 type { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport type { BooleanCommandOption, CommandOption } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ExistingOptionsContext: ComponentContext<string[]> =\n createNamedContext<string[]>(\"ExistingOptions\", []);\n\n/**\n * Hook to access the ExistingOptions context.\n *\n * @remarks\n * This context provides a list of option names that already exist on the interface definition.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useExistingOptions() {\n return useContext<string[]>(ExistingOptionsContext)!;\n}\n\nexport function computedOptions(options: CommandOption[]) {\n return options.reduce(\n (ret, option) => {\n ret[camelCase(option.name)] ??= defu(\n {\n name: camelCase(option.name)\n },\n ret[option.name] ?? {},\n option\n ) as CommandOption;\n\n if (\n option.kind === CommandParameterKinds.boolean &&\n option.isNegativeOf\n ) {\n ret[camelCase(option.isNegativeOf)] = defu(\n {\n name: camelCase(option.isNegativeOf)\n },\n ret[option.isNegativeOf] ?? {},\n {\n ...option,\n env: isSetString(option.env) ? `NO_${option.env}` : false,\n description: `${option.description.replace(\n /\\.+$/,\n \"\"\n )}. This property is the negative form of ${option.name}.`,\n isNegativeOf: camelCase(option.name),\n default: !option.default\n }\n ) as BooleanCommandOption;\n }\n\n return ret;\n },\n {} as Record<string, CommandOption>\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;AAUX,MAAa,0BAAsB,mBAAkB,IAAA,CAAA,CAAA,KAAA,CAAA,EAAA,mBAAA,mBAAA,EAAA,CAAA;;;;;;;;;AASrD,SAAS,qBAA4B;AACrC,QAAY,WAAW,IAAA,CAAA,CAAA,KAAA,CAAA,EAAA,WAAA,uBAAA;;AAEvB,mBAAS,SAAA;CAAA;CAAuC;CAAQ;CAAA;;AAEtD,QAAA,QAAA,OAAA,cAAA,KAAA,WAAA;AACK,MAAA,UAAW,OAAU,KAAA,MAAY,OAAI,EAC1C,MAAA,UAAA,OAAA,KAAA,EACK,EAAA,IAAM,OAAA,SAAA,EAAA,EAAsB,OAAE;AACnC,MAAA,OAAA,SAA0B,sBAAsB,+BAEhD,KAAA,UAAA,OAAA,aAAA,IAAA,OAAA,EACS,MAAW,UAAA,OAAgB,aAAO,EAC5C,EAAA,IAAA,OAAA,iBAAA,EAAA,EAAA;GACG,GAAA;GACY,KAAA,YAAgB,OAAG,IAAO,GAAK,MAAM,OAAO,QAAO;GAClE,aAAA,GAAA,OAAA,YAAA,QAAA,QAAA,GAAA,CAAA,0CAAA,OAAA,KAAA;GACa,cAAgB,UAAQ,OAAQ,KAAA;GAC5C,SAAA,CAAA,OAAA;GACK,CAAA;AAEP,SAAA;;;;;;;;AAGA,gBAAgB,SAAO;CAAA;CAAA;CAAA;CAAA;CAAA"}
@@ -53,5 +53,4 @@ const commands = (context) => (0, automd.defineGenerator)({
53
53
  });
54
54
 
55
55
  //#endregion
56
- exports.commands = commands;
57
- //# sourceMappingURL=automd.cjs.map
56
+ exports.commands = commands;
@@ -15,9 +15,9 @@ getDocsOutputPath.__type = [
15
15
  "Context",
16
16
  "context",
17
17
  "getDocsOutputPath",
18
- "P\"w!2\"&/#"
18
+ "Gets the output path for the generated documentation.",
19
+ "P\"w!2\"&/#?$"
19
20
  ];
20
21
 
21
22
  //#endregion
22
- exports.getDocsOutputPath = getDocsOutputPath;
23
- //# sourceMappingURL=docs-helpers.cjs.map
23
+ exports.getDocsOutputPath = getDocsOutputPath;
@@ -14,7 +14,8 @@ getDocsOutputPath.__type = [
14
14
  "Context",
15
15
  "context",
16
16
  "getDocsOutputPath",
17
- "P\"w!2\"&/#"
17
+ "Gets the output path for the generated documentation.",
18
+ "P\"w!2\"&/#?$"
18
19
  ];
19
20
 
20
21
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"docs-helpers.mjs","names":[],"sources":["../../src/helpers/docs-helpers.ts"],"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 { joinPaths } from \"@stryke/path/join\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Gets the output path for the generated documentation.\n *\n * @param context - The Shell Shock context.\n * @returns The output path for the generated documentation.\n */\nexport function getDocsOutputPath(context: Context): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;AAwBA,SAAU,kBAAoB,SAAa;AACvC,QAAO,UAAK,QAAY,OAAQ,MAAA,QAAU,YAAa;;AAE3D,kBAAgB,SAAA;CAAA;CAAkB;CAAgB;CAAU;CAAA"}
1
+ {"version":3,"file":"docs-helpers.mjs","names":[],"sources":["../../src/helpers/docs-helpers.ts"],"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 { joinPaths } from \"@stryke/path/join\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Gets the output path for the generated documentation.\n *\n * @param context - The Shell Shock context.\n * @returns The output path for the generated documentation.\n */\nexport function getDocsOutputPath(context: Context): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;AAwBA,SAAU,kBAAoB,SAAa;AACvC,QAAO,UAAK,QAAY,OAAQ,MAAA,QAAU,YAAa;;AAE3D,kBAAgB,SAAA;CAAA;CAAkB;CAAgB;CAAU;CAAA;CAAA"}
@@ -49,7 +49,8 @@ function resolveCommandName(file) {
49
49
  resolveCommandName.__type = [
50
50
  "file",
51
51
  "resolveCommandName",
52
- "P&2!\"/\""
52
+ "Finds the command name from the given file path.",
53
+ "P&2!\"/\"?#"
53
54
  ];
54
55
  function resolveCommandPath(context, file) {
55
56
  return (0, _stryke_path_replace.replacePath)((0, _stryke_path_file_path_fns.findFilePath)(file), context.commandsPath).replaceAll(/^\/+/g, "").replaceAll(/\/+$/g, "").split("/").filter(__assignType((path) => path && !require_context_helpers.isPathSegmentGroup(path), [
@@ -133,5 +134,4 @@ findCommandsRoot.__type = [
133
134
  exports.findCommandsRoot = findCommandsRoot;
134
135
  exports.resolveCommandId = resolveCommandId;
135
136
  exports.resolveCommandName = resolveCommandName;
136
- exports.resolveCommandPath = resolveCommandPath;
137
- //# sourceMappingURL=paths.cjs.map
137
+ exports.resolveCommandPath = resolveCommandPath;
@@ -48,7 +48,8 @@ function resolveCommandName(file) {
48
48
  resolveCommandName.__type = [
49
49
  "file",
50
50
  "resolveCommandName",
51
- "P&2!\"/\""
51
+ "Finds the command name from the given file path.",
52
+ "P&2!\"/\"?#"
52
53
  ];
53
54
  function resolveCommandPath(context, file) {
54
55
  return replacePath(findFilePath(file), context.commandsPath).replaceAll(/^\/+/g, "").replaceAll(/\/+$/g, "").split("/").filter(__assignType((path) => path && !isPathSegmentGroup(path), [