@socketsecurity/cli-with-sentry 1.1.25 → 2.0.0

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 (914) hide show
  1. package/CHANGELOG.md +51 -218
  2. package/README.md +41 -74
  3. package/dist/cli.js.bz +0 -0
  4. package/dist/cli.js.bz.sha256 +1 -0
  5. package/dist/index.js +2 -0
  6. package/package.json +31 -274
  7. package/bin/cli.js +0 -52
  8. package/bin/npm-cli.js +0 -29
  9. package/bin/npx-cli.js +0 -29
  10. package/bin/pnpm-cli.js +0 -29
  11. package/bin/yarn-cli.js +0 -29
  12. package/dist/cli.js +0 -14999
  13. package/dist/cli.js.map +0 -1
  14. package/dist/constants.js +0 -845
  15. package/dist/constants.js.map +0 -1
  16. package/dist/flags.js +0 -212
  17. package/dist/flags.js.map +0 -1
  18. package/dist/init.gradle +0 -250
  19. package/dist/instrument-with-sentry.js +0 -44
  20. package/dist/instrument-with-sentry.js.map +0 -1
  21. package/dist/npm-cli.js +0 -30
  22. package/dist/npm-cli.js.map +0 -1
  23. package/dist/npx-cli.js +0 -26
  24. package/dist/npx-cli.js.map +0 -1
  25. package/dist/pnpm-cli.js +0 -30
  26. package/dist/pnpm-cli.js.map +0 -1
  27. package/dist/shadow-npm-bin.js +0 -8
  28. package/dist/shadow-npm-bin.js.map +0 -1
  29. package/dist/shadow-npm-bin2.js +0 -102
  30. package/dist/shadow-npm-bin2.js.map +0 -1
  31. package/dist/shadow-npm-inject.js +0 -307
  32. package/dist/shadow-npm-inject.js.map +0 -1
  33. package/dist/shadow-npx-bin.js +0 -12
  34. package/dist/shadow-npx-bin.js.map +0 -1
  35. package/dist/shadow-pnpm-bin.js +0 -8
  36. package/dist/shadow-pnpm-bin.js.map +0 -1
  37. package/dist/shadow-pnpm-bin2.js +0 -300
  38. package/dist/shadow-pnpm-bin2.js.map +0 -1
  39. package/dist/shadow-yarn-bin.js +0 -96
  40. package/dist/shadow-yarn-bin.js.map +0 -1
  41. package/dist/tsconfig.dts.tsbuildinfo +0 -1
  42. package/dist/types/cli.d.mts +0 -3
  43. package/dist/types/cli.d.mts.map +0 -1
  44. package/dist/types/commands/analytics/cmd-analytics.d.mts +0 -10
  45. package/dist/types/commands/analytics/cmd-analytics.d.mts.map +0 -1
  46. package/dist/types/commands/analytics/fetch-org-analytics.d.mts +0 -8
  47. package/dist/types/commands/analytics/fetch-org-analytics.d.mts.map +0 -1
  48. package/dist/types/commands/analytics/fetch-repo-analytics.d.mts +0 -8
  49. package/dist/types/commands/analytics/fetch-repo-analytics.d.mts.map +0 -1
  50. package/dist/types/commands/analytics/handle-analytics.d.mts +0 -10
  51. package/dist/types/commands/analytics/handle-analytics.d.mts.map +0 -1
  52. package/dist/types/commands/analytics/output-analytics.d.mts +0 -29
  53. package/dist/types/commands/analytics/output-analytics.d.mts.map +0 -1
  54. package/dist/types/commands/audit-log/cmd-audit-log.d.mts +0 -10
  55. package/dist/types/commands/audit-log/cmd-audit-log.d.mts.map +0 -1
  56. package/dist/types/commands/audit-log/fetch-audit-log.d.mts +0 -15
  57. package/dist/types/commands/audit-log/fetch-audit-log.d.mts.map +0 -1
  58. package/dist/types/commands/audit-log/handle-audit-log.d.mts +0 -9
  59. package/dist/types/commands/audit-log/handle-audit-log.d.mts.map +0 -1
  60. package/dist/types/commands/audit-log/output-audit-log.d.mts +0 -22
  61. package/dist/types/commands/audit-log/output-audit-log.d.mts.map +0 -1
  62. package/dist/types/commands/ci/cmd-ci.d.mts +0 -9
  63. package/dist/types/commands/ci/cmd-ci.d.mts.map +0 -1
  64. package/dist/types/commands/ci/fetch-default-org-slug.d.mts +0 -4
  65. package/dist/types/commands/ci/fetch-default-org-slug.d.mts.map +0 -1
  66. package/dist/types/commands/ci/handle-ci.d.mts +0 -2
  67. package/dist/types/commands/ci/handle-ci.d.mts.map +0 -1
  68. package/dist/types/commands/config/cmd-config-auto.d.mts +0 -10
  69. package/dist/types/commands/config/cmd-config-auto.d.mts.map +0 -1
  70. package/dist/types/commands/config/cmd-config-get.d.mts +0 -9
  71. package/dist/types/commands/config/cmd-config-get.d.mts.map +0 -1
  72. package/dist/types/commands/config/cmd-config-list.d.mts +0 -9
  73. package/dist/types/commands/config/cmd-config-list.d.mts.map +0 -1
  74. package/dist/types/commands/config/cmd-config-set.d.mts +0 -10
  75. package/dist/types/commands/config/cmd-config-set.d.mts.map +0 -1
  76. package/dist/types/commands/config/cmd-config-unset.d.mts +0 -10
  77. package/dist/types/commands/config/cmd-config-unset.d.mts.map +0 -1
  78. package/dist/types/commands/config/cmd-config.d.mts +0 -3
  79. package/dist/types/commands/config/cmd-config.d.mts.map +0 -1
  80. package/dist/types/commands/config/discover-config-value.d.mts +0 -3
  81. package/dist/types/commands/config/discover-config-value.d.mts.map +0 -1
  82. package/dist/types/commands/config/handle-config-auto.d.mts +0 -7
  83. package/dist/types/commands/config/handle-config-auto.d.mts.map +0 -1
  84. package/dist/types/commands/config/handle-config-get.d.mts +0 -7
  85. package/dist/types/commands/config/handle-config-get.d.mts.map +0 -1
  86. package/dist/types/commands/config/handle-config-set.d.mts +0 -8
  87. package/dist/types/commands/config/handle-config-set.d.mts.map +0 -1
  88. package/dist/types/commands/config/handle-config-unset.d.mts +0 -7
  89. package/dist/types/commands/config/handle-config-unset.d.mts.map +0 -1
  90. package/dist/types/commands/config/output-config-auto.d.mts +0 -4
  91. package/dist/types/commands/config/output-config-auto.d.mts.map +0 -1
  92. package/dist/types/commands/config/output-config-get.d.mts +0 -4
  93. package/dist/types/commands/config/output-config-get.d.mts.map +0 -1
  94. package/dist/types/commands/config/output-config-list.d.mts +0 -6
  95. package/dist/types/commands/config/output-config-list.d.mts.map +0 -1
  96. package/dist/types/commands/config/output-config-set.d.mts +0 -3
  97. package/dist/types/commands/config/output-config-set.d.mts.map +0 -1
  98. package/dist/types/commands/config/output-config-unset.d.mts +0 -3
  99. package/dist/types/commands/config/output-config-unset.d.mts.map +0 -1
  100. package/dist/types/commands/fix/cmd-fix.d.mts +0 -10
  101. package/dist/types/commands/fix/cmd-fix.d.mts.map +0 -1
  102. package/dist/types/commands/fix/coana-fix.d.mts +0 -6
  103. package/dist/types/commands/fix/coana-fix.d.mts.map +0 -1
  104. package/dist/types/commands/fix/env-helpers.d.mts +0 -26
  105. package/dist/types/commands/fix/env-helpers.d.mts.map +0 -1
  106. package/dist/types/commands/fix/git.d.mts +0 -13
  107. package/dist/types/commands/fix/git.d.mts.map +0 -1
  108. package/dist/types/commands/fix/handle-fix.d.mts +0 -20
  109. package/dist/types/commands/fix/handle-fix.d.mts.map +0 -1
  110. package/dist/types/commands/fix/output-fix-result.d.mts +0 -3
  111. package/dist/types/commands/fix/output-fix-result.d.mts.map +0 -1
  112. package/dist/types/commands/fix/pull-request.d.mts +0 -31
  113. package/dist/types/commands/fix/pull-request.d.mts.map +0 -1
  114. package/dist/types/commands/fix/types.d.mts +0 -21
  115. package/dist/types/commands/fix/types.d.mts.map +0 -1
  116. package/dist/types/commands/install/cmd-install-completion.d.mts +0 -9
  117. package/dist/types/commands/install/cmd-install-completion.d.mts.map +0 -1
  118. package/dist/types/commands/install/cmd-install.d.mts +0 -3
  119. package/dist/types/commands/install/cmd-install.d.mts.map +0 -1
  120. package/dist/types/commands/install/handle-install-completion.d.mts +0 -2
  121. package/dist/types/commands/install/handle-install-completion.d.mts.map +0 -1
  122. package/dist/types/commands/install/output-install-completion.d.mts +0 -12
  123. package/dist/types/commands/install/output-install-completion.d.mts.map +0 -1
  124. package/dist/types/commands/install/setup-tab-completion.d.mts +0 -13
  125. package/dist/types/commands/install/setup-tab-completion.d.mts.map +0 -1
  126. package/dist/types/commands/json/cmd-json.d.mts +0 -9
  127. package/dist/types/commands/json/cmd-json.d.mts.map +0 -1
  128. package/dist/types/commands/json/handle-cmd-json.d.mts +0 -2
  129. package/dist/types/commands/json/handle-cmd-json.d.mts.map +0 -1
  130. package/dist/types/commands/json/output-cmd-json.d.mts +0 -2
  131. package/dist/types/commands/json/output-cmd-json.d.mts.map +0 -1
  132. package/dist/types/commands/login/apply-login.d.mts +0 -2
  133. package/dist/types/commands/login/apply-login.d.mts.map +0 -1
  134. package/dist/types/commands/login/attempt-login.d.mts +0 -6
  135. package/dist/types/commands/login/attempt-login.d.mts.map +0 -1
  136. package/dist/types/commands/login/cmd-login.d.mts +0 -10
  137. package/dist/types/commands/login/cmd-login.d.mts.map +0 -1
  138. package/dist/types/commands/logout/apply-logout.d.mts +0 -2
  139. package/dist/types/commands/logout/apply-logout.d.mts.map +0 -1
  140. package/dist/types/commands/logout/attempt-logout.d.mts +0 -2
  141. package/dist/types/commands/logout/attempt-logout.d.mts.map +0 -1
  142. package/dist/types/commands/logout/cmd-logout.d.mts +0 -9
  143. package/dist/types/commands/logout/cmd-logout.d.mts.map +0 -1
  144. package/dist/types/commands/manifest/cmd-manifest-auto.d.mts +0 -9
  145. package/dist/types/commands/manifest/cmd-manifest-auto.d.mts.map +0 -1
  146. package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts +0 -9
  147. package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts.map +0 -1
  148. package/dist/types/commands/manifest/cmd-manifest-conda.d.mts +0 -9
  149. package/dist/types/commands/manifest/cmd-manifest-conda.d.mts.map +0 -1
  150. package/dist/types/commands/manifest/cmd-manifest-gradle.d.mts +0 -9
  151. package/dist/types/commands/manifest/cmd-manifest-gradle.d.mts.map +0 -1
  152. package/dist/types/commands/manifest/cmd-manifest-kotlin.d.mts +0 -9
  153. package/dist/types/commands/manifest/cmd-manifest-kotlin.d.mts.map +0 -1
  154. package/dist/types/commands/manifest/cmd-manifest-scala.d.mts +0 -9
  155. package/dist/types/commands/manifest/cmd-manifest-scala.d.mts.map +0 -1
  156. package/dist/types/commands/manifest/cmd-manifest-setup.d.mts +0 -9
  157. package/dist/types/commands/manifest/cmd-manifest-setup.d.mts.map +0 -1
  158. package/dist/types/commands/manifest/cmd-manifest.d.mts +0 -9
  159. package/dist/types/commands/manifest/cmd-manifest.d.mts.map +0 -1
  160. package/dist/types/commands/manifest/convert-conda-to-requirements.d.mts +0 -8
  161. package/dist/types/commands/manifest/convert-conda-to-requirements.d.mts.map +0 -1
  162. package/dist/types/commands/manifest/convert_gradle_to_maven.d.mts +0 -7
  163. package/dist/types/commands/manifest/convert_gradle_to_maven.d.mts.map +0 -1
  164. package/dist/types/commands/manifest/convert_sbt_to_maven.d.mts +0 -8
  165. package/dist/types/commands/manifest/convert_sbt_to_maven.d.mts.map +0 -1
  166. package/dist/types/commands/manifest/detect-manifest-actions.d.mts +0 -13
  167. package/dist/types/commands/manifest/detect-manifest-actions.d.mts.map +0 -1
  168. package/dist/types/commands/manifest/generate_auto_manifest.d.mts +0 -9
  169. package/dist/types/commands/manifest/generate_auto_manifest.d.mts.map +0 -1
  170. package/dist/types/commands/manifest/handle-manifest-conda.d.mts +0 -9
  171. package/dist/types/commands/manifest/handle-manifest-conda.d.mts.map +0 -1
  172. package/dist/types/commands/manifest/handle-manifest-setup.d.mts +0 -2
  173. package/dist/types/commands/manifest/handle-manifest-setup.d.mts.map +0 -1
  174. package/dist/types/commands/manifest/output-manifest-setup.d.mts +0 -3
  175. package/dist/types/commands/manifest/output-manifest-setup.d.mts.map +0 -1
  176. package/dist/types/commands/manifest/output-requirements.d.mts +0 -6
  177. package/dist/types/commands/manifest/output-requirements.d.mts.map +0 -1
  178. package/dist/types/commands/manifest/run-cdxgen.d.mts +0 -6
  179. package/dist/types/commands/manifest/run-cdxgen.d.mts.map +0 -1
  180. package/dist/types/commands/manifest/setup-manifest-config.d.mts +0 -3
  181. package/dist/types/commands/manifest/setup-manifest-config.d.mts.map +0 -1
  182. package/dist/types/commands/npm/cmd-npm.d.mts +0 -10
  183. package/dist/types/commands/npm/cmd-npm.d.mts.map +0 -1
  184. package/dist/types/commands/npx/cmd-npx.d.mts +0 -9
  185. package/dist/types/commands/npx/cmd-npx.d.mts.map +0 -1
  186. package/dist/types/commands/oops/cmd-oops.d.mts +0 -9
  187. package/dist/types/commands/oops/cmd-oops.d.mts.map +0 -1
  188. package/dist/types/commands/optimize/add-overrides.d.mts +0 -20
  189. package/dist/types/commands/optimize/add-overrides.d.mts.map +0 -1
  190. package/dist/types/commands/optimize/apply-optimization.d.mts +0 -14
  191. package/dist/types/commands/optimize/apply-optimization.d.mts.map +0 -1
  192. package/dist/types/commands/optimize/cmd-optimize.d.mts +0 -10
  193. package/dist/types/commands/optimize/cmd-optimize.d.mts.map +0 -1
  194. package/dist/types/commands/optimize/deps-includes-by-agent.d.mts +0 -5
  195. package/dist/types/commands/optimize/deps-includes-by-agent.d.mts.map +0 -1
  196. package/dist/types/commands/optimize/get-dependency-entries.d.mts +0 -3
  197. package/dist/types/commands/optimize/get-dependency-entries.d.mts.map +0 -1
  198. package/dist/types/commands/optimize/get-overrides-by-agent.d.mts +0 -42
  199. package/dist/types/commands/optimize/get-overrides-by-agent.d.mts.map +0 -1
  200. package/dist/types/commands/optimize/handle-optimize.d.mts +0 -8
  201. package/dist/types/commands/optimize/handle-optimize.d.mts.map +0 -1
  202. package/dist/types/commands/optimize/lockfile-includes-by-agent.d.mts +0 -8
  203. package/dist/types/commands/optimize/lockfile-includes-by-agent.d.mts.map +0 -1
  204. package/dist/types/commands/optimize/ls-by-agent.d.mts +0 -13
  205. package/dist/types/commands/optimize/ls-by-agent.d.mts.map +0 -1
  206. package/dist/types/commands/optimize/output-optimize-result.d.mts +0 -9
  207. package/dist/types/commands/optimize/output-optimize-result.d.mts.map +0 -1
  208. package/dist/types/commands/optimize/shared.d.mts +0 -2
  209. package/dist/types/commands/optimize/shared.d.mts.map +0 -1
  210. package/dist/types/commands/optimize/types.d.mts +0 -9
  211. package/dist/types/commands/optimize/types.d.mts.map +0 -1
  212. package/dist/types/commands/optimize/update-lockfile.d.mts +0 -11
  213. package/dist/types/commands/optimize/update-lockfile.d.mts.map +0 -1
  214. package/dist/types/commands/optimize/update-manifest-by-agent.d.mts +0 -8
  215. package/dist/types/commands/optimize/update-manifest-by-agent.d.mts.map +0 -1
  216. package/dist/types/commands/organization/cmd-organization-dependencies.d.mts +0 -10
  217. package/dist/types/commands/organization/cmd-organization-dependencies.d.mts.map +0 -1
  218. package/dist/types/commands/organization/cmd-organization-list.d.mts +0 -10
  219. package/dist/types/commands/organization/cmd-organization-list.d.mts.map +0 -1
  220. package/dist/types/commands/organization/cmd-organization-policy-license.d.mts +0 -10
  221. package/dist/types/commands/organization/cmd-organization-policy-license.d.mts.map +0 -1
  222. package/dist/types/commands/organization/cmd-organization-policy-security.d.mts +0 -10
  223. package/dist/types/commands/organization/cmd-organization-policy-security.d.mts.map +0 -1
  224. package/dist/types/commands/organization/cmd-organization-policy.d.mts +0 -3
  225. package/dist/types/commands/organization/cmd-organization-policy.d.mts.map +0 -1
  226. package/dist/types/commands/organization/cmd-organization-quota.d.mts +0 -9
  227. package/dist/types/commands/organization/cmd-organization-quota.d.mts.map +0 -1
  228. package/dist/types/commands/organization/cmd-organization.d.mts +0 -3
  229. package/dist/types/commands/organization/cmd-organization.d.mts.map +0 -1
  230. package/dist/types/commands/organization/fetch-dependencies.d.mts +0 -12
  231. package/dist/types/commands/organization/fetch-dependencies.d.mts.map +0 -1
  232. package/dist/types/commands/organization/fetch-license-policy.d.mts +0 -8
  233. package/dist/types/commands/organization/fetch-license-policy.d.mts.map +0 -1
  234. package/dist/types/commands/organization/fetch-organization-list.d.mts +0 -20
  235. package/dist/types/commands/organization/fetch-organization-list.d.mts.map +0 -1
  236. package/dist/types/commands/organization/fetch-quota.d.mts +0 -8
  237. package/dist/types/commands/organization/fetch-quota.d.mts.map +0 -1
  238. package/dist/types/commands/organization/fetch-security-policy.d.mts +0 -8
  239. package/dist/types/commands/organization/fetch-security-policy.d.mts.map +0 -1
  240. package/dist/types/commands/organization/handle-dependencies.d.mts +0 -7
  241. package/dist/types/commands/organization/handle-dependencies.d.mts.map +0 -1
  242. package/dist/types/commands/organization/handle-license-policy.d.mts +0 -3
  243. package/dist/types/commands/organization/handle-license-policy.d.mts.map +0 -1
  244. package/dist/types/commands/organization/handle-organization-list.d.mts +0 -3
  245. package/dist/types/commands/organization/handle-organization-list.d.mts.map +0 -1
  246. package/dist/types/commands/organization/handle-quota.d.mts +0 -3
  247. package/dist/types/commands/organization/handle-quota.d.mts.map +0 -1
  248. package/dist/types/commands/organization/handle-security-policy.d.mts +0 -3
  249. package/dist/types/commands/organization/handle-security-policy.d.mts.map +0 -1
  250. package/dist/types/commands/organization/output-dependencies.d.mts +0 -8
  251. package/dist/types/commands/organization/output-dependencies.d.mts.map +0 -1
  252. package/dist/types/commands/organization/output-license-policy.d.mts +0 -4
  253. package/dist/types/commands/organization/output-license-policy.d.mts.map +0 -1
  254. package/dist/types/commands/organization/output-organization-list.d.mts +0 -4
  255. package/dist/types/commands/organization/output-organization-list.d.mts.map +0 -1
  256. package/dist/types/commands/organization/output-quota.d.mts +0 -4
  257. package/dist/types/commands/organization/output-quota.d.mts.map +0 -1
  258. package/dist/types/commands/organization/output-security-policy.d.mts +0 -4
  259. package/dist/types/commands/organization/output-security-policy.d.mts.map +0 -1
  260. package/dist/types/commands/package/cmd-package-score.d.mts +0 -10
  261. package/dist/types/commands/package/cmd-package-score.d.mts.map +0 -1
  262. package/dist/types/commands/package/cmd-package-shallow.d.mts +0 -17
  263. package/dist/types/commands/package/cmd-package-shallow.d.mts.map +0 -1
  264. package/dist/types/commands/package/cmd-package.d.mts +0 -3
  265. package/dist/types/commands/package/cmd-package.d.mts.map +0 -1
  266. package/dist/types/commands/package/fetch-purl-deep-score.d.mts +0 -51
  267. package/dist/types/commands/package/fetch-purl-deep-score.d.mts.map +0 -1
  268. package/dist/types/commands/package/fetch-purls-shallow-score.d.mts +0 -8
  269. package/dist/types/commands/package/fetch-purls-shallow-score.d.mts.map +0 -1
  270. package/dist/types/commands/package/handle-purl-deep-score.d.mts +0 -3
  271. package/dist/types/commands/package/handle-purl-deep-score.d.mts.map +0 -1
  272. package/dist/types/commands/package/handle-purls-shallow-score.d.mts +0 -6
  273. package/dist/types/commands/package/handle-purls-shallow-score.d.mts.map +0 -1
  274. package/dist/types/commands/package/output-purls-deep-score.d.mts +0 -5
  275. package/dist/types/commands/package/output-purls-deep-score.d.mts.map +0 -1
  276. package/dist/types/commands/package/output-purls-shallow-score.d.mts +0 -29
  277. package/dist/types/commands/package/output-purls-shallow-score.d.mts.map +0 -1
  278. package/dist/types/commands/package/parse-package-specifiers.d.mts +0 -9
  279. package/dist/types/commands/package/parse-package-specifiers.d.mts.map +0 -1
  280. package/dist/types/commands/patch/cmd-patch.d.mts +0 -10
  281. package/dist/types/commands/patch/cmd-patch.d.mts.map +0 -1
  282. package/dist/types/commands/patch/handle-patch.d.mts +0 -12
  283. package/dist/types/commands/patch/handle-patch.d.mts.map +0 -1
  284. package/dist/types/commands/patch/manifest-schema.d.mts +0 -34
  285. package/dist/types/commands/patch/manifest-schema.d.mts.map +0 -1
  286. package/dist/types/commands/patch/output-patch-result.d.mts +0 -5
  287. package/dist/types/commands/patch/output-patch-result.d.mts.map +0 -1
  288. package/dist/types/commands/pnpm/cmd-pnpm.d.mts +0 -10
  289. package/dist/types/commands/pnpm/cmd-pnpm.d.mts.map +0 -1
  290. package/dist/types/commands/raw-npm/cmd-raw-npm.d.mts +0 -9
  291. package/dist/types/commands/raw-npm/cmd-raw-npm.d.mts.map +0 -1
  292. package/dist/types/commands/raw-npm/run-raw-npm.d.mts +0 -2
  293. package/dist/types/commands/raw-npm/run-raw-npm.d.mts.map +0 -1
  294. package/dist/types/commands/raw-npx/cmd-raw-npx.d.mts +0 -9
  295. package/dist/types/commands/raw-npx/cmd-raw-npx.d.mts.map +0 -1
  296. package/dist/types/commands/raw-npx/run-raw-npx.d.mts +0 -2
  297. package/dist/types/commands/raw-npx/run-raw-npx.d.mts.map +0 -1
  298. package/dist/types/commands/repository/cmd-repository-create.d.mts +0 -10
  299. package/dist/types/commands/repository/cmd-repository-create.d.mts.map +0 -1
  300. package/dist/types/commands/repository/cmd-repository-del.d.mts +0 -10
  301. package/dist/types/commands/repository/cmd-repository-del.d.mts.map +0 -1
  302. package/dist/types/commands/repository/cmd-repository-list.d.mts +0 -10
  303. package/dist/types/commands/repository/cmd-repository-list.d.mts.map +0 -1
  304. package/dist/types/commands/repository/cmd-repository-update.d.mts +0 -10
  305. package/dist/types/commands/repository/cmd-repository-update.d.mts.map +0 -1
  306. package/dist/types/commands/repository/cmd-repository-view.d.mts +0 -10
  307. package/dist/types/commands/repository/cmd-repository-view.d.mts.map +0 -1
  308. package/dist/types/commands/repository/cmd-repository.d.mts +0 -3
  309. package/dist/types/commands/repository/cmd-repository.d.mts.map +0 -1
  310. package/dist/types/commands/repository/fetch-create-repo.d.mts +0 -16
  311. package/dist/types/commands/repository/fetch-create-repo.d.mts.map +0 -1
  312. package/dist/types/commands/repository/fetch-delete-repo.d.mts +0 -8
  313. package/dist/types/commands/repository/fetch-delete-repo.d.mts.map +0 -1
  314. package/dist/types/commands/repository/fetch-list-all-repos.d.mts +0 -10
  315. package/dist/types/commands/repository/fetch-list-all-repos.d.mts.map +0 -1
  316. package/dist/types/commands/repository/fetch-list-repos.d.mts +0 -15
  317. package/dist/types/commands/repository/fetch-list-repos.d.mts.map +0 -1
  318. package/dist/types/commands/repository/fetch-update-repo.d.mts +0 -16
  319. package/dist/types/commands/repository/fetch-update-repo.d.mts.map +0 -1
  320. package/dist/types/commands/repository/fetch-view-repo.d.mts +0 -8
  321. package/dist/types/commands/repository/fetch-view-repo.d.mts.map +0 -1
  322. package/dist/types/commands/repository/handle-create-repo.d.mts +0 -10
  323. package/dist/types/commands/repository/handle-create-repo.d.mts.map +0 -1
  324. package/dist/types/commands/repository/handle-delete-repo.d.mts +0 -3
  325. package/dist/types/commands/repository/handle-delete-repo.d.mts.map +0 -1
  326. package/dist/types/commands/repository/handle-list-repos.d.mts +0 -12
  327. package/dist/types/commands/repository/handle-list-repos.d.mts.map +0 -1
  328. package/dist/types/commands/repository/handle-update-repo.d.mts +0 -10
  329. package/dist/types/commands/repository/handle-update-repo.d.mts.map +0 -1
  330. package/dist/types/commands/repository/handle-view-repo.d.mts +0 -3
  331. package/dist/types/commands/repository/handle-view-repo.d.mts.map +0 -1
  332. package/dist/types/commands/repository/output-create-repo.d.mts +0 -4
  333. package/dist/types/commands/repository/output-create-repo.d.mts.map +0 -1
  334. package/dist/types/commands/repository/output-delete-repo.d.mts +0 -4
  335. package/dist/types/commands/repository/output-delete-repo.d.mts.map +0 -1
  336. package/dist/types/commands/repository/output-list-repos.d.mts +0 -5
  337. package/dist/types/commands/repository/output-list-repos.d.mts.map +0 -1
  338. package/dist/types/commands/repository/output-update-repo.d.mts +0 -4
  339. package/dist/types/commands/repository/output-update-repo.d.mts.map +0 -1
  340. package/dist/types/commands/repository/output-view-repo.d.mts +0 -4
  341. package/dist/types/commands/repository/output-view-repo.d.mts.map +0 -1
  342. package/dist/types/commands/repository/types.d.mts +0 -2
  343. package/dist/types/commands/repository/types.d.mts.map +0 -1
  344. package/dist/types/commands/scan/cmd-scan-create.d.mts +0 -10
  345. package/dist/types/commands/scan/cmd-scan-create.d.mts.map +0 -1
  346. package/dist/types/commands/scan/cmd-scan-del.d.mts +0 -10
  347. package/dist/types/commands/scan/cmd-scan-del.d.mts.map +0 -1
  348. package/dist/types/commands/scan/cmd-scan-diff.d.mts +0 -10
  349. package/dist/types/commands/scan/cmd-scan-diff.d.mts.map +0 -1
  350. package/dist/types/commands/scan/cmd-scan-github.d.mts +0 -10
  351. package/dist/types/commands/scan/cmd-scan-github.d.mts.map +0 -1
  352. package/dist/types/commands/scan/cmd-scan-list.d.mts +0 -4
  353. package/dist/types/commands/scan/cmd-scan-list.d.mts.map +0 -1
  354. package/dist/types/commands/scan/cmd-scan-metadata.d.mts +0 -4
  355. package/dist/types/commands/scan/cmd-scan-metadata.d.mts.map +0 -1
  356. package/dist/types/commands/scan/cmd-scan-reach.d.mts +0 -10
  357. package/dist/types/commands/scan/cmd-scan-reach.d.mts.map +0 -1
  358. package/dist/types/commands/scan/cmd-scan-report.d.mts +0 -4
  359. package/dist/types/commands/scan/cmd-scan-report.d.mts.map +0 -1
  360. package/dist/types/commands/scan/cmd-scan-setup.d.mts +0 -9
  361. package/dist/types/commands/scan/cmd-scan-setup.d.mts.map +0 -1
  362. package/dist/types/commands/scan/cmd-scan-view.d.mts +0 -4
  363. package/dist/types/commands/scan/cmd-scan-view.d.mts.map +0 -1
  364. package/dist/types/commands/scan/cmd-scan.d.mts +0 -3
  365. package/dist/types/commands/scan/cmd-scan.d.mts.map +0 -1
  366. package/dist/types/commands/scan/create-scan-from-github.d.mts +0 -12
  367. package/dist/types/commands/scan/create-scan-from-github.d.mts.map +0 -1
  368. package/dist/types/commands/scan/fetch-create-org-full-scan.d.mts +0 -20
  369. package/dist/types/commands/scan/fetch-create-org-full-scan.d.mts.map +0 -1
  370. package/dist/types/commands/scan/fetch-delete-org-full-scan.d.mts +0 -8
  371. package/dist/types/commands/scan/fetch-delete-org-full-scan.d.mts.map +0 -1
  372. package/dist/types/commands/scan/fetch-diff-scan.d.mts +0 -8
  373. package/dist/types/commands/scan/fetch-diff-scan.d.mts.map +0 -1
  374. package/dist/types/commands/scan/fetch-list-scans.d.mts +0 -18
  375. package/dist/types/commands/scan/fetch-list-scans.d.mts.map +0 -1
  376. package/dist/types/commands/scan/fetch-report-data.d.mts +0 -17
  377. package/dist/types/commands/scan/fetch-report-data.d.mts.map +0 -1
  378. package/dist/types/commands/scan/fetch-scan-metadata.d.mts +0 -8
  379. package/dist/types/commands/scan/fetch-scan-metadata.d.mts.map +0 -1
  380. package/dist/types/commands/scan/fetch-scan.d.mts +0 -4
  381. package/dist/types/commands/scan/fetch-scan.d.mts.map +0 -1
  382. package/dist/types/commands/scan/fetch-supported-scan-file-names.d.mts +0 -10
  383. package/dist/types/commands/scan/fetch-supported-scan-file-names.d.mts.map +0 -1
  384. package/dist/types/commands/scan/finalize-tier1-scan.d.mts +0 -12
  385. package/dist/types/commands/scan/finalize-tier1-scan.d.mts.map +0 -1
  386. package/dist/types/commands/scan/generate-report.d.mts +0 -44
  387. package/dist/types/commands/scan/generate-report.d.mts.map +0 -1
  388. package/dist/types/commands/scan/handle-create-github-scan.d.mts +0 -12
  389. package/dist/types/commands/scan/handle-create-github-scan.d.mts.map +0 -1
  390. package/dist/types/commands/scan/handle-create-new-scan.d.mts +0 -29
  391. package/dist/types/commands/scan/handle-create-new-scan.d.mts.map +0 -1
  392. package/dist/types/commands/scan/handle-delete-scan.d.mts +0 -3
  393. package/dist/types/commands/scan/handle-delete-scan.d.mts.map +0 -1
  394. package/dist/types/commands/scan/handle-diff-scan.d.mts +0 -10
  395. package/dist/types/commands/scan/handle-diff-scan.d.mts.map +0 -1
  396. package/dist/types/commands/scan/handle-list-scans.d.mts +0 -13
  397. package/dist/types/commands/scan/handle-list-scans.d.mts.map +0 -1
  398. package/dist/types/commands/scan/handle-scan-config.d.mts +0 -2
  399. package/dist/types/commands/scan/handle-scan-config.d.mts.map +0 -1
  400. package/dist/types/commands/scan/handle-scan-metadata.d.mts +0 -3
  401. package/dist/types/commands/scan/handle-scan-metadata.d.mts.map +0 -1
  402. package/dist/types/commands/scan/handle-scan-reach.d.mts +0 -12
  403. package/dist/types/commands/scan/handle-scan-reach.d.mts.map +0 -1
  404. package/dist/types/commands/scan/handle-scan-report.d.mts +0 -14
  405. package/dist/types/commands/scan/handle-scan-report.d.mts.map +0 -1
  406. package/dist/types/commands/scan/handle-scan-view.d.mts +0 -3
  407. package/dist/types/commands/scan/handle-scan-view.d.mts.map +0 -1
  408. package/dist/types/commands/scan/output-create-new-scan.d.mts +0 -10
  409. package/dist/types/commands/scan/output-create-new-scan.d.mts.map +0 -1
  410. package/dist/types/commands/scan/output-delete-scan.d.mts +0 -4
  411. package/dist/types/commands/scan/output-delete-scan.d.mts.map +0 -1
  412. package/dist/types/commands/scan/output-diff-scan.d.mts +0 -8
  413. package/dist/types/commands/scan/output-diff-scan.d.mts.map +0 -1
  414. package/dist/types/commands/scan/output-list-scans.d.mts +0 -4
  415. package/dist/types/commands/scan/output-list-scans.d.mts.map +0 -1
  416. package/dist/types/commands/scan/output-scan-config-result.d.mts +0 -3
  417. package/dist/types/commands/scan/output-scan-config-result.d.mts.map +0 -1
  418. package/dist/types/commands/scan/output-scan-github.d.mts +0 -3
  419. package/dist/types/commands/scan/output-scan-github.d.mts.map +0 -1
  420. package/dist/types/commands/scan/output-scan-metadata.d.mts +0 -4
  421. package/dist/types/commands/scan/output-scan-metadata.d.mts.map +0 -1
  422. package/dist/types/commands/scan/output-scan-reach.d.mts +0 -7
  423. package/dist/types/commands/scan/output-scan-reach.d.mts.map +0 -1
  424. package/dist/types/commands/scan/output-scan-report.d.mts +0 -22
  425. package/dist/types/commands/scan/output-scan-report.d.mts.map +0 -1
  426. package/dist/types/commands/scan/output-scan-view.d.mts +0 -4
  427. package/dist/types/commands/scan/output-scan-view.d.mts.map +0 -1
  428. package/dist/types/commands/scan/perform-reachability-analysis.d.mts +0 -27
  429. package/dist/types/commands/scan/perform-reachability-analysis.d.mts.map +0 -1
  430. package/dist/types/commands/scan/reachability-flags.d.mts +0 -3
  431. package/dist/types/commands/scan/reachability-flags.d.mts.map +0 -1
  432. package/dist/types/commands/scan/setup-scan-config.d.mts +0 -3
  433. package/dist/types/commands/scan/setup-scan-config.d.mts.map +0 -1
  434. package/dist/types/commands/scan/stream-scan.d.mts +0 -7
  435. package/dist/types/commands/scan/stream-scan.d.mts.map +0 -1
  436. package/dist/types/commands/scan/suggest-org-slug.d.mts +0 -2
  437. package/dist/types/commands/scan/suggest-org-slug.d.mts.map +0 -1
  438. package/dist/types/commands/scan/suggest-to-persist-orgslug.d.mts +0 -2
  439. package/dist/types/commands/scan/suggest-to-persist-orgslug.d.mts.map +0 -1
  440. package/dist/types/commands/scan/suggest_branch_slug.d.mts +0 -2
  441. package/dist/types/commands/scan/suggest_branch_slug.d.mts.map +0 -1
  442. package/dist/types/commands/scan/suggest_target.d.mts +0 -2
  443. package/dist/types/commands/scan/suggest_target.d.mts.map +0 -1
  444. package/dist/types/commands/scan/types.d.mts +0 -3
  445. package/dist/types/commands/scan/types.d.mts.map +0 -1
  446. package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts +0 -10
  447. package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts.map +0 -1
  448. package/dist/types/commands/threat-feed/fetch-threat-feed.d.mts +0 -13
  449. package/dist/types/commands/threat-feed/fetch-threat-feed.d.mts.map +0 -1
  450. package/dist/types/commands/threat-feed/handle-threat-feed.d.mts +0 -13
  451. package/dist/types/commands/threat-feed/handle-threat-feed.d.mts.map +0 -1
  452. package/dist/types/commands/threat-feed/output-threat-feed.d.mts +0 -4
  453. package/dist/types/commands/threat-feed/output-threat-feed.d.mts.map +0 -1
  454. package/dist/types/commands/threat-feed/types.d.mts +0 -15
  455. package/dist/types/commands/threat-feed/types.d.mts.map +0 -1
  456. package/dist/types/commands/uninstall/cmd-uninstall-completion.d.mts +0 -8
  457. package/dist/types/commands/uninstall/cmd-uninstall-completion.d.mts.map +0 -1
  458. package/dist/types/commands/uninstall/cmd-uninstall.d.mts +0 -3
  459. package/dist/types/commands/uninstall/cmd-uninstall.d.mts.map +0 -1
  460. package/dist/types/commands/uninstall/handle-uninstall-completion.d.mts +0 -2
  461. package/dist/types/commands/uninstall/handle-uninstall-completion.d.mts.map +0 -1
  462. package/dist/types/commands/uninstall/output-uninstall-completion.d.mts +0 -6
  463. package/dist/types/commands/uninstall/output-uninstall-completion.d.mts.map +0 -1
  464. package/dist/types/commands/uninstall/teardown-tab-completion.d.mts +0 -6
  465. package/dist/types/commands/uninstall/teardown-tab-completion.d.mts.map +0 -1
  466. package/dist/types/commands/wrapper/add-socket-wrapper.d.mts +0 -2
  467. package/dist/types/commands/wrapper/add-socket-wrapper.d.mts.map +0 -1
  468. package/dist/types/commands/wrapper/check-socket-wrapper-setup.d.mts +0 -2
  469. package/dist/types/commands/wrapper/check-socket-wrapper-setup.d.mts.map +0 -1
  470. package/dist/types/commands/wrapper/cmd-wrapper.d.mts +0 -9
  471. package/dist/types/commands/wrapper/cmd-wrapper.d.mts.map +0 -1
  472. package/dist/types/commands/wrapper/postinstall-wrapper.d.mts +0 -2
  473. package/dist/types/commands/wrapper/postinstall-wrapper.d.mts.map +0 -1
  474. package/dist/types/commands/wrapper/remove-socket-wrapper.d.mts +0 -2
  475. package/dist/types/commands/wrapper/remove-socket-wrapper.d.mts.map +0 -1
  476. package/dist/types/commands/yarn/cmd-yarn.d.mts +0 -10
  477. package/dist/types/commands/yarn/cmd-yarn.d.mts.map +0 -1
  478. package/dist/types/commands.d.mts +0 -203
  479. package/dist/types/commands.d.mts.map +0 -1
  480. package/dist/types/constants.d.mts +0 -299
  481. package/dist/types/constants.d.mts.map +0 -1
  482. package/dist/types/flags.d.mts +0 -18
  483. package/dist/types/flags.d.mts.map +0 -1
  484. package/dist/types/instrument-with-sentry.d.mts +0 -2
  485. package/dist/types/instrument-with-sentry.d.mts.map +0 -1
  486. package/dist/types/npm-cli.d.mts +0 -3
  487. package/dist/types/npm-cli.d.mts.map +0 -1
  488. package/dist/types/npx-cli.d.mts +0 -3
  489. package/dist/types/npx-cli.d.mts.map +0 -1
  490. package/dist/types/pnpm-cli.d.mts +0 -3
  491. package/dist/types/pnpm-cli.d.mts.map +0 -1
  492. package/dist/types/sea/bootstrap.d.mts +0 -2
  493. package/dist/types/sea/bootstrap.d.mts.map +0 -1
  494. package/dist/types/sea/build-sea.d.mts +0 -27
  495. package/dist/types/sea/build-sea.d.mts.map +0 -1
  496. package/dist/types/shadow/common.d.mts +0 -23
  497. package/dist/types/shadow/common.d.mts.map +0 -1
  498. package/dist/types/shadow/npm/arborist/index.d.mts +0 -8
  499. package/dist/types/shadow/npm/arborist/index.d.mts.map +0 -1
  500. package/dist/types/shadow/npm/arborist/lib/arborist/index.d.mts +0 -35
  501. package/dist/types/shadow/npm/arborist/lib/arborist/index.d.mts.map +0 -1
  502. package/dist/types/shadow/npm/arborist/types.d.mts +0 -123
  503. package/dist/types/shadow/npm/arborist/types.d.mts.map +0 -1
  504. package/dist/types/shadow/npm/arborist-helpers.d.mts +0 -24
  505. package/dist/types/shadow/npm/arborist-helpers.d.mts.map +0 -1
  506. package/dist/types/shadow/npm/bin.d.mts +0 -5
  507. package/dist/types/shadow/npm/bin.d.mts.map +0 -1
  508. package/dist/types/shadow/npm/inject.d.mts +0 -2
  509. package/dist/types/shadow/npm/inject.d.mts.map +0 -1
  510. package/dist/types/shadow/npm/install.d.mts +0 -13
  511. package/dist/types/shadow/npm/install.d.mts.map +0 -1
  512. package/dist/types/shadow/npm/paths.d.mts +0 -6
  513. package/dist/types/shadow/npm/paths.d.mts.map +0 -1
  514. package/dist/types/shadow/npm-base.d.mts +0 -11
  515. package/dist/types/shadow/npm-base.d.mts.map +0 -1
  516. package/dist/types/shadow/npx/bin.d.mts +0 -5
  517. package/dist/types/shadow/npx/bin.d.mts.map +0 -1
  518. package/dist/types/shadow/pnpm/bin.d.mts +0 -10
  519. package/dist/types/shadow/pnpm/bin.d.mts.map +0 -1
  520. package/dist/types/shadow/stdio-ipc.d.mts +0 -7
  521. package/dist/types/shadow/stdio-ipc.d.mts.map +0 -1
  522. package/dist/types/shadow/yarn/bin.d.mts +0 -10
  523. package/dist/types/shadow/yarn/bin.d.mts.map +0 -1
  524. package/dist/types/test/json-output-validation.d.mts +0 -37
  525. package/dist/types/test/json-output-validation.d.mts.map +0 -1
  526. package/dist/types/test/mocks/socket-auth.d.mts +0 -88
  527. package/dist/types/test/mocks/socket-auth.d.mts.map +0 -1
  528. package/dist/types/types.d.mts +0 -29
  529. package/dist/types/types.d.mts.map +0 -1
  530. package/dist/types/utils/agent.d.mts +0 -12
  531. package/dist/types/utils/agent.d.mts.map +0 -1
  532. package/dist/types/utils/alert/artifact.d.mts +0 -21
  533. package/dist/types/utils/alert/artifact.d.mts.map +0 -1
  534. package/dist/types/utils/alert/fix.d.mts +0 -6
  535. package/dist/types/utils/alert/fix.d.mts.map +0 -1
  536. package/dist/types/utils/alert/severity.d.mts +0 -14
  537. package/dist/types/utils/alert/severity.d.mts.map +0 -1
  538. package/dist/types/utils/alerts-map.d.mts +0 -27
  539. package/dist/types/utils/alerts-map.d.mts.map +0 -1
  540. package/dist/types/utils/api.d.mts +0 -44
  541. package/dist/types/utils/api.d.mts.map +0 -1
  542. package/dist/types/utils/check-input.d.mts +0 -9
  543. package/dist/types/utils/check-input.d.mts.map +0 -1
  544. package/dist/types/utils/cmd.d.mts +0 -50
  545. package/dist/types/utils/cmd.d.mts.map +0 -1
  546. package/dist/types/utils/coana.d.mts +0 -2
  547. package/dist/types/utils/coana.d.mts.map +0 -1
  548. package/dist/types/utils/color-or-markdown.d.mts +0 -16
  549. package/dist/types/utils/color-or-markdown.d.mts.map +0 -1
  550. package/dist/types/utils/completion.d.mts +0 -11
  551. package/dist/types/utils/completion.d.mts.map +0 -1
  552. package/dist/types/utils/config.d.mts +0 -34
  553. package/dist/types/utils/config.d.mts.map +0 -1
  554. package/dist/types/utils/cve-to-ghsa.d.mts +0 -6
  555. package/dist/types/utils/cve-to-ghsa.d.mts.map +0 -1
  556. package/dist/types/utils/debug.d.mts +0 -45
  557. package/dist/types/utils/debug.d.mts.map +0 -1
  558. package/dist/types/utils/determine-org-slug.d.mts +0 -2
  559. package/dist/types/utils/determine-org-slug.d.mts.map +0 -1
  560. package/dist/types/utils/dlx-binary.d.mts +0 -58
  561. package/dist/types/utils/dlx-binary.d.mts.map +0 -1
  562. package/dist/types/utils/dlx-detection.d.mts +0 -29
  563. package/dist/types/utils/dlx-detection.d.mts.map +0 -1
  564. package/dist/types/utils/dlx.d.mts +0 -36
  565. package/dist/types/utils/dlx.d.mts.map +0 -1
  566. package/dist/types/utils/ecosystem.d.mts +0 -20
  567. package/dist/types/utils/ecosystem.d.mts.map +0 -1
  568. package/dist/types/utils/errors.d.mts +0 -62
  569. package/dist/types/utils/errors.d.mts.map +0 -1
  570. package/dist/types/utils/extract-names.d.mts +0 -15
  571. package/dist/types/utils/extract-names.d.mts.map +0 -1
  572. package/dist/types/utils/fail-msg-with-badge.d.mts +0 -2
  573. package/dist/types/utils/fail-msg-with-badge.d.mts.map +0 -1
  574. package/dist/types/utils/filter-config.d.mts +0 -5
  575. package/dist/types/utils/filter-config.d.mts.map +0 -1
  576. package/dist/types/utils/fs.d.mts +0 -8
  577. package/dist/types/utils/fs.d.mts.map +0 -1
  578. package/dist/types/utils/get-output-kind.d.mts +0 -3
  579. package/dist/types/utils/get-output-kind.d.mts.map +0 -1
  580. package/dist/types/utils/git.d.mts +0 -35
  581. package/dist/types/utils/git.d.mts.map +0 -1
  582. package/dist/types/utils/github.d.mts +0 -38
  583. package/dist/types/utils/github.d.mts.map +0 -1
  584. package/dist/types/utils/glob.d.mts +0 -15
  585. package/dist/types/utils/glob.d.mts.map +0 -1
  586. package/dist/types/utils/lockfile.d.mts +0 -2
  587. package/dist/types/utils/lockfile.d.mts.map +0 -1
  588. package/dist/types/utils/map-to-object.d.mts +0 -10
  589. package/dist/types/utils/map-to-object.d.mts.map +0 -1
  590. package/dist/types/utils/markdown.d.mts +0 -27
  591. package/dist/types/utils/markdown.d.mts.map +0 -1
  592. package/dist/types/utils/meow-with-subcommands.d.mts +0 -83
  593. package/dist/types/utils/meow-with-subcommands.d.mts.map +0 -1
  594. package/dist/types/utils/ms-at-home.d.mts +0 -2
  595. package/dist/types/utils/ms-at-home.d.mts.map +0 -1
  596. package/dist/types/utils/npm-config.d.mts +0 -14
  597. package/dist/types/utils/npm-config.d.mts.map +0 -1
  598. package/dist/types/utils/npm-package-arg.d.mts +0 -8
  599. package/dist/types/utils/npm-package-arg.d.mts.map +0 -1
  600. package/dist/types/utils/npm-paths.d.mts +0 -7
  601. package/dist/types/utils/npm-paths.d.mts.map +0 -1
  602. package/dist/types/utils/npm-spec.d.mts +0 -57
  603. package/dist/types/utils/npm-spec.d.mts.map +0 -1
  604. package/dist/types/utils/objects.d.mts +0 -3
  605. package/dist/types/utils/objects.d.mts.map +0 -1
  606. package/dist/types/utils/organization.d.mts +0 -5
  607. package/dist/types/utils/organization.d.mts.map +0 -1
  608. package/dist/types/utils/output-formatting.d.mts +0 -20
  609. package/dist/types/utils/output-formatting.d.mts.map +0 -1
  610. package/dist/types/utils/package-environment.d.mts +0 -57
  611. package/dist/types/utils/package-environment.d.mts.map +0 -1
  612. package/dist/types/utils/path-resolve.d.mts +0 -14
  613. package/dist/types/utils/path-resolve.d.mts.map +0 -1
  614. package/dist/types/utils/pnpm-paths.d.mts +0 -5
  615. package/dist/types/utils/pnpm-paths.d.mts.map +0 -1
  616. package/dist/types/utils/pnpm.d.mts +0 -11
  617. package/dist/types/utils/pnpm.d.mts.map +0 -1
  618. package/dist/types/utils/purl-to-ghsa.d.mts +0 -6
  619. package/dist/types/utils/purl-to-ghsa.d.mts.map +0 -1
  620. package/dist/types/utils/purl.d.mts +0 -71
  621. package/dist/types/utils/purl.d.mts.map +0 -1
  622. package/dist/types/utils/requirements.d.mts +0 -125
  623. package/dist/types/utils/requirements.d.mts.map +0 -1
  624. package/dist/types/utils/sdk.d.mts +0 -17
  625. package/dist/types/utils/sdk.d.mts.map +0 -1
  626. package/dist/types/utils/semver.d.mts +0 -7
  627. package/dist/types/utils/semver.d.mts.map +0 -1
  628. package/dist/types/utils/serialize-result-json.d.mts +0 -5
  629. package/dist/types/utils/serialize-result-json.d.mts.map +0 -1
  630. package/dist/types/utils/shadow-links.d.mts +0 -5
  631. package/dist/types/utils/shadow-links.d.mts.map +0 -1
  632. package/dist/types/utils/socket-json.d.mts +0 -59
  633. package/dist/types/utils/socket-json.d.mts.map +0 -1
  634. package/dist/types/utils/socket-package-alert.d.mts +0 -80
  635. package/dist/types/utils/socket-package-alert.d.mts.map +0 -1
  636. package/dist/types/utils/socket-url.d.mts +0 -8
  637. package/dist/types/utils/socket-url.d.mts.map +0 -1
  638. package/dist/types/utils/spec.d.mts +0 -5
  639. package/dist/types/utils/spec.d.mts.map +0 -1
  640. package/dist/types/utils/strings.d.mts +0 -14
  641. package/dist/types/utils/strings.d.mts.map +0 -1
  642. package/dist/types/utils/terminal-link.d.mts +0 -52
  643. package/dist/types/utils/terminal-link.d.mts.map +0 -1
  644. package/dist/types/utils/tildify.d.mts +0 -2
  645. package/dist/types/utils/tildify.d.mts.map +0 -1
  646. package/dist/types/utils/translations.d.mts +0 -617
  647. package/dist/types/utils/translations.d.mts.map +0 -1
  648. package/dist/types/utils/walk-nested-map.d.mts +0 -7
  649. package/dist/types/utils/walk-nested-map.d.mts.map +0 -1
  650. package/dist/types/utils/yarn-paths.d.mts +0 -5
  651. package/dist/types/utils/yarn-paths.d.mts.map +0 -1
  652. package/dist/types/utils/yarn-version.d.mts +0 -2
  653. package/dist/types/utils/yarn-version.d.mts.map +0 -1
  654. package/dist/types/yarn-cli.d.mts +0 -3
  655. package/dist/types/yarn-cli.d.mts.map +0 -1
  656. package/dist/utils.js +0 -6146
  657. package/dist/utils.js.map +0 -1
  658. package/dist/vendor.js +0 -162074
  659. package/dist/yarn-cli.js +0 -30
  660. package/dist/yarn-cli.js.map +0 -1
  661. package/external/@socketsecurity/registry/LICENSE +0 -21
  662. package/external/@socketsecurity/registry/README.md +0 -9
  663. package/external/@socketsecurity/registry/extensions.json +0 -28
  664. package/external/@socketsecurity/registry/external/@inquirer/confirm.js +0 -3165
  665. package/external/@socketsecurity/registry/external/@inquirer/input.js +0 -3202
  666. package/external/@socketsecurity/registry/external/@inquirer/password.js +0 -3307
  667. package/external/@socketsecurity/registry/external/@inquirer/search.js +0 -3519
  668. package/external/@socketsecurity/registry/external/@inquirer/select.js +0 -3655
  669. package/external/@socketsecurity/registry/external/@npmcli/package-json/index.js +0 -21406
  670. package/external/@socketsecurity/registry/external/@npmcli/package-json/lib/read-package.js +0 -183
  671. package/external/@socketsecurity/registry/external/@npmcli/package-json/lib/sort.js +0 -274
  672. package/external/@socketsecurity/registry/external/@npmcli/promise-spawn.js +0 -704
  673. package/external/@socketsecurity/registry/external/@socketregistry/is-unicode-supported.js +0 -54
  674. package/external/@socketsecurity/registry/external/@socketregistry/packageurl-js.js +0 -4516
  675. package/external/@socketsecurity/registry/external/@socketregistry/yocto-spinner.js +0 -453
  676. package/external/@socketsecurity/registry/external/@yarnpkg/extensions.js +0 -1406
  677. package/external/@socketsecurity/registry/external/browserslist.js +0 -20496
  678. package/external/@socketsecurity/registry/external/cacache.js +0 -16208
  679. package/external/@socketsecurity/registry/external/debug.js +0 -1163
  680. package/external/@socketsecurity/registry/external/fast-glob.js +0 -7994
  681. package/external/@socketsecurity/registry/external/fast-sort.js +0 -181
  682. package/external/@socketsecurity/registry/external/libnpmpack.js +0 -106271
  683. package/external/@socketsecurity/registry/external/make-fetch-happen.js +0 -38997
  684. package/external/@socketsecurity/registry/external/normalize-package-data.js +0 -5343
  685. package/external/@socketsecurity/registry/external/npm-package-arg.js +0 -5773
  686. package/external/@socketsecurity/registry/external/pacote.js +0 -74109
  687. package/external/@socketsecurity/registry/external/picomatch.js +0 -2307
  688. package/external/@socketsecurity/registry/external/semver.js +0 -2618
  689. package/external/@socketsecurity/registry/external/signal-exit.js +0 -336
  690. package/external/@socketsecurity/registry/external/spdx-correct.js +0 -1457
  691. package/external/@socketsecurity/registry/external/spdx-expression-parse.js +0 -1043
  692. package/external/@socketsecurity/registry/external/streaming-iterables.js +0 -326
  693. package/external/@socketsecurity/registry/external/validate-npm-package-name.js +0 -108
  694. package/external/@socketsecurity/registry/external/which.js +0 -405
  695. package/external/@socketsecurity/registry/external/yoctocolors-cjs.js +0 -101
  696. package/external/@socketsecurity/registry/index.js +0 -31
  697. package/external/@socketsecurity/registry/lib/agent.js +0 -390
  698. package/external/@socketsecurity/registry/lib/arrays.js +0 -89
  699. package/external/@socketsecurity/registry/lib/bin.js +0 -650
  700. package/external/@socketsecurity/registry/lib/constants/abort-controller.js +0 -15
  701. package/external/@socketsecurity/registry/lib/constants/abort-signal.js +0 -27
  702. package/external/@socketsecurity/registry/lib/constants/at-latest.js +0 -3
  703. package/external/@socketsecurity/registry/lib/constants/biome-json.js +0 -3
  704. package/external/@socketsecurity/registry/lib/constants/bun-lock.js +0 -3
  705. package/external/@socketsecurity/registry/lib/constants/bun-lockb.js +0 -3
  706. package/external/@socketsecurity/registry/lib/constants/bun.js +0 -3
  707. package/external/@socketsecurity/registry/lib/constants/ci.js +0 -3
  708. package/external/@socketsecurity/registry/lib/constants/column-limit.js +0 -3
  709. package/external/@socketsecurity/registry/lib/constants/copy-left-licenses.js +0 -27
  710. package/external/@socketsecurity/registry/lib/constants/darwin.js +0 -3
  711. package/external/@socketsecurity/registry/lib/constants/dot-git-dir.js +0 -3
  712. package/external/@socketsecurity/registry/lib/constants/dot-package-lock-json.js +0 -3
  713. package/external/@socketsecurity/registry/lib/constants/dot-socket-dir.js +0 -3
  714. package/external/@socketsecurity/registry/lib/constants/empty-file.js +0 -3
  715. package/external/@socketsecurity/registry/lib/constants/empty-value.js +0 -3
  716. package/external/@socketsecurity/registry/lib/constants/env.js +0 -59
  717. package/external/@socketsecurity/registry/lib/constants/eslint-config-js.js +0 -3
  718. package/external/@socketsecurity/registry/lib/constants/esnext.js +0 -3
  719. package/external/@socketsecurity/registry/lib/constants/exec-path.js +0 -3
  720. package/external/@socketsecurity/registry/lib/constants/ext-cjs.js +0 -3
  721. package/external/@socketsecurity/registry/lib/constants/ext-cmd.js +0 -3
  722. package/external/@socketsecurity/registry/lib/constants/ext-cts.js +0 -3
  723. package/external/@socketsecurity/registry/lib/constants/ext-dts.js +0 -3
  724. package/external/@socketsecurity/registry/lib/constants/ext-js.js +0 -3
  725. package/external/@socketsecurity/registry/lib/constants/ext-json.js +0 -3
  726. package/external/@socketsecurity/registry/lib/constants/ext-lock.js +0 -3
  727. package/external/@socketsecurity/registry/lib/constants/ext-lockb.js +0 -3
  728. package/external/@socketsecurity/registry/lib/constants/ext-md.js +0 -3
  729. package/external/@socketsecurity/registry/lib/constants/ext-mjs.js +0 -3
  730. package/external/@socketsecurity/registry/lib/constants/ext-mts.js +0 -3
  731. package/external/@socketsecurity/registry/lib/constants/ext-ps1.js +0 -3
  732. package/external/@socketsecurity/registry/lib/constants/ext-yaml.js +0 -3
  733. package/external/@socketsecurity/registry/lib/constants/ext-yml.js +0 -3
  734. package/external/@socketsecurity/registry/lib/constants/extensions-json.js +0 -3
  735. package/external/@socketsecurity/registry/lib/constants/extensions.js +0 -3
  736. package/external/@socketsecurity/registry/lib/constants/get-ipc.js +0 -10
  737. package/external/@socketsecurity/registry/lib/constants/gitignore.js +0 -3
  738. package/external/@socketsecurity/registry/lib/constants/index.js +0 -139
  739. package/external/@socketsecurity/registry/lib/constants/ipc-handler.js +0 -19
  740. package/external/@socketsecurity/registry/lib/constants/ipc-object.js +0 -6
  741. package/external/@socketsecurity/registry/lib/constants/ipc-promise.js +0 -47
  742. package/external/@socketsecurity/registry/lib/constants/ipc-target.js +0 -3
  743. package/external/@socketsecurity/registry/lib/constants/k-internals-symbol.js +0 -3
  744. package/external/@socketsecurity/registry/lib/constants/latest.js +0 -3
  745. package/external/@socketsecurity/registry/lib/constants/license-glob-recursive.js +0 -3
  746. package/external/@socketsecurity/registry/lib/constants/license-glob.js +0 -3
  747. package/external/@socketsecurity/registry/lib/constants/license-original-glob-recursive.js +0 -3
  748. package/external/@socketsecurity/registry/lib/constants/license-original-glob.js +0 -3
  749. package/external/@socketsecurity/registry/lib/constants/license-original.js +0 -3
  750. package/external/@socketsecurity/registry/lib/constants/license.js +0 -3
  751. package/external/@socketsecurity/registry/lib/constants/lifecycle-script-names.js +0 -18
  752. package/external/@socketsecurity/registry/lib/constants/loop-sentinel.js +0 -3
  753. package/external/@socketsecurity/registry/lib/constants/maintained-node-versions.js +0 -47
  754. package/external/@socketsecurity/registry/lib/constants/manifest-json.js +0 -3
  755. package/external/@socketsecurity/registry/lib/constants/mit.js +0 -3
  756. package/external/@socketsecurity/registry/lib/constants/node-auth-token.js +0 -3
  757. package/external/@socketsecurity/registry/lib/constants/node-debug-flags.js +0 -9
  758. package/external/@socketsecurity/registry/lib/constants/node-env.js +0 -3
  759. package/external/@socketsecurity/registry/lib/constants/node-harden-flags.js +0 -29
  760. package/external/@socketsecurity/registry/lib/constants/node-modules-glob-recursive.js +0 -3
  761. package/external/@socketsecurity/registry/lib/constants/node-modules.js +0 -3
  762. package/external/@socketsecurity/registry/lib/constants/node-no-warnings-flags.js +0 -16
  763. package/external/@socketsecurity/registry/lib/constants/node-version.js +0 -3
  764. package/external/@socketsecurity/registry/lib/constants/npm-exec-path.js +0 -5
  765. package/external/@socketsecurity/registry/lib/constants/npm-real-exec-path.js +0 -6
  766. package/external/@socketsecurity/registry/lib/constants/npm-shrinkwrap-json.js +0 -3
  767. package/external/@socketsecurity/registry/lib/constants/npm.js +0 -3
  768. package/external/@socketsecurity/registry/lib/constants/npx.js +0 -3
  769. package/external/@socketsecurity/registry/lib/constants/overrides.js +0 -3
  770. package/external/@socketsecurity/registry/lib/constants/package-default-node-range.js +0 -6
  771. package/external/@socketsecurity/registry/lib/constants/package-default-socket-categories.js +0 -3
  772. package/external/@socketsecurity/registry/lib/constants/package-default-version.js +0 -3
  773. package/external/@socketsecurity/registry/lib/constants/package-extensions.js +0 -47
  774. package/external/@socketsecurity/registry/lib/constants/package-json.js +0 -3
  775. package/external/@socketsecurity/registry/lib/constants/package-lock-json.js +0 -3
  776. package/external/@socketsecurity/registry/lib/constants/packument-cache.js +0 -3
  777. package/external/@socketsecurity/registry/lib/constants/pacote-cache-path.js +0 -9
  778. package/external/@socketsecurity/registry/lib/constants/pnpm-exec-path.js +0 -5
  779. package/external/@socketsecurity/registry/lib/constants/pnpm-lock-yaml.js +0 -3
  780. package/external/@socketsecurity/registry/lib/constants/pnpm.js +0 -3
  781. package/external/@socketsecurity/registry/lib/constants/pre-commit.js +0 -3
  782. package/external/@socketsecurity/registry/lib/constants/readme-glob-recursive.js +0 -3
  783. package/external/@socketsecurity/registry/lib/constants/readme-glob.js +0 -3
  784. package/external/@socketsecurity/registry/lib/constants/readme-md.js +0 -3
  785. package/external/@socketsecurity/registry/lib/constants/registry-scope-delimiter.js +0 -3
  786. package/external/@socketsecurity/registry/lib/constants/registry.js +0 -3
  787. package/external/@socketsecurity/registry/lib/constants/resolutions.js +0 -3
  788. package/external/@socketsecurity/registry/lib/constants/socket-github-org.js +0 -3
  789. package/external/@socketsecurity/registry/lib/constants/socket-ipc-handshake.js +0 -3
  790. package/external/@socketsecurity/registry/lib/constants/socket-override-scope.js +0 -3
  791. package/external/@socketsecurity/registry/lib/constants/socket-public-api-token.js +0 -3
  792. package/external/@socketsecurity/registry/lib/constants/socket-registry-npm-org.js +0 -3
  793. package/external/@socketsecurity/registry/lib/constants/socket-registry-package-name.js +0 -3
  794. package/external/@socketsecurity/registry/lib/constants/socket-registry-repo-name.js +0 -3
  795. package/external/@socketsecurity/registry/lib/constants/socket-registry-scope.js +0 -3
  796. package/external/@socketsecurity/registry/lib/constants/socket-security-scope.js +0 -3
  797. package/external/@socketsecurity/registry/lib/constants/spinner.js +0 -4
  798. package/external/@socketsecurity/registry/lib/constants/supports-node-compile-cache-api.js +0 -8
  799. package/external/@socketsecurity/registry/lib/constants/supports-node-compile-cache-env-var.js +0 -8
  800. package/external/@socketsecurity/registry/lib/constants/supports-node-disable-warning-flag.js +0 -8
  801. package/external/@socketsecurity/registry/lib/constants/supports-node-permission-flag.js +0 -8
  802. package/external/@socketsecurity/registry/lib/constants/supports-node-require-module.js +0 -3
  803. package/external/@socketsecurity/registry/lib/constants/supports-node-run.js +0 -8
  804. package/external/@socketsecurity/registry/lib/constants/supports-process-send.js +0 -5
  805. package/external/@socketsecurity/registry/lib/constants/ts-libs-available.js +0 -22
  806. package/external/@socketsecurity/registry/lib/constants/ts-types-available.js +0 -3
  807. package/external/@socketsecurity/registry/lib/constants/tsconfig-json.js +0 -3
  808. package/external/@socketsecurity/registry/lib/constants/undefined-token.js +0 -3
  809. package/external/@socketsecurity/registry/lib/constants/unknown-error.js +0 -3
  810. package/external/@socketsecurity/registry/lib/constants/unknown-value.js +0 -3
  811. package/external/@socketsecurity/registry/lib/constants/unlicenced.js +0 -3
  812. package/external/@socketsecurity/registry/lib/constants/unlicensed.js +0 -3
  813. package/external/@socketsecurity/registry/lib/constants/utf8.js +0 -3
  814. package/external/@socketsecurity/registry/lib/constants/vitest.js +0 -3
  815. package/external/@socketsecurity/registry/lib/constants/vlt-lock-json.js +0 -3
  816. package/external/@socketsecurity/registry/lib/constants/vlt.js +0 -3
  817. package/external/@socketsecurity/registry/lib/constants/win32.js +0 -3
  818. package/external/@socketsecurity/registry/lib/constants/yarn-berry.js +0 -3
  819. package/external/@socketsecurity/registry/lib/constants/yarn-classic.js +0 -3
  820. package/external/@socketsecurity/registry/lib/constants/yarn-exec-path.js +0 -5
  821. package/external/@socketsecurity/registry/lib/constants/yarn-lock.js +0 -3
  822. package/external/@socketsecurity/registry/lib/constants/yarn.js +0 -3
  823. package/external/@socketsecurity/registry/lib/debug.js +0 -264
  824. package/external/@socketsecurity/registry/lib/env.js +0 -62
  825. package/external/@socketsecurity/registry/lib/fs.js +0 -556
  826. package/external/@socketsecurity/registry/lib/functions.js +0 -20
  827. package/external/@socketsecurity/registry/lib/globs.js +0 -145
  828. package/external/@socketsecurity/registry/lib/json.js +0 -69
  829. package/external/@socketsecurity/registry/lib/logger.js +0 -534
  830. package/external/@socketsecurity/registry/lib/objects.js +0 -422
  831. package/external/@socketsecurity/registry/lib/packages.js +0 -1376
  832. package/external/@socketsecurity/registry/lib/path.js +0 -231
  833. package/external/@socketsecurity/registry/lib/promises.js +0 -286
  834. package/external/@socketsecurity/registry/lib/prompts.js +0 -63
  835. package/external/@socketsecurity/registry/lib/regexps.js +0 -23
  836. package/external/@socketsecurity/registry/lib/sorts.js +0 -70
  837. package/external/@socketsecurity/registry/lib/spawn.js +0 -252
  838. package/external/@socketsecurity/registry/lib/spinner.js +0 -205
  839. package/external/@socketsecurity/registry/lib/streams.js +0 -84
  840. package/external/@socketsecurity/registry/lib/strings.js +0 -235
  841. package/external/@socketsecurity/registry/lib/url.js +0 -68
  842. package/external/@socketsecurity/registry/lib/words.js +0 -45
  843. package/external/@socketsecurity/registry/manifest.json +0 -1875
  844. package/external/blessed/LICENSE +0 -20
  845. package/external/blessed/README.md +0 -2421
  846. package/external/blessed/lib/alias.js +0 -528
  847. package/external/blessed/lib/blessed.js +0 -34
  848. package/external/blessed/lib/colors.js +0 -532
  849. package/external/blessed/lib/events.js +0 -191
  850. package/external/blessed/lib/gpmclient.js +0 -223
  851. package/external/blessed/lib/helpers.js +0 -167
  852. package/external/blessed/lib/keys.js +0 -341
  853. package/external/blessed/lib/program.js +0 -4297
  854. package/external/blessed/lib/tput.js +0 -3020
  855. package/external/blessed/lib/unicode.js +0 -792
  856. package/external/blessed/lib/widget.js +0 -62
  857. package/external/blessed/lib/widgets/ansiimage.js +0 -169
  858. package/external/blessed/lib/widgets/bigtext.js +0 -161
  859. package/external/blessed/lib/widgets/box.js +0 -36
  860. package/external/blessed/lib/widgets/button.js +0 -64
  861. package/external/blessed/lib/widgets/checkbox.js +0 -93
  862. package/external/blessed/lib/widgets/element.js +0 -2572
  863. package/external/blessed/lib/widgets/filemanager.js +0 -214
  864. package/external/blessed/lib/widgets/form.js +0 -269
  865. package/external/blessed/lib/widgets/image.js +0 -63
  866. package/external/blessed/lib/widgets/input.js +0 -36
  867. package/external/blessed/lib/widgets/layout.js +0 -235
  868. package/external/blessed/lib/widgets/line.js +0 -58
  869. package/external/blessed/lib/widgets/list.js +0 -601
  870. package/external/blessed/lib/widgets/listbar.js +0 -413
  871. package/external/blessed/lib/widgets/listtable.js +0 -254
  872. package/external/blessed/lib/widgets/loading.js +0 -90
  873. package/external/blessed/lib/widgets/log.js +0 -85
  874. package/external/blessed/lib/widgets/message.js +0 -125
  875. package/external/blessed/lib/widgets/node.js +0 -284
  876. package/external/blessed/lib/widgets/overlayimage.js +0 -719
  877. package/external/blessed/lib/widgets/progressbar.js +0 -159
  878. package/external/blessed/lib/widgets/prompt.js +0 -122
  879. package/external/blessed/lib/widgets/question.js +0 -118
  880. package/external/blessed/lib/widgets/radiobutton.js +0 -63
  881. package/external/blessed/lib/widgets/radioset.js +0 -38
  882. package/external/blessed/lib/widgets/screen.js +0 -2300
  883. package/external/blessed/lib/widgets/scrollablebox.js +0 -391
  884. package/external/blessed/lib/widgets/scrollabletext.js +0 -37
  885. package/external/blessed/lib/widgets/table.js +0 -356
  886. package/external/blessed/lib/widgets/terminal.js +0 -414
  887. package/external/blessed/lib/widgets/text.js +0 -37
  888. package/external/blessed/lib/widgets/textarea.js +0 -344
  889. package/external/blessed/lib/widgets/textbox.js +0 -79
  890. package/external/blessed/lib/widgets/video.js +0 -128
  891. package/external/blessed/usr/fonts/AUTHORS +0 -1
  892. package/external/blessed/usr/fonts/LICENSE +0 -94
  893. package/external/blessed/usr/fonts/README +0 -340
  894. package/external/blessed/usr/fonts/ter-u14b.json +0 -17826
  895. package/external/blessed/usr/fonts/ter-u14n.json +0 -17826
  896. package/external/blessed/usr/linux +0 -0
  897. package/external/blessed/usr/windows-ansi +0 -0
  898. package/external/blessed/usr/xterm +0 -0
  899. package/external/blessed/usr/xterm-256color +0 -0
  900. package/external/blessed/usr/xterm.termcap +0 -243
  901. package/external/blessed/usr/xterm.terminfo +0 -1977
  902. package/external/blessed/vendor/tng.js +0 -1757
  903. package/external/blessed-contrib/LICENSE.md +0 -21
  904. package/external/blessed-contrib/lib/layout/grid.js +0 -409
  905. package/external/blessed-contrib/lib/widget/charts/bar.js +0 -8370
  906. package/external/blessed-contrib/lib/widget/charts/line.js +0 -17924
  907. package/external/blessed-contrib/lib/widget/table.js +0 -187
  908. package/shadow-bin/npm +0 -27
  909. package/shadow-bin/npx +0 -27
  910. package/shadow-bin/pnpm +0 -27
  911. package/shadow-bin/yarn +0 -27
  912. /package/{translations.json → data/alert-translations.json} +0 -0
  913. /package/{requirements.json → data/command-api-requirements.json} +0 -0
  914. /package/{dist → data}/socket-completion.bash +0 -0
@@ -1,3519 +0,0 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true })
4
-
5
- const require$$0 = require('tty')
6
- const process$2 = require('process')
7
- const readline$1 = require('readline')
8
- const async_hooks = require('async_hooks')
9
- const require$$0$2 = require('stream')
10
- const util = require('util')
11
- const require$$0$1 = require('tty')
12
-
13
- function _interopNamespaceDefault(e) {
14
- const n = Object.create(null)
15
- if (e) {
16
- Object.keys(e).forEach(function (k) {
17
- if (k !== 'default') {
18
- const d = Object.getOwnPropertyDescriptor(e, k)
19
- Object.defineProperty(
20
- n,
21
- k,
22
- d.get
23
- ? d
24
- : {
25
- enumerable: true,
26
- get: function () {
27
- return e[k]
28
- }
29
- }
30
- )
31
- }
32
- })
33
- }
34
- n.default = e
35
- return Object.freeze(n)
36
- }
37
-
38
- const readline__namespace = /*#__PURE__*/ _interopNamespaceDefault(readline$1)
39
-
40
- const isUpKey = key => key.name === 'up'
41
- const isDownKey = key => key.name === 'down'
42
- const isTabKey = key => key.name === 'tab'
43
- const isEnterKey = key => key.name === 'enter' || key.name === 'return'
44
-
45
- class AbortPromptError extends Error {
46
- name = 'AbortPromptError'
47
- message = 'Prompt was aborted'
48
- constructor(options) {
49
- super()
50
- this.cause = options?.cause
51
- }
52
- }
53
- class CancelPromptError extends Error {
54
- name = 'CancelPromptError'
55
- message = 'Prompt was canceled'
56
- }
57
- class ExitPromptError extends Error {
58
- name = 'ExitPromptError'
59
- }
60
- class HookError extends Error {
61
- name = 'HookError'
62
- }
63
- class ValidationError extends Error {
64
- name = 'ValidationError'
65
- }
66
-
67
- /* eslint @typescript-eslint/no-explicit-any: ["off"] */
68
- const hookStorage = new async_hooks.AsyncLocalStorage()
69
- function createStore(rl) {
70
- const store = {
71
- rl,
72
- hooks: [],
73
- hooksCleanup: [],
74
- hooksEffect: [],
75
- index: 0,
76
- handleChange() {}
77
- }
78
- return store
79
- }
80
- // Run callback in with the hook engine setup.
81
- function withHooks(rl, cb) {
82
- const store = createStore(rl)
83
- return hookStorage.run(store, () => {
84
- function cycle(render) {
85
- store.handleChange = () => {
86
- store.index = 0
87
- render()
88
- }
89
- store.handleChange()
90
- }
91
- return cb(cycle)
92
- })
93
- }
94
- // Safe getStore utility that'll return the store or throw if undefined.
95
- function getStore() {
96
- const store = hookStorage.getStore()
97
- if (!store) {
98
- throw new HookError(
99
- '[Inquirer] Hook functions can only be called from within a prompt'
100
- )
101
- }
102
- return store
103
- }
104
- function readline() {
105
- return getStore().rl
106
- }
107
- // Merge state updates happening within the callback function to avoid multiple renders.
108
- function withUpdates(fn) {
109
- const wrapped = (...args) => {
110
- const store = getStore()
111
- let shouldUpdate = false
112
- const oldHandleChange = store.handleChange
113
- store.handleChange = () => {
114
- shouldUpdate = true
115
- }
116
- const returnValue = fn(...args)
117
- if (shouldUpdate) {
118
- oldHandleChange()
119
- }
120
- store.handleChange = oldHandleChange
121
- return returnValue
122
- }
123
- return async_hooks.AsyncResource.bind(wrapped)
124
- }
125
- function withPointer(cb) {
126
- const store = getStore()
127
- const { index } = store
128
- const pointer = {
129
- get() {
130
- return store.hooks[index]
131
- },
132
- set(value) {
133
- store.hooks[index] = value
134
- },
135
- initialized: index in store.hooks
136
- }
137
- const returnValue = cb(pointer)
138
- store.index++
139
- return returnValue
140
- }
141
- function handleChange() {
142
- getStore().handleChange()
143
- }
144
- const effectScheduler = {
145
- queue(cb) {
146
- const store = getStore()
147
- const { index } = store
148
- store.hooksEffect.push(() => {
149
- store.hooksCleanup[index]?.()
150
- const cleanFn = cb(readline())
151
- if (cleanFn != null && typeof cleanFn !== 'function') {
152
- throw new ValidationError(
153
- 'useEffect return value must be a cleanup function or nothing.'
154
- )
155
- }
156
- store.hooksCleanup[index] = cleanFn
157
- })
158
- },
159
- run() {
160
- const store = getStore()
161
- withUpdates(() => {
162
- store.hooksEffect.forEach(effect => {
163
- effect()
164
- })
165
- // Warning: Clean the hooks before exiting the `withUpdates` block.
166
- // Failure to do so means an updates would hit the same effects again.
167
- store.hooksEffect.length = 0
168
- })()
169
- },
170
- clearAll() {
171
- const store = getStore()
172
- store.hooksCleanup.forEach(cleanFn => {
173
- cleanFn?.()
174
- })
175
- store.hooksEffect.length = 0
176
- store.hooksCleanup.length = 0
177
- }
178
- }
179
-
180
- function useState(defaultValue) {
181
- return withPointer(pointer => {
182
- const setState = async_hooks.AsyncResource.bind(
183
- function setState(newValue) {
184
- // Noop if the value is still the same.
185
- if (pointer.get() !== newValue) {
186
- pointer.set(newValue)
187
- // Trigger re-render
188
- handleChange()
189
- }
190
- }
191
- )
192
- if (pointer.initialized) {
193
- return [pointer.get(), setState]
194
- }
195
- const value =
196
- typeof defaultValue === 'function' ? defaultValue() : defaultValue
197
- pointer.set(value)
198
- return [value, setState]
199
- })
200
- }
201
-
202
- function useEffect(cb, depArray) {
203
- withPointer(pointer => {
204
- const oldDeps = pointer.get()
205
- const hasChanged =
206
- !Array.isArray(oldDeps) ||
207
- depArray.some((dep, i) => !Object.is(dep, oldDeps[i]))
208
- if (hasChanged) {
209
- effectScheduler.queue(cb)
210
- }
211
- pointer.set(depArray)
212
- })
213
- }
214
-
215
- let yoctocolorsCjs
216
- let hasRequiredYoctocolorsCjs
217
- function requireYoctocolorsCjs() {
218
- if (hasRequiredYoctocolorsCjs) {
219
- return yoctocolorsCjs
220
- }
221
- hasRequiredYoctocolorsCjs = 1
222
- const tty = require$$0 // eslint-disable-line unicorn/prefer-module
223
-
224
- // eslint-disable-next-line no-warning-comments
225
- // TODO: Use a better method when it's added to Node.js (https://github.com/nodejs/node/pull/40240)
226
- // Lots of optionals here to support Deno.
227
- const hasColors = tty?.WriteStream?.prototype?.hasColors?.() ?? false
228
- const format = (open, close) => {
229
- if (!hasColors) {
230
- return input => input
231
- }
232
- const openCode = `\u001B[${open}m`
233
- const closeCode = `\u001B[${close}m`
234
- return input => {
235
- const string = input + '' // eslint-disable-line no-implicit-coercion -- This is faster.
236
- let index = string.indexOf(closeCode)
237
- if (index === -1) {
238
- // Note: Intentionally not using string interpolation for performance reasons.
239
- return openCode + string + closeCode
240
- }
241
-
242
- // Handle nested colors.
243
-
244
- // We could have done this, but it's too slow (as of Node.js 22).
245
- // return openCode + string.replaceAll(closeCode, openCode) + closeCode;
246
-
247
- let result = openCode
248
- let lastIndex = 0
249
-
250
- // SGR 22 resets both bold (1) and dim (2). When we encounter a nested
251
- // close for styles that use 22, we need to re-open the outer style.
252
- const reopenOnNestedClose = close === 22
253
- const replaceCode = (reopenOnNestedClose ? closeCode : '') + openCode
254
- while (index !== -1) {
255
- result += string.slice(lastIndex, index) + replaceCode
256
- lastIndex = index + closeCode.length
257
- index = string.indexOf(closeCode, lastIndex)
258
- }
259
- result += string.slice(lastIndex) + closeCode
260
- return result
261
- }
262
- }
263
- const colors = {}
264
- colors.reset = format(0, 0)
265
- colors.bold = format(1, 22)
266
- colors.dim = format(2, 22)
267
- colors.italic = format(3, 23)
268
- colors.underline = format(4, 24)
269
- colors.overline = format(53, 55)
270
- colors.inverse = format(7, 27)
271
- colors.hidden = format(8, 28)
272
- colors.strikethrough = format(9, 29)
273
- colors.black = format(30, 39)
274
- colors.red = format(31, 39)
275
- colors.green = format(32, 39)
276
- colors.yellow = format(33, 39)
277
- colors.blue = format(34, 39)
278
- colors.magenta = format(35, 39)
279
- colors.cyan = format(36, 39)
280
- colors.white = format(37, 39)
281
- colors.gray = format(90, 39)
282
- colors.bgBlack = format(40, 49)
283
- colors.bgRed = format(41, 49)
284
- colors.bgGreen = format(42, 49)
285
- colors.bgYellow = format(43, 49)
286
- colors.bgBlue = format(44, 49)
287
- colors.bgMagenta = format(45, 49)
288
- colors.bgCyan = format(46, 49)
289
- colors.bgWhite = format(47, 49)
290
- colors.bgGray = format(100, 49)
291
- colors.redBright = format(91, 39)
292
- colors.greenBright = format(92, 39)
293
- colors.yellowBright = format(93, 39)
294
- colors.blueBright = format(94, 39)
295
- colors.magentaBright = format(95, 39)
296
- colors.cyanBright = format(96, 39)
297
- colors.whiteBright = format(97, 39)
298
- colors.bgRedBright = format(101, 49)
299
- colors.bgGreenBright = format(102, 49)
300
- colors.bgYellowBright = format(103, 49)
301
- colors.bgBlueBright = format(104, 49)
302
- colors.bgMagentaBright = format(105, 49)
303
- colors.bgCyanBright = format(106, 49)
304
- colors.bgWhiteBright = format(107, 49)
305
- yoctocolorsCjs = colors // eslint-disable-line unicorn/prefer-module
306
- return yoctocolorsCjs
307
- }
308
-
309
- const yoctocolorsCjsExports = /*@__PURE__*/ requireYoctocolorsCjs()
310
-
311
- // process.env dot-notation access prints:
312
- // Property 'TERM' comes from an index signature, so it must be accessed with ['TERM'].ts(4111)
313
- /* eslint dot-notation: ["off"] */
314
- // Ported from is-unicode-supported
315
- function isUnicodeSupported() {
316
- if (process$2.platform !== 'win32') {
317
- return process$2.env['TERM'] !== 'linux' // Linux console (kernel)
318
- }
319
- return (
320
- Boolean(process$2.env['WT_SESSION']) ||
321
- // Windows Terminal
322
- Boolean(process$2.env['TERMINUS_SUBLIME']) ||
323
- // Terminus (<0.2.27)
324
- process$2.env['ConEmuTask'] === '{cmd::Cmder}' ||
325
- // ConEmu and cmder
326
- process$2.env['TERM_PROGRAM'] === 'Terminus-Sublime' ||
327
- process$2.env['TERM_PROGRAM'] === 'vscode' ||
328
- process$2.env['TERM'] === 'xterm-256color' ||
329
- process$2.env['TERM'] === 'alacritty' ||
330
- process$2.env['TERMINAL_EMULATOR'] === 'JetBrains-JediTerm'
331
- )
332
- }
333
- // Ported from figures
334
- const common = {
335
- circleQuestionMark: '(?)',
336
- questionMarkPrefix: '(?)',
337
- square: '█',
338
- squareDarkShade: '▓',
339
- squareMediumShade: '▒',
340
- squareLightShade: '░',
341
- squareTop: '▀',
342
- squareBottom: '▄',
343
- squareLeft: '▌',
344
- squareRight: '▐',
345
- squareCenter: '■',
346
- bullet: '●',
347
- dot: '․',
348
- ellipsis: '…',
349
- pointerSmall: '›',
350
- triangleUp: '▲',
351
- triangleUpSmall: '▴',
352
- triangleDown: '▼',
353
- triangleDownSmall: '▾',
354
- triangleLeftSmall: '◂',
355
- triangleRightSmall: '▸',
356
- home: '⌂',
357
- heart: '♥',
358
- musicNote: '♪',
359
- musicNoteBeamed: '♫',
360
- arrowUp: '↑',
361
- arrowDown: '↓',
362
- arrowLeft: '←',
363
- arrowRight: '→',
364
- arrowLeftRight: '↔',
365
- arrowUpDown: '↕',
366
- almostEqual: '≈',
367
- notEqual: '≠',
368
- lessOrEqual: '≤',
369
- greaterOrEqual: '≥',
370
- identical: '≡',
371
- infinity: '∞',
372
- subscriptZero: '₀',
373
- subscriptOne: '₁',
374
- subscriptTwo: '₂',
375
- subscriptThree: '₃',
376
- subscriptFour: '₄',
377
- subscriptFive: '₅',
378
- subscriptSix: '₆',
379
- subscriptSeven: '₇',
380
- subscriptEight: '₈',
381
- subscriptNine: '₉',
382
- oneHalf: '½',
383
- oneThird: '⅓',
384
- oneQuarter: '¼',
385
- oneFifth: '⅕',
386
- oneSixth: '⅙',
387
- oneEighth: '⅛',
388
- twoThirds: '⅔',
389
- twoFifths: '⅖',
390
- threeQuarters: '¾',
391
- threeFifths: '⅗',
392
- threeEighths: '⅜',
393
- fourFifths: '⅘',
394
- fiveSixths: '⅚',
395
- fiveEighths: '⅝',
396
- sevenEighths: '⅞',
397
- line: '─',
398
- lineBold: '━',
399
- lineDouble: '═',
400
- lineDashed0: '┄',
401
- lineDashed1: '┅',
402
- lineDashed2: '┈',
403
- lineDashed3: '┉',
404
- lineDashed4: '╌',
405
- lineDashed5: '╍',
406
- lineDashed6: '╴',
407
- lineDashed7: '╶',
408
- lineDashed8: '╸',
409
- lineDashed9: '╺',
410
- lineDashed10: '╼',
411
- lineDashed11: '╾',
412
- lineDashed12: '−',
413
- lineDashed13: '–',
414
- lineDashed14: '‐',
415
- lineDashed15: '⁃',
416
- lineVertical: '│',
417
- lineVerticalBold: '┃',
418
- lineVerticalDouble: '║',
419
- lineVerticalDashed0: '┆',
420
- lineVerticalDashed1: '┇',
421
- lineVerticalDashed2: '┊',
422
- lineVerticalDashed3: '┋',
423
- lineVerticalDashed4: '╎',
424
- lineVerticalDashed5: '╏',
425
- lineVerticalDashed6: '╵',
426
- lineVerticalDashed7: '╷',
427
- lineVerticalDashed8: '╹',
428
- lineVerticalDashed9: '╻',
429
- lineVerticalDashed10: '╽',
430
- lineVerticalDashed11: '╿',
431
- lineDownLeft: '┐',
432
- lineDownLeftArc: '╮',
433
- lineDownBoldLeftBold: '┓',
434
- lineDownBoldLeft: '┒',
435
- lineDownLeftBold: '┑',
436
- lineDownDoubleLeftDouble: '╗',
437
- lineDownDoubleLeft: '╖',
438
- lineDownLeftDouble: '╕',
439
- lineDownRight: '┌',
440
- lineDownRightArc: '╭',
441
- lineDownBoldRightBold: '┏',
442
- lineDownBoldRight: '┎',
443
- lineDownRightBold: '┍',
444
- lineDownDoubleRightDouble: '╔',
445
- lineDownDoubleRight: '╓',
446
- lineDownRightDouble: '╒',
447
- lineUpLeft: '┘',
448
- lineUpLeftArc: '╯',
449
- lineUpBoldLeftBold: '┛',
450
- lineUpBoldLeft: '┚',
451
- lineUpLeftBold: '┙',
452
- lineUpDoubleLeftDouble: '╝',
453
- lineUpDoubleLeft: '╜',
454
- lineUpLeftDouble: '╛',
455
- lineUpRight: '└',
456
- lineUpRightArc: '╰',
457
- lineUpBoldRightBold: '┗',
458
- lineUpBoldRight: '┖',
459
- lineUpRightBold: '┕',
460
- lineUpDoubleRightDouble: '╚',
461
- lineUpDoubleRight: '╙',
462
- lineUpRightDouble: '╘',
463
- lineUpDownLeft: '┤',
464
- lineUpBoldDownBoldLeftBold: '┫',
465
- lineUpBoldDownBoldLeft: '┨',
466
- lineUpDownLeftBold: '┥',
467
- lineUpBoldDownLeftBold: '┩',
468
- lineUpDownBoldLeftBold: '┪',
469
- lineUpDownBoldLeft: '┧',
470
- lineUpBoldDownLeft: '┦',
471
- lineUpDoubleDownDoubleLeftDouble: '╣',
472
- lineUpDoubleDownDoubleLeft: '╢',
473
- lineUpDownLeftDouble: '╡',
474
- lineUpDownRight: '├',
475
- lineUpBoldDownBoldRightBold: '┣',
476
- lineUpBoldDownBoldRight: '┠',
477
- lineUpDownRightBold: '┝',
478
- lineUpBoldDownRightBold: '┡',
479
- lineUpDownBoldRightBold: '┢',
480
- lineUpDownBoldRight: '┟',
481
- lineUpBoldDownRight: '┞',
482
- lineUpDoubleDownDoubleRightDouble: '╠',
483
- lineUpDoubleDownDoubleRight: '╟',
484
- lineUpDownRightDouble: '╞',
485
- lineDownLeftRight: '┬',
486
- lineDownBoldLeftBoldRightBold: '┳',
487
- lineDownLeftBoldRightBold: '┯',
488
- lineDownBoldLeftRight: '┰',
489
- lineDownBoldLeftBoldRight: '┱',
490
- lineDownBoldLeftRightBold: '┲',
491
- lineDownLeftRightBold: '┮',
492
- lineDownLeftBoldRight: '┭',
493
- lineDownDoubleLeftDoubleRightDouble: '╦',
494
- lineDownDoubleLeftRight: '╥',
495
- lineDownLeftDoubleRightDouble: '╤',
496
- lineUpLeftRight: '┴',
497
- lineUpBoldLeftBoldRightBold: '┻',
498
- lineUpLeftBoldRightBold: '┷',
499
- lineUpBoldLeftRight: '┸',
500
- lineUpBoldLeftBoldRight: '┹',
501
- lineUpBoldLeftRightBold: '┺',
502
- lineUpLeftRightBold: '┶',
503
- lineUpLeftBoldRight: '┵',
504
- lineUpDoubleLeftDoubleRightDouble: '╩',
505
- lineUpDoubleLeftRight: '╨',
506
- lineUpLeftDoubleRightDouble: '╧',
507
- lineUpDownLeftRight: '┼',
508
- lineUpBoldDownBoldLeftBoldRightBold: '╋',
509
- lineUpDownBoldLeftBoldRightBold: '╈',
510
- lineUpBoldDownLeftBoldRightBold: '╇',
511
- lineUpBoldDownBoldLeftRightBold: '╊',
512
- lineUpBoldDownBoldLeftBoldRight: '╉',
513
- lineUpBoldDownLeftRight: '╀',
514
- lineUpDownBoldLeftRight: '╁',
515
- lineUpDownLeftBoldRight: '┽',
516
- lineUpDownLeftRightBold: '┾',
517
- lineUpBoldDownBoldLeftRight: '╂',
518
- lineUpDownLeftBoldRightBold: '┿',
519
- lineUpBoldDownLeftBoldRight: '╃',
520
- lineUpBoldDownLeftRightBold: '╄',
521
- lineUpDownBoldLeftBoldRight: '╅',
522
- lineUpDownBoldLeftRightBold: '╆',
523
- lineUpDoubleDownDoubleLeftDoubleRightDouble: '╬',
524
- lineUpDoubleDownDoubleLeftRight: '╫',
525
- lineUpDownLeftDoubleRightDouble: '╪',
526
- lineCross: '╳',
527
- lineBackslash: '╲',
528
- lineSlash: '╱'
529
- }
530
- const specialMainSymbols = {
531
- tick: '✔',
532
- info: 'ℹ',
533
- warning: '⚠',
534
- cross: '✘',
535
- squareSmall: '◻',
536
- squareSmallFilled: '◼',
537
- circle: '◯',
538
- circleFilled: '◉',
539
- circleDotted: '◌',
540
- circleDouble: '◎',
541
- circleCircle: 'ⓞ',
542
- circleCross: 'ⓧ',
543
- circlePipe: 'Ⓘ',
544
- radioOn: '◉',
545
- radioOff: '◯',
546
- checkboxOn: '☒',
547
- checkboxOff: '☐',
548
- checkboxCircleOn: 'ⓧ',
549
- checkboxCircleOff: 'Ⓘ',
550
- pointer: '❯',
551
- triangleUpOutline: '△',
552
- triangleLeft: '◀',
553
- triangleRight: '▶',
554
- lozenge: '◆',
555
- lozengeOutline: '◇',
556
- hamburger: '☰',
557
- smiley: '㋡',
558
- mustache: '෴',
559
- star: '★',
560
- play: '▶',
561
- nodejs: '⬢',
562
- oneSeventh: '⅐',
563
- oneNinth: '⅑',
564
- oneTenth: '⅒'
565
- }
566
- const specialFallbackSymbols = {
567
- tick: '√',
568
- info: 'i',
569
- warning: '‼',
570
- cross: '×',
571
- squareSmall: '□',
572
- squareSmallFilled: '■',
573
- circle: '( )',
574
- circleFilled: '(*)',
575
- circleDotted: '( )',
576
- circleDouble: '( )',
577
- circleCircle: '(○)',
578
- circleCross: '(×)',
579
- circlePipe: '(│)',
580
- radioOn: '(*)',
581
- radioOff: '( )',
582
- checkboxOn: '[×]',
583
- checkboxOff: '[ ]',
584
- checkboxCircleOn: '(×)',
585
- checkboxCircleOff: '( )',
586
- pointer: '>',
587
- triangleUpOutline: '∆',
588
- triangleLeft: '◄',
589
- triangleRight: '►',
590
- lozenge: '♦',
591
- lozengeOutline: '◊',
592
- hamburger: '≡',
593
- smiley: '☺',
594
- mustache: '┌─┐',
595
- star: '✶',
596
- play: '►',
597
- nodejs: '♦',
598
- oneSeventh: '1/7',
599
- oneNinth: '1/9',
600
- oneTenth: '1/10'
601
- }
602
- const mainSymbols = {
603
- ...common,
604
- ...specialMainSymbols
605
- }
606
- const fallbackSymbols = {
607
- ...common,
608
- ...specialFallbackSymbols
609
- }
610
- const shouldUseMain = isUnicodeSupported()
611
- const figures = shouldUseMain ? mainSymbols : fallbackSymbols
612
-
613
- const defaultTheme = {
614
- prefix: {
615
- idle: yoctocolorsCjsExports.blue('?'),
616
- // TODO: use figure
617
- done: yoctocolorsCjsExports.green(figures.tick)
618
- },
619
- spinner: {
620
- interval: 80,
621
- frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'].map(frame =>
622
- yoctocolorsCjsExports.yellow(frame)
623
- )
624
- },
625
- style: {
626
- answer: yoctocolorsCjsExports.cyan,
627
- message: yoctocolorsCjsExports.bold,
628
- error: text => yoctocolorsCjsExports.red(`> ${text}`),
629
- defaultAnswer: text => yoctocolorsCjsExports.dim(`(${text})`),
630
- help: yoctocolorsCjsExports.dim,
631
- highlight: yoctocolorsCjsExports.cyan,
632
- key: text =>
633
- yoctocolorsCjsExports.cyan(yoctocolorsCjsExports.bold(`<${text}>`))
634
- }
635
- }
636
-
637
- function isPlainObject(value) {
638
- if (typeof value !== 'object' || value === null) {
639
- return false
640
- }
641
- let proto = value
642
- while (Object.getPrototypeOf(proto) !== null) {
643
- proto = Object.getPrototypeOf(proto)
644
- }
645
- return Object.getPrototypeOf(value) === proto
646
- }
647
- function deepMerge(...objects) {
648
- const output = {}
649
- for (const obj of objects) {
650
- for (const [key, value] of Object.entries(obj)) {
651
- const prevValue = output[key]
652
- output[key] =
653
- isPlainObject(prevValue) && isPlainObject(value)
654
- ? deepMerge(prevValue, value)
655
- : value
656
- }
657
- }
658
- return output
659
- }
660
- function makeTheme(...themes) {
661
- const themesToMerge = [defaultTheme, ...themes.filter(theme => theme != null)]
662
- return deepMerge(...themesToMerge)
663
- }
664
-
665
- function usePrefix({ status = 'idle', theme }) {
666
- const [showLoader, setShowLoader] = useState(false)
667
- const [tick, setTick] = useState(0)
668
- const { prefix, spinner } = makeTheme(theme)
669
- useEffect(() => {
670
- if (status === 'loading') {
671
- let tickInterval
672
- let inc = -1
673
- // Delay displaying spinner by 300ms, to avoid flickering
674
- const delayTimeout = setTimeout(() => {
675
- setShowLoader(true)
676
- tickInterval = setInterval(() => {
677
- inc = inc + 1
678
- setTick(inc % spinner.frames.length)
679
- }, spinner.interval)
680
- }, 300)
681
- return () => {
682
- clearTimeout(delayTimeout)
683
- clearInterval(tickInterval)
684
- }
685
- } else {
686
- setShowLoader(false)
687
- }
688
- }, [status])
689
- if (showLoader) {
690
- return spinner.frames[tick]
691
- }
692
- // There's a delay before we show the loader. So we want to ignore `loading` here, and pass idle instead.
693
- const iconName = status === 'loading' ? 'idle' : status
694
- return typeof prefix === 'string'
695
- ? prefix
696
- : (prefix[iconName] ?? prefix['idle'])
697
- }
698
-
699
- function useMemo(fn, dependencies) {
700
- return withPointer(pointer => {
701
- const prev = pointer.get()
702
- if (
703
- !prev ||
704
- prev.dependencies.length !== dependencies.length ||
705
- prev.dependencies.some((dep, i) => dep !== dependencies[i])
706
- ) {
707
- const value = fn()
708
- pointer.set({
709
- value,
710
- dependencies
711
- })
712
- return value
713
- }
714
- return prev.value
715
- })
716
- }
717
-
718
- function useRef(val) {
719
- return useState({
720
- current: val
721
- })[0]
722
- }
723
-
724
- function useKeypress(userHandler) {
725
- const signal = useRef(userHandler)
726
- signal.current = userHandler
727
- useEffect(rl => {
728
- let ignore = false
729
- const handler = withUpdates((_input, event) => {
730
- if (ignore) {
731
- return
732
- }
733
- void signal.current(event, rl)
734
- })
735
- rl.input.on('keypress', handler)
736
- return () => {
737
- ignore = true
738
- rl.input.removeListener('keypress', handler)
739
- }
740
- }, [])
741
- }
742
-
743
- let cliWidth_1
744
- let hasRequiredCliWidth
745
- function requireCliWidth() {
746
- if (hasRequiredCliWidth) {
747
- return cliWidth_1
748
- }
749
- hasRequiredCliWidth = 1
750
- cliWidth_1 = cliWidth
751
- function normalizeOpts(options) {
752
- const defaultOpts = {
753
- defaultWidth: 0,
754
- output: process.stdout,
755
- tty: require$$0$1
756
- }
757
- if (!options) {
758
- return defaultOpts
759
- }
760
- Object.keys(defaultOpts).forEach(function (key) {
761
- if (!options[key]) {
762
- options[key] = defaultOpts[key]
763
- }
764
- })
765
- return options
766
- }
767
- function cliWidth(options) {
768
- const opts = normalizeOpts(options)
769
- if (opts.output.getWindowSize) {
770
- return opts.output.getWindowSize()[0] || opts.defaultWidth
771
- }
772
- if (opts.tty.getWindowSize) {
773
- return opts.tty.getWindowSize()[1] || opts.defaultWidth
774
- }
775
- if (opts.output.columns) {
776
- return opts.output.columns
777
- }
778
- if (process.env.CLI_WIDTH) {
779
- const width = parseInt(process.env.CLI_WIDTH, 10)
780
- if (!isNaN(width) && width !== 0) {
781
- return width
782
- }
783
- }
784
- return opts.defaultWidth
785
- }
786
- return cliWidth_1
787
- }
788
-
789
- const cliWidthExports = requireCliWidth()
790
-
791
- const stringWidth = { exports: {} }
792
-
793
- let ansiRegex
794
- let hasRequiredAnsiRegex
795
- function requireAnsiRegex() {
796
- if (hasRequiredAnsiRegex) {
797
- return ansiRegex
798
- }
799
- hasRequiredAnsiRegex = 1
800
- ansiRegex = ({ onlyFirst = false } = {}) => {
801
- const pattern = [
802
- '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
803
- '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
804
- ].join('|')
805
- return new RegExp(pattern, onlyFirst ? undefined : 'g')
806
- }
807
- return ansiRegex
808
- }
809
-
810
- let stripAnsi
811
- let hasRequiredStripAnsi
812
- function requireStripAnsi() {
813
- if (hasRequiredStripAnsi) {
814
- return stripAnsi
815
- }
816
- hasRequiredStripAnsi = 1
817
- const ansiRegex = requireAnsiRegex()
818
- stripAnsi = string =>
819
- typeof string === 'string' ? string.replace(ansiRegex(), '') : string
820
- return stripAnsi
821
- }
822
-
823
- const isFullwidthCodePoint = { exports: {} }
824
-
825
- /* eslint-disable yoda */
826
- let hasRequiredIsFullwidthCodePoint
827
- function requireIsFullwidthCodePoint() {
828
- if (hasRequiredIsFullwidthCodePoint) {
829
- return isFullwidthCodePoint.exports
830
- }
831
- hasRequiredIsFullwidthCodePoint = 1
832
- const isFullwidthCodePoint$1 = codePoint => {
833
- if (Number.isNaN(codePoint)) {
834
- return false
835
- }
836
-
837
- // Code points are derived from:
838
- // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
839
- if (
840
- codePoint >= 0x1100 &&
841
- (codePoint <= 0x115f ||
842
- // Hangul Jamo
843
- codePoint === 0x2329 ||
844
- // LEFT-POINTING ANGLE BRACKET
845
- codePoint === 0x232a ||
846
- // RIGHT-POINTING ANGLE BRACKET
847
- // CJK Radicals Supplement .. Enclosed CJK Letters and Months
848
- (0x2e80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303f) ||
849
- // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
850
- (0x3250 <= codePoint && codePoint <= 0x4dbf) ||
851
- // CJK Unified Ideographs .. Yi Radicals
852
- (0x4e00 <= codePoint && codePoint <= 0xa4c6) ||
853
- // Hangul Jamo Extended-A
854
- (0xa960 <= codePoint && codePoint <= 0xa97c) ||
855
- // Hangul Syllables
856
- (0xac00 <= codePoint && codePoint <= 0xd7a3) ||
857
- // CJK Compatibility Ideographs
858
- (0xf900 <= codePoint && codePoint <= 0xfaff) ||
859
- // Vertical Forms
860
- (0xfe10 <= codePoint && codePoint <= 0xfe19) ||
861
- // CJK Compatibility Forms .. Small Form Variants
862
- (0xfe30 <= codePoint && codePoint <= 0xfe6b) ||
863
- // Halfwidth and Fullwidth Forms
864
- (0xff01 <= codePoint && codePoint <= 0xff60) ||
865
- (0xffe0 <= codePoint && codePoint <= 0xffe6) ||
866
- // Kana Supplement
867
- (0x1b000 <= codePoint && codePoint <= 0x1b001) ||
868
- // Enclosed Ideographic Supplement
869
- (0x1f200 <= codePoint && codePoint <= 0x1f251) ||
870
- // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
871
- (0x20000 <= codePoint && codePoint <= 0x3fffd))
872
- ) {
873
- return true
874
- }
875
- return false
876
- }
877
- isFullwidthCodePoint.exports = isFullwidthCodePoint$1
878
- isFullwidthCodePoint.exports.default = isFullwidthCodePoint$1
879
- return isFullwidthCodePoint.exports
880
- }
881
-
882
- let emojiRegex
883
- let hasRequiredEmojiRegex
884
- function requireEmojiRegex() {
885
- if (hasRequiredEmojiRegex) {
886
- return emojiRegex
887
- }
888
- hasRequiredEmojiRegex = 1
889
- emojiRegex = function () {
890
- // https://mths.be/emoji
891
- return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g
892
- }
893
- return emojiRegex
894
- }
895
-
896
- let hasRequiredStringWidth
897
- function requireStringWidth() {
898
- if (hasRequiredStringWidth) {
899
- return stringWidth.exports
900
- }
901
- hasRequiredStringWidth = 1
902
- const stripAnsi = requireStripAnsi()
903
- const isFullwidthCodePoint = requireIsFullwidthCodePoint()
904
- const emojiRegex = requireEmojiRegex()
905
- const stringWidth$1 = string => {
906
- if (typeof string !== 'string' || string.length === 0) {
907
- return 0
908
- }
909
- string = stripAnsi(string)
910
- if (string.length === 0) {
911
- return 0
912
- }
913
- string = string.replace(emojiRegex(), ' ')
914
- let width = 0
915
- for (let i = 0; i < string.length; i++) {
916
- const code = string.codePointAt(i)
917
-
918
- // Ignore control characters
919
- if (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) {
920
- continue
921
- }
922
-
923
- // Ignore combining characters
924
- if (code >= 0x300 && code <= 0x36f) {
925
- continue
926
- }
927
-
928
- // Surrogates
929
- if (code > 0xffff) {
930
- i++
931
- }
932
- width += isFullwidthCodePoint(code) ? 2 : 1
933
- }
934
- return width
935
- }
936
- stringWidth.exports = stringWidth$1
937
- // TODO: remove this in the next major version
938
- stringWidth.exports.default = stringWidth$1
939
- return stringWidth.exports
940
- }
941
-
942
- const ansiStyles = { exports: {} }
943
-
944
- let colorName
945
- let hasRequiredColorName
946
- function requireColorName() {
947
- if (hasRequiredColorName) {
948
- return colorName
949
- }
950
- hasRequiredColorName = 1
951
- colorName = {
952
- aliceblue: [240, 248, 255],
953
- antiquewhite: [250, 235, 215],
954
- aqua: [0, 255, 255],
955
- aquamarine: [127, 255, 212],
956
- azure: [240, 255, 255],
957
- beige: [245, 245, 220],
958
- bisque: [255, 228, 196],
959
- black: [0, 0, 0],
960
- blanchedalmond: [255, 235, 205],
961
- blue: [0, 0, 255],
962
- blueviolet: [138, 43, 226],
963
- brown: [165, 42, 42],
964
- burlywood: [222, 184, 135],
965
- cadetblue: [95, 158, 160],
966
- chartreuse: [127, 255, 0],
967
- chocolate: [210, 105, 30],
968
- coral: [255, 127, 80],
969
- cornflowerblue: [100, 149, 237],
970
- cornsilk: [255, 248, 220],
971
- crimson: [220, 20, 60],
972
- cyan: [0, 255, 255],
973
- darkblue: [0, 0, 139],
974
- darkcyan: [0, 139, 139],
975
- darkgoldenrod: [184, 134, 11],
976
- darkgray: [169, 169, 169],
977
- darkgreen: [0, 100, 0],
978
- darkgrey: [169, 169, 169],
979
- darkkhaki: [189, 183, 107],
980
- darkmagenta: [139, 0, 139],
981
- darkolivegreen: [85, 107, 47],
982
- darkorange: [255, 140, 0],
983
- darkorchid: [153, 50, 204],
984
- darkred: [139, 0, 0],
985
- darksalmon: [233, 150, 122],
986
- darkseagreen: [143, 188, 143],
987
- darkslateblue: [72, 61, 139],
988
- darkslategray: [47, 79, 79],
989
- darkslategrey: [47, 79, 79],
990
- darkturquoise: [0, 206, 209],
991
- darkviolet: [148, 0, 211],
992
- deeppink: [255, 20, 147],
993
- deepskyblue: [0, 191, 255],
994
- dimgray: [105, 105, 105],
995
- dimgrey: [105, 105, 105],
996
- dodgerblue: [30, 144, 255],
997
- firebrick: [178, 34, 34],
998
- floralwhite: [255, 250, 240],
999
- forestgreen: [34, 139, 34],
1000
- fuchsia: [255, 0, 255],
1001
- gainsboro: [220, 220, 220],
1002
- ghostwhite: [248, 248, 255],
1003
- gold: [255, 215, 0],
1004
- goldenrod: [218, 165, 32],
1005
- gray: [128, 128, 128],
1006
- green: [0, 128, 0],
1007
- greenyellow: [173, 255, 47],
1008
- grey: [128, 128, 128],
1009
- honeydew: [240, 255, 240],
1010
- hotpink: [255, 105, 180],
1011
- indianred: [205, 92, 92],
1012
- indigo: [75, 0, 130],
1013
- ivory: [255, 255, 240],
1014
- khaki: [240, 230, 140],
1015
- lavender: [230, 230, 250],
1016
- lavenderblush: [255, 240, 245],
1017
- lawngreen: [124, 252, 0],
1018
- lemonchiffon: [255, 250, 205],
1019
- lightblue: [173, 216, 230],
1020
- lightcoral: [240, 128, 128],
1021
- lightcyan: [224, 255, 255],
1022
- lightgoldenrodyellow: [250, 250, 210],
1023
- lightgray: [211, 211, 211],
1024
- lightgreen: [144, 238, 144],
1025
- lightgrey: [211, 211, 211],
1026
- lightpink: [255, 182, 193],
1027
- lightsalmon: [255, 160, 122],
1028
- lightseagreen: [32, 178, 170],
1029
- lightskyblue: [135, 206, 250],
1030
- lightslategray: [119, 136, 153],
1031
- lightslategrey: [119, 136, 153],
1032
- lightsteelblue: [176, 196, 222],
1033
- lightyellow: [255, 255, 224],
1034
- lime: [0, 255, 0],
1035
- limegreen: [50, 205, 50],
1036
- linen: [250, 240, 230],
1037
- magenta: [255, 0, 255],
1038
- maroon: [128, 0, 0],
1039
- mediumaquamarine: [102, 205, 170],
1040
- mediumblue: [0, 0, 205],
1041
- mediumorchid: [186, 85, 211],
1042
- mediumpurple: [147, 112, 219],
1043
- mediumseagreen: [60, 179, 113],
1044
- mediumslateblue: [123, 104, 238],
1045
- mediumspringgreen: [0, 250, 154],
1046
- mediumturquoise: [72, 209, 204],
1047
- mediumvioletred: [199, 21, 133],
1048
- midnightblue: [25, 25, 112],
1049
- mintcream: [245, 255, 250],
1050
- mistyrose: [255, 228, 225],
1051
- moccasin: [255, 228, 181],
1052
- navajowhite: [255, 222, 173],
1053
- navy: [0, 0, 128],
1054
- oldlace: [253, 245, 230],
1055
- olive: [128, 128, 0],
1056
- olivedrab: [107, 142, 35],
1057
- orange: [255, 165, 0],
1058
- orangered: [255, 69, 0],
1059
- orchid: [218, 112, 214],
1060
- palegoldenrod: [238, 232, 170],
1061
- palegreen: [152, 251, 152],
1062
- paleturquoise: [175, 238, 238],
1063
- palevioletred: [219, 112, 147],
1064
- papayawhip: [255, 239, 213],
1065
- peachpuff: [255, 218, 185],
1066
- peru: [205, 133, 63],
1067
- pink: [255, 192, 203],
1068
- plum: [221, 160, 221],
1069
- powderblue: [176, 224, 230],
1070
- purple: [128, 0, 128],
1071
- rebeccapurple: [102, 51, 153],
1072
- red: [255, 0, 0],
1073
- rosybrown: [188, 143, 143],
1074
- royalblue: [65, 105, 225],
1075
- saddlebrown: [139, 69, 19],
1076
- salmon: [250, 128, 114],
1077
- sandybrown: [244, 164, 96],
1078
- seagreen: [46, 139, 87],
1079
- seashell: [255, 245, 238],
1080
- sienna: [160, 82, 45],
1081
- silver: [192, 192, 192],
1082
- skyblue: [135, 206, 235],
1083
- slateblue: [106, 90, 205],
1084
- slategray: [112, 128, 144],
1085
- slategrey: [112, 128, 144],
1086
- snow: [255, 250, 250],
1087
- springgreen: [0, 255, 127],
1088
- steelblue: [70, 130, 180],
1089
- tan: [210, 180, 140],
1090
- teal: [0, 128, 128],
1091
- thistle: [216, 191, 216],
1092
- tomato: [255, 99, 71],
1093
- turquoise: [64, 224, 208],
1094
- violet: [238, 130, 238],
1095
- wheat: [245, 222, 179],
1096
- white: [255, 255, 255],
1097
- whitesmoke: [245, 245, 245],
1098
- yellow: [255, 255, 0],
1099
- yellowgreen: [154, 205, 50]
1100
- }
1101
- return colorName
1102
- }
1103
-
1104
- /* MIT license */
1105
- let conversions
1106
- let hasRequiredConversions
1107
- function requireConversions() {
1108
- if (hasRequiredConversions) {
1109
- return conversions
1110
- }
1111
- hasRequiredConversions = 1
1112
- /* eslint-disable no-mixed-operators */
1113
- const cssKeywords = requireColorName()
1114
-
1115
- // NOTE: conversions should only return primitive values (i.e. arrays, or
1116
- // values that give correct `typeof` results).
1117
- // do not use box values types (i.e. Number(), String(), etc.)
1118
-
1119
- const reverseKeywords = {}
1120
- for (const key of Object.keys(cssKeywords)) {
1121
- reverseKeywords[cssKeywords[key]] = key
1122
- }
1123
- const convert = {
1124
- rgb: {
1125
- channels: 3,
1126
- labels: 'rgb'
1127
- },
1128
- hsl: {
1129
- channels: 3,
1130
- labels: 'hsl'
1131
- },
1132
- hsv: {
1133
- channels: 3,
1134
- labels: 'hsv'
1135
- },
1136
- hwb: {
1137
- channels: 3,
1138
- labels: 'hwb'
1139
- },
1140
- cmyk: {
1141
- channels: 4,
1142
- labels: 'cmyk'
1143
- },
1144
- xyz: {
1145
- channels: 3,
1146
- labels: 'xyz'
1147
- },
1148
- lab: {
1149
- channels: 3,
1150
- labels: 'lab'
1151
- },
1152
- lch: {
1153
- channels: 3,
1154
- labels: 'lch'
1155
- },
1156
- hex: {
1157
- channels: 1,
1158
- labels: ['hex']
1159
- },
1160
- keyword: {
1161
- channels: 1,
1162
- labels: ['keyword']
1163
- },
1164
- ansi16: {
1165
- channels: 1,
1166
- labels: ['ansi16']
1167
- },
1168
- ansi256: {
1169
- channels: 1,
1170
- labels: ['ansi256']
1171
- },
1172
- hcg: {
1173
- channels: 3,
1174
- labels: ['h', 'c', 'g']
1175
- },
1176
- apple: {
1177
- channels: 3,
1178
- labels: ['r16', 'g16', 'b16']
1179
- },
1180
- gray: {
1181
- channels: 1,
1182
- labels: ['gray']
1183
- }
1184
- }
1185
- conversions = convert
1186
-
1187
- // Hide .channels and .labels properties
1188
- for (const model of Object.keys(convert)) {
1189
- if (!('channels' in convert[model])) {
1190
- throw new Error('missing channels property: ' + model)
1191
- }
1192
- if (!('labels' in convert[model])) {
1193
- throw new Error('missing channel labels property: ' + model)
1194
- }
1195
- if (convert[model].labels.length !== convert[model].channels) {
1196
- throw new Error('channel and label counts mismatch: ' + model)
1197
- }
1198
- const { channels, labels } = convert[model]
1199
- delete convert[model].channels
1200
- delete convert[model].labels
1201
- Object.defineProperty(convert[model], 'channels', {
1202
- value: channels
1203
- })
1204
- Object.defineProperty(convert[model], 'labels', {
1205
- value: labels
1206
- })
1207
- }
1208
- convert.rgb.hsl = function (rgb) {
1209
- const r = rgb[0] / 255
1210
- const g = rgb[1] / 255
1211
- const b = rgb[2] / 255
1212
- const min = Math.min(r, g, b)
1213
- const max = Math.max(r, g, b)
1214
- const delta = max - min
1215
- let h
1216
- let s
1217
- if (max === min) {
1218
- h = 0
1219
- } else if (r === max) {
1220
- h = (g - b) / delta
1221
- } else if (g === max) {
1222
- h = 2 + (b - r) / delta
1223
- } else if (b === max) {
1224
- h = 4 + (r - g) / delta
1225
- }
1226
- h = Math.min(h * 60, 360)
1227
- if (h < 0) {
1228
- h += 360
1229
- }
1230
- const l = (min + max) / 2
1231
- if (max === min) {
1232
- s = 0
1233
- } else if (l <= 0.5) {
1234
- s = delta / (max + min)
1235
- } else {
1236
- s = delta / (2 - max - min)
1237
- }
1238
- return [h, s * 100, l * 100]
1239
- }
1240
- convert.rgb.hsv = function (rgb) {
1241
- let rdif
1242
- let gdif
1243
- let bdif
1244
- let h
1245
- let s
1246
- const r = rgb[0] / 255
1247
- const g = rgb[1] / 255
1248
- const b = rgb[2] / 255
1249
- const v = Math.max(r, g, b)
1250
- const diff = v - Math.min(r, g, b)
1251
- const diffc = function (c) {
1252
- return (v - c) / 6 / diff + 1 / 2
1253
- }
1254
- if (diff === 0) {
1255
- h = 0
1256
- s = 0
1257
- } else {
1258
- s = diff / v
1259
- rdif = diffc(r)
1260
- gdif = diffc(g)
1261
- bdif = diffc(b)
1262
- if (r === v) {
1263
- h = bdif - gdif
1264
- } else if (g === v) {
1265
- h = 1 / 3 + rdif - bdif
1266
- } else if (b === v) {
1267
- h = 2 / 3 + gdif - rdif
1268
- }
1269
- if (h < 0) {
1270
- h += 1
1271
- } else if (h > 1) {
1272
- h -= 1
1273
- }
1274
- }
1275
- return [h * 360, s * 100, v * 100]
1276
- }
1277
- convert.rgb.hwb = function (rgb) {
1278
- const r = rgb[0]
1279
- const g = rgb[1]
1280
- let b = rgb[2]
1281
- const h = convert.rgb.hsl(rgb)[0]
1282
- const w = (1 / 255) * Math.min(r, Math.min(g, b))
1283
- b = 1 - (1 / 255) * Math.max(r, Math.max(g, b))
1284
- return [h, w * 100, b * 100]
1285
- }
1286
- convert.rgb.cmyk = function (rgb) {
1287
- const r = rgb[0] / 255
1288
- const g = rgb[1] / 255
1289
- const b = rgb[2] / 255
1290
- const k = Math.min(1 - r, 1 - g, 1 - b)
1291
- const c = (1 - r - k) / (1 - k) || 0
1292
- const m = (1 - g - k) / (1 - k) || 0
1293
- const y = (1 - b - k) / (1 - k) || 0
1294
- return [c * 100, m * 100, y * 100, k * 100]
1295
- }
1296
- function comparativeDistance(x, y) {
1297
- /*
1298
- See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
1299
- */
1300
- return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2
1301
- }
1302
- convert.rgb.keyword = function (rgb) {
1303
- const reversed = reverseKeywords[rgb]
1304
- if (reversed) {
1305
- return reversed
1306
- }
1307
- let currentClosestDistance = Infinity
1308
- let currentClosestKeyword
1309
- for (const keyword of Object.keys(cssKeywords)) {
1310
- const value = cssKeywords[keyword]
1311
-
1312
- // Compute comparative distance
1313
- const distance = comparativeDistance(rgb, value)
1314
-
1315
- // Check if its less, if so set as closest
1316
- if (distance < currentClosestDistance) {
1317
- currentClosestDistance = distance
1318
- currentClosestKeyword = keyword
1319
- }
1320
- }
1321
- return currentClosestKeyword
1322
- }
1323
- convert.keyword.rgb = function (keyword) {
1324
- return cssKeywords[keyword]
1325
- }
1326
- convert.rgb.xyz = function (rgb) {
1327
- let r = rgb[0] / 255
1328
- let g = rgb[1] / 255
1329
- let b = rgb[2] / 255
1330
-
1331
- // Assume sRGB
1332
- r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92
1333
- g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92
1334
- b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92
1335
- const x = r * 0.4124 + g * 0.3576 + b * 0.1805
1336
- const y = r * 0.2126 + g * 0.7152 + b * 0.0722
1337
- const z = r * 0.0193 + g * 0.1192 + b * 0.9505
1338
- return [x * 100, y * 100, z * 100]
1339
- }
1340
- convert.rgb.lab = function (rgb) {
1341
- const xyz = convert.rgb.xyz(rgb)
1342
- let x = xyz[0]
1343
- let y = xyz[1]
1344
- let z = xyz[2]
1345
- x /= 95.047
1346
- y /= 100
1347
- z /= 108.883
1348
- x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116
1349
- y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116
1350
- z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116
1351
- const l = 116 * y - 16
1352
- const a = 500 * (x - y)
1353
- const b = 200 * (y - z)
1354
- return [l, a, b]
1355
- }
1356
- convert.hsl.rgb = function (hsl) {
1357
- const h = hsl[0] / 360
1358
- const s = hsl[1] / 100
1359
- const l = hsl[2] / 100
1360
- let t2
1361
- let t3
1362
- let val
1363
- if (s === 0) {
1364
- val = l * 255
1365
- return [val, val, val]
1366
- }
1367
- if (l < 0.5) {
1368
- t2 = l * (1 + s)
1369
- } else {
1370
- t2 = l + s - l * s
1371
- }
1372
- const t1 = 2 * l - t2
1373
- const rgb = [0, 0, 0]
1374
- for (let i = 0; i < 3; i++) {
1375
- t3 = h + (1 / 3) * -(i - 1)
1376
- if (t3 < 0) {
1377
- t3++
1378
- }
1379
- if (t3 > 1) {
1380
- t3--
1381
- }
1382
- if (6 * t3 < 1) {
1383
- val = t1 + (t2 - t1) * 6 * t3
1384
- } else if (2 * t3 < 1) {
1385
- val = t2
1386
- } else if (3 * t3 < 2) {
1387
- val = t1 + (t2 - t1) * (2 / 3 - t3) * 6
1388
- } else {
1389
- val = t1
1390
- }
1391
- rgb[i] = val * 255
1392
- }
1393
- return rgb
1394
- }
1395
- convert.hsl.hsv = function (hsl) {
1396
- const h = hsl[0]
1397
- let s = hsl[1] / 100
1398
- let l = hsl[2] / 100
1399
- let smin = s
1400
- const lmin = Math.max(l, 0.01)
1401
- l *= 2
1402
- s *= l <= 1 ? l : 2 - l
1403
- smin *= lmin <= 1 ? lmin : 2 - lmin
1404
- const v = (l + s) / 2
1405
- const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s)
1406
- return [h, sv * 100, v * 100]
1407
- }
1408
- convert.hsv.rgb = function (hsv) {
1409
- const h = hsv[0] / 60
1410
- const s = hsv[1] / 100
1411
- let v = hsv[2] / 100
1412
- const hi = Math.floor(h) % 6
1413
- const f = h - Math.floor(h)
1414
- const p = 255 * v * (1 - s)
1415
- const q = 255 * v * (1 - s * f)
1416
- const t = 255 * v * (1 - s * (1 - f))
1417
- v *= 255
1418
- switch (hi) {
1419
- case 0:
1420
- return [v, t, p]
1421
- case 1:
1422
- return [q, v, p]
1423
- case 2:
1424
- return [p, v, t]
1425
- case 3:
1426
- return [p, q, v]
1427
- case 4:
1428
- return [t, p, v]
1429
- case 5:
1430
- return [v, p, q]
1431
- }
1432
- }
1433
- convert.hsv.hsl = function (hsv) {
1434
- const h = hsv[0]
1435
- const s = hsv[1] / 100
1436
- const v = hsv[2] / 100
1437
- const vmin = Math.max(v, 0.01)
1438
- let sl
1439
- let l
1440
- l = (2 - s) * v
1441
- const lmin = (2 - s) * vmin
1442
- sl = s * vmin
1443
- sl /= lmin <= 1 ? lmin : 2 - lmin
1444
- sl = sl || 0
1445
- l /= 2
1446
- return [h, sl * 100, l * 100]
1447
- }
1448
-
1449
- // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
1450
- convert.hwb.rgb = function (hwb) {
1451
- const h = hwb[0] / 360
1452
- let wh = hwb[1] / 100
1453
- let bl = hwb[2] / 100
1454
- const ratio = wh + bl
1455
- let f
1456
-
1457
- // Wh + bl cant be > 1
1458
- if (ratio > 1) {
1459
- wh /= ratio
1460
- bl /= ratio
1461
- }
1462
- const i = Math.floor(6 * h)
1463
- const v = 1 - bl
1464
- f = 6 * h - i
1465
- if ((i & 0x01) !== 0) {
1466
- f = 1 - f
1467
- }
1468
- const n = wh + f * (v - wh) // Linear interpolation
1469
-
1470
- let r
1471
- let g
1472
- let b
1473
- /* eslint-disable max-statements-per-line,no-multi-spaces */
1474
- switch (i) {
1475
- default:
1476
- case 6:
1477
- case 0:
1478
- r = v
1479
- g = n
1480
- b = wh
1481
- break
1482
- case 1:
1483
- r = n
1484
- g = v
1485
- b = wh
1486
- break
1487
- case 2:
1488
- r = wh
1489
- g = v
1490
- b = n
1491
- break
1492
- case 3:
1493
- r = wh
1494
- g = n
1495
- b = v
1496
- break
1497
- case 4:
1498
- r = n
1499
- g = wh
1500
- b = v
1501
- break
1502
- case 5:
1503
- r = v
1504
- g = wh
1505
- b = n
1506
- break
1507
- }
1508
- /* eslint-enable max-statements-per-line,no-multi-spaces */
1509
-
1510
- return [r * 255, g * 255, b * 255]
1511
- }
1512
- convert.cmyk.rgb = function (cmyk) {
1513
- const c = cmyk[0] / 100
1514
- const m = cmyk[1] / 100
1515
- const y = cmyk[2] / 100
1516
- const k = cmyk[3] / 100
1517
- const r = 1 - Math.min(1, c * (1 - k) + k)
1518
- const g = 1 - Math.min(1, m * (1 - k) + k)
1519
- const b = 1 - Math.min(1, y * (1 - k) + k)
1520
- return [r * 255, g * 255, b * 255]
1521
- }
1522
- convert.xyz.rgb = function (xyz) {
1523
- const x = xyz[0] / 100
1524
- const y = xyz[1] / 100
1525
- const z = xyz[2] / 100
1526
- let r
1527
- let g
1528
- let b
1529
- r = x * 3.2406 + y * -1.5372 + z * -0.4986
1530
- g = x * -0.9689 + y * 1.8758 + z * 0.0415
1531
- b = x * 0.0557 + y * -0.204 + z * 1.057
1532
-
1533
- // Assume sRGB
1534
- r = r > 0.0031308 ? 1.055 * r ** (1.0 / 2.4) - 0.055 : r * 12.92
1535
- g = g > 0.0031308 ? 1.055 * g ** (1.0 / 2.4) - 0.055 : g * 12.92
1536
- b = b > 0.0031308 ? 1.055 * b ** (1.0 / 2.4) - 0.055 : b * 12.92
1537
- r = Math.min(Math.max(0, r), 1)
1538
- g = Math.min(Math.max(0, g), 1)
1539
- b = Math.min(Math.max(0, b), 1)
1540
- return [r * 255, g * 255, b * 255]
1541
- }
1542
- convert.xyz.lab = function (xyz) {
1543
- let x = xyz[0]
1544
- let y = xyz[1]
1545
- let z = xyz[2]
1546
- x /= 95.047
1547
- y /= 100
1548
- z /= 108.883
1549
- x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116
1550
- y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116
1551
- z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116
1552
- const l = 116 * y - 16
1553
- const a = 500 * (x - y)
1554
- const b = 200 * (y - z)
1555
- return [l, a, b]
1556
- }
1557
- convert.lab.xyz = function (lab) {
1558
- const l = lab[0]
1559
- const a = lab[1]
1560
- const b = lab[2]
1561
- let x
1562
- let y
1563
- let z
1564
- y = (l + 16) / 116
1565
- x = a / 500 + y
1566
- z = y - b / 200
1567
- const y2 = y ** 3
1568
- const x2 = x ** 3
1569
- const z2 = z ** 3
1570
- y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787
1571
- x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787
1572
- z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787
1573
- x *= 95.047
1574
- y *= 100
1575
- z *= 108.883
1576
- return [x, y, z]
1577
- }
1578
- convert.lab.lch = function (lab) {
1579
- const l = lab[0]
1580
- const a = lab[1]
1581
- const b = lab[2]
1582
- let h
1583
- const hr = Math.atan2(b, a)
1584
- h = (hr * 360) / 2 / Math.PI
1585
- if (h < 0) {
1586
- h += 360
1587
- }
1588
- const c = Math.sqrt(a * a + b * b)
1589
- return [l, c, h]
1590
- }
1591
- convert.lch.lab = function (lch) {
1592
- const l = lch[0]
1593
- const c = lch[1]
1594
- const h = lch[2]
1595
- const hr = (h / 360) * 2 * Math.PI
1596
- const a = c * Math.cos(hr)
1597
- const b = c * Math.sin(hr)
1598
- return [l, a, b]
1599
- }
1600
- convert.rgb.ansi16 = function (args, saturation = null) {
1601
- const [r, g, b] = args
1602
- let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation // Hsv -> ansi16 optimization
1603
-
1604
- value = Math.round(value / 50)
1605
- if (value === 0) {
1606
- return 30
1607
- }
1608
- let ansi =
1609
- 30 +
1610
- ((Math.round(b / 255) << 2) |
1611
- (Math.round(g / 255) << 1) |
1612
- Math.round(r / 255))
1613
- if (value === 2) {
1614
- ansi += 60
1615
- }
1616
- return ansi
1617
- }
1618
- convert.hsv.ansi16 = function (args) {
1619
- // Optimization here; we already know the value and don't need to get
1620
- // it converted for us.
1621
- return convert.rgb.ansi16(convert.hsv.rgb(args), args[2])
1622
- }
1623
- convert.rgb.ansi256 = function (args) {
1624
- const r = args[0]
1625
- const g = args[1]
1626
- const b = args[2]
1627
-
1628
- // We use the extended greyscale palette here, with the exception of
1629
- // black and white. normal palette only has 4 greyscale shades.
1630
- if (r === g && g === b) {
1631
- if (r < 8) {
1632
- return 16
1633
- }
1634
- if (r > 248) {
1635
- return 231
1636
- }
1637
- return Math.round(((r - 8) / 247) * 24) + 232
1638
- }
1639
- const ansi =
1640
- 16 +
1641
- 36 * Math.round((r / 255) * 5) +
1642
- 6 * Math.round((g / 255) * 5) +
1643
- Math.round((b / 255) * 5)
1644
- return ansi
1645
- }
1646
- convert.ansi16.rgb = function (args) {
1647
- let color = args % 10
1648
-
1649
- // Handle greyscale
1650
- if (color === 0 || color === 7) {
1651
- if (args > 50) {
1652
- color += 3.5
1653
- }
1654
- color = (color / 10.5) * 255
1655
- return [color, color, color]
1656
- }
1657
- const mult = (~~(args > 50) + 1) * 0.5
1658
- const r = (color & 1) * mult * 255
1659
- const g = ((color >> 1) & 1) * mult * 255
1660
- const b = ((color >> 2) & 1) * mult * 255
1661
- return [r, g, b]
1662
- }
1663
- convert.ansi256.rgb = function (args) {
1664
- // Handle greyscale
1665
- if (args >= 232) {
1666
- const c = (args - 232) * 10 + 8
1667
- return [c, c, c]
1668
- }
1669
- args -= 16
1670
- let rem
1671
- const r = (Math.floor(args / 36) / 5) * 255
1672
- const g = (Math.floor((rem = args % 36) / 6) / 5) * 255
1673
- const b = ((rem % 6) / 5) * 255
1674
- return [r, g, b]
1675
- }
1676
- convert.rgb.hex = function (args) {
1677
- const integer =
1678
- ((Math.round(args[0]) & 0xff) << 16) +
1679
- ((Math.round(args[1]) & 0xff) << 8) +
1680
- (Math.round(args[2]) & 0xff)
1681
- const string = integer.toString(16).toUpperCase()
1682
- return '000000'.substring(string.length) + string
1683
- }
1684
- convert.hex.rgb = function (args) {
1685
- const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i)
1686
- if (!match) {
1687
- return [0, 0, 0]
1688
- }
1689
- let colorString = match[0]
1690
- if (match[0].length === 3) {
1691
- colorString = colorString
1692
- .split('')
1693
- .map(char => {
1694
- return char + char
1695
- })
1696
- .join('')
1697
- }
1698
- const integer = parseInt(colorString, 16)
1699
- const r = (integer >> 16) & 0xff
1700
- const g = (integer >> 8) & 0xff
1701
- const b = integer & 0xff
1702
- return [r, g, b]
1703
- }
1704
- convert.rgb.hcg = function (rgb) {
1705
- const r = rgb[0] / 255
1706
- const g = rgb[1] / 255
1707
- const b = rgb[2] / 255
1708
- const max = Math.max(Math.max(r, g), b)
1709
- const min = Math.min(Math.min(r, g), b)
1710
- const chroma = max - min
1711
- let grayscale
1712
- let hue
1713
- if (chroma < 1) {
1714
- grayscale = min / (1 - chroma)
1715
- } else {
1716
- grayscale = 0
1717
- }
1718
- if (chroma <= 0) {
1719
- hue = 0
1720
- } else if (max === r) {
1721
- hue = ((g - b) / chroma) % 6
1722
- } else if (max === g) {
1723
- hue = 2 + (b - r) / chroma
1724
- } else {
1725
- hue = 4 + (r - g) / chroma
1726
- }
1727
- hue /= 6
1728
- hue %= 1
1729
- return [hue * 360, chroma * 100, grayscale * 100]
1730
- }
1731
- convert.hsl.hcg = function (hsl) {
1732
- const s = hsl[1] / 100
1733
- const l = hsl[2] / 100
1734
- const c = l < 0.5 ? 2.0 * s * l : 2.0 * s * (1.0 - l)
1735
- let f = 0
1736
- if (c < 1.0) {
1737
- f = (l - 0.5 * c) / (1.0 - c)
1738
- }
1739
- return [hsl[0], c * 100, f * 100]
1740
- }
1741
- convert.hsv.hcg = function (hsv) {
1742
- const s = hsv[1] / 100
1743
- const v = hsv[2] / 100
1744
- const c = s * v
1745
- let f = 0
1746
- if (c < 1.0) {
1747
- f = (v - c) / (1 - c)
1748
- }
1749
- return [hsv[0], c * 100, f * 100]
1750
- }
1751
- convert.hcg.rgb = function (hcg) {
1752
- const h = hcg[0] / 360
1753
- const c = hcg[1] / 100
1754
- const g = hcg[2] / 100
1755
- if (c === 0.0) {
1756
- return [g * 255, g * 255, g * 255]
1757
- }
1758
- const pure = [0, 0, 0]
1759
- const hi = (h % 1) * 6
1760
- const v = hi % 1
1761
- const w = 1 - v
1762
- let mg = 0
1763
-
1764
- /* eslint-disable max-statements-per-line */
1765
- switch (Math.floor(hi)) {
1766
- case 0:
1767
- pure[0] = 1
1768
- pure[1] = v
1769
- pure[2] = 0
1770
- break
1771
- case 1:
1772
- pure[0] = w
1773
- pure[1] = 1
1774
- pure[2] = 0
1775
- break
1776
- case 2:
1777
- pure[0] = 0
1778
- pure[1] = 1
1779
- pure[2] = v
1780
- break
1781
- case 3:
1782
- pure[0] = 0
1783
- pure[1] = w
1784
- pure[2] = 1
1785
- break
1786
- case 4:
1787
- pure[0] = v
1788
- pure[1] = 0
1789
- pure[2] = 1
1790
- break
1791
- default:
1792
- pure[0] = 1
1793
- pure[1] = 0
1794
- pure[2] = w
1795
- }
1796
- /* eslint-enable max-statements-per-line */
1797
-
1798
- mg = (1.0 - c) * g
1799
- return [
1800
- (c * pure[0] + mg) * 255,
1801
- (c * pure[1] + mg) * 255,
1802
- (c * pure[2] + mg) * 255
1803
- ]
1804
- }
1805
- convert.hcg.hsv = function (hcg) {
1806
- const c = hcg[1] / 100
1807
- const g = hcg[2] / 100
1808
- const v = c + g * (1.0 - c)
1809
- let f = 0
1810
- if (v > 0.0) {
1811
- f = c / v
1812
- }
1813
- return [hcg[0], f * 100, v * 100]
1814
- }
1815
- convert.hcg.hsl = function (hcg) {
1816
- const c = hcg[1] / 100
1817
- const g = hcg[2] / 100
1818
- const l = g * (1.0 - c) + 0.5 * c
1819
- let s = 0
1820
- if (l > 0.0 && l < 0.5) {
1821
- s = c / (2 * l)
1822
- } else if (l >= 0.5 && l < 1.0) {
1823
- s = c / (2 * (1 - l))
1824
- }
1825
- return [hcg[0], s * 100, l * 100]
1826
- }
1827
- convert.hcg.hwb = function (hcg) {
1828
- const c = hcg[1] / 100
1829
- const g = hcg[2] / 100
1830
- const v = c + g * (1.0 - c)
1831
- return [hcg[0], (v - c) * 100, (1 - v) * 100]
1832
- }
1833
- convert.hwb.hcg = function (hwb) {
1834
- const w = hwb[1] / 100
1835
- const b = hwb[2] / 100
1836
- const v = 1 - b
1837
- const c = v - w
1838
- let g = 0
1839
- if (c < 1) {
1840
- g = (v - c) / (1 - c)
1841
- }
1842
- return [hwb[0], c * 100, g * 100]
1843
- }
1844
- convert.apple.rgb = function (apple) {
1845
- return [
1846
- (apple[0] / 65535) * 255,
1847
- (apple[1] / 65535) * 255,
1848
- (apple[2] / 65535) * 255
1849
- ]
1850
- }
1851
- convert.rgb.apple = function (rgb) {
1852
- return [
1853
- (rgb[0] / 255) * 65535,
1854
- (rgb[1] / 255) * 65535,
1855
- (rgb[2] / 255) * 65535
1856
- ]
1857
- }
1858
- convert.gray.rgb = function (args) {
1859
- return [(args[0] / 100) * 255, (args[0] / 100) * 255, (args[0] / 100) * 255]
1860
- }
1861
- convert.gray.hsl = function (args) {
1862
- return [0, 0, args[0]]
1863
- }
1864
- convert.gray.hsv = convert.gray.hsl
1865
- convert.gray.hwb = function (gray) {
1866
- return [0, 100, gray[0]]
1867
- }
1868
- convert.gray.cmyk = function (gray) {
1869
- return [0, 0, 0, gray[0]]
1870
- }
1871
- convert.gray.lab = function (gray) {
1872
- return [gray[0], 0, 0]
1873
- }
1874
- convert.gray.hex = function (gray) {
1875
- const val = Math.round((gray[0] / 100) * 255) & 0xff
1876
- const integer = (val << 16) + (val << 8) + val
1877
- const string = integer.toString(16).toUpperCase()
1878
- return '000000'.substring(string.length) + string
1879
- }
1880
- convert.rgb.gray = function (rgb) {
1881
- const val = (rgb[0] + rgb[1] + rgb[2]) / 3
1882
- return [(val / 255) * 100]
1883
- }
1884
- return conversions
1885
- }
1886
-
1887
- let route
1888
- let hasRequiredRoute
1889
- function requireRoute() {
1890
- if (hasRequiredRoute) {
1891
- return route
1892
- }
1893
- hasRequiredRoute = 1
1894
- const conversions = requireConversions()
1895
-
1896
- /*
1897
- This function routes a model to all other models.
1898
- all functions that are routed have a property `.conversion` attached
1899
- to the returned synthetic function. This property is an array
1900
- of strings, each with the steps in between the 'from' and 'to'
1901
- color models (inclusive).
1902
- conversions that are not possible simply are not included.
1903
- */
1904
-
1905
- function buildGraph() {
1906
- const graph = {}
1907
- // https://jsperf.com/object-keys-vs-for-in-with-closure/3
1908
- const models = Object.keys(conversions)
1909
- for (let len = models.length, i = 0; i < len; i++) {
1910
- graph[models[i]] = {
1911
- // http://jsperf.com/1-vs-infinity
1912
- // micro-opt, but this is simple.
1913
- distance: -1,
1914
- parent: null
1915
- }
1916
- }
1917
- return graph
1918
- }
1919
-
1920
- // https://en.wikipedia.org/wiki/Breadth-first_search
1921
- function deriveBFS(fromModel) {
1922
- const graph = buildGraph()
1923
- const queue = [fromModel] // Unshift -> queue -> pop
1924
-
1925
- graph[fromModel].distance = 0
1926
- while (queue.length) {
1927
- const current = queue.pop()
1928
- const adjacents = Object.keys(conversions[current])
1929
- for (let len = adjacents.length, i = 0; i < len; i++) {
1930
- const adjacent = adjacents[i]
1931
- const node = graph[adjacent]
1932
- if (node.distance === -1) {
1933
- node.distance = graph[current].distance + 1
1934
- node.parent = current
1935
- queue.unshift(adjacent)
1936
- }
1937
- }
1938
- }
1939
- return graph
1940
- }
1941
- function link(from, to) {
1942
- return function (args) {
1943
- return to(from(args))
1944
- }
1945
- }
1946
- function wrapConversion(toModel, graph) {
1947
- const path = [graph[toModel].parent, toModel]
1948
- let fn = conversions[graph[toModel].parent][toModel]
1949
- let cur = graph[toModel].parent
1950
- while (graph[cur].parent) {
1951
- path.unshift(graph[cur].parent)
1952
- fn = link(conversions[graph[cur].parent][cur], fn)
1953
- cur = graph[cur].parent
1954
- }
1955
- fn.conversion = path
1956
- return fn
1957
- }
1958
- route = function (fromModel) {
1959
- const graph = deriveBFS(fromModel)
1960
- const conversion = {}
1961
- const models = Object.keys(graph)
1962
- for (let len = models.length, i = 0; i < len; i++) {
1963
- const toModel = models[i]
1964
- const node = graph[toModel]
1965
- if (node.parent === null) {
1966
- // No possible conversion, or this node is the source model.
1967
- continue
1968
- }
1969
- conversion[toModel] = wrapConversion(toModel, graph)
1970
- }
1971
- return conversion
1972
- }
1973
- return route
1974
- }
1975
-
1976
- let colorConvert
1977
- let hasRequiredColorConvert
1978
- function requireColorConvert() {
1979
- if (hasRequiredColorConvert) {
1980
- return colorConvert
1981
- }
1982
- hasRequiredColorConvert = 1
1983
- const conversions = requireConversions()
1984
- const route = requireRoute()
1985
- const convert = {}
1986
- const models = Object.keys(conversions)
1987
- function wrapRaw(fn) {
1988
- const wrappedFn = function (...args) {
1989
- const arg0 = args[0]
1990
- if (arg0 === undefined || arg0 === null) {
1991
- return arg0
1992
- }
1993
- if (arg0.length > 1) {
1994
- args = arg0
1995
- }
1996
- return fn(args)
1997
- }
1998
-
1999
- // Preserve .conversion property if there is one
2000
- if ('conversion' in fn) {
2001
- wrappedFn.conversion = fn.conversion
2002
- }
2003
- return wrappedFn
2004
- }
2005
- function wrapRounded(fn) {
2006
- const wrappedFn = function (...args) {
2007
- const arg0 = args[0]
2008
- if (arg0 === undefined || arg0 === null) {
2009
- return arg0
2010
- }
2011
- if (arg0.length > 1) {
2012
- args = arg0
2013
- }
2014
- const result = fn(args)
2015
-
2016
- // We're assuming the result is an array here.
2017
- // see notice in conversions.js; don't use box types
2018
- // in conversion functions.
2019
- if (typeof result === 'object') {
2020
- for (let len = result.length, i = 0; i < len; i++) {
2021
- result[i] = Math.round(result[i])
2022
- }
2023
- }
2024
- return result
2025
- }
2026
-
2027
- // Preserve .conversion property if there is one
2028
- if ('conversion' in fn) {
2029
- wrappedFn.conversion = fn.conversion
2030
- }
2031
- return wrappedFn
2032
- }
2033
- models.forEach(fromModel => {
2034
- convert[fromModel] = {}
2035
- Object.defineProperty(convert[fromModel], 'channels', {
2036
- value: conversions[fromModel].channels
2037
- })
2038
- Object.defineProperty(convert[fromModel], 'labels', {
2039
- value: conversions[fromModel].labels
2040
- })
2041
- const routes = route(fromModel)
2042
- const routeModels = Object.keys(routes)
2043
- routeModels.forEach(toModel => {
2044
- const fn = routes[toModel]
2045
- convert[fromModel][toModel] = wrapRounded(fn)
2046
- convert[fromModel][toModel].raw = wrapRaw(fn)
2047
- })
2048
- })
2049
- colorConvert = convert
2050
- return colorConvert
2051
- }
2052
-
2053
- ansiStyles.exports
2054
- let hasRequiredAnsiStyles
2055
- function requireAnsiStyles() {
2056
- if (hasRequiredAnsiStyles) {
2057
- return ansiStyles.exports
2058
- }
2059
- hasRequiredAnsiStyles = 1
2060
- ;(function (module) {
2061
- const wrapAnsi16 =
2062
- (fn, offset) =>
2063
- (...args) => {
2064
- const code = fn(...args)
2065
- return `\u001B[${code + offset}m`
2066
- }
2067
- const wrapAnsi256 =
2068
- (fn, offset) =>
2069
- (...args) => {
2070
- const code = fn(...args)
2071
- return `\u001B[${38 + offset};5;${code}m`
2072
- }
2073
- const wrapAnsi16m =
2074
- (fn, offset) =>
2075
- (...args) => {
2076
- const rgb = fn(...args)
2077
- return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`
2078
- }
2079
- const ansi2ansi = n => n
2080
- const rgb2rgb = (r, g, b) => [r, g, b]
2081
- const setLazyProperty = (object, property, get) => {
2082
- Object.defineProperty(object, property, {
2083
- get: () => {
2084
- const value = get()
2085
- Object.defineProperty(object, property, {
2086
- value,
2087
- enumerable: true,
2088
- configurable: true
2089
- })
2090
- return value
2091
- },
2092
- enumerable: true,
2093
- configurable: true
2094
- })
2095
- }
2096
-
2097
- /** @type {typeof import('color-convert')} */
2098
- let colorConvert
2099
- const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
2100
- if (colorConvert === undefined) {
2101
- colorConvert = requireColorConvert()
2102
- }
2103
- const offset = isBackground ? 10 : 0
2104
- const styles = {}
2105
- for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
2106
- const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace
2107
- if (sourceSpace === targetSpace) {
2108
- styles[name] = wrap(identity, offset)
2109
- } else if (typeof suite === 'object') {
2110
- styles[name] = wrap(suite[targetSpace], offset)
2111
- }
2112
- }
2113
- return styles
2114
- }
2115
- function assembleStyles() {
2116
- const codes = new Map()
2117
- const styles = {
2118
- modifier: {
2119
- reset: [0, 0],
2120
- // 21 isn't widely supported and 22 does the same thing
2121
- bold: [1, 22],
2122
- dim: [2, 22],
2123
- italic: [3, 23],
2124
- underline: [4, 24],
2125
- inverse: [7, 27],
2126
- hidden: [8, 28],
2127
- strikethrough: [9, 29]
2128
- },
2129
- color: {
2130
- black: [30, 39],
2131
- red: [31, 39],
2132
- green: [32, 39],
2133
- yellow: [33, 39],
2134
- blue: [34, 39],
2135
- magenta: [35, 39],
2136
- cyan: [36, 39],
2137
- white: [37, 39],
2138
- // Bright color
2139
- blackBright: [90, 39],
2140
- redBright: [91, 39],
2141
- greenBright: [92, 39],
2142
- yellowBright: [93, 39],
2143
- blueBright: [94, 39],
2144
- magentaBright: [95, 39],
2145
- cyanBright: [96, 39],
2146
- whiteBright: [97, 39]
2147
- },
2148
- bgColor: {
2149
- bgBlack: [40, 49],
2150
- bgRed: [41, 49],
2151
- bgGreen: [42, 49],
2152
- bgYellow: [43, 49],
2153
- bgBlue: [44, 49],
2154
- bgMagenta: [45, 49],
2155
- bgCyan: [46, 49],
2156
- bgWhite: [47, 49],
2157
- // Bright color
2158
- bgBlackBright: [100, 49],
2159
- bgRedBright: [101, 49],
2160
- bgGreenBright: [102, 49],
2161
- bgYellowBright: [103, 49],
2162
- bgBlueBright: [104, 49],
2163
- bgMagentaBright: [105, 49],
2164
- bgCyanBright: [106, 49],
2165
- bgWhiteBright: [107, 49]
2166
- }
2167
- }
2168
-
2169
- // Alias bright black as gray (and grey)
2170
- styles.color.gray = styles.color.blackBright
2171
- styles.bgColor.bgGray = styles.bgColor.bgBlackBright
2172
- styles.color.grey = styles.color.blackBright
2173
- styles.bgColor.bgGrey = styles.bgColor.bgBlackBright
2174
- for (const [groupName, group] of Object.entries(styles)) {
2175
- for (const [styleName, style] of Object.entries(group)) {
2176
- styles[styleName] = {
2177
- open: `\u001B[${style[0]}m`,
2178
- close: `\u001B[${style[1]}m`
2179
- }
2180
- group[styleName] = styles[styleName]
2181
- codes.set(style[0], style[1])
2182
- }
2183
- Object.defineProperty(styles, groupName, {
2184
- value: group,
2185
- enumerable: false
2186
- })
2187
- }
2188
- Object.defineProperty(styles, 'codes', {
2189
- value: codes,
2190
- enumerable: false
2191
- })
2192
- styles.color.close = '\u001B[39m'
2193
- styles.bgColor.close = '\u001B[49m'
2194
- setLazyProperty(styles.color, 'ansi', () =>
2195
- makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)
2196
- )
2197
- setLazyProperty(styles.color, 'ansi256', () =>
2198
- makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)
2199
- )
2200
- setLazyProperty(styles.color, 'ansi16m', () =>
2201
- makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)
2202
- )
2203
- setLazyProperty(styles.bgColor, 'ansi', () =>
2204
- makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)
2205
- )
2206
- setLazyProperty(styles.bgColor, 'ansi256', () =>
2207
- makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)
2208
- )
2209
- setLazyProperty(styles.bgColor, 'ansi16m', () =>
2210
- makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)
2211
- )
2212
- return styles
2213
- }
2214
-
2215
- // Make the export immutable
2216
- Object.defineProperty(module, 'exports', {
2217
- enumerable: true,
2218
- get: assembleStyles
2219
- })
2220
- })(ansiStyles)
2221
- return ansiStyles.exports
2222
- }
2223
-
2224
- let wrapAnsi_1
2225
- let hasRequiredWrapAnsi
2226
- function requireWrapAnsi() {
2227
- if (hasRequiredWrapAnsi) {
2228
- return wrapAnsi_1
2229
- }
2230
- hasRequiredWrapAnsi = 1
2231
- const stringWidth = requireStringWidth()
2232
- const stripAnsi = requireStripAnsi()
2233
- const ansiStyles = requireAnsiStyles()
2234
- const ESCAPES = new Set(['\u001B', '\u009B'])
2235
- const END_CODE = 39
2236
- const wrapAnsi = code => `${ESCAPES.values().next().value}[${code}m`
2237
-
2238
- // Calculate the length of words split on ' ', ignoring
2239
- // the extra characters added by ansi escape codes
2240
- const wordLengths = string =>
2241
- string.split(' ').map(character => stringWidth(character))
2242
-
2243
- // Wrap a long word across multiple rows
2244
- // Ansi escape codes do not count towards length
2245
- const wrapWord = (rows, word, columns) => {
2246
- const characters = [...word]
2247
- let isInsideEscape = false
2248
- let visible = stringWidth(stripAnsi(rows[rows.length - 1]))
2249
- for (const [index, character] of characters.entries()) {
2250
- const characterLength = stringWidth(character)
2251
- if (visible + characterLength <= columns) {
2252
- rows[rows.length - 1] += character
2253
- } else {
2254
- rows.push(character)
2255
- visible = 0
2256
- }
2257
- if (ESCAPES.has(character)) {
2258
- isInsideEscape = true
2259
- } else if (isInsideEscape && character === 'm') {
2260
- isInsideEscape = false
2261
- continue
2262
- }
2263
- if (isInsideEscape) {
2264
- continue
2265
- }
2266
- visible += characterLength
2267
- if (visible === columns && index < characters.length - 1) {
2268
- rows.push('')
2269
- visible = 0
2270
- }
2271
- }
2272
-
2273
- // It's possible that the last row we copy over is only
2274
- // ansi escape characters, handle this edge-case
2275
- if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) {
2276
- rows[rows.length - 2] += rows.pop()
2277
- }
2278
- }
2279
-
2280
- // Trims spaces from a string ignoring invisible sequences
2281
- const stringVisibleTrimSpacesRight = str => {
2282
- const words = str.split(' ')
2283
- let last = words.length
2284
- while (last > 0) {
2285
- if (stringWidth(words[last - 1]) > 0) {
2286
- break
2287
- }
2288
- last--
2289
- }
2290
- if (last === words.length) {
2291
- return str
2292
- }
2293
- return words.slice(0, last).join(' ') + words.slice(last).join('')
2294
- }
2295
-
2296
- // The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode
2297
- //
2298
- // 'hard' will never allow a string to take up more than columns characters
2299
- //
2300
- // 'soft' allows long words to expand past the column length
2301
- const exec = (string, columns, options = {}) => {
2302
- if (options.trim !== false && string.trim() === '') {
2303
- return ''
2304
- }
2305
- let pre = ''
2306
- let ret = ''
2307
- let escapeCode
2308
- const lengths = wordLengths(string)
2309
- let rows = ['']
2310
- for (const [index, word] of string.split(' ').entries()) {
2311
- if (options.trim !== false) {
2312
- rows[rows.length - 1] = rows[rows.length - 1].trimLeft()
2313
- }
2314
- let rowLength = stringWidth(rows[rows.length - 1])
2315
- if (index !== 0) {
2316
- if (
2317
- rowLength >= columns &&
2318
- (options.wordWrap === false || options.trim === false)
2319
- ) {
2320
- // If we start with a new word but the current row length equals the length of the columns, add a new row
2321
- rows.push('')
2322
- rowLength = 0
2323
- }
2324
- if (rowLength > 0 || options.trim === false) {
2325
- rows[rows.length - 1] += ' '
2326
- rowLength++
2327
- }
2328
- }
2329
-
2330
- // In 'hard' wrap mode, the length of a line is never allowed to extend past 'columns'
2331
- if (options.hard && lengths[index] > columns) {
2332
- const remainingColumns = columns - rowLength
2333
- const breaksStartingThisLine =
2334
- 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns)
2335
- const breaksStartingNextLine = Math.floor(
2336
- (lengths[index] - 1) / columns
2337
- )
2338
- if (breaksStartingNextLine < breaksStartingThisLine) {
2339
- rows.push('')
2340
- }
2341
- wrapWord(rows, word, columns)
2342
- continue
2343
- }
2344
- if (
2345
- rowLength + lengths[index] > columns &&
2346
- rowLength > 0 &&
2347
- lengths[index] > 0
2348
- ) {
2349
- if (options.wordWrap === false && rowLength < columns) {
2350
- wrapWord(rows, word, columns)
2351
- continue
2352
- }
2353
- rows.push('')
2354
- }
2355
- if (rowLength + lengths[index] > columns && options.wordWrap === false) {
2356
- wrapWord(rows, word, columns)
2357
- continue
2358
- }
2359
- rows[rows.length - 1] += word
2360
- }
2361
- if (options.trim !== false) {
2362
- rows = rows.map(stringVisibleTrimSpacesRight)
2363
- }
2364
- pre = rows.join('\n')
2365
- for (const [index, character] of [...pre].entries()) {
2366
- ret += character
2367
- if (ESCAPES.has(character)) {
2368
- const code = parseFloat(/\d[^m]*/.exec(pre.slice(index, index + 4)))
2369
- escapeCode = code === END_CODE ? null : code
2370
- }
2371
- const code = ansiStyles.codes.get(Number(escapeCode))
2372
- if (escapeCode && code) {
2373
- if (pre[index + 1] === '\n') {
2374
- ret += wrapAnsi(code)
2375
- } else if (character === '\n') {
2376
- ret += wrapAnsi(escapeCode)
2377
- }
2378
- }
2379
- }
2380
- return ret
2381
- }
2382
-
2383
- // For each newline, invoke the method separately
2384
- wrapAnsi_1 = (string, columns, options) => {
2385
- return String(string)
2386
- .normalize()
2387
- .replace(/\r\n/g, '\n')
2388
- .split('\n')
2389
- .map(line => exec(line, columns, options))
2390
- .join('\n')
2391
- }
2392
- return wrapAnsi_1
2393
- }
2394
-
2395
- const wrapAnsiExports = requireWrapAnsi()
2396
-
2397
- /**
2398
- * Force line returns at specific width. This function is ANSI code friendly and it'll
2399
- * ignore invisible codes during width calculation.
2400
- * @param {string} content
2401
- * @param {number} width
2402
- * @return {string}
2403
- */
2404
- function breakLines(content, width) {
2405
- return content
2406
- .split('\n')
2407
- .flatMap(line =>
2408
- wrapAnsiExports(line, width, {
2409
- trim: false,
2410
- hard: true
2411
- })
2412
- .split('\n')
2413
- .map(str => str.trimEnd())
2414
- )
2415
- .join('\n')
2416
- }
2417
- /**
2418
- * Returns the width of the active readline, or 80 as default value.
2419
- * @returns {number}
2420
- */
2421
- function readlineWidth() {
2422
- return cliWidthExports({
2423
- defaultWidth: 80,
2424
- output: readline().output
2425
- })
2426
- }
2427
-
2428
- function usePointerPosition({ active, renderedItems, pageSize, loop }) {
2429
- const state = useRef({
2430
- lastPointer: active,
2431
- lastActive: undefined
2432
- })
2433
- const { lastPointer, lastActive } = state.current
2434
- const middle = Math.floor(pageSize / 2)
2435
- const renderedLength = renderedItems.reduce(
2436
- (acc, item) => acc + item.length,
2437
- 0
2438
- )
2439
- const defaultPointerPosition = renderedItems
2440
- .slice(0, active)
2441
- .reduce((acc, item) => acc + item.length, 0)
2442
- let pointer = defaultPointerPosition
2443
- if (renderedLength > pageSize) {
2444
- if (loop) {
2445
- /**
2446
- * Creates the next position for the pointer considering an infinitely
2447
- * looping list of items to be rendered on the page.
2448
- *
2449
- * The goal is to progressively move the cursor to the middle position as the user move down, and then keep
2450
- * the cursor there. When the user move up, maintain the cursor position.
2451
- */
2452
- // By default, keep the cursor position as-is.
2453
- pointer = lastPointer
2454
- if (
2455
- // First render, skip this logic.
2456
- lastActive != null &&
2457
- // Only move the pointer down when the user moves down.
2458
- lastActive < active &&
2459
- // Check user didn't move up across page boundary.
2460
- active - lastActive < pageSize
2461
- ) {
2462
- pointer = Math.min(
2463
- // Furthest allowed position for the pointer is the middle of the list
2464
- middle,
2465
- Math.abs(active - lastActive) === 1
2466
- ? Math.min(
2467
- // Move the pointer at most the height of the last active item.
2468
- lastPointer + (renderedItems[lastActive]?.length ?? 0),
2469
- // If the user moved by one item, move the pointer to the natural position of the active item as
2470
- // long as it doesn't move the cursor up.
2471
- Math.max(defaultPointerPosition, lastPointer)
2472
- )
2473
- : // Otherwise, move the pointer down by the difference between the active and last active item.
2474
- lastPointer + active - lastActive
2475
- )
2476
- }
2477
- } else {
2478
- /**
2479
- * Creates the next position for the pointer considering a finite list of
2480
- * items to be rendered on a page.
2481
- *
2482
- * The goal is to keep the pointer in the middle of the page whenever possible, until
2483
- * we reach the bounds of the list (top or bottom). In which case, the cursor moves progressively
2484
- * to the bottom or top of the list.
2485
- */
2486
- const spaceUnderActive = renderedItems
2487
- .slice(active)
2488
- .reduce((acc, item) => acc + item.length, 0)
2489
- pointer =
2490
- spaceUnderActive < pageSize - middle
2491
- ? // If the active item is near the end of the list, progressively move the cursor towards the end.
2492
- pageSize - spaceUnderActive
2493
- : // Otherwise, progressively move the pointer to the middle of the list.
2494
- Math.min(defaultPointerPosition, middle)
2495
- }
2496
- }
2497
- // Save state for the next render
2498
- state.current.lastPointer = pointer
2499
- state.current.lastActive = active
2500
- return pointer
2501
- }
2502
- function usePagination({ items, active, renderItem, pageSize, loop = true }) {
2503
- const width = readlineWidth()
2504
- const bound = num => ((num % items.length) + items.length) % items.length
2505
- const renderedItems = items.map((item, index) => {
2506
- if (item == null) {
2507
- return []
2508
- }
2509
- return breakLines(
2510
- renderItem({
2511
- item,
2512
- index,
2513
- isActive: index === active
2514
- }),
2515
- width
2516
- ).split('\n')
2517
- })
2518
- const renderedLength = renderedItems.reduce(
2519
- (acc, item) => acc + item.length,
2520
- 0
2521
- )
2522
- const renderItemAtIndex = index => renderedItems[index] ?? []
2523
- const pointer = usePointerPosition({
2524
- active,
2525
- renderedItems,
2526
- pageSize,
2527
- loop
2528
- })
2529
- // Render the active item to decide the position.
2530
- // If the active item fits under the pointer, we render it there.
2531
- // Otherwise, we need to render it to fit at the bottom of the page; moving the pointer up.
2532
- const activeItem = renderItemAtIndex(active).slice(0, pageSize)
2533
- const activeItemPosition =
2534
- pointer + activeItem.length <= pageSize
2535
- ? pointer
2536
- : pageSize - activeItem.length
2537
- // Create an array of lines for the page, and add the lines of the active item into the page
2538
- const pageBuffer = Array.from({
2539
- length: pageSize
2540
- })
2541
- pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem)
2542
- // Store to prevent rendering the same item twice
2543
- const itemVisited = new Set([active])
2544
- // Fill the page under the active item
2545
- let bufferPointer = activeItemPosition + activeItem.length
2546
- let itemPointer = bound(active + 1)
2547
- while (
2548
- bufferPointer < pageSize &&
2549
- !itemVisited.has(itemPointer) &&
2550
- (loop && renderedLength > pageSize
2551
- ? itemPointer !== active
2552
- : itemPointer > active)
2553
- ) {
2554
- const lines = renderItemAtIndex(itemPointer)
2555
- const linesToAdd = lines.slice(0, pageSize - bufferPointer)
2556
- pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd)
2557
- // Move pointers for next iteration
2558
- itemVisited.add(itemPointer)
2559
- bufferPointer += linesToAdd.length
2560
- itemPointer = bound(itemPointer + 1)
2561
- }
2562
- // Fill the page over the active item
2563
- bufferPointer = activeItemPosition - 1
2564
- itemPointer = bound(active - 1)
2565
- while (
2566
- bufferPointer >= 0 &&
2567
- !itemVisited.has(itemPointer) &&
2568
- (loop && renderedLength > pageSize
2569
- ? itemPointer !== active
2570
- : itemPointer < active)
2571
- ) {
2572
- const lines = renderItemAtIndex(itemPointer)
2573
- const linesToAdd = lines.slice(
2574
- Math.max(0, lines.length - bufferPointer - 1)
2575
- )
2576
- pageBuffer.splice(
2577
- bufferPointer - linesToAdd.length + 1,
2578
- linesToAdd.length,
2579
- ...linesToAdd
2580
- )
2581
- // Move pointers for next iteration
2582
- itemVisited.add(itemPointer)
2583
- bufferPointer -= linesToAdd.length
2584
- itemPointer = bound(itemPointer - 1)
2585
- }
2586
- return pageBuffer.filter(line => typeof line === 'string').join('\n')
2587
- }
2588
-
2589
- let lib
2590
- let hasRequiredLib
2591
- function requireLib() {
2592
- if (hasRequiredLib) {
2593
- return lib
2594
- }
2595
- hasRequiredLib = 1
2596
- const Stream = require$$0$2
2597
- class MuteStream extends Stream {
2598
- #isTTY = null
2599
- constructor(opts = {}) {
2600
- super(opts)
2601
- this.writable = this.readable = true
2602
- this.muted = false
2603
- this.on('pipe', this._onpipe)
2604
- this.replace = opts.replace
2605
-
2606
- // For readline-type situations
2607
- // This much at the start of a line being redrawn after a ctrl char
2608
- // is seen (such as backspace) won't be redrawn as the replacement
2609
- this._prompt = opts.prompt || null
2610
- this._hadControl = false
2611
- }
2612
- #destSrc(key, def) {
2613
- if (this._dest) {
2614
- return this._dest[key]
2615
- }
2616
- if (this._src) {
2617
- return this._src[key]
2618
- }
2619
- return def
2620
- }
2621
- #proxy(method, ...args) {
2622
- if (typeof this._dest?.[method] === 'function') {
2623
- this._dest[method](...args)
2624
- }
2625
- if (typeof this._src?.[method] === 'function') {
2626
- this._src[method](...args)
2627
- }
2628
- }
2629
- get isTTY() {
2630
- if (this.#isTTY !== null) {
2631
- return this.#isTTY
2632
- }
2633
- return this.#destSrc('isTTY', false)
2634
- }
2635
-
2636
- // basically just get replace the getter/setter with a regular value
2637
- set isTTY(val) {
2638
- this.#isTTY = val
2639
- }
2640
- get rows() {
2641
- return this.#destSrc('rows')
2642
- }
2643
- get columns() {
2644
- return this.#destSrc('columns')
2645
- }
2646
- mute() {
2647
- this.muted = true
2648
- }
2649
- unmute() {
2650
- this.muted = false
2651
- }
2652
- _onpipe(src) {
2653
- this._src = src
2654
- }
2655
- pipe(dest, options) {
2656
- this._dest = dest
2657
- return super.pipe(dest, options)
2658
- }
2659
- pause() {
2660
- if (this._src) {
2661
- return this._src.pause()
2662
- }
2663
- }
2664
- resume() {
2665
- if (this._src) {
2666
- return this._src.resume()
2667
- }
2668
- }
2669
- write(c) {
2670
- if (this.muted) {
2671
- if (!this.replace) {
2672
- return true
2673
- }
2674
- // eslint-disable-next-line no-control-regex
2675
- if (c.match(/^\u001b/)) {
2676
- if (c.indexOf(this._prompt) === 0) {
2677
- c = c.slice(this._prompt.length)
2678
- c = c.replace(/./g, this.replace)
2679
- c = this._prompt + c
2680
- }
2681
- this._hadControl = true
2682
- return this.emit('data', c)
2683
- } else {
2684
- if (
2685
- this._prompt &&
2686
- this._hadControl &&
2687
- c.indexOf(this._prompt) === 0
2688
- ) {
2689
- this._hadControl = false
2690
- this.emit('data', this._prompt)
2691
- c = c.slice(this._prompt.length)
2692
- }
2693
- c = c.toString().replace(/./g, this.replace)
2694
- }
2695
- }
2696
- this.emit('data', c)
2697
- }
2698
- end(c) {
2699
- if (this.muted) {
2700
- if (c && this.replace) {
2701
- c = c.toString().replace(/./g, this.replace)
2702
- } else {
2703
- c = null
2704
- }
2705
- }
2706
- if (c) {
2707
- this.emit('data', c)
2708
- }
2709
- this.emit('end')
2710
- }
2711
- destroy(...args) {
2712
- return this.#proxy('destroy', ...args)
2713
- }
2714
- destroySoon(...args) {
2715
- return this.#proxy('destroySoon', ...args)
2716
- }
2717
- close(...args) {
2718
- return this.#proxy('close', ...args)
2719
- }
2720
- }
2721
- lib = MuteStream
2722
- return lib
2723
- }
2724
-
2725
- const libExports = requireLib()
2726
-
2727
- /**
2728
- * This is not the set of all possible signals.
2729
- *
2730
- * It IS, however, the set of all signals that trigger
2731
- * an exit on either Linux or BSD systems. Linux is a
2732
- * superset of the signal names supported on BSD, and
2733
- * the unknown signals just fail to register, so we can
2734
- * catch that easily enough.
2735
- *
2736
- * Windows signals are a different set, since there are
2737
- * signals that terminate Windows processes, but don't
2738
- * terminate (or don't even exist) on Posix systems.
2739
- *
2740
- * Don't bother with SIGKILL. It's uncatchable, which
2741
- * means that we can't fire any callbacks anyway.
2742
- *
2743
- * If a user does happen to register a handler on a non-
2744
- * fatal signal like SIGWINCH or something, and then
2745
- * exit, it'll end up firing `process.emit('exit')`, so
2746
- * the handler will be fired anyway.
2747
- *
2748
- * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
2749
- * artificially, inherently leave the process in a
2750
- * state from which it is not safe to try and enter JS
2751
- * listeners.
2752
- */
2753
- const signals = []
2754
- signals.push('SIGHUP', 'SIGINT', 'SIGTERM')
2755
- if (process.platform !== 'win32') {
2756
- signals.push(
2757
- 'SIGALRM',
2758
- 'SIGABRT',
2759
- 'SIGVTALRM',
2760
- 'SIGXCPU',
2761
- 'SIGXFSZ',
2762
- 'SIGUSR2',
2763
- 'SIGTRAP',
2764
- 'SIGSYS',
2765
- 'SIGQUIT',
2766
- 'SIGIOT'
2767
- // should detect profiler and enable/disable accordingly.
2768
- // see #21
2769
- // 'SIGPROF'
2770
- )
2771
- }
2772
- if (process.platform === 'linux') {
2773
- signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT')
2774
- }
2775
-
2776
- // Note: since nyc uses this module to output coverage, any lines
2777
- // that are in the direct sync flow of nyc's outputCoverage are
2778
- // ignored, since we can never get coverage for them.
2779
- // grab a reference to node's real process object right away
2780
- const processOk = process =>
2781
- !!process &&
2782
- typeof process === 'object' &&
2783
- typeof process.removeListener === 'function' &&
2784
- typeof process.emit === 'function' &&
2785
- typeof process.reallyExit === 'function' &&
2786
- typeof process.listeners === 'function' &&
2787
- typeof process.kill === 'function' &&
2788
- typeof process.pid === 'number' &&
2789
- typeof process.on === 'function'
2790
- const kExitEmitter = Symbol.for('signal-exit emitter')
2791
- const global = globalThis
2792
- const ObjectDefineProperty = Object.defineProperty.bind(Object)
2793
- // teeny special purpose ee
2794
- class Emitter {
2795
- emitted = {
2796
- afterExit: false,
2797
- exit: false
2798
- }
2799
- listeners = {
2800
- afterExit: [],
2801
- exit: []
2802
- }
2803
- count = 0
2804
- id = Math.random()
2805
- constructor() {
2806
- if (global[kExitEmitter]) {
2807
- return global[kExitEmitter]
2808
- }
2809
- ObjectDefineProperty(global, kExitEmitter, {
2810
- value: this,
2811
- writable: false,
2812
- enumerable: false,
2813
- configurable: false
2814
- })
2815
- }
2816
- on(ev, fn) {
2817
- this.listeners[ev].push(fn)
2818
- }
2819
- removeListener(ev, fn) {
2820
- const list = this.listeners[ev]
2821
- const i = list.indexOf(fn)
2822
- /* c8 ignore start */
2823
- if (i === -1) {
2824
- return
2825
- }
2826
- /* c8 ignore stop */
2827
- if (i === 0 && list.length === 1) {
2828
- list.length = 0
2829
- } else {
2830
- list.splice(i, 1)
2831
- }
2832
- }
2833
- emit(ev, code, signal) {
2834
- if (this.emitted[ev]) {
2835
- return false
2836
- }
2837
- this.emitted[ev] = true
2838
- let ret = false
2839
- for (const fn of this.listeners[ev]) {
2840
- ret = fn(code, signal) === true || ret
2841
- }
2842
- if (ev === 'exit') {
2843
- ret = this.emit('afterExit', code, signal) || ret
2844
- }
2845
- return ret
2846
- }
2847
- }
2848
- class SignalExitBase {}
2849
- const signalExitWrap = handler => {
2850
- return {
2851
- onExit(cb, opts) {
2852
- return handler.onExit(cb, opts)
2853
- },
2854
- load() {
2855
- return handler.load()
2856
- },
2857
- unload() {
2858
- return handler.unload()
2859
- }
2860
- }
2861
- }
2862
- class SignalExitFallback extends SignalExitBase {
2863
- onExit() {
2864
- return () => {}
2865
- }
2866
- load() {}
2867
- unload() {}
2868
- }
2869
- class SignalExit extends SignalExitBase {
2870
- // "SIGHUP" throws an `ENOSYS` error on Windows,
2871
- // so use a supported signal instead
2872
- /* c8 ignore start */
2873
- #hupSig = process$1.platform === 'win32' ? 'SIGINT' : 'SIGHUP'
2874
- /* c8 ignore stop */
2875
- #emitter = new Emitter()
2876
- #process
2877
- #originalProcessEmit
2878
- #originalProcessReallyExit
2879
- #sigListeners = {}
2880
- #loaded = false
2881
- constructor(process) {
2882
- super()
2883
- this.#process = process
2884
- // { <signal>: <listener fn>, ... }
2885
- this.#sigListeners = {}
2886
- for (const sig of signals) {
2887
- this.#sigListeners[sig] = () => {
2888
- // If there are no other listeners, an exit is coming!
2889
- // Simplest way: remove us and then re-send the signal.
2890
- // We know that this will kill the process, so we can
2891
- // safely emit now.
2892
- const listeners = this.#process.listeners(sig)
2893
- let { count } = this.#emitter
2894
- // This is a workaround for the fact that signal-exit v3 and signal
2895
- // exit v4 are not aware of each other, and each will attempt to let
2896
- // the other handle it, so neither of them do. To correct this, we
2897
- // detect if we're the only handler *except* for previous versions
2898
- // of signal-exit, and increment by the count of listeners it has
2899
- // created.
2900
- /* c8 ignore start */
2901
- const p = process
2902
- if (
2903
- typeof p.__signal_exit_emitter__ === 'object' &&
2904
- typeof p.__signal_exit_emitter__.count === 'number'
2905
- ) {
2906
- count += p.__signal_exit_emitter__.count
2907
- }
2908
- /* c8 ignore stop */
2909
- if (listeners.length === count) {
2910
- this.unload()
2911
- const ret = this.#emitter.emit('exit', null, sig)
2912
- /* c8 ignore start */
2913
- const s = sig === 'SIGHUP' ? this.#hupSig : sig
2914
- if (!ret) {
2915
- process.kill(process.pid, s)
2916
- }
2917
- /* c8 ignore stop */
2918
- }
2919
- }
2920
- }
2921
- this.#originalProcessReallyExit = process.reallyExit
2922
- this.#originalProcessEmit = process.emit
2923
- }
2924
- onExit(cb, opts) {
2925
- /* c8 ignore start */
2926
- if (!processOk(this.#process)) {
2927
- return () => {}
2928
- }
2929
- /* c8 ignore stop */
2930
- if (this.#loaded === false) {
2931
- this.load()
2932
- }
2933
- const ev = opts?.alwaysLast ? 'afterExit' : 'exit'
2934
- this.#emitter.on(ev, cb)
2935
- return () => {
2936
- this.#emitter.removeListener(ev, cb)
2937
- if (
2938
- this.#emitter.listeners['exit'].length === 0 &&
2939
- this.#emitter.listeners['afterExit'].length === 0
2940
- ) {
2941
- this.unload()
2942
- }
2943
- }
2944
- }
2945
- load() {
2946
- if (this.#loaded) {
2947
- return
2948
- }
2949
- this.#loaded = true
2950
- // This is the number of onSignalExit's that are in play.
2951
- // It's important so that we can count the correct number of
2952
- // listeners on signals, and don't wait for the other one to
2953
- // handle it instead of us.
2954
- this.#emitter.count += 1
2955
- for (const sig of signals) {
2956
- try {
2957
- const fn = this.#sigListeners[sig]
2958
- if (fn) {
2959
- this.#process.on(sig, fn)
2960
- }
2961
- } catch (_) {}
2962
- }
2963
- this.#process.emit = (ev, ...a) => {
2964
- return this.#processEmit(ev, ...a)
2965
- }
2966
- this.#process.reallyExit = code => {
2967
- return this.#processReallyExit(code)
2968
- }
2969
- }
2970
- unload() {
2971
- if (!this.#loaded) {
2972
- return
2973
- }
2974
- this.#loaded = false
2975
- signals.forEach(sig => {
2976
- const listener = this.#sigListeners[sig]
2977
- /* c8 ignore start */
2978
- if (!listener) {
2979
- throw new Error('Listener not defined for signal: ' + sig)
2980
- }
2981
- /* c8 ignore stop */
2982
- try {
2983
- this.#process.removeListener(sig, listener)
2984
- /* c8 ignore start */
2985
- } catch (_) {}
2986
- /* c8 ignore stop */
2987
- })
2988
- this.#process.emit = this.#originalProcessEmit
2989
- this.#process.reallyExit = this.#originalProcessReallyExit
2990
- this.#emitter.count -= 1
2991
- }
2992
- #processReallyExit(code) {
2993
- /* c8 ignore start */
2994
- if (!processOk(this.#process)) {
2995
- return 0
2996
- }
2997
- this.#process.exitCode = code || 0
2998
- /* c8 ignore stop */
2999
- this.#emitter.emit('exit', this.#process.exitCode, null)
3000
- return this.#originalProcessReallyExit.call(
3001
- this.#process,
3002
- this.#process.exitCode
3003
- )
3004
- }
3005
- #processEmit(ev, ...args) {
3006
- const og = this.#originalProcessEmit
3007
- if (ev === 'exit' && processOk(this.#process)) {
3008
- if (typeof args[0] === 'number') {
3009
- this.#process.exitCode = args[0]
3010
- /* c8 ignore start */
3011
- }
3012
- /* c8 ignore start */
3013
- const ret = og.call(this.#process, ev, ...args)
3014
- /* c8 ignore start */
3015
- this.#emitter.emit('exit', this.#process.exitCode, null)
3016
- /* c8 ignore stop */
3017
- return ret
3018
- } else {
3019
- return og.call(this.#process, ev, ...args)
3020
- }
3021
- }
3022
- }
3023
- const process$1 = globalThis.process
3024
- // wrap so that we call the method on the actual handler, without
3025
- // exporting it directly.
3026
- const {
3027
- /**
3028
- * Called when the process is exiting, whether via signal, explicit
3029
- * exit, or running out of stuff to do.
3030
- *
3031
- * If the global process object is not suitable for instrumentation,
3032
- * then this will be a no-op.
3033
- *
3034
- * Returns a function that may be used to unload signal-exit.
3035
- */
3036
- onExit
3037
- } = signalExitWrap(
3038
- processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback()
3039
- )
3040
-
3041
- const ESC = '\u001B['
3042
- /** Move cursor to first column */
3043
- const cursorLeft = ESC + 'G'
3044
- /** Show the cursor */
3045
- const cursorShow = ESC + '?25h'
3046
- /** Move cursor up by count rows */
3047
- const cursorUp = (rows = 1) => (rows > 0 ? `${ESC}${rows}A` : '')
3048
- /** Move cursor down by count rows */
3049
- const cursorDown = (rows = 1) => (rows > 0 ? `${ESC}${rows}B` : '')
3050
- /** Move cursor to position (x, y) */
3051
- const cursorTo = (x, y) => {
3052
- return `${ESC}${x + 1}G`
3053
- }
3054
- const eraseLine = ESC + '2K'
3055
- /** Erase the specified number of lines above the cursor */
3056
- const eraseLines = lines =>
3057
- lines > 0
3058
- ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft
3059
- : ''
3060
-
3061
- const height = content => content.split('\n').length
3062
- const lastLine = content => content.split('\n').pop() ?? ''
3063
- class ScreenManager {
3064
- // These variables are keeping information to allow correct prompt re-rendering
3065
- height = 0
3066
- extraLinesUnderPrompt = 0
3067
- cursorPos
3068
- rl
3069
- constructor(rl) {
3070
- this.rl = rl
3071
- this.cursorPos = rl.getCursorPos()
3072
- }
3073
- write(content) {
3074
- this.rl.output.unmute()
3075
- this.rl.output.write(content)
3076
- this.rl.output.mute()
3077
- }
3078
- render(content, bottomContent = '') {
3079
- // Write message to screen and setPrompt to control backspace
3080
- const promptLine = lastLine(content)
3081
- const rawPromptLine = util.stripVTControlCharacters(promptLine)
3082
- // Remove the rl.line from our prompt. We can't rely on the content of
3083
- // rl.line (mainly because of the password prompt), so just rely on it's
3084
- // length.
3085
- let prompt = rawPromptLine
3086
- if (this.rl.line.length > 0) {
3087
- prompt = prompt.slice(0, -this.rl.line.length)
3088
- }
3089
- this.rl.setPrompt(prompt)
3090
- // SetPrompt will change cursor position, now we can get correct value
3091
- this.cursorPos = this.rl.getCursorPos()
3092
- const width = readlineWidth()
3093
- content = breakLines(content, width)
3094
- bottomContent = breakLines(bottomContent, width)
3095
- // Manually insert an extra line if we're at the end of the line.
3096
- // This prevent the cursor from appearing at the beginning of the
3097
- // current line.
3098
- if (rawPromptLine.length % width === 0) {
3099
- content += '\n'
3100
- }
3101
- let output = content + (bottomContent ? '\n' + bottomContent : '')
3102
- /**
3103
- * Re-adjust the cursor at the correct position.
3104
- */
3105
- // We need to consider parts of the prompt under the cursor as part of the bottom
3106
- // content in order to correctly cleanup and re-render.
3107
- const promptLineUpDiff =
3108
- Math.floor(rawPromptLine.length / width) - this.cursorPos.rows
3109
- const bottomContentHeight =
3110
- promptLineUpDiff + (bottomContent ? height(bottomContent) : 0)
3111
- // Return cursor to the input position (on top of the bottomContent)
3112
- if (bottomContentHeight > 0) {
3113
- output += cursorUp(bottomContentHeight)
3114
- }
3115
- // Return cursor to the initial left offset.
3116
- output += cursorTo(this.cursorPos.cols)
3117
- /**
3118
- * Render and store state for future re-rendering
3119
- */
3120
- this.write(
3121
- cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output
3122
- )
3123
- this.extraLinesUnderPrompt = bottomContentHeight
3124
- this.height = height(output)
3125
- }
3126
- checkCursorPos() {
3127
- const cursorPos = this.rl.getCursorPos()
3128
- if (cursorPos.cols !== this.cursorPos.cols) {
3129
- this.write(cursorTo(cursorPos.cols))
3130
- this.cursorPos = cursorPos
3131
- }
3132
- }
3133
- done({ clearContent }) {
3134
- this.rl.setPrompt('')
3135
- let output = cursorDown(this.extraLinesUnderPrompt)
3136
- output += clearContent ? eraseLines(this.height) : '\n'
3137
- output += cursorShow
3138
- this.write(output)
3139
- this.rl.close()
3140
- }
3141
- }
3142
-
3143
- // TODO: Remove this class once Node 22 becomes the minimum supported version.
3144
- class PromisePolyfill extends Promise {
3145
- // Available starting from Node 22
3146
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
3147
- static withResolver() {
3148
- let resolve
3149
- let reject
3150
- const promise = new Promise((res, rej) => {
3151
- resolve = res
3152
- reject = rej
3153
- })
3154
- return {
3155
- promise,
3156
- resolve: resolve,
3157
- reject: reject
3158
- }
3159
- }
3160
- }
3161
-
3162
- function getCallSites() {
3163
- // eslint-disable-next-line @typescript-eslint/unbound-method
3164
- const _prepareStackTrace = Error.prepareStackTrace
3165
- let result = []
3166
- try {
3167
- Error.prepareStackTrace = (_, callSites) => {
3168
- const callSitesWithoutCurrent = callSites.slice(1)
3169
- result = callSitesWithoutCurrent
3170
- return callSitesWithoutCurrent
3171
- }
3172
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions
3173
- new Error().stack
3174
- } catch {
3175
- // An error will occur if the Node flag --frozen-intrinsics is used.
3176
- // https://nodejs.org/api/cli.html#--frozen-intrinsics
3177
- return result
3178
- }
3179
- Error.prepareStackTrace = _prepareStackTrace
3180
- return result
3181
- }
3182
- function createPrompt(view) {
3183
- const callSites = getCallSites()
3184
- const prompt = (config, context = {}) => {
3185
- // Default `input` to stdin
3186
- const { input = process.stdin, signal } = context
3187
- const cleanups = new Set()
3188
- // Add mute capabilities to the output
3189
- const output = new libExports()
3190
- output.pipe(context.output ?? process.stdout)
3191
- const rl = readline__namespace.createInterface({
3192
- terminal: true,
3193
- input,
3194
- output
3195
- })
3196
- const screen = new ScreenManager(rl)
3197
- const { promise, resolve, reject } = PromisePolyfill.withResolver()
3198
- const cancel = () => reject(new CancelPromptError())
3199
- if (signal) {
3200
- const abort = () =>
3201
- reject(
3202
- new AbortPromptError({
3203
- cause: signal.reason
3204
- })
3205
- )
3206
- if (signal.aborted) {
3207
- abort()
3208
- return Object.assign(promise, {
3209
- cancel
3210
- })
3211
- }
3212
- signal.addEventListener('abort', abort)
3213
- cleanups.add(() => signal.removeEventListener('abort', abort))
3214
- }
3215
- cleanups.add(
3216
- onExit((code, signal) => {
3217
- reject(
3218
- new ExitPromptError(
3219
- `User force closed the prompt with ${code} ${signal}`
3220
- )
3221
- )
3222
- })
3223
- )
3224
- // SIGINT must be explicitly handled by the prompt so the ExitPromptError can be handled.
3225
- // Otherwise, the prompt will stop and in some scenarios never resolve.
3226
- // Ref issue #1741
3227
- const sigint = () =>
3228
- reject(new ExitPromptError(`User force closed the prompt with SIGINT`))
3229
- rl.on('SIGINT', sigint)
3230
- cleanups.add(() => rl.removeListener('SIGINT', sigint))
3231
- // Re-renders only happen when the state change; but the readline cursor could change position
3232
- // and that also requires a re-render (and a manual one because we mute the streams).
3233
- // We set the listener after the initial workLoop to avoid a double render if render triggered
3234
- // by a state change sets the cursor to the right position.
3235
- const checkCursorPos = () => screen.checkCursorPos()
3236
- rl.input.on('keypress', checkCursorPos)
3237
- cleanups.add(() => rl.input.removeListener('keypress', checkCursorPos))
3238
- return withHooks(rl, cycle => {
3239
- // The close event triggers immediately when the user press ctrl+c. SignalExit on the other hand
3240
- // triggers after the process is done (which happens after timeouts are done triggering.)
3241
- // We triggers the hooks cleanup phase on rl `close` so active timeouts can be cleared.
3242
- const hooksCleanup = async_hooks.AsyncResource.bind(() =>
3243
- effectScheduler.clearAll()
3244
- )
3245
- rl.on('close', hooksCleanup)
3246
- cleanups.add(() => rl.removeListener('close', hooksCleanup))
3247
- cycle(() => {
3248
- try {
3249
- const nextView = view(config, value => {
3250
- setImmediate(() => resolve(value))
3251
- })
3252
- // Typescript won't allow this, but not all users rely on typescript.
3253
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
3254
- if (nextView === undefined) {
3255
- const callerFilename = callSites[1]?.getFileName()
3256
- throw new Error(
3257
- `Prompt functions must return a string.\n at ${callerFilename}`
3258
- )
3259
- }
3260
- const [content, bottomContent] =
3261
- typeof nextView === 'string' ? [nextView] : nextView
3262
- screen.render(content, bottomContent)
3263
- effectScheduler.run()
3264
- } catch (error) {
3265
- reject(error)
3266
- }
3267
- })
3268
- return Object.assign(
3269
- promise
3270
- .then(
3271
- answer => {
3272
- effectScheduler.clearAll()
3273
- return answer
3274
- },
3275
- error => {
3276
- effectScheduler.clearAll()
3277
- throw error
3278
- }
3279
- )
3280
- // Wait for the promise to settle, then cleanup.
3281
- .finally(() => {
3282
- cleanups.forEach(cleanup => cleanup())
3283
- screen.done({
3284
- clearContent: Boolean(context.clearPromptOnDone)
3285
- })
3286
- output.end()
3287
- })
3288
- // Once cleanup is done, let the expose promise resolve/reject to the internal one.
3289
- .then(() => promise),
3290
- {
3291
- cancel
3292
- }
3293
- )
3294
- })
3295
- }
3296
- return prompt
3297
- }
3298
-
3299
- /**
3300
- * Separator object
3301
- * Used to space/separate choices group
3302
- */
3303
- class Separator {
3304
- separator = yoctocolorsCjsExports.dim(
3305
- Array.from({
3306
- length: 15
3307
- }).join(figures.line)
3308
- )
3309
- type = 'separator'
3310
- constructor(separator) {
3311
- if (separator) {
3312
- this.separator = separator
3313
- }
3314
- }
3315
- static isSeparator(choice) {
3316
- return Boolean(
3317
- choice &&
3318
- typeof choice === 'object' &&
3319
- 'type' in choice &&
3320
- choice.type === 'separator'
3321
- )
3322
- }
3323
- }
3324
-
3325
- const searchTheme = {
3326
- icon: {
3327
- cursor: figures.pointer
3328
- },
3329
- style: {
3330
- disabled: text => yoctocolorsCjsExports.dim(`- ${text}`),
3331
- searchTerm: text => yoctocolorsCjsExports.cyan(text),
3332
- description: text => yoctocolorsCjsExports.cyan(text)
3333
- },
3334
- helpMode: 'auto'
3335
- }
3336
- function isSelectable(item) {
3337
- return !Separator.isSeparator(item) && !item.disabled
3338
- }
3339
- function normalizeChoices(choices) {
3340
- return choices.map(choice => {
3341
- if (Separator.isSeparator(choice)) {
3342
- return choice
3343
- }
3344
- if (typeof choice === 'string') {
3345
- return {
3346
- value: choice,
3347
- name: choice,
3348
- short: choice,
3349
- disabled: false
3350
- }
3351
- }
3352
- const name = choice.name ?? String(choice.value)
3353
- const normalizedChoice = {
3354
- value: choice.value,
3355
- name,
3356
- short: choice.short ?? name,
3357
- disabled: choice.disabled ?? false
3358
- }
3359
- if (choice.description) {
3360
- normalizedChoice.description = choice.description
3361
- }
3362
- return normalizedChoice
3363
- })
3364
- }
3365
- const index = createPrompt((config, done) => {
3366
- const { pageSize = 7, validate = () => true } = config
3367
- const theme = makeTheme(searchTheme, config.theme)
3368
- const firstRender = useRef(true)
3369
- const [status, setStatus] = useState('loading')
3370
- const [searchTerm, setSearchTerm] = useState('')
3371
- const [searchResults, setSearchResults] = useState([])
3372
- const [searchError, setSearchError] = useState()
3373
- const prefix = usePrefix({
3374
- status,
3375
- theme
3376
- })
3377
- const bounds = useMemo(() => {
3378
- const first = searchResults.findIndex(isSelectable)
3379
- const last = searchResults.findLastIndex(isSelectable)
3380
- return {
3381
- first,
3382
- last
3383
- }
3384
- }, [searchResults])
3385
- const [active = bounds.first, setActive] = useState()
3386
- useEffect(() => {
3387
- const controller = new AbortController()
3388
- setStatus('loading')
3389
- setSearchError(undefined)
3390
- const fetchResults = async () => {
3391
- try {
3392
- const results = await config.source(searchTerm || undefined, {
3393
- signal: controller.signal
3394
- })
3395
- if (!controller.signal.aborted) {
3396
- // Reset the pointer
3397
- setActive(undefined)
3398
- setSearchError(undefined)
3399
- setSearchResults(normalizeChoices(results))
3400
- setStatus('idle')
3401
- }
3402
- } catch (error) {
3403
- if (!controller.signal.aborted && error instanceof Error) {
3404
- setSearchError(error.message)
3405
- }
3406
- }
3407
- }
3408
- void fetchResults()
3409
- return () => {
3410
- controller.abort()
3411
- }
3412
- }, [searchTerm])
3413
- // Safe to assume the cursor position never points to a Separator.
3414
- const selectedChoice = searchResults[active]
3415
- useKeypress(async (key, rl) => {
3416
- if (isEnterKey(key)) {
3417
- if (selectedChoice) {
3418
- setStatus('loading')
3419
- const isValid = await validate(selectedChoice.value)
3420
- setStatus('idle')
3421
- if (isValid === true) {
3422
- setStatus('done')
3423
- done(selectedChoice.value)
3424
- } else if (selectedChoice.name === searchTerm) {
3425
- setSearchError(isValid || 'You must provide a valid value')
3426
- } else {
3427
- // Reset line with new search term
3428
- rl.write(selectedChoice.name)
3429
- setSearchTerm(selectedChoice.name)
3430
- }
3431
- } else {
3432
- // Reset the readline line value to the previous value. On line event, the value
3433
- // get cleared, forcing the user to re-enter the value instead of fixing it.
3434
- rl.write(searchTerm)
3435
- }
3436
- } else if (isTabKey(key) && selectedChoice) {
3437
- rl.clearLine(0) // Remove the tab character.
3438
- rl.write(selectedChoice.name)
3439
- setSearchTerm(selectedChoice.name)
3440
- } else if (status !== 'loading' && (isUpKey(key) || isDownKey(key))) {
3441
- rl.clearLine(0)
3442
- if (
3443
- (isUpKey(key) && active !== bounds.first) ||
3444
- (isDownKey(key) && active !== bounds.last)
3445
- ) {
3446
- const offset = isUpKey(key) ? -1 : 1
3447
- let next = active
3448
- do {
3449
- next = (next + offset + searchResults.length) % searchResults.length
3450
- } while (!isSelectable(searchResults[next]))
3451
- setActive(next)
3452
- }
3453
- } else {
3454
- setSearchTerm(rl.line)
3455
- }
3456
- })
3457
- const message = theme.style.message(config.message, status)
3458
- if (active > 0) {
3459
- firstRender.current = false
3460
- }
3461
- let helpTip = ''
3462
- if (
3463
- searchResults.length > 1 &&
3464
- (theme.helpMode === 'always' ||
3465
- (theme.helpMode === 'auto' && firstRender.current))
3466
- ) {
3467
- helpTip =
3468
- searchResults.length > pageSize
3469
- ? `\n${theme.style.help(`(${config.instructions?.pager ?? 'Use arrow keys to reveal more choices'})`)}`
3470
- : `\n${theme.style.help(`(${config.instructions?.navigation ?? 'Use arrow keys'})`)}`
3471
- }
3472
- // TODO: What to do if no results are found? Should we display a message?
3473
- const page = usePagination({
3474
- items: searchResults,
3475
- active,
3476
- renderItem({ item, isActive }) {
3477
- if (Separator.isSeparator(item)) {
3478
- return ` ${item.separator}`
3479
- }
3480
- if (item.disabled) {
3481
- const disabledLabel =
3482
- typeof item.disabled === 'string' ? item.disabled : '(disabled)'
3483
- return theme.style.disabled(`${item.name} ${disabledLabel}`)
3484
- }
3485
- const color = isActive ? theme.style.highlight : x => x
3486
- const cursor = isActive ? theme.icon.cursor : ` `
3487
- return color(`${cursor} ${item.name}`)
3488
- },
3489
- pageSize,
3490
- loop: false
3491
- })
3492
- let error
3493
- if (searchError) {
3494
- error = theme.style.error(searchError)
3495
- } else if (
3496
- searchResults.length === 0 &&
3497
- searchTerm !== '' &&
3498
- status === 'idle'
3499
- ) {
3500
- error = theme.style.error('No results found')
3501
- }
3502
- let searchStr
3503
- if (status === 'done' && selectedChoice) {
3504
- const answer = selectedChoice.short
3505
- return `${prefix} ${message} ${theme.style.answer(answer)}`
3506
- } else {
3507
- searchStr = theme.style.searchTerm(searchTerm)
3508
- }
3509
- const choiceDescription = selectedChoice?.description
3510
- ? `\n${theme.style.description(selectedChoice.description)}`
3511
- : ``
3512
- return [
3513
- [prefix, message, searchStr].filter(Boolean).join(' '),
3514
- `${error ?? page}${helpTip}${choiceDescription}`
3515
- ]
3516
- })
3517
-
3518
- exports.Separator = Separator
3519
- exports.default = index