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,24 @@
1
+ /**
2
+ Binary search on a sorted flat array of [start, end] pairs.
3
+
4
+ @param {number[]} ranges - Flat array of inclusive [start, end] range pairs, e.g. [0, 5, 10, 20].
5
+ @param {number} codePoint - The value to search for.
6
+ @returns {boolean} Whether the value falls within any of the ranges.
7
+ */
8
+ export const isInRange = (ranges, codePoint) => {
9
+ let low = 0;
10
+ let high = Math.floor(ranges.length / 2) - 1;
11
+ while (low <= high) {
12
+ const mid = Math.floor((low + high) / 2);
13
+ const i = mid * 2;
14
+ if (codePoint < ranges[i]) {
15
+ high = mid - 1;
16
+ } else if (codePoint > ranges[i + 1]) {
17
+ low = mid + 1;
18
+ } else {
19
+ return true;
20
+ }
21
+ }
22
+
23
+ return false;
24
+ };
@@ -0,0 +1,17 @@
1
+ /**
2
+ Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms).
3
+
4
+ @param codePoint - The [code point](https://en.wikipedia.org/wiki/Code_point) of a character.
5
+
6
+ @example
7
+ ```
8
+ import isFullwidthCodePoint from 'is-fullwidth-code-point';
9
+
10
+ isFullwidthCodePoint('谢'.codePointAt(0));
11
+ //=> true
12
+
13
+ isFullwidthCodePoint('a'.codePointAt(0));
14
+ //=> false
15
+ ```
16
+ */
17
+ export default function isFullwidthCodePoint(codePoint: number): boolean;
@@ -0,0 +1,50 @@
1
+ /* eslint-disable yoda */
2
+ 'use strict';
3
+
4
+ const isFullwidthCodePoint = codePoint => {
5
+ if (Number.isNaN(codePoint)) {
6
+ return false;
7
+ }
8
+
9
+ // Code points are derived from:
10
+ // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
11
+ if (
12
+ codePoint >= 0x1100 && (
13
+ codePoint <= 0x115F || // Hangul Jamo
14
+ codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
15
+ codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
16
+ // CJK Radicals Supplement .. Enclosed CJK Letters and Months
17
+ (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) ||
18
+ // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
19
+ (0x3250 <= codePoint && codePoint <= 0x4DBF) ||
20
+ // CJK Unified Ideographs .. Yi Radicals
21
+ (0x4E00 <= codePoint && codePoint <= 0xA4C6) ||
22
+ // Hangul Jamo Extended-A
23
+ (0xA960 <= codePoint && codePoint <= 0xA97C) ||
24
+ // Hangul Syllables
25
+ (0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
26
+ // CJK Compatibility Ideographs
27
+ (0xF900 <= codePoint && codePoint <= 0xFAFF) ||
28
+ // Vertical Forms
29
+ (0xFE10 <= codePoint && codePoint <= 0xFE19) ||
30
+ // CJK Compatibility Forms .. Small Form Variants
31
+ (0xFE30 <= codePoint && codePoint <= 0xFE6B) ||
32
+ // Halfwidth and Fullwidth Forms
33
+ (0xFF01 <= codePoint && codePoint <= 0xFF60) ||
34
+ (0xFFE0 <= codePoint && codePoint <= 0xFFE6) ||
35
+ // Kana Supplement
36
+ (0x1B000 <= codePoint && codePoint <= 0x1B001) ||
37
+ // Enclosed Ideographic Supplement
38
+ (0x1F200 <= codePoint && codePoint <= 0x1F251) ||
39
+ // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
40
+ (0x20000 <= codePoint && codePoint <= 0x3FFFD)
41
+ )
42
+ ) {
43
+ return true;
44
+ }
45
+
46
+ return false;
47
+ };
48
+
49
+ module.exports = isFullwidthCodePoint;
50
+ module.exports.default = isFullwidthCodePoint;
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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,42 @@
1
+ {
2
+ "name": "is-fullwidth-code-point",
3
+ "version": "3.0.0",
4
+ "description": "Check if the character represented by a given Unicode code point is fullwidth",
5
+ "license": "MIT",
6
+ "repository": "sindresorhus/is-fullwidth-code-point",
7
+ "author": {
8
+ "name": "Sindre Sorhus",
9
+ "email": "sindresorhus@gmail.com",
10
+ "url": "sindresorhus.com"
11
+ },
12
+ "engines": {
13
+ "node": ">=8"
14
+ },
15
+ "scripts": {
16
+ "test": "xo && ava && tsd-check"
17
+ },
18
+ "files": [
19
+ "index.js",
20
+ "index.d.ts"
21
+ ],
22
+ "keywords": [
23
+ "fullwidth",
24
+ "full-width",
25
+ "full",
26
+ "width",
27
+ "unicode",
28
+ "character",
29
+ "string",
30
+ "codepoint",
31
+ "code",
32
+ "point",
33
+ "is",
34
+ "detect",
35
+ "check"
36
+ ],
37
+ "devDependencies": {
38
+ "ava": "^1.3.1",
39
+ "tsd-check": "^0.5.0",
40
+ "xo": "^0.24.0"
41
+ }
42
+ }
@@ -0,0 +1,39 @@
1
+ # is-fullwidth-code-point [![Build Status](https://travis-ci.org/sindresorhus/is-fullwidth-code-point.svg?branch=master)](https://travis-ci.org/sindresorhus/is-fullwidth-code-point)
2
+
3
+ > Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms)
4
+
5
+
6
+ ## Install
7
+
8
+ ```
9
+ $ npm install is-fullwidth-code-point
10
+ ```
11
+
12
+
13
+ ## Usage
14
+
15
+ ```js
16
+ const isFullwidthCodePoint = require('is-fullwidth-code-point');
17
+
18
+ isFullwidthCodePoint('谢'.codePointAt(0));
19
+ //=> true
20
+
21
+ isFullwidthCodePoint('a'.codePointAt(0));
22
+ //=> false
23
+ ```
24
+
25
+
26
+ ## API
27
+
28
+ ### isFullwidthCodePoint(codePoint)
29
+
30
+ #### codePoint
31
+
32
+ Type: `number`
33
+
34
+ The [code point](https://en.wikipedia.org/wiki/Code_point) of a character.
35
+
36
+
37
+ ## License
38
+
39
+ MIT © [Sindre Sorhus](https://sindresorhus.com)
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2019 Garen J. Torikian
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,70 @@
1
+ # isBinaryFile
2
+
3
+ Detects if a file is binary in Node.js using ✨promises✨. Similar to [Perl's `-B` switch](http://stackoverflow.com/questions/899206/how-does-perl-know-a-file-is-binary), in that:
4
+ - it reads the first few thousand bytes of a file
5
+ - checks for a `null` byte; if it's found, it's binary
6
+ - flags non-ASCII characters. After a certain number of "weird" characters, the file is flagged as binary
7
+
8
+ Much of the logic is pretty much ported from [ag](https://github.com/ggreer/the_silver_searcher).
9
+
10
+ Note: if the file doesn't exist or is a directory, an error is thrown.
11
+
12
+ ## Installation
13
+
14
+ ```
15
+ npm install isbinaryfile
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ Returns `Promise<boolean>` (or just `boolean` for `*Sync`). `true` if the file is binary, `false` otherwise.
21
+
22
+ ### isBinaryFile(filepath)
23
+
24
+ * `filepath` - a `string` indicating the path to the file.
25
+
26
+ ### isBinaryFile(bytes[, size])
27
+
28
+ * `bytes` - a `Buffer` of the file's contents.
29
+ * `size` - an optional `number` indicating the file size.
30
+
31
+ ### isBinaryFileSync(filepath)
32
+
33
+ * `filepath` - a `string` indicating the path to the file.
34
+
35
+
36
+ ### isBinaryFileSync(bytes[, size])
37
+
38
+ * `bytes` - a `Buffer` of the file's contents.
39
+ * `size` - an optional `number` indicating the file size.
40
+
41
+ ### Examples
42
+
43
+ Here's an arbitrary usage:
44
+
45
+ ```javascript
46
+ const isBinaryFile = require("isbinaryfile").isBinaryFile;
47
+ const fs = require("fs");
48
+
49
+ const filename = "fixtures/pdf.pdf";
50
+ const data = fs.readFileSync(filename);
51
+ const stat = fs.lstatSync(filename);
52
+
53
+ isBinaryFile(data, stat.size).then((result) => {
54
+ if (result) {
55
+ console.log("It is binary!")
56
+ }
57
+ else {
58
+ console.log("No it is not.")
59
+ }
60
+ });
61
+
62
+ const isBinaryFileSync = require("isbinaryfile").isBinaryFileSync;
63
+ const bytes = fs.readFileSync(filename);
64
+ const size = fs.lstatSync(filename).size;
65
+ console.log(isBinaryFileSync(bytes, size)); // true or false
66
+ ```
67
+
68
+ ## Testing
69
+
70
+ Run `npm install`, then run `npm test`.
@@ -0,0 +1,3 @@
1
+ /// <reference types="node" />
2
+ export declare function isBinaryFile(file: string | Buffer, size?: number): Promise<boolean>;
3
+ export declare function isBinaryFileSync(file: string | Buffer, size?: number): boolean;
@@ -0,0 +1,256 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isBinaryFileSync = exports.isBinaryFile = void 0;
4
+ const fs = require("fs");
5
+ const util_1 = require("util");
6
+ const statAsync = (0, util_1.promisify)(fs.stat);
7
+ const openAsync = (0, util_1.promisify)(fs.open);
8
+ const closeAsync = (0, util_1.promisify)(fs.close);
9
+ const MAX_BYTES = 512;
10
+ const UTF8_BOUNDARY_RESERVE = 3;
11
+ // A very basic non-exception raising reader. Read bytes and
12
+ // at the end use hasError() to check whether this worked.
13
+ class Reader {
14
+ fileBuffer;
15
+ size;
16
+ offset;
17
+ error;
18
+ constructor(fileBuffer, size) {
19
+ this.fileBuffer = fileBuffer;
20
+ this.size = size;
21
+ this.offset = 0;
22
+ this.error = false;
23
+ }
24
+ hasError() {
25
+ return this.error;
26
+ }
27
+ nextByte() {
28
+ if (this.offset === this.size || this.hasError()) {
29
+ this.error = true;
30
+ return 0xff;
31
+ }
32
+ return this.fileBuffer[this.offset++];
33
+ }
34
+ next(len) {
35
+ const n = new Array();
36
+ for (let i = 0; i < len; i++) {
37
+ // Stop reading if an error occurred
38
+ if (this.error) {
39
+ return n;
40
+ }
41
+ n[i] = this.nextByte();
42
+ }
43
+ return n;
44
+ }
45
+ }
46
+ // Read a Google Protobuf var(iable)int from the buffer.
47
+ function readProtoVarInt(reader) {
48
+ let idx = 0;
49
+ let varInt = 0;
50
+ while (!reader.hasError()) {
51
+ const b = reader.nextByte();
52
+ varInt = varInt | ((b & 0x7f) << (7 * idx));
53
+ if ((b & 0x80) === 0) {
54
+ break;
55
+ }
56
+ if (idx >= 10) {
57
+ // Varint can be between 1 and 10 bytes. This is too large.
58
+ reader.error = true;
59
+ break;
60
+ }
61
+ idx++;
62
+ }
63
+ return varInt;
64
+ }
65
+ // Attempt to taste a full Google Protobuf message.
66
+ function readProtoMessage(reader) {
67
+ const varInt = readProtoVarInt(reader);
68
+ const wireType = varInt & 0x7;
69
+ switch (wireType) {
70
+ case 0:
71
+ readProtoVarInt(reader);
72
+ return true;
73
+ case 1:
74
+ reader.next(8);
75
+ return true;
76
+ case 2:
77
+ const len = readProtoVarInt(reader);
78
+ reader.next(len);
79
+ return true;
80
+ case 5:
81
+ reader.next(4);
82
+ return true;
83
+ }
84
+ return false;
85
+ }
86
+ // Check whether this seems to be a valid protobuf file.
87
+ function isBinaryProto(fileBuffer, totalBytes) {
88
+ const reader = new Reader(fileBuffer, totalBytes);
89
+ let numMessages = 0;
90
+ while (true) {
91
+ // Definitely not a valid protobuf
92
+ if (!readProtoMessage(reader) && !reader.hasError()) {
93
+ return false;
94
+ }
95
+ // Short read?
96
+ if (reader.hasError()) {
97
+ break;
98
+ }
99
+ numMessages++;
100
+ }
101
+ return numMessages > 0;
102
+ }
103
+ async function isBinaryFile(file, size) {
104
+ if (isString(file)) {
105
+ const stat = await statAsync(file);
106
+ isStatFile(stat);
107
+ const fileDescriptor = await openAsync(file, 'r');
108
+ const allocBuffer = Buffer.alloc(MAX_BYTES + UTF8_BOUNDARY_RESERVE);
109
+ // Read the file with no encoding for raw buffer access.
110
+ // NB: something is severely wrong with promisify, had to construct my own Promise
111
+ return new Promise((fulfill, reject) => {
112
+ fs.read(fileDescriptor, allocBuffer, 0, MAX_BYTES + UTF8_BOUNDARY_RESERVE, 0, (err, bytesRead, _) => {
113
+ closeAsync(fileDescriptor);
114
+ if (err) {
115
+ reject(err);
116
+ }
117
+ else {
118
+ try {
119
+ fulfill(isBinaryCheck(allocBuffer, bytesRead));
120
+ }
121
+ catch (error) {
122
+ reject(error);
123
+ }
124
+ }
125
+ });
126
+ });
127
+ }
128
+ else {
129
+ if (size === undefined) {
130
+ size = file.length;
131
+ }
132
+ return isBinaryCheck(file, size);
133
+ }
134
+ }
135
+ exports.isBinaryFile = isBinaryFile;
136
+ function isBinaryFileSync(file, size) {
137
+ if (isString(file)) {
138
+ const stat = fs.statSync(file);
139
+ isStatFile(stat);
140
+ const fileDescriptor = fs.openSync(file, 'r');
141
+ const allocBuffer = Buffer.alloc(MAX_BYTES + UTF8_BOUNDARY_RESERVE);
142
+ const bytesRead = fs.readSync(fileDescriptor, allocBuffer, 0, MAX_BYTES + UTF8_BOUNDARY_RESERVE, 0);
143
+ fs.closeSync(fileDescriptor);
144
+ return isBinaryCheck(allocBuffer, bytesRead);
145
+ }
146
+ else {
147
+ if (size === undefined) {
148
+ size = file.length;
149
+ }
150
+ return isBinaryCheck(file, size);
151
+ }
152
+ }
153
+ exports.isBinaryFileSync = isBinaryFileSync;
154
+ function isBinaryCheck(fileBuffer, bytesRead) {
155
+ // empty file. no clue what it is.
156
+ if (bytesRead === 0) {
157
+ return false;
158
+ }
159
+ let suspiciousBytes = 0;
160
+ const totalBytes = Math.min(bytesRead, MAX_BYTES + UTF8_BOUNDARY_RESERVE);
161
+ const scanBytes = Math.min(totalBytes, MAX_BYTES);
162
+ // UTF-8 BOM
163
+ if (bytesRead >= 3 && fileBuffer[0] === 0xef && fileBuffer[1] === 0xbb && fileBuffer[2] === 0xbf) {
164
+ return false;
165
+ }
166
+ // UTF-32 BOM
167
+ if (bytesRead >= 4 &&
168
+ fileBuffer[0] === 0x00 &&
169
+ fileBuffer[1] === 0x00 &&
170
+ fileBuffer[2] === 0xfe &&
171
+ fileBuffer[3] === 0xff) {
172
+ return false;
173
+ }
174
+ // UTF-32 LE BOM
175
+ if (bytesRead >= 4 &&
176
+ fileBuffer[0] === 0xff &&
177
+ fileBuffer[1] === 0xfe &&
178
+ fileBuffer[2] === 0x00 &&
179
+ fileBuffer[3] === 0x00) {
180
+ return false;
181
+ }
182
+ // GB BOM
183
+ if (bytesRead >= 4 &&
184
+ fileBuffer[0] === 0x84 &&
185
+ fileBuffer[1] === 0x31 &&
186
+ fileBuffer[2] === 0x95 &&
187
+ fileBuffer[3] === 0x33) {
188
+ return false;
189
+ }
190
+ if (totalBytes >= 5 && fileBuffer.slice(0, 5).toString() === '%PDF-') {
191
+ /* PDF. This is binary. */
192
+ return true;
193
+ }
194
+ // UTF-16 BE BOM
195
+ if (bytesRead >= 2 && fileBuffer[0] === 0xfe && fileBuffer[1] === 0xff) {
196
+ return false;
197
+ }
198
+ // UTF-16 LE BOM
199
+ if (bytesRead >= 2 && fileBuffer[0] === 0xff && fileBuffer[1] === 0xfe) {
200
+ return false;
201
+ }
202
+ for (let i = 0; i < scanBytes; i++) {
203
+ if (fileBuffer[i] === 0) {
204
+ // NULL byte--it's binary!
205
+ return true;
206
+ }
207
+ else if ((fileBuffer[i] < 7 || fileBuffer[i] > 14) && (fileBuffer[i] < 32 || fileBuffer[i] > 127)) {
208
+ // UTF-8 detection
209
+ if (fileBuffer[i] >= 0xc0 && fileBuffer[i] <= 0xdf && i + 1 < totalBytes) {
210
+ i++;
211
+ if (fileBuffer[i] >= 0x80 && fileBuffer[i] <= 0xbf) {
212
+ continue;
213
+ }
214
+ }
215
+ else if (fileBuffer[i] >= 0xe0 && fileBuffer[i] <= 0xef && i + 2 < totalBytes) {
216
+ i++;
217
+ if (fileBuffer[i] >= 0x80 && fileBuffer[i] <= 0xbf && fileBuffer[i + 1] >= 0x80 && fileBuffer[i + 1] <= 0xbf) {
218
+ i++;
219
+ continue;
220
+ }
221
+ }
222
+ else if (fileBuffer[i] >= 0xf0 && fileBuffer[i] <= 0xf7 && i + 3 < totalBytes) {
223
+ i++;
224
+ if (fileBuffer[i] >= 0x80 &&
225
+ fileBuffer[i] <= 0xbf &&
226
+ fileBuffer[i + 1] >= 0x80 &&
227
+ fileBuffer[i + 1] <= 0xbf &&
228
+ fileBuffer[i + 2] >= 0x80 &&
229
+ fileBuffer[i + 2] <= 0xbf) {
230
+ i += 2;
231
+ continue;
232
+ }
233
+ }
234
+ suspiciousBytes++;
235
+ // Read at least 32 fileBuffer before making a decision
236
+ if (i >= 32 && (suspiciousBytes * 100) / scanBytes > 10) {
237
+ return true;
238
+ }
239
+ }
240
+ }
241
+ if ((suspiciousBytes * 100) / scanBytes > 10) {
242
+ return true;
243
+ }
244
+ if (suspiciousBytes > 1 && isBinaryProto(fileBuffer, scanBytes)) {
245
+ return true;
246
+ }
247
+ return false;
248
+ }
249
+ function isString(x) {
250
+ return typeof x === 'string';
251
+ }
252
+ function isStatFile(stat) {
253
+ if (!stat.isFile()) {
254
+ throw new Error(`Path provided was not a file!`);
255
+ }
256
+ }
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "isbinaryfile",
3
+ "description": "Detects if a file is binary in Node.js. Similar to Perl's -B.",
4
+ "version": "5.0.7",
5
+ "keywords": [
6
+ "text",
7
+ "binary",
8
+ "encoding",
9
+ "istext",
10
+ "is text",
11
+ "isbinary",
12
+ "is binary",
13
+ "is text or binary",
14
+ "is text or binary file",
15
+ "isbinaryfile",
16
+ "is binary file",
17
+ "istextfile",
18
+ "is text file"
19
+ ],
20
+ "devDependencies": {
21
+ "@types/jest": "^23.3.14",
22
+ "@types/node": "^10.17.60",
23
+ "jest": "^29.7.0",
24
+ "prettier": "^1.19.1",
25
+ "release-it": "^19.0.4",
26
+ "ts-jest": "^29.1.4",
27
+ "tslint": "^5.20.1",
28
+ "tslint-config-prettier": "^1.18.0",
29
+ "typescript": "^4.9.4"
30
+ },
31
+ "engines": {
32
+ "node": ">= 18.0.0"
33
+ },
34
+ "files": [
35
+ "lib/**/*"
36
+ ],
37
+ "license": "MIT",
38
+ "main": "lib/index.js",
39
+ "types": "lib/index.d.ts",
40
+ "maintainers": [
41
+ {
42
+ "name": "Garen J. Torikian",
43
+ "email": "gjtorikian@gmail.com"
44
+ }
45
+ ],
46
+ "funding": "https://github.com/sponsors/gjtorikian/",
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "https://github.com/gjtorikian/isBinaryFile"
50
+ },
51
+ "scripts": {
52
+ "build": "tsc",
53
+ "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\" && tslint --fix -c tslint.json 'src/**/*.ts'",
54
+ "lint": "tslint -p tsconfig.json",
55
+ "prepare": "npm run build",
56
+ "release": "release-it",
57
+ "prepublishOnly": "npm test && npm run lint",
58
+ "preversion": "npm run lint",
59
+ "version": "npm run format && git add -A src",
60
+ "postversion": "git push && git push --tags",
61
+ "test": "jest --config jestconfig.json",
62
+ "watch": "tsc -w"
63
+ }
64
+ }
@@ -0,0 +1,39 @@
1
+ export type Options = {
2
+ /**
3
+ Count [ambiguous width characters](https://www.unicode.org/reports/tr11/#Ambiguous) as having narrow width (count of 1) instead of wide width (count of 2).
4
+
5
+ @default true
6
+
7
+ > Ambiguous characters behave like wide or narrow characters depending on the context (language tag, script identification, associated font, source of data, or explicit markup; all can provide the context). __If the context cannot be established reliably, they should be treated as narrow characters by default.__
8
+ > - http://www.unicode.org/reports/tr11/
9
+ */
10
+ readonly ambiguousIsNarrow?: boolean;
11
+
12
+ /**
13
+ Whether [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) should be counted.
14
+
15
+ @default false
16
+ */
17
+ readonly countAnsiEscapeCodes?: boolean;
18
+ };
19
+
20
+ /**
21
+ Get the visual width of a string - the number of columns required to display it.
22
+
23
+ Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.
24
+
25
+ @example
26
+ ```
27
+ import stringWidth from 'string-width';
28
+
29
+ stringWidth('a');
30
+ //=> 1
31
+
32
+ stringWidth('古');
33
+ //=> 2
34
+
35
+ stringWidth('\u001B[1m古\u001B[22m');
36
+ //=> 2
37
+ ```
38
+ */
39
+ export default function stringWidth(string: string, options?: Options): number;