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