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