pull-request-split-advisor 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/LICENSE +52 -0
  2. package/README.md +168 -0
  3. package/dist/ai/config-wizard.js +282 -0
  4. package/dist/ai/enricher.js +290 -0
  5. package/dist/ai/prompts.js +231 -0
  6. package/dist/ai/provider.js +265 -0
  7. package/dist/cli.js +442 -0
  8. package/dist/config/config.js +315 -0
  9. package/dist/config/default-config.js +223 -0
  10. package/dist/core/blocks.js +145 -0
  11. package/dist/core/commit-planner.js +273 -0
  12. package/dist/core/dependency.js +284 -0
  13. package/dist/core/file-stats.js +341 -0
  14. package/dist/core/history.js +72 -0
  15. package/dist/core/planner.js +25 -0
  16. package/dist/core/scoring.js +166 -0
  17. package/dist/core/strategy.js +486 -0
  18. package/dist/git/branch-naming.js +120 -0
  19. package/dist/git/executor.js +378 -0
  20. package/dist/git/git.js +239 -0
  21. package/dist/output/report-styles.generated.js +10 -0
  22. package/dist/output/report.js +726 -0
  23. package/dist/output/ui.js +417 -0
  24. package/dist/shared/constants.js +59 -0
  25. package/dist/shared/types.js +7 -0
  26. package/dist/shared/utils.js +73 -0
  27. package/node_modules/@colors/colors/LICENSE +26 -0
  28. package/node_modules/@colors/colors/README.md +219 -0
  29. package/node_modules/@colors/colors/examples/normal-usage.js +83 -0
  30. package/node_modules/@colors/colors/examples/safe-string.js +80 -0
  31. package/node_modules/@colors/colors/index.d.ts +136 -0
  32. package/node_modules/@colors/colors/lib/colors.js +211 -0
  33. package/node_modules/@colors/colors/lib/custom/trap.js +46 -0
  34. package/node_modules/@colors/colors/lib/custom/zalgo.js +110 -0
  35. package/node_modules/@colors/colors/lib/extendStringPrototype.js +110 -0
  36. package/node_modules/@colors/colors/lib/index.js +13 -0
  37. package/node_modules/@colors/colors/lib/maps/america.js +10 -0
  38. package/node_modules/@colors/colors/lib/maps/rainbow.js +12 -0
  39. package/node_modules/@colors/colors/lib/maps/random.js +11 -0
  40. package/node_modules/@colors/colors/lib/maps/zebra.js +5 -0
  41. package/node_modules/@colors/colors/lib/styles.js +95 -0
  42. package/node_modules/@colors/colors/lib/system/has-flag.js +35 -0
  43. package/node_modules/@colors/colors/lib/system/supports-colors.js +151 -0
  44. package/node_modules/@colors/colors/package.json +45 -0
  45. package/node_modules/@colors/colors/safe.d.ts +48 -0
  46. package/node_modules/@colors/colors/safe.js +10 -0
  47. package/node_modules/@colors/colors/themes/generic-logging.js +12 -0
  48. package/node_modules/ansi-align/LICENSE +13 -0
  49. package/node_modules/ansi-align/README.md +80 -0
  50. package/node_modules/ansi-align/index.js +61 -0
  51. package/node_modules/ansi-align/node_modules/ansi-regex/index.d.ts +37 -0
  52. package/node_modules/ansi-align/node_modules/ansi-regex/index.js +10 -0
  53. package/node_modules/ansi-align/node_modules/ansi-regex/license +9 -0
  54. package/node_modules/ansi-align/node_modules/ansi-regex/package.json +55 -0
  55. package/node_modules/ansi-align/node_modules/ansi-regex/readme.md +78 -0
  56. package/node_modules/ansi-align/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
  57. package/node_modules/ansi-align/node_modules/emoji-regex/README.md +73 -0
  58. package/node_modules/ansi-align/node_modules/emoji-regex/es2015/index.js +6 -0
  59. package/node_modules/ansi-align/node_modules/emoji-regex/es2015/text.js +6 -0
  60. package/node_modules/ansi-align/node_modules/emoji-regex/index.d.ts +23 -0
  61. package/node_modules/ansi-align/node_modules/emoji-regex/index.js +6 -0
  62. package/node_modules/ansi-align/node_modules/emoji-regex/package.json +50 -0
  63. package/node_modules/ansi-align/node_modules/emoji-regex/text.js +6 -0
  64. package/node_modules/ansi-align/node_modules/string-width/index.d.ts +29 -0
  65. package/node_modules/ansi-align/node_modules/string-width/index.js +47 -0
  66. package/node_modules/ansi-align/node_modules/string-width/license +9 -0
  67. package/node_modules/ansi-align/node_modules/string-width/package.json +56 -0
  68. package/node_modules/ansi-align/node_modules/string-width/readme.md +50 -0
  69. package/node_modules/ansi-align/node_modules/strip-ansi/index.d.ts +17 -0
  70. package/node_modules/ansi-align/node_modules/strip-ansi/index.js +4 -0
  71. package/node_modules/ansi-align/node_modules/strip-ansi/license +9 -0
  72. package/node_modules/ansi-align/node_modules/strip-ansi/package.json +54 -0
  73. package/node_modules/ansi-align/node_modules/strip-ansi/readme.md +46 -0
  74. package/node_modules/ansi-align/package.json +43 -0
  75. package/node_modules/ansi-regex/index.d.ts +33 -0
  76. package/node_modules/ansi-regex/index.js +14 -0
  77. package/node_modules/ansi-regex/license +9 -0
  78. package/node_modules/ansi-regex/package.json +61 -0
  79. package/node_modules/ansi-regex/readme.md +66 -0
  80. package/node_modules/ansi-styles/index.d.ts +236 -0
  81. package/node_modules/ansi-styles/index.js +223 -0
  82. package/node_modules/ansi-styles/license +9 -0
  83. package/node_modules/ansi-styles/package.json +54 -0
  84. package/node_modules/ansi-styles/readme.md +173 -0
  85. package/node_modules/boxen/index.d.ts +267 -0
  86. package/node_modules/boxen/index.js +376 -0
  87. package/node_modules/boxen/license +9 -0
  88. package/node_modules/boxen/package.json +69 -0
  89. package/node_modules/boxen/readme.md +300 -0
  90. package/node_modules/camelcase/index.d.ts +102 -0
  91. package/node_modules/camelcase/index.js +110 -0
  92. package/node_modules/camelcase/license +9 -0
  93. package/node_modules/camelcase/package.json +47 -0
  94. package/node_modules/camelcase/readme.md +135 -0
  95. package/node_modules/chalk/license +9 -0
  96. package/node_modules/chalk/package.json +83 -0
  97. package/node_modules/chalk/readme.md +297 -0
  98. package/node_modules/chalk/source/index.d.ts +325 -0
  99. package/node_modules/chalk/source/index.js +225 -0
  100. package/node_modules/chalk/source/utilities.js +33 -0
  101. package/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +236 -0
  102. package/node_modules/chalk/source/vendor/ansi-styles/index.js +223 -0
  103. package/node_modules/chalk/source/vendor/supports-color/browser.d.ts +1 -0
  104. package/node_modules/chalk/source/vendor/supports-color/browser.js +34 -0
  105. package/node_modules/chalk/source/vendor/supports-color/index.d.ts +55 -0
  106. package/node_modules/chalk/source/vendor/supports-color/index.js +190 -0
  107. package/node_modules/cli-boxes/boxes.json +82 -0
  108. package/node_modules/cli-boxes/index.d.ts +127 -0
  109. package/node_modules/cli-boxes/index.js +6 -0
  110. package/node_modules/cli-boxes/license +9 -0
  111. package/node_modules/cli-boxes/package.json +42 -0
  112. package/node_modules/cli-boxes/readme.md +115 -0
  113. package/node_modules/cli-table3/LICENSE +21 -0
  114. package/node_modules/cli-table3/README.md +236 -0
  115. package/node_modules/cli-table3/index.d.ts +96 -0
  116. package/node_modules/cli-table3/index.js +1 -0
  117. package/node_modules/cli-table3/node_modules/ansi-regex/index.d.ts +37 -0
  118. package/node_modules/cli-table3/node_modules/ansi-regex/index.js +10 -0
  119. package/node_modules/cli-table3/node_modules/ansi-regex/license +9 -0
  120. package/node_modules/cli-table3/node_modules/ansi-regex/package.json +55 -0
  121. package/node_modules/cli-table3/node_modules/ansi-regex/readme.md +78 -0
  122. package/node_modules/cli-table3/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
  123. package/node_modules/cli-table3/node_modules/emoji-regex/README.md +73 -0
  124. package/node_modules/cli-table3/node_modules/emoji-regex/es2015/index.js +6 -0
  125. package/node_modules/cli-table3/node_modules/emoji-regex/es2015/text.js +6 -0
  126. package/node_modules/cli-table3/node_modules/emoji-regex/index.d.ts +23 -0
  127. package/node_modules/cli-table3/node_modules/emoji-regex/index.js +6 -0
  128. package/node_modules/cli-table3/node_modules/emoji-regex/package.json +50 -0
  129. package/node_modules/cli-table3/node_modules/emoji-regex/text.js +6 -0
  130. package/node_modules/cli-table3/node_modules/string-width/index.d.ts +29 -0
  131. package/node_modules/cli-table3/node_modules/string-width/index.js +47 -0
  132. package/node_modules/cli-table3/node_modules/string-width/license +9 -0
  133. package/node_modules/cli-table3/node_modules/string-width/package.json +56 -0
  134. package/node_modules/cli-table3/node_modules/string-width/readme.md +50 -0
  135. package/node_modules/cli-table3/node_modules/strip-ansi/index.d.ts +17 -0
  136. package/node_modules/cli-table3/node_modules/strip-ansi/index.js +4 -0
  137. package/node_modules/cli-table3/node_modules/strip-ansi/license +9 -0
  138. package/node_modules/cli-table3/node_modules/strip-ansi/package.json +54 -0
  139. package/node_modules/cli-table3/node_modules/strip-ansi/readme.md +46 -0
  140. package/node_modules/cli-table3/package.json +100 -0
  141. package/node_modules/cli-table3/src/cell.js +409 -0
  142. package/node_modules/cli-table3/src/debug.js +28 -0
  143. package/node_modules/cli-table3/src/layout-manager.js +254 -0
  144. package/node_modules/cli-table3/src/table.js +106 -0
  145. package/node_modules/cli-table3/src/utils.js +344 -0
  146. package/node_modules/commander/LICENSE +22 -0
  147. package/node_modules/commander/Readme.md +1157 -0
  148. package/node_modules/commander/esm.mjs +16 -0
  149. package/node_modules/commander/index.js +24 -0
  150. package/node_modules/commander/lib/argument.js +149 -0
  151. package/node_modules/commander/lib/command.js +2509 -0
  152. package/node_modules/commander/lib/error.js +39 -0
  153. package/node_modules/commander/lib/help.js +520 -0
  154. package/node_modules/commander/lib/option.js +330 -0
  155. package/node_modules/commander/lib/suggestSimilar.js +101 -0
  156. package/node_modules/commander/package-support.json +16 -0
  157. package/node_modules/commander/package.json +84 -0
  158. package/node_modules/commander/typings/esm.d.mts +3 -0
  159. package/node_modules/commander/typings/index.d.ts +969 -0
  160. package/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
  161. package/node_modules/emoji-regex/README.md +107 -0
  162. package/node_modules/emoji-regex/index.d.ts +3 -0
  163. package/node_modules/emoji-regex/index.js +4 -0
  164. package/node_modules/emoji-regex/index.mjs +4 -0
  165. package/node_modules/emoji-regex/package.json +45 -0
  166. package/node_modules/get-east-asian-width/index.d.ts +60 -0
  167. package/node_modules/get-east-asian-width/index.js +30 -0
  168. package/node_modules/get-east-asian-width/license +9 -0
  169. package/node_modules/get-east-asian-width/lookup-data.js +18 -0
  170. package/node_modules/get-east-asian-width/lookup.js +135 -0
  171. package/node_modules/get-east-asian-width/package.json +71 -0
  172. package/node_modules/get-east-asian-width/readme.md +65 -0
  173. package/node_modules/get-east-asian-width/utilities.js +24 -0
  174. package/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
  175. package/node_modules/is-fullwidth-code-point/index.js +50 -0
  176. package/node_modules/is-fullwidth-code-point/license +9 -0
  177. package/node_modules/is-fullwidth-code-point/package.json +42 -0
  178. package/node_modules/is-fullwidth-code-point/readme.md +39 -0
  179. package/node_modules/isbinaryfile/LICENSE.txt +22 -0
  180. package/node_modules/isbinaryfile/README.md +70 -0
  181. package/node_modules/isbinaryfile/lib/index.d.ts +3 -0
  182. package/node_modules/isbinaryfile/lib/index.js +256 -0
  183. package/node_modules/isbinaryfile/package.json +64 -0
  184. package/node_modules/string-width/index.d.ts +39 -0
  185. package/node_modules/string-width/index.js +82 -0
  186. package/node_modules/string-width/license +9 -0
  187. package/node_modules/string-width/package.json +64 -0
  188. package/node_modules/string-width/readme.md +66 -0
  189. package/node_modules/strip-ansi/index.d.ts +15 -0
  190. package/node_modules/strip-ansi/index.js +19 -0
  191. package/node_modules/strip-ansi/license +9 -0
  192. package/node_modules/strip-ansi/package.json +59 -0
  193. package/node_modules/strip-ansi/readme.md +37 -0
  194. package/node_modules/type-fest/index.d.ts +178 -0
  195. package/node_modules/type-fest/license-cc0 +121 -0
  196. package/node_modules/type-fest/license-mit +9 -0
  197. package/node_modules/type-fest/package.json +91 -0
  198. package/node_modules/type-fest/readme.md +1060 -0
  199. package/node_modules/type-fest/source/all-union-fields.d.ts +88 -0
  200. package/node_modules/type-fest/source/and.d.ts +25 -0
  201. package/node_modules/type-fest/source/array-indices.d.ts +23 -0
  202. package/node_modules/type-fest/source/array-slice.d.ts +109 -0
  203. package/node_modules/type-fest/source/array-splice.d.ts +99 -0
  204. package/node_modules/type-fest/source/array-tail.d.ts +76 -0
  205. package/node_modules/type-fest/source/array-values.d.ts +22 -0
  206. package/node_modules/type-fest/source/arrayable.d.ts +29 -0
  207. package/node_modules/type-fest/source/async-return-type.d.ts +23 -0
  208. package/node_modules/type-fest/source/asyncify.d.ts +32 -0
  209. package/node_modules/type-fest/source/basic.d.ts +68 -0
  210. package/node_modules/type-fest/source/camel-case.d.ts +89 -0
  211. package/node_modules/type-fest/source/camel-cased-properties-deep.d.ts +97 -0
  212. package/node_modules/type-fest/source/camel-cased-properties.d.ts +43 -0
  213. package/node_modules/type-fest/source/conditional-except.d.ts +45 -0
  214. package/node_modules/type-fest/source/conditional-keys.d.ts +47 -0
  215. package/node_modules/type-fest/source/conditional-pick-deep.d.ts +118 -0
  216. package/node_modules/type-fest/source/conditional-pick.d.ts +44 -0
  217. package/node_modules/type-fest/source/conditional-simplify.d.ts +32 -0
  218. package/node_modules/type-fest/source/delimiter-case.d.ts +78 -0
  219. package/node_modules/type-fest/source/delimiter-cased-properties-deep.d.ts +106 -0
  220. package/node_modules/type-fest/source/delimiter-cased-properties.d.ts +46 -0
  221. package/node_modules/type-fest/source/distributed-omit.d.ts +89 -0
  222. package/node_modules/type-fest/source/distributed-pick.d.ts +85 -0
  223. package/node_modules/type-fest/source/empty-object.d.ts +46 -0
  224. package/node_modules/type-fest/source/enforce-optional.d.ts +47 -0
  225. package/node_modules/type-fest/source/entries.d.ts +62 -0
  226. package/node_modules/type-fest/source/entry.d.ts +65 -0
  227. package/node_modules/type-fest/source/exact.d.ts +68 -0
  228. package/node_modules/type-fest/source/except.d.ts +108 -0
  229. package/node_modules/type-fest/source/find-global-type.d.ts +64 -0
  230. package/node_modules/type-fest/source/fixed-length-array.d.ts +43 -0
  231. package/node_modules/type-fest/source/get.d.ts +219 -0
  232. package/node_modules/type-fest/source/global-this.d.ts +21 -0
  233. package/node_modules/type-fest/source/greater-than-or-equal.d.ts +22 -0
  234. package/node_modules/type-fest/source/greater-than.d.ts +56 -0
  235. package/node_modules/type-fest/source/has-optional-keys.d.ts +21 -0
  236. package/node_modules/type-fest/source/has-readonly-keys.d.ts +21 -0
  237. package/node_modules/type-fest/source/has-required-keys.d.ts +59 -0
  238. package/node_modules/type-fest/source/has-writable-keys.d.ts +21 -0
  239. package/node_modules/type-fest/source/if-any.d.ts +24 -0
  240. package/node_modules/type-fest/source/if-empty-object.d.ts +26 -0
  241. package/node_modules/type-fest/source/if-never.d.ts +24 -0
  242. package/node_modules/type-fest/source/if-null.d.ts +24 -0
  243. package/node_modules/type-fest/source/if-unknown.d.ts +24 -0
  244. package/node_modules/type-fest/source/includes.d.ts +22 -0
  245. package/node_modules/type-fest/source/int-closed-range.d.ts +35 -0
  246. package/node_modules/type-fest/source/int-range.d.ts +55 -0
  247. package/node_modules/type-fest/source/internal/array.d.ts +126 -0
  248. package/node_modules/type-fest/source/internal/characters.d.ts +67 -0
  249. package/node_modules/type-fest/source/internal/index.d.ts +8 -0
  250. package/node_modules/type-fest/source/internal/keys.d.ts +97 -0
  251. package/node_modules/type-fest/source/internal/numeric.d.ts +118 -0
  252. package/node_modules/type-fest/source/internal/object.d.ts +236 -0
  253. package/node_modules/type-fest/source/internal/string.d.ts +210 -0
  254. package/node_modules/type-fest/source/internal/tuple.d.ts +90 -0
  255. package/node_modules/type-fest/source/internal/type.d.ts +139 -0
  256. package/node_modules/type-fest/source/invariant-of.d.ts +76 -0
  257. package/node_modules/type-fest/source/is-any.d.ts +33 -0
  258. package/node_modules/type-fest/source/is-equal.d.ts +31 -0
  259. package/node_modules/type-fest/source/is-float.d.ts +41 -0
  260. package/node_modules/type-fest/source/is-integer.d.ts +58 -0
  261. package/node_modules/type-fest/source/is-literal.d.ts +296 -0
  262. package/node_modules/type-fest/source/is-never.d.ts +42 -0
  263. package/node_modules/type-fest/source/is-null.d.ts +20 -0
  264. package/node_modules/type-fest/source/is-tuple.d.ts +89 -0
  265. package/node_modules/type-fest/source/is-unknown.d.ts +52 -0
  266. package/node_modules/type-fest/source/iterable-element.d.ts +64 -0
  267. package/node_modules/type-fest/source/join.d.ts +68 -0
  268. package/node_modules/type-fest/source/jsonifiable.d.ts +37 -0
  269. package/node_modules/type-fest/source/jsonify.d.ts +122 -0
  270. package/node_modules/type-fest/source/kebab-case.d.ts +44 -0
  271. package/node_modules/type-fest/source/kebab-cased-properties-deep.d.ts +63 -0
  272. package/node_modules/type-fest/source/kebab-cased-properties.d.ts +40 -0
  273. package/node_modules/type-fest/source/keys-of-union.d.ts +42 -0
  274. package/node_modules/type-fest/source/last-array-element.d.ts +38 -0
  275. package/node_modules/type-fest/source/less-than-or-equal.d.ts +22 -0
  276. package/node_modules/type-fest/source/less-than.d.ts +26 -0
  277. package/node_modules/type-fest/source/literal-to-primitive-deep.d.ts +36 -0
  278. package/node_modules/type-fest/source/literal-to-primitive.d.ts +36 -0
  279. package/node_modules/type-fest/source/literal-union.d.ts +37 -0
  280. package/node_modules/type-fest/source/merge-deep.d.ts +486 -0
  281. package/node_modules/type-fest/source/merge-exclusive.d.ts +41 -0
  282. package/node_modules/type-fest/source/merge.d.ts +48 -0
  283. package/node_modules/type-fest/source/multidimensional-array.d.ts +44 -0
  284. package/node_modules/type-fest/source/multidimensional-readonly-array.d.ts +48 -0
  285. package/node_modules/type-fest/source/non-empty-object.d.ts +35 -0
  286. package/node_modules/type-fest/source/non-empty-string.d.ts +28 -0
  287. package/node_modules/type-fest/source/non-empty-tuple.d.ts +21 -0
  288. package/node_modules/type-fest/source/numeric.d.ts +222 -0
  289. package/node_modules/type-fest/source/observable-like.d.ts +63 -0
  290. package/node_modules/type-fest/source/omit-deep.d.ts +167 -0
  291. package/node_modules/type-fest/source/omit-index-signature.d.ts +95 -0
  292. package/node_modules/type-fest/source/opaque.d.ts +1 -0
  293. package/node_modules/type-fest/source/optional-keys-of.d.ts +39 -0
  294. package/node_modules/type-fest/source/or.d.ts +25 -0
  295. package/node_modules/type-fest/source/override-properties.d.ts +36 -0
  296. package/node_modules/type-fest/source/package-json.d.ts +676 -0
  297. package/node_modules/type-fest/source/partial-deep.d.ts +151 -0
  298. package/node_modules/type-fest/source/partial-on-undefined-deep.d.ts +78 -0
  299. package/node_modules/type-fest/source/pascal-case.d.ts +42 -0
  300. package/node_modules/type-fest/source/pascal-cased-properties-deep.d.ts +62 -0
  301. package/node_modules/type-fest/source/pascal-cased-properties.d.ts +36 -0
  302. package/node_modules/type-fest/source/paths.d.ts +262 -0
  303. package/node_modules/type-fest/source/pick-deep.d.ts +149 -0
  304. package/node_modules/type-fest/source/pick-index-signature.d.ts +50 -0
  305. package/node_modules/type-fest/source/primitive.d.ts +13 -0
  306. package/node_modules/type-fest/source/promisable.d.ts +25 -0
  307. package/node_modules/type-fest/source/readonly-deep.d.ts +81 -0
  308. package/node_modules/type-fest/source/readonly-keys-of.d.ts +30 -0
  309. package/node_modules/type-fest/source/readonly-tuple.d.ts +41 -0
  310. package/node_modules/type-fest/source/replace.d.ts +85 -0
  311. package/node_modules/type-fest/source/require-all-or-none.d.ts +51 -0
  312. package/node_modules/type-fest/source/require-at-least-one.d.ts +47 -0
  313. package/node_modules/type-fest/source/require-exactly-one.d.ts +45 -0
  314. package/node_modules/type-fest/source/require-one-or-none.d.ts +46 -0
  315. package/node_modules/type-fest/source/required-deep.d.ts +78 -0
  316. package/node_modules/type-fest/source/required-keys-of.d.ts +30 -0
  317. package/node_modules/type-fest/source/schema.d.ts +114 -0
  318. package/node_modules/type-fest/source/screaming-snake-case.d.ts +28 -0
  319. package/node_modules/type-fest/source/set-field-type.d.ts +65 -0
  320. package/node_modules/type-fest/source/set-non-nullable-deep.d.ts +83 -0
  321. package/node_modules/type-fest/source/set-non-nullable.d.ts +39 -0
  322. package/node_modules/type-fest/source/set-optional.d.ts +38 -0
  323. package/node_modules/type-fest/source/set-parameter-type.d.ts +117 -0
  324. package/node_modules/type-fest/source/set-readonly.d.ts +39 -0
  325. package/node_modules/type-fest/source/set-required-deep.d.ts +68 -0
  326. package/node_modules/type-fest/source/set-required.d.ts +70 -0
  327. package/node_modules/type-fest/source/set-return-type.d.ts +29 -0
  328. package/node_modules/type-fest/source/shared-union-fields-deep.d.ts +178 -0
  329. package/node_modules/type-fest/source/shared-union-fields.d.ts +76 -0
  330. package/node_modules/type-fest/source/simplify-deep.d.ts +115 -0
  331. package/node_modules/type-fest/source/simplify.d.ts +58 -0
  332. package/node_modules/type-fest/source/single-key-object.d.ts +29 -0
  333. package/node_modules/type-fest/source/snake-case.d.ts +45 -0
  334. package/node_modules/type-fest/source/snake-cased-properties-deep.d.ts +63 -0
  335. package/node_modules/type-fest/source/snake-cased-properties.d.ts +40 -0
  336. package/node_modules/type-fest/source/split.d.ts +88 -0
  337. package/node_modules/type-fest/source/spread.d.ts +84 -0
  338. package/node_modules/type-fest/source/string-key-of.d.ts +25 -0
  339. package/node_modules/type-fest/source/string-repeat.d.ts +47 -0
  340. package/node_modules/type-fest/source/string-slice.d.ts +37 -0
  341. package/node_modules/type-fest/source/stringified.d.ts +23 -0
  342. package/node_modules/type-fest/source/structured-cloneable.d.ts +92 -0
  343. package/node_modules/type-fest/source/subtract.d.ts +83 -0
  344. package/node_modules/type-fest/source/sum.d.ts +78 -0
  345. package/node_modules/type-fest/source/tagged-union.d.ts +51 -0
  346. package/node_modules/type-fest/source/tagged.d.ts +256 -0
  347. package/node_modules/type-fest/source/trim.d.ts +27 -0
  348. package/node_modules/type-fest/source/tsconfig-json.d.ts +1294 -0
  349. package/node_modules/type-fest/source/tuple-to-object.d.ts +42 -0
  350. package/node_modules/type-fest/source/tuple-to-union.d.ts +51 -0
  351. package/node_modules/type-fest/source/typed-array.d.ts +17 -0
  352. package/node_modules/type-fest/source/undefined-on-partial-deep.d.ts +80 -0
  353. package/node_modules/type-fest/source/union-to-intersection.d.ts +61 -0
  354. package/node_modules/type-fest/source/union-to-tuple.d.ts +56 -0
  355. package/node_modules/type-fest/source/unknown-array.d.ts +25 -0
  356. package/node_modules/type-fest/source/unknown-map.d.ts +24 -0
  357. package/node_modules/type-fest/source/unknown-record.d.ts +31 -0
  358. package/node_modules/type-fest/source/unknown-set.d.ts +24 -0
  359. package/node_modules/type-fest/source/value-of.d.ts +42 -0
  360. package/node_modules/type-fest/source/words.d.ts +118 -0
  361. package/node_modules/type-fest/source/writable-deep.d.ts +83 -0
  362. package/node_modules/type-fest/source/writable-keys-of.d.ts +33 -0
  363. package/node_modules/type-fest/source/writable.d.ts +68 -0
  364. package/node_modules/widest-line/index.d.ts +12 -0
  365. package/node_modules/widest-line/index.js +11 -0
  366. package/node_modules/widest-line/license +9 -0
  367. package/node_modules/widest-line/package.json +60 -0
  368. package/node_modules/widest-line/readme.md +26 -0
  369. package/node_modules/wrap-ansi/index.d.ts +41 -0
  370. package/node_modules/wrap-ansi/index.js +222 -0
  371. package/node_modules/wrap-ansi/license +9 -0
  372. package/node_modules/wrap-ansi/package.json +69 -0
  373. package/node_modules/wrap-ansi/readme.md +75 -0
  374. package/package.json +78 -0
  375. package/scripts/postinstall.cjs +122 -0
@@ -0,0 +1,33 @@
1
+ export type Options = {
2
+ /**
3
+ Match only the first ANSI escape.
4
+
5
+ @default false
6
+ */
7
+ readonly onlyFirst: boolean;
8
+ };
9
+
10
+ /**
11
+ Regular expression for matching ANSI escape codes.
12
+
13
+ @example
14
+ ```
15
+ import ansiRegex from 'ansi-regex';
16
+
17
+ ansiRegex().test('\u001B[4mcake\u001B[0m');
18
+ //=> true
19
+
20
+ ansiRegex().test('cake');
21
+ //=> false
22
+
23
+ '\u001B[4mcake\u001B[0m'.match(ansiRegex());
24
+ //=> ['\u001B[4m', '\u001B[0m']
25
+
26
+ '\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
27
+ //=> ['\u001B[4m']
28
+
29
+ '\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
30
+ //=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
31
+ ```
32
+ */
33
+ export default function ansiRegex(options?: Options): RegExp;
@@ -0,0 +1,14 @@
1
+ export default function ansiRegex({onlyFirst = false} = {}) {
2
+ // Valid string terminator sequences are BEL, ESC\, and 0x9c
3
+ const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)';
4
+
5
+ // OSC sequences only: ESC ] ... ST (non-greedy until the first ST)
6
+ const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
7
+
8
+ // CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte
9
+ const csi = '[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]';
10
+
11
+ const pattern = `${osc}|${csi}`;
12
+
13
+ return new RegExp(pattern, onlyFirst ? undefined : 'g');
14
+ }
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "ansi-regex",
3
+ "version": "6.2.2",
4
+ "description": "Regular expression for matching ANSI escape codes",
5
+ "license": "MIT",
6
+ "repository": "chalk/ansi-regex",
7
+ "funding": "https://github.com/chalk/ansi-regex?sponsor=1",
8
+ "author": {
9
+ "name": "Sindre Sorhus",
10
+ "email": "sindresorhus@gmail.com",
11
+ "url": "https://sindresorhus.com"
12
+ },
13
+ "type": "module",
14
+ "exports": "./index.js",
15
+ "types": "./index.d.ts",
16
+ "sideEffects": false,
17
+ "engines": {
18
+ "node": ">=12"
19
+ },
20
+ "scripts": {
21
+ "test": "xo && ava && tsd",
22
+ "view-supported": "node fixtures/view-codes.js"
23
+ },
24
+ "files": [
25
+ "index.js",
26
+ "index.d.ts"
27
+ ],
28
+ "keywords": [
29
+ "ansi",
30
+ "styles",
31
+ "color",
32
+ "colour",
33
+ "colors",
34
+ "terminal",
35
+ "console",
36
+ "cli",
37
+ "string",
38
+ "tty",
39
+ "escape",
40
+ "formatting",
41
+ "rgb",
42
+ "256",
43
+ "shell",
44
+ "xterm",
45
+ "command-line",
46
+ "text",
47
+ "regex",
48
+ "regexp",
49
+ "re",
50
+ "match",
51
+ "test",
52
+ "find",
53
+ "pattern"
54
+ ],
55
+ "devDependencies": {
56
+ "ansi-escapes": "^5.0.0",
57
+ "ava": "^3.15.0",
58
+ "tsd": "^0.21.0",
59
+ "xo": "^0.54.2"
60
+ }
61
+ }
@@ -0,0 +1,66 @@
1
+ # ansi-regex
2
+
3
+ > Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm install ansi-regex
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```js
14
+ import ansiRegex from 'ansi-regex';
15
+
16
+ ansiRegex().test('\u001B[4mcake\u001B[0m');
17
+ //=> true
18
+
19
+ ansiRegex().test('cake');
20
+ //=> false
21
+
22
+ '\u001B[4mcake\u001B[0m'.match(ansiRegex());
23
+ //=> ['\u001B[4m', '\u001B[0m']
24
+
25
+ '\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
26
+ //=> ['\u001B[4m']
27
+
28
+ '\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
29
+ //=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
30
+ ```
31
+
32
+ ## API
33
+
34
+ ### ansiRegex(options?)
35
+
36
+ Returns a regex for matching ANSI escape codes.
37
+
38
+ #### options
39
+
40
+ Type: `object`
41
+
42
+ ##### onlyFirst
43
+
44
+ Type: `boolean`\
45
+ Default: `false` *(Matches any ANSI escape codes in a string)*
46
+
47
+ Match only the first ANSI escape.
48
+
49
+ ## Important
50
+
51
+ If you run the regex against untrusted user input in a server context, you should [give it a timeout](https://github.com/sindresorhus/super-regex).
52
+
53
+ **I do not consider [ReDoS](https://blog.yossarian.net/2022/12/28/ReDoS-vulnerabilities-and-misaligned-incentives) a valid vulnerability for this package.**
54
+
55
+ ## FAQ
56
+
57
+ ### Why do you test for codes not in the ECMA 48 standard?
58
+
59
+ Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
60
+
61
+ On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
62
+
63
+ ## Maintainers
64
+
65
+ - [Sindre Sorhus](https://github.com/sindresorhus)
66
+ - [Josh Junon](https://github.com/qix-)
@@ -0,0 +1,236 @@
1
+ export type CSPair = { // eslint-disable-line @typescript-eslint/naming-convention
2
+ /**
3
+ The ANSI terminal control sequence for starting this style.
4
+ */
5
+ readonly open: string;
6
+
7
+ /**
8
+ The ANSI terminal control sequence for ending this style.
9
+ */
10
+ readonly close: string;
11
+ };
12
+
13
+ export type ColorBase = {
14
+ /**
15
+ The ANSI terminal control sequence for ending this color.
16
+ */
17
+ readonly close: string;
18
+
19
+ ansi(code: number): string;
20
+
21
+ ansi256(code: number): string;
22
+
23
+ ansi16m(red: number, green: number, blue: number): string;
24
+ };
25
+
26
+ export type Modifier = {
27
+ /**
28
+ Resets the current color chain.
29
+ */
30
+ readonly reset: CSPair;
31
+
32
+ /**
33
+ Make text bold.
34
+ */
35
+ readonly bold: CSPair;
36
+
37
+ /**
38
+ Emitting only a small amount of light.
39
+ */
40
+ readonly dim: CSPair;
41
+
42
+ /**
43
+ Make text italic. (Not widely supported)
44
+ */
45
+ readonly italic: CSPair;
46
+
47
+ /**
48
+ Make text underline. (Not widely supported)
49
+ */
50
+ readonly underline: CSPair;
51
+
52
+ /**
53
+ Make text overline.
54
+
55
+ Supported on VTE-based terminals, the GNOME terminal, mintty, and Git Bash.
56
+ */
57
+ readonly overline: CSPair;
58
+
59
+ /**
60
+ Inverse background and foreground colors.
61
+ */
62
+ readonly inverse: CSPair;
63
+
64
+ /**
65
+ Prints the text, but makes it invisible.
66
+ */
67
+ readonly hidden: CSPair;
68
+
69
+ /**
70
+ Puts a horizontal line through the center of the text. (Not widely supported)
71
+ */
72
+ readonly strikethrough: CSPair;
73
+ };
74
+
75
+ export type ForegroundColor = {
76
+ readonly black: CSPair;
77
+ readonly red: CSPair;
78
+ readonly green: CSPair;
79
+ readonly yellow: CSPair;
80
+ readonly blue: CSPair;
81
+ readonly cyan: CSPair;
82
+ readonly magenta: CSPair;
83
+ readonly white: CSPair;
84
+
85
+ /**
86
+ Alias for `blackBright`.
87
+ */
88
+ readonly gray: CSPair;
89
+
90
+ /**
91
+ Alias for `blackBright`.
92
+ */
93
+ readonly grey: CSPair;
94
+
95
+ readonly blackBright: CSPair;
96
+ readonly redBright: CSPair;
97
+ readonly greenBright: CSPair;
98
+ readonly yellowBright: CSPair;
99
+ readonly blueBright: CSPair;
100
+ readonly cyanBright: CSPair;
101
+ readonly magentaBright: CSPair;
102
+ readonly whiteBright: CSPair;
103
+ };
104
+
105
+ export type BackgroundColor = {
106
+ readonly bgBlack: CSPair;
107
+ readonly bgRed: CSPair;
108
+ readonly bgGreen: CSPair;
109
+ readonly bgYellow: CSPair;
110
+ readonly bgBlue: CSPair;
111
+ readonly bgCyan: CSPair;
112
+ readonly bgMagenta: CSPair;
113
+ readonly bgWhite: CSPair;
114
+
115
+ /**
116
+ Alias for `bgBlackBright`.
117
+ */
118
+ readonly bgGray: CSPair;
119
+
120
+ /**
121
+ Alias for `bgBlackBright`.
122
+ */
123
+ readonly bgGrey: CSPair;
124
+
125
+ readonly bgBlackBright: CSPair;
126
+ readonly bgRedBright: CSPair;
127
+ readonly bgGreenBright: CSPair;
128
+ readonly bgYellowBright: CSPair;
129
+ readonly bgBlueBright: CSPair;
130
+ readonly bgCyanBright: CSPair;
131
+ readonly bgMagentaBright: CSPair;
132
+ readonly bgWhiteBright: CSPair;
133
+ };
134
+
135
+ export type ConvertColor = {
136
+ /**
137
+ Convert from the RGB color space to the ANSI 256 color space.
138
+
139
+ @param red - (`0...255`)
140
+ @param green - (`0...255`)
141
+ @param blue - (`0...255`)
142
+ */
143
+ rgbToAnsi256(red: number, green: number, blue: number): number;
144
+
145
+ /**
146
+ Convert from the RGB HEX color space to the RGB color space.
147
+
148
+ @param hex - A hexadecimal string containing RGB data.
149
+ */
150
+ hexToRgb(hex: string): [red: number, green: number, blue: number];
151
+
152
+ /**
153
+ Convert from the RGB HEX color space to the ANSI 256 color space.
154
+
155
+ @param hex - A hexadecimal string containing RGB data.
156
+ */
157
+ hexToAnsi256(hex: string): number;
158
+
159
+ /**
160
+ Convert from the ANSI 256 color space to the ANSI 16 color space.
161
+
162
+ @param code - A number representing the ANSI 256 color.
163
+ */
164
+ ansi256ToAnsi(code: number): number;
165
+
166
+ /**
167
+ Convert from the RGB color space to the ANSI 16 color space.
168
+
169
+ @param red - (`0...255`)
170
+ @param green - (`0...255`)
171
+ @param blue - (`0...255`)
172
+ */
173
+ rgbToAnsi(red: number, green: number, blue: number): number;
174
+
175
+ /**
176
+ Convert from the RGB HEX color space to the ANSI 16 color space.
177
+
178
+ @param hex - A hexadecimal string containing RGB data.
179
+ */
180
+ hexToAnsi(hex: string): number;
181
+ };
182
+
183
+ /**
184
+ Basic modifier names.
185
+ */
186
+ export type ModifierName = keyof Modifier;
187
+
188
+ /**
189
+ Basic foreground color names.
190
+
191
+ [More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support)
192
+ */
193
+ export type ForegroundColorName = keyof ForegroundColor;
194
+
195
+ /**
196
+ Basic background color names.
197
+
198
+ [More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support)
199
+ */
200
+ export type BackgroundColorName = keyof BackgroundColor;
201
+
202
+ /**
203
+ Basic color names. The combination of foreground and background color names.
204
+
205
+ [More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support)
206
+ */
207
+ export type ColorName = ForegroundColorName | BackgroundColorName;
208
+
209
+ /**
210
+ Basic modifier names.
211
+ */
212
+ export const modifierNames: readonly ModifierName[];
213
+
214
+ /**
215
+ Basic foreground color names.
216
+ */
217
+ export const foregroundColorNames: readonly ForegroundColorName[];
218
+
219
+ /**
220
+ Basic background color names.
221
+ */
222
+ export const backgroundColorNames: readonly BackgroundColorName[];
223
+
224
+ /*
225
+ Basic color names. The combination of foreground and background color names.
226
+ */
227
+ export const colorNames: readonly ColorName[];
228
+
229
+ declare const ansiStyles: {
230
+ readonly modifier: Modifier;
231
+ readonly color: ColorBase & ForegroundColor;
232
+ readonly bgColor: ColorBase & BackgroundColor;
233
+ readonly codes: ReadonlyMap<number, number>;
234
+ } & ForegroundColor & BackgroundColor & Modifier & ConvertColor;
235
+
236
+ export default ansiStyles;
@@ -0,0 +1,223 @@
1
+ const ANSI_BACKGROUND_OFFSET = 10;
2
+
3
+ const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`;
4
+
5
+ const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
6
+
7
+ const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
8
+
9
+ const styles = {
10
+ modifier: {
11
+ reset: [0, 0],
12
+ // 21 isn't widely supported and 22 does the same thing
13
+ bold: [1, 22],
14
+ dim: [2, 22],
15
+ italic: [3, 23],
16
+ underline: [4, 24],
17
+ overline: [53, 55],
18
+ inverse: [7, 27],
19
+ hidden: [8, 28],
20
+ strikethrough: [9, 29],
21
+ },
22
+ color: {
23
+ black: [30, 39],
24
+ red: [31, 39],
25
+ green: [32, 39],
26
+ yellow: [33, 39],
27
+ blue: [34, 39],
28
+ magenta: [35, 39],
29
+ cyan: [36, 39],
30
+ white: [37, 39],
31
+
32
+ // Bright color
33
+ blackBright: [90, 39],
34
+ gray: [90, 39], // Alias of `blackBright`
35
+ grey: [90, 39], // Alias of `blackBright`
36
+ redBright: [91, 39],
37
+ greenBright: [92, 39],
38
+ yellowBright: [93, 39],
39
+ blueBright: [94, 39],
40
+ magentaBright: [95, 39],
41
+ cyanBright: [96, 39],
42
+ whiteBright: [97, 39],
43
+ },
44
+ bgColor: {
45
+ bgBlack: [40, 49],
46
+ bgRed: [41, 49],
47
+ bgGreen: [42, 49],
48
+ bgYellow: [43, 49],
49
+ bgBlue: [44, 49],
50
+ bgMagenta: [45, 49],
51
+ bgCyan: [46, 49],
52
+ bgWhite: [47, 49],
53
+
54
+ // Bright color
55
+ bgBlackBright: [100, 49],
56
+ bgGray: [100, 49], // Alias of `bgBlackBright`
57
+ bgGrey: [100, 49], // Alias of `bgBlackBright`
58
+ bgRedBright: [101, 49],
59
+ bgGreenBright: [102, 49],
60
+ bgYellowBright: [103, 49],
61
+ bgBlueBright: [104, 49],
62
+ bgMagentaBright: [105, 49],
63
+ bgCyanBright: [106, 49],
64
+ bgWhiteBright: [107, 49],
65
+ },
66
+ };
67
+
68
+ export const modifierNames = Object.keys(styles.modifier);
69
+ export const foregroundColorNames = Object.keys(styles.color);
70
+ export const backgroundColorNames = Object.keys(styles.bgColor);
71
+ export const colorNames = [...foregroundColorNames, ...backgroundColorNames];
72
+
73
+ function assembleStyles() {
74
+ const codes = new Map();
75
+
76
+ for (const [groupName, group] of Object.entries(styles)) {
77
+ for (const [styleName, style] of Object.entries(group)) {
78
+ styles[styleName] = {
79
+ open: `\u001B[${style[0]}m`,
80
+ close: `\u001B[${style[1]}m`,
81
+ };
82
+
83
+ group[styleName] = styles[styleName];
84
+
85
+ codes.set(style[0], style[1]);
86
+ }
87
+
88
+ Object.defineProperty(styles, groupName, {
89
+ value: group,
90
+ enumerable: false,
91
+ });
92
+ }
93
+
94
+ Object.defineProperty(styles, 'codes', {
95
+ value: codes,
96
+ enumerable: false,
97
+ });
98
+
99
+ styles.color.close = '\u001B[39m';
100
+ styles.bgColor.close = '\u001B[49m';
101
+
102
+ styles.color.ansi = wrapAnsi16();
103
+ styles.color.ansi256 = wrapAnsi256();
104
+ styles.color.ansi16m = wrapAnsi16m();
105
+ styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
106
+ styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
107
+ styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
108
+
109
+ // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
110
+ Object.defineProperties(styles, {
111
+ rgbToAnsi256: {
112
+ value(red, green, blue) {
113
+ // We use the extended greyscale palette here, with the exception of
114
+ // black and white. normal palette only has 4 greyscale shades.
115
+ if (red === green && green === blue) {
116
+ if (red < 8) {
117
+ return 16;
118
+ }
119
+
120
+ if (red > 248) {
121
+ return 231;
122
+ }
123
+
124
+ return Math.round(((red - 8) / 247) * 24) + 232;
125
+ }
126
+
127
+ return 16
128
+ + (36 * Math.round(red / 255 * 5))
129
+ + (6 * Math.round(green / 255 * 5))
130
+ + Math.round(blue / 255 * 5);
131
+ },
132
+ enumerable: false,
133
+ },
134
+ hexToRgb: {
135
+ value(hex) {
136
+ const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
137
+ if (!matches) {
138
+ return [0, 0, 0];
139
+ }
140
+
141
+ let [colorString] = matches;
142
+
143
+ if (colorString.length === 3) {
144
+ colorString = [...colorString].map(character => character + character).join('');
145
+ }
146
+
147
+ const integer = Number.parseInt(colorString, 16);
148
+
149
+ return [
150
+ /* eslint-disable no-bitwise */
151
+ (integer >> 16) & 0xFF,
152
+ (integer >> 8) & 0xFF,
153
+ integer & 0xFF,
154
+ /* eslint-enable no-bitwise */
155
+ ];
156
+ },
157
+ enumerable: false,
158
+ },
159
+ hexToAnsi256: {
160
+ value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
161
+ enumerable: false,
162
+ },
163
+ ansi256ToAnsi: {
164
+ value(code) {
165
+ if (code < 8) {
166
+ return 30 + code;
167
+ }
168
+
169
+ if (code < 16) {
170
+ return 90 + (code - 8);
171
+ }
172
+
173
+ let red;
174
+ let green;
175
+ let blue;
176
+
177
+ if (code >= 232) {
178
+ red = (((code - 232) * 10) + 8) / 255;
179
+ green = red;
180
+ blue = red;
181
+ } else {
182
+ code -= 16;
183
+
184
+ const remainder = code % 36;
185
+
186
+ red = Math.floor(code / 36) / 5;
187
+ green = Math.floor(remainder / 6) / 5;
188
+ blue = (remainder % 6) / 5;
189
+ }
190
+
191
+ const value = Math.max(red, green, blue) * 2;
192
+
193
+ if (value === 0) {
194
+ return 30;
195
+ }
196
+
197
+ // eslint-disable-next-line no-bitwise
198
+ let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));
199
+
200
+ if (value === 2) {
201
+ result += 60;
202
+ }
203
+
204
+ return result;
205
+ },
206
+ enumerable: false,
207
+ },
208
+ rgbToAnsi: {
209
+ value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
210
+ enumerable: false,
211
+ },
212
+ hexToAnsi: {
213
+ value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
214
+ enumerable: false,
215
+ },
216
+ });
217
+
218
+ return styles;
219
+ }
220
+
221
+ const ansiStyles = assembleStyles();
222
+
223
+ export default ansiStyles;
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.