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
+ import type {IsEqual} from './is-equal';
2
+
3
+ /**
4
+ Extract all writable keys from the given type.
5
+
6
+ This is useful when you want to create a new type that contains writable keys only.
7
+
8
+ @example
9
+ ```
10
+ import type {WritableKeysOf} from 'type-fest';
11
+
12
+ interface User {
13
+ name: string;
14
+ surname: string;
15
+ readonly id: number;
16
+ }
17
+
18
+ type UpdateRequest<Entity extends object> = Pick<Entity, WritableKeysOf<Entity>>;
19
+
20
+ const update1: UpdateRequest<User> = {
21
+ name: 'Alice',
22
+ surname: 'Acme',
23
+ };
24
+ ```
25
+
26
+ @category Utilities
27
+ */
28
+ export type WritableKeysOf<T> =
29
+ T extends unknown // For distributing `T`
30
+ ? (keyof {
31
+ [P in keyof T as IsEqual<{[Q in P]: T[P]}, {readonly [Q in P]: T[P]}> extends false ? P : never]: never
32
+ }) & keyof T // Intersect with `keyof T` to ensure result of `WritableKeysOf<T>` is always assignable to `keyof T`
33
+ : never; // Should never happen
@@ -0,0 +1,68 @@
1
+ import type {Except} from './except';
2
+ import type {Simplify} from './simplify';
3
+
4
+ /**
5
+ Create a writable version of the given array type.
6
+ */
7
+ type WritableArray<ArrayType extends readonly unknown[]> =
8
+ ArrayType extends readonly [] ? []
9
+ : ArrayType extends readonly [...infer U, infer V] ? [...U, V]
10
+ : ArrayType extends readonly [infer U, ...infer V] ? [U, ...V]
11
+ : ArrayType extends ReadonlyArray<infer U> ? U[]
12
+ : ArrayType;
13
+
14
+ /**
15
+ Create a type that strips `readonly` from the given type. Inverse of `Readonly<T>`.
16
+
17
+ The 2nd argument will be ignored if the input type is not an object.
18
+
19
+ Note: This type can make readonly `Set` and `Map` writable. This behavior is different from `Readonly<T>` (as of TypeScript 5.2.2). See: https://github.com/microsoft/TypeScript/issues/29655
20
+
21
+ This can be used to [store and mutate options within a class](https://github.com/sindresorhus/pageres/blob/4a5d05fca19a5fbd2f53842cbf3eb7b1b63bddd2/source/index.ts#L72), [edit `readonly` objects within tests](https://stackoverflow.com/questions/50703834), [construct a `readonly` object within a function](https://github.com/Microsoft/TypeScript/issues/24509), or to define a single model where the only thing that changes is whether or not some of the keys are writable.
22
+
23
+ @example
24
+ ```
25
+ import type {Writable} from 'type-fest';
26
+
27
+ type Foo = {
28
+ readonly a: number;
29
+ readonly b: readonly string[]; // To show that only the mutability status of the properties, not their values, are affected.
30
+ readonly c: boolean;
31
+ };
32
+
33
+ const writableFoo: Writable<Foo> = {a: 1, b: ['2'], c: true};
34
+ writableFoo.a = 3;
35
+ writableFoo.b[0] = 'new value'; // Will still fail as the value of property "b" is still a readonly type.
36
+ writableFoo.b = ['something']; // Will work as the "b" property itself is no longer readonly.
37
+
38
+ type SomeWritable = Writable<Foo, 'b' | 'c'>;
39
+ // type SomeWritable = {
40
+ // readonly a: number;
41
+ // b: readonly string[]; // It's now writable. The type of the property remains unaffected.
42
+ // c: boolean; // It's now writable.
43
+ // }
44
+
45
+ // Also supports array
46
+ const readonlyArray: readonly number[] = [1, 2, 3];
47
+ readonlyArray.push(4); // Will fail as the array itself is readonly.
48
+ const writableArray: Writable<typeof readonlyArray> = readonlyArray as Writable<typeof readonlyArray>;
49
+ writableArray.push(4); // Will work as the array itself is now writable.
50
+ ```
51
+
52
+ @category Object
53
+ */
54
+ export type Writable<BaseType, Keys extends keyof BaseType = keyof BaseType> =
55
+ BaseType extends ReadonlyMap<infer KeyType, infer ValueType>
56
+ ? Map<KeyType, ValueType>
57
+ : BaseType extends ReadonlySet<infer ItemType>
58
+ ? Set<ItemType>
59
+ : BaseType extends readonly unknown[]
60
+ // Handle array
61
+ ? WritableArray<BaseType>
62
+ // Handle object
63
+ : Simplify<
64
+ // Pick just the keys that are not writable from the base type.
65
+ Except<BaseType, Keys> &
66
+ // Pick the keys that should be writable from the base type and make them writable by removing the `readonly` modifier from the key.
67
+ {-readonly [KeyType in keyof Pick<BaseType, Keys>]: Pick<BaseType, Keys>[KeyType]}
68
+ >;
@@ -0,0 +1,12 @@
1
+ /**
2
+ Get the visual width of the widest line in a string - the number of columns required to display it.
3
+
4
+ @example
5
+ ```
6
+ import widestLine from 'widest-line';
7
+
8
+ widestLine('古\n\u001B[1m@\u001B[22m');
9
+ //=> 2
10
+ ```
11
+ */
12
+ export default function widestLine(string: string): number;
@@ -0,0 +1,11 @@
1
+ import stringWidth from 'string-width';
2
+
3
+ export default function widestLine(string) {
4
+ let lineWidth = 0;
5
+
6
+ for (const line of string.split('\n')) {
7
+ lineWidth = Math.max(lineWidth, stringWidth(line));
8
+ }
9
+
10
+ return lineWidth;
11
+ }
@@ -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,60 @@
1
+ {
2
+ "name": "widest-line",
3
+ "version": "5.0.0",
4
+ "description": "Get the visual width of the widest line in a string - the number of columns required to display it",
5
+ "license": "MIT",
6
+ "repository": "sindresorhus/widest-line",
7
+ "funding": "https://github.com/sponsors/sindresorhus",
8
+ "author": {
9
+ "name": "Sindre Sorhus",
10
+ "email": "sindresorhus@gmail.com",
11
+ "url": "https://sindresorhus.com"
12
+ },
13
+ "type": "module",
14
+ "exports": {
15
+ "types": "./index.d.ts",
16
+ "default": "./index.js"
17
+ },
18
+ "engines": {
19
+ "node": ">=18"
20
+ },
21
+ "scripts": {
22
+ "test": "xo && ava && tsd"
23
+ },
24
+ "files": [
25
+ "index.js",
26
+ "index.d.ts"
27
+ ],
28
+ "keywords": [
29
+ "string",
30
+ "character",
31
+ "unicode",
32
+ "width",
33
+ "visual",
34
+ "column",
35
+ "columns",
36
+ "fullwidth",
37
+ "full-width",
38
+ "full",
39
+ "ansi",
40
+ "escape",
41
+ "codes",
42
+ "cli",
43
+ "command-line",
44
+ "terminal",
45
+ "console",
46
+ "cjk",
47
+ "chinese",
48
+ "japanese",
49
+ "korean",
50
+ "fixed-width"
51
+ ],
52
+ "dependencies": {
53
+ "string-width": "^7.0.0"
54
+ },
55
+ "devDependencies": {
56
+ "ava": "^5.3.1",
57
+ "tsd": "^0.29.0",
58
+ "xo": "^0.56.0"
59
+ }
60
+ }
@@ -0,0 +1,26 @@
1
+ # widest-line
2
+
3
+ > Get the visual width of the widest line in a string - the number of columns required to display it
4
+
5
+ Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.
6
+
7
+ Useful to be able to know the maximum width a string will take up in the terminal.
8
+
9
+ ## Install
10
+
11
+ ```sh
12
+ npm install widest-line
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```js
18
+ import widestLine from 'widest-line';
19
+
20
+ widestLine('古\n\u001B[1m@\u001B[22m');
21
+ //=> 2
22
+ ```
23
+
24
+ ## Related
25
+
26
+ - [string-width](https://github.com/sindresorhus/string-width) - Get the visual width of a string
@@ -0,0 +1,41 @@
1
+ export type Options = {
2
+ /**
3
+ By default the wrap is soft, meaning long words may extend past the column width. Setting this to `true` will make it hard wrap at the column width.
4
+
5
+ @default false
6
+ */
7
+ readonly hard?: boolean;
8
+
9
+ /**
10
+ By default, an attempt is made to split words at spaces, ensuring that they don't extend past the configured columns. If wordWrap is `false`, each column will instead be completely filled splitting words as necessary.
11
+
12
+ @default true
13
+ */
14
+ readonly wordWrap?: boolean;
15
+
16
+ /**
17
+ Whitespace on all lines is removed by default. Set this option to `false` if you don't want to trim.
18
+
19
+ @default true
20
+ */
21
+ readonly trim?: boolean;
22
+ };
23
+
24
+ /**
25
+ Wrap words to the specified column width.
26
+
27
+ @param string - A string with ANSI escape codes, like one styled by [`chalk`](https://github.com/chalk/chalk). Newline characters will be normalized to `\n`.
28
+ @param columns - The number of columns to wrap the text to.
29
+
30
+ @example
31
+ ```
32
+ import chalk from 'chalk';
33
+ import wrapAnsi from 'wrap-ansi';
34
+
35
+ const input = 'The quick brown ' + chalk.red('fox jumped over ') +
36
+ 'the lazy ' + chalk.green('dog and then ran away with the unicorn.');
37
+
38
+ console.log(wrapAnsi(input, 20));
39
+ ```
40
+ */
41
+ export default function wrapAnsi(string: string, columns: number, options?: Options): string;
@@ -0,0 +1,222 @@
1
+ import stringWidth from 'string-width';
2
+ import stripAnsi from 'strip-ansi';
3
+ import ansiStyles from 'ansi-styles';
4
+
5
+ const ESCAPES = new Set([
6
+ '\u001B',
7
+ '\u009B',
8
+ ]);
9
+
10
+ const END_CODE = 39;
11
+ const ANSI_ESCAPE_BELL = '\u0007';
12
+ const ANSI_CSI = '[';
13
+ const ANSI_OSC = ']';
14
+ const ANSI_SGR_TERMINATOR = 'm';
15
+ const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
16
+
17
+ const wrapAnsiCode = code => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
18
+ const wrapAnsiHyperlink = url => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
19
+
20
+ // Calculate the length of words split on ' ', ignoring
21
+ // the extra characters added by ansi escape codes
22
+ const wordLengths = string => string.split(' ').map(character => stringWidth(character));
23
+
24
+ // Wrap a long word across multiple rows
25
+ // Ansi escape codes do not count towards length
26
+ const wrapWord = (rows, word, columns) => {
27
+ const characters = [...word];
28
+
29
+ let isInsideEscape = false;
30
+ let isInsideLinkEscape = false;
31
+ let visible = stringWidth(stripAnsi(rows.at(-1)));
32
+
33
+ for (const [index, character] of characters.entries()) {
34
+ const characterLength = stringWidth(character);
35
+
36
+ if (visible + characterLength <= columns) {
37
+ rows[rows.length - 1] += character;
38
+ } else {
39
+ rows.push(character);
40
+ visible = 0;
41
+ }
42
+
43
+ if (ESCAPES.has(character)) {
44
+ isInsideEscape = true;
45
+
46
+ const ansiEscapeLinkCandidate = characters.slice(index + 1, index + 1 + ANSI_ESCAPE_LINK.length).join('');
47
+ isInsideLinkEscape = ansiEscapeLinkCandidate === ANSI_ESCAPE_LINK;
48
+ }
49
+
50
+ if (isInsideEscape) {
51
+ if (isInsideLinkEscape) {
52
+ if (character === ANSI_ESCAPE_BELL) {
53
+ isInsideEscape = false;
54
+ isInsideLinkEscape = false;
55
+ }
56
+ } else if (character === ANSI_SGR_TERMINATOR) {
57
+ isInsideEscape = false;
58
+ }
59
+
60
+ continue;
61
+ }
62
+
63
+ visible += characterLength;
64
+
65
+ if (visible === columns && index < characters.length - 1) {
66
+ rows.push('');
67
+ visible = 0;
68
+ }
69
+ }
70
+
71
+ // It's possible that the last row we copy over is only
72
+ // ansi escape characters, handle this edge-case
73
+ if (!visible && rows.at(-1).length > 0 && rows.length > 1) {
74
+ rows[rows.length - 2] += rows.pop();
75
+ }
76
+ };
77
+
78
+ // Trims spaces from a string ignoring invisible sequences
79
+ const stringVisibleTrimSpacesRight = string => {
80
+ const words = string.split(' ');
81
+ let last = words.length;
82
+
83
+ while (last > 0) {
84
+ if (stringWidth(words[last - 1]) > 0) {
85
+ break;
86
+ }
87
+
88
+ last--;
89
+ }
90
+
91
+ if (last === words.length) {
92
+ return string;
93
+ }
94
+
95
+ return words.slice(0, last).join(' ') + words.slice(last).join('');
96
+ };
97
+
98
+ // The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode.
99
+ //
100
+ // 'hard' will never allow a string to take up more than columns characters.
101
+ //
102
+ // 'soft' allows long words to expand past the column length.
103
+ const exec = (string, columns, options = {}) => {
104
+ if (options.trim !== false && string.trim() === '') {
105
+ return '';
106
+ }
107
+
108
+ let returnValue = '';
109
+ let escapeCode;
110
+ let escapeUrl;
111
+
112
+ const lengths = wordLengths(string);
113
+ let rows = [''];
114
+
115
+ for (const [index, word] of string.split(' ').entries()) {
116
+ if (options.trim !== false) {
117
+ rows[rows.length - 1] = rows.at(-1).trimStart();
118
+ }
119
+
120
+ let rowLength = stringWidth(rows.at(-1));
121
+
122
+ if (index !== 0) {
123
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
124
+ // If we start with a new word but the current row length equals the length of the columns, add a new row
125
+ rows.push('');
126
+ rowLength = 0;
127
+ }
128
+
129
+ if (rowLength > 0 || options.trim === false) {
130
+ rows[rows.length - 1] += ' ';
131
+ rowLength++;
132
+ }
133
+ }
134
+
135
+ // In 'hard' wrap mode, the length of a line is never allowed to extend past 'columns'
136
+ if (options.hard && lengths[index] > columns) {
137
+ const remainingColumns = (columns - rowLength);
138
+ const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
139
+ const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
140
+ if (breaksStartingNextLine < breaksStartingThisLine) {
141
+ rows.push('');
142
+ }
143
+
144
+ wrapWord(rows, word, columns);
145
+ continue;
146
+ }
147
+
148
+ if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
149
+ if (options.wordWrap === false && rowLength < columns) {
150
+ wrapWord(rows, word, columns);
151
+ continue;
152
+ }
153
+
154
+ rows.push('');
155
+ }
156
+
157
+ if (rowLength + lengths[index] > columns && options.wordWrap === false) {
158
+ wrapWord(rows, word, columns);
159
+ continue;
160
+ }
161
+
162
+ rows[rows.length - 1] += word;
163
+ }
164
+
165
+ if (options.trim !== false) {
166
+ rows = rows.map(row => stringVisibleTrimSpacesRight(row));
167
+ }
168
+
169
+ const preString = rows.join('\n');
170
+ const pre = [...preString];
171
+
172
+ // We need to keep a separate index as `String#slice()` works on Unicode code units, while `pre` is an array of codepoints.
173
+ let preStringIndex = 0;
174
+
175
+ for (const [index, character] of pre.entries()) {
176
+ returnValue += character;
177
+
178
+ if (ESCAPES.has(character)) {
179
+ const {groups} = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(preString.slice(preStringIndex)) || {groups: {}};
180
+ if (groups.code !== undefined) {
181
+ const code = Number.parseFloat(groups.code);
182
+ escapeCode = code === END_CODE ? undefined : code;
183
+ } else if (groups.uri !== undefined) {
184
+ escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
185
+ }
186
+ }
187
+
188
+ const code = ansiStyles.codes.get(Number(escapeCode));
189
+
190
+ if (pre[index + 1] === '\n') {
191
+ if (escapeUrl) {
192
+ returnValue += wrapAnsiHyperlink('');
193
+ }
194
+
195
+ if (escapeCode && code) {
196
+ returnValue += wrapAnsiCode(code);
197
+ }
198
+ } else if (character === '\n') {
199
+ if (escapeCode && code) {
200
+ returnValue += wrapAnsiCode(escapeCode);
201
+ }
202
+
203
+ if (escapeUrl) {
204
+ returnValue += wrapAnsiHyperlink(escapeUrl);
205
+ }
206
+ }
207
+
208
+ preStringIndex += character.length;
209
+ }
210
+
211
+ return returnValue;
212
+ };
213
+
214
+ // For each newline, invoke the method separately
215
+ export default function wrapAnsi(string, columns, options) {
216
+ return String(string)
217
+ .normalize()
218
+ .replaceAll('\r\n', '\n')
219
+ .split('\n')
220
+ .map(line => exec(line, columns, options))
221
+ .join('\n');
222
+ }
@@ -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,69 @@
1
+ {
2
+ "name": "wrap-ansi",
3
+ "version": "9.0.2",
4
+ "description": "Wordwrap a string with ANSI escape codes",
5
+ "license": "MIT",
6
+ "repository": "chalk/wrap-ansi",
7
+ "funding": "https://github.com/chalk/wrap-ansi?sponsor=1",
8
+ "author": {
9
+ "name": "Sindre Sorhus",
10
+ "email": "sindresorhus@gmail.com",
11
+ "url": "https://sindresorhus.com"
12
+ },
13
+ "type": "module",
14
+ "exports": {
15
+ "types": "./index.d.ts",
16
+ "default": "./index.js"
17
+ },
18
+ "engines": {
19
+ "node": ">=18"
20
+ },
21
+ "scripts": {
22
+ "test": "xo && nyc ava && tsd"
23
+ },
24
+ "files": [
25
+ "index.js",
26
+ "index.d.ts"
27
+ ],
28
+ "keywords": [
29
+ "wrap",
30
+ "break",
31
+ "wordwrap",
32
+ "wordbreak",
33
+ "linewrap",
34
+ "ansi",
35
+ "styles",
36
+ "color",
37
+ "colour",
38
+ "colors",
39
+ "terminal",
40
+ "console",
41
+ "cli",
42
+ "string",
43
+ "tty",
44
+ "escape",
45
+ "formatting",
46
+ "rgb",
47
+ "256",
48
+ "shell",
49
+ "xterm",
50
+ "log",
51
+ "logging",
52
+ "command-line",
53
+ "text"
54
+ ],
55
+ "dependencies": {
56
+ "ansi-styles": "^6.2.1",
57
+ "string-width": "^7.0.0",
58
+ "strip-ansi": "^7.1.0"
59
+ },
60
+ "devDependencies": {
61
+ "ava": "^5.3.1",
62
+ "chalk": "^5.3.0",
63
+ "coveralls": "^3.1.1",
64
+ "has-ansi": "^5.0.1",
65
+ "nyc": "^15.1.0",
66
+ "tsd": "^0.29.0",
67
+ "xo": "^0.56.0"
68
+ }
69
+ }
@@ -0,0 +1,75 @@
1
+ # wrap-ansi
2
+
3
+ > Wordwrap a string with [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles)
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm install wrap-ansi
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```js
14
+ import chalk from 'chalk';
15
+ import wrapAnsi from 'wrap-ansi';
16
+
17
+ const input = 'The quick brown ' + chalk.red('fox jumped over ') +
18
+ 'the lazy ' + chalk.green('dog and then ran away with the unicorn.');
19
+
20
+ console.log(wrapAnsi(input, 20));
21
+ ```
22
+
23
+ <img width="331" src="screenshot.png">
24
+
25
+ ## API
26
+
27
+ ### wrapAnsi(string, columns, options?)
28
+
29
+ Wrap words to the specified column width.
30
+
31
+ #### string
32
+
33
+ Type: `string`
34
+
35
+ A string with ANSI escape codes, like one styled by [`chalk`](https://github.com/chalk/chalk).
36
+
37
+ Newline characters will be normalized to `\n`.
38
+
39
+ #### columns
40
+
41
+ Type: `number`
42
+
43
+ The number of columns to wrap the text to.
44
+
45
+ #### options
46
+
47
+ Type: `object`
48
+
49
+ ##### hard
50
+
51
+ Type: `boolean`\
52
+ Default: `false`
53
+
54
+ By default the wrap is soft, meaning long words may extend past the column width. Setting this to `true` will make it hard wrap at the column width.
55
+
56
+ ##### wordWrap
57
+
58
+ Type: `boolean`\
59
+ Default: `true`
60
+
61
+ By default, an attempt is made to split words at spaces, ensuring that they don't extend past the configured columns. If wordWrap is `false`, each column will instead be completely filled splitting words as necessary.
62
+
63
+ ##### trim
64
+
65
+ Type: `boolean`\
66
+ Default: `true`
67
+
68
+ Whitespace on all lines is removed by default. Set this option to `false` if you don't want to trim.
69
+
70
+ ## Related
71
+
72
+ - [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
73
+ - [cli-truncate](https://github.com/sindresorhus/cli-truncate) - Truncate a string to a specific width in the terminal
74
+ - [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
75
+ - [jsesc](https://github.com/mathiasbynens/jsesc) - Generate ASCII-only output from Unicode strings. Useful for creating test fixtures.