keep-a-changelog 2.2.1 → 2.4.1

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 (258) hide show
  1. package/CHANGELOG.md +26 -2
  2. package/README.md +27 -8
  3. package/esm/_dnt.shims.js +0 -1
  4. package/esm/bin.js +8 -3
  5. package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/flags/mod.js +3 -2
  6. package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/_util.d.ts +3 -0
  7. package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/_util.js +46 -0
  8. package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/mod.d.ts +3 -1
  9. package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/mod.js +4 -1
  10. package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/posix.d.ts +7 -5
  11. package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/posix.js +50 -108
  12. package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/win32.d.ts +7 -5
  13. package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/win32.js +23 -82
  14. package/esm/deps/deno.land/std@0.203.0/semver/_shared.d.ts +42 -0
  15. package/esm/deps/deno.land/std@0.203.0/semver/_shared.js +230 -0
  16. package/esm/deps/deno.land/std@0.203.0/semver/cmp.d.ts +9 -0
  17. package/esm/deps/deno.land/std@0.203.0/semver/cmp.js +35 -0
  18. package/esm/deps/deno.land/std@0.203.0/semver/comparator_format.d.ts +8 -0
  19. package/esm/deps/deno.land/std@0.203.0/semver/comparator_format.js +11 -0
  20. package/esm/deps/deno.land/std@0.203.0/semver/comparator_intersects.d.ts +8 -0
  21. package/esm/deps/deno.land/std@0.203.0/semver/comparator_intersects.js +45 -0
  22. package/esm/deps/deno.land/std@0.203.0/semver/comparator_max.d.ts +9 -0
  23. package/esm/deps/deno.land/std@0.203.0/semver/comparator_max.js +45 -0
  24. package/esm/deps/deno.land/std@0.203.0/semver/comparator_min.d.ts +8 -0
  25. package/esm/deps/deno.land/std@0.203.0/semver/comparator_min.js +32 -0
  26. package/esm/deps/deno.land/std@0.203.0/semver/compare.d.ts +10 -0
  27. package/esm/deps/deno.land/std@0.203.0/semver/compare.js +18 -0
  28. package/esm/deps/deno.land/std@0.203.0/semver/compare_build.d.ts +13 -0
  29. package/esm/deps/deno.land/std@0.203.0/semver/compare_build.js +23 -0
  30. package/esm/deps/deno.land/std@0.203.0/semver/constants.d.ts +42 -0
  31. package/esm/deps/deno.land/std@0.203.0/semver/constants.js +75 -0
  32. package/esm/deps/deno.land/std@0.203.0/semver/difference.d.ts +4 -0
  33. package/esm/deps/deno.land/std@0.203.0/semver/difference.js +26 -0
  34. package/esm/deps/deno.land/std@0.203.0/semver/eq.d.ts +4 -0
  35. package/esm/deps/deno.land/std@0.203.0/semver/eq.js +7 -0
  36. package/esm/deps/deno.land/std@0.203.0/semver/format.d.ts +12 -0
  37. package/esm/deps/deno.land/std@0.203.0/semver/format.js +54 -0
  38. package/esm/deps/deno.land/std@0.203.0/semver/gt.d.ts +3 -0
  39. package/esm/deps/deno.land/std@0.203.0/semver/gt.js +5 -0
  40. package/esm/deps/deno.land/std@0.203.0/semver/gte.d.ts +3 -0
  41. package/esm/deps/deno.land/std@0.203.0/semver/gte.js +5 -0
  42. package/esm/deps/deno.land/std@0.203.0/semver/gtr.d.ts +3 -0
  43. package/esm/deps/deno.land/std@0.203.0/semver/gtr.js +5 -0
  44. package/esm/deps/deno.land/std@0.203.0/semver/increment.d.ts +28 -0
  45. package/esm/deps/deno.land/std@0.203.0/semver/increment.js +207 -0
  46. package/esm/deps/deno.land/std@0.203.0/semver/is_semver.d.ts +17 -0
  47. package/esm/deps/deno.land/std@0.203.0/semver/is_semver.js +41 -0
  48. package/esm/deps/deno.land/std@0.203.0/semver/is_semver_comparator.d.ts +12 -0
  49. package/esm/deps/deno.land/std@0.203.0/semver/is_semver_comparator.js +31 -0
  50. package/esm/deps/deno.land/std@0.203.0/semver/is_semver_range.d.ts +12 -0
  51. package/esm/deps/deno.land/std@0.203.0/semver/is_semver_range.js +22 -0
  52. package/esm/deps/deno.land/std@0.203.0/semver/lt.d.ts +3 -0
  53. package/esm/deps/deno.land/std@0.203.0/semver/lt.js +5 -0
  54. package/esm/deps/deno.land/std@0.203.0/semver/lte.d.ts +3 -0
  55. package/esm/deps/deno.land/std@0.203.0/semver/lte.js +5 -0
  56. package/esm/deps/deno.land/std@0.203.0/semver/ltr.d.ts +3 -0
  57. package/esm/deps/deno.land/std@0.203.0/semver/ltr.js +5 -0
  58. package/esm/deps/deno.land/std@0.203.0/semver/max_satisfying.d.ts +9 -0
  59. package/esm/deps/deno.land/std@0.203.0/semver/max_satisfying.js +14 -0
  60. package/esm/deps/deno.land/std@0.203.0/semver/min_satisfying.d.ts +9 -0
  61. package/esm/deps/deno.land/std@0.203.0/semver/min_satisfying.js +14 -0
  62. package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.203.0}/semver/mod.d.ts +88 -176
  63. package/esm/deps/deno.land/std@0.203.0/semver/mod.js +313 -0
  64. package/esm/deps/deno.land/std@0.203.0/semver/neq.d.ts +3 -0
  65. package/esm/deps/deno.land/std@0.203.0/semver/neq.js +5 -0
  66. package/esm/deps/deno.land/std@0.203.0/semver/outside.d.ts +11 -0
  67. package/esm/deps/deno.land/std@0.203.0/semver/outside.js +67 -0
  68. package/esm/deps/deno.land/std@0.203.0/semver/parse.d.ts +8 -0
  69. package/esm/deps/deno.land/std@0.203.0/semver/parse.js +66 -0
  70. package/esm/deps/deno.land/std@0.203.0/semver/parse_comparator.d.ts +7 -0
  71. package/esm/deps/deno.land/std@0.203.0/semver/parse_comparator.js +28 -0
  72. package/esm/deps/deno.land/std@0.203.0/semver/parse_range.d.ts +7 -0
  73. package/esm/deps/deno.land/std@0.203.0/semver/parse_range.js +292 -0
  74. package/esm/deps/deno.land/std@0.203.0/semver/range_format.d.ts +8 -0
  75. package/esm/deps/deno.land/std@0.203.0/semver/range_format.js +11 -0
  76. package/esm/deps/deno.land/std@0.203.0/semver/range_intersects.d.ts +8 -0
  77. package/esm/deps/deno.land/std@0.203.0/semver/range_intersects.js +35 -0
  78. package/esm/deps/deno.land/std@0.203.0/semver/range_max.d.ts +7 -0
  79. package/esm/deps/deno.land/std@0.203.0/semver/range_max.js +15 -0
  80. package/esm/deps/deno.land/std@0.203.0/semver/range_min.d.ts +7 -0
  81. package/esm/deps/deno.land/std@0.203.0/semver/range_min.js +14 -0
  82. package/esm/deps/deno.land/std@0.203.0/semver/rcompare.d.ts +8 -0
  83. package/esm/deps/deno.land/std@0.203.0/semver/rcompare.js +10 -0
  84. package/esm/deps/deno.land/std@0.203.0/semver/rsort.d.ts +3 -0
  85. package/esm/deps/deno.land/std@0.203.0/semver/rsort.js +5 -0
  86. package/esm/deps/deno.land/std@0.203.0/semver/sort.d.ts +3 -0
  87. package/esm/deps/deno.land/std@0.203.0/semver/sort.js +5 -0
  88. package/esm/deps/deno.land/std@0.203.0/semver/test_comparator.d.ts +8 -0
  89. package/esm/deps/deno.land/std@0.203.0/semver/test_comparator.js +10 -0
  90. package/esm/deps/deno.land/std@0.203.0/semver/test_range.d.ts +8 -0
  91. package/esm/deps/deno.land/std@0.203.0/semver/test_range.js +16 -0
  92. package/esm/deps/deno.land/std@0.203.0/semver/types.d.ts +44 -0
  93. package/esm/deps/deno.land/std@0.203.0/semver/types.js +2 -0
  94. package/{types → esm}/src/Changelog.d.ts +4 -2
  95. package/esm/src/Changelog.js +25 -4
  96. package/{types → esm}/src/Release.d.ts +5 -4
  97. package/esm/src/Release.js +21 -22
  98. package/esm/src/deps.d.ts +2 -0
  99. package/esm/src/deps.js +1 -1
  100. package/esm/test/changelog.custom.type.md +2 -3
  101. package/esm/test/changelog.expected.linted.md +3 -4
  102. package/esm/test/changelog.expected.md +3 -4
  103. package/esm/test/changelog.md +3 -4
  104. package/esm/test/empty.expected.md +2 -2
  105. package/package.json +6 -13
  106. package/script/_dnt.polyfills.d.ts +11 -0
  107. package/script/_dnt.shims.d.ts +5 -0
  108. package/script/_dnt.shims.js +0 -1
  109. package/script/bin.d.ts +2 -0
  110. package/script/bin.js +8 -3
  111. package/script/deps/deno.land/std@0.189.0/_util/asserts.d.ts +10 -0
  112. package/script/deps/deno.land/std@0.189.0/_util/os.d.ts +4 -0
  113. package/script/deps/deno.land/std@0.189.0/flags/mod.d.ts +166 -0
  114. package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/flags/mod.js +4 -3
  115. package/script/deps/deno.land/std@0.189.0/path/_constants.d.ts +39 -0
  116. package/script/deps/deno.land/std@0.189.0/path/_interface.d.ts +26 -0
  117. package/script/deps/deno.land/std@0.189.0/path/_util.d.ts +11 -0
  118. package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/_util.js +50 -1
  119. package/script/deps/deno.land/std@0.189.0/path/common.d.ts +13 -0
  120. package/script/deps/deno.land/std@0.189.0/path/glob.d.ts +83 -0
  121. package/script/deps/deno.land/std@0.189.0/path/mod.d.ts +11 -0
  122. package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/mod.js +5 -2
  123. package/script/deps/deno.land/std@0.189.0/path/posix.d.ts +86 -0
  124. package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/posix.js +48 -106
  125. package/script/deps/deno.land/std@0.189.0/path/separator.d.ts +2 -0
  126. package/script/deps/deno.land/std@0.189.0/path/win32.d.ts +91 -0
  127. package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/win32.js +22 -81
  128. package/script/deps/deno.land/std@0.203.0/semver/_shared.d.ts +42 -0
  129. package/script/deps/deno.land/std@0.203.0/semver/_shared.js +248 -0
  130. package/script/deps/deno.land/std@0.203.0/semver/cmp.d.ts +9 -0
  131. package/script/deps/deno.land/std@0.203.0/semver/cmp.js +39 -0
  132. package/script/deps/deno.land/std@0.203.0/semver/comparator_format.d.ts +8 -0
  133. package/script/deps/deno.land/std@0.203.0/semver/comparator_format.js +15 -0
  134. package/script/deps/deno.land/std@0.203.0/semver/comparator_intersects.d.ts +8 -0
  135. package/script/deps/deno.land/std@0.203.0/semver/comparator_intersects.js +49 -0
  136. package/script/deps/deno.land/std@0.203.0/semver/comparator_max.d.ts +9 -0
  137. package/script/deps/deno.land/std@0.203.0/semver/comparator_max.js +49 -0
  138. package/script/deps/deno.land/std@0.203.0/semver/comparator_min.d.ts +8 -0
  139. package/script/deps/deno.land/std@0.203.0/semver/comparator_min.js +36 -0
  140. package/script/deps/deno.land/std@0.203.0/semver/compare.d.ts +10 -0
  141. package/script/deps/deno.land/std@0.203.0/semver/compare.js +22 -0
  142. package/script/deps/deno.land/std@0.203.0/semver/compare_build.d.ts +13 -0
  143. package/script/deps/deno.land/std@0.203.0/semver/compare_build.js +27 -0
  144. package/script/deps/deno.land/std@0.203.0/semver/constants.d.ts +42 -0
  145. package/script/deps/deno.land/std@0.203.0/semver/constants.js +78 -0
  146. package/script/deps/deno.land/std@0.203.0/semver/difference.d.ts +4 -0
  147. package/script/deps/deno.land/std@0.203.0/semver/difference.js +30 -0
  148. package/script/deps/deno.land/std@0.203.0/semver/eq.d.ts +4 -0
  149. package/script/deps/deno.land/std@0.203.0/semver/eq.js +11 -0
  150. package/script/deps/deno.land/std@0.203.0/semver/format.d.ts +12 -0
  151. package/script/deps/deno.land/std@0.203.0/semver/format.js +58 -0
  152. package/script/deps/deno.land/std@0.203.0/semver/gt.d.ts +3 -0
  153. package/script/deps/deno.land/std@0.203.0/semver/gt.js +9 -0
  154. package/script/deps/deno.land/std@0.203.0/semver/gte.d.ts +3 -0
  155. package/script/deps/deno.land/std@0.203.0/semver/gte.js +9 -0
  156. package/script/deps/deno.land/std@0.203.0/semver/gtr.d.ts +3 -0
  157. package/script/deps/deno.land/std@0.203.0/semver/gtr.js +9 -0
  158. package/script/deps/deno.land/std@0.203.0/semver/increment.d.ts +28 -0
  159. package/script/deps/deno.land/std@0.203.0/semver/increment.js +211 -0
  160. package/script/deps/deno.land/std@0.203.0/semver/is_semver.d.ts +17 -0
  161. package/script/deps/deno.land/std@0.203.0/semver/is_semver.js +45 -0
  162. package/script/deps/deno.land/std@0.203.0/semver/is_semver_comparator.d.ts +12 -0
  163. package/script/deps/deno.land/std@0.203.0/semver/is_semver_comparator.js +35 -0
  164. package/script/deps/deno.land/std@0.203.0/semver/is_semver_range.d.ts +12 -0
  165. package/script/deps/deno.land/std@0.203.0/semver/is_semver_range.js +26 -0
  166. package/script/deps/deno.land/std@0.203.0/semver/lt.d.ts +3 -0
  167. package/script/deps/deno.land/std@0.203.0/semver/lt.js +9 -0
  168. package/script/deps/deno.land/std@0.203.0/semver/lte.d.ts +3 -0
  169. package/script/deps/deno.land/std@0.203.0/semver/lte.js +9 -0
  170. package/script/deps/deno.land/std@0.203.0/semver/ltr.d.ts +3 -0
  171. package/script/deps/deno.land/std@0.203.0/semver/ltr.js +9 -0
  172. package/script/deps/deno.land/std@0.203.0/semver/max_satisfying.d.ts +9 -0
  173. package/script/deps/deno.land/std@0.203.0/semver/max_satisfying.js +18 -0
  174. package/script/deps/deno.land/std@0.203.0/semver/min_satisfying.d.ts +9 -0
  175. package/script/deps/deno.land/std@0.203.0/semver/min_satisfying.js +18 -0
  176. package/script/deps/deno.land/std@0.203.0/semver/mod.d.ts +310 -0
  177. package/script/deps/deno.land/std@0.203.0/semver/mod.js +330 -0
  178. package/script/deps/deno.land/std@0.203.0/semver/neq.d.ts +3 -0
  179. package/script/deps/deno.land/std@0.203.0/semver/neq.js +9 -0
  180. package/script/deps/deno.land/std@0.203.0/semver/outside.d.ts +11 -0
  181. package/script/deps/deno.land/std@0.203.0/semver/outside.js +71 -0
  182. package/script/deps/deno.land/std@0.203.0/semver/parse.d.ts +8 -0
  183. package/script/deps/deno.land/std@0.203.0/semver/parse.js +70 -0
  184. package/script/deps/deno.land/std@0.203.0/semver/parse_comparator.d.ts +7 -0
  185. package/script/deps/deno.land/std@0.203.0/semver/parse_comparator.js +32 -0
  186. package/script/deps/deno.land/std@0.203.0/semver/parse_range.d.ts +7 -0
  187. package/script/deps/deno.land/std@0.203.0/semver/parse_range.js +296 -0
  188. package/script/deps/deno.land/std@0.203.0/semver/range_format.d.ts +8 -0
  189. package/script/deps/deno.land/std@0.203.0/semver/range_format.js +15 -0
  190. package/script/deps/deno.land/std@0.203.0/semver/range_intersects.d.ts +8 -0
  191. package/script/deps/deno.land/std@0.203.0/semver/range_intersects.js +39 -0
  192. package/script/deps/deno.land/std@0.203.0/semver/range_max.d.ts +7 -0
  193. package/script/deps/deno.land/std@0.203.0/semver/range_max.js +19 -0
  194. package/script/deps/deno.land/std@0.203.0/semver/range_min.d.ts +7 -0
  195. package/script/deps/deno.land/std@0.203.0/semver/range_min.js +18 -0
  196. package/script/deps/deno.land/std@0.203.0/semver/rcompare.d.ts +8 -0
  197. package/script/deps/deno.land/std@0.203.0/semver/rcompare.js +14 -0
  198. package/script/deps/deno.land/std@0.203.0/semver/rsort.d.ts +3 -0
  199. package/script/deps/deno.land/std@0.203.0/semver/rsort.js +9 -0
  200. package/script/deps/deno.land/std@0.203.0/semver/sort.d.ts +3 -0
  201. package/script/deps/deno.land/std@0.203.0/semver/sort.js +9 -0
  202. package/script/deps/deno.land/std@0.203.0/semver/test_comparator.d.ts +8 -0
  203. package/script/deps/deno.land/std@0.203.0/semver/test_comparator.js +14 -0
  204. package/script/deps/deno.land/std@0.203.0/semver/test_range.d.ts +8 -0
  205. package/script/deps/deno.land/std@0.203.0/semver/test_range.js +20 -0
  206. package/script/deps/deno.land/std@0.203.0/semver/types.d.ts +44 -0
  207. package/script/deps/deno.land/std@0.203.0/semver/types.js +3 -0
  208. package/script/deps/deno.land/std@0.51.0/fs/eol.d.ts +12 -0
  209. package/script/deps/deno.land/x/ini@v2.1.0/ini.d.ts +53 -0
  210. package/script/deps/deno.land/x/ini@v2.1.0/mod.d.ts +1 -0
  211. package/script/mod.d.ts +6 -0
  212. package/script/src/Change.d.ts +8 -0
  213. package/script/src/Changelog.d.ts +21 -0
  214. package/script/src/Changelog.js +24 -3
  215. package/script/src/Release.d.ts +28 -0
  216. package/script/src/Release.js +20 -21
  217. package/script/src/deps.d.ts +2 -0
  218. package/script/src/deps.js +5 -6
  219. package/script/src/parser.d.ts +11 -0
  220. package/script/test/changelog.custom.type.md +2 -3
  221. package/script/test/changelog.expected.linted.md +3 -4
  222. package/script/test/changelog.expected.md +3 -4
  223. package/script/test/changelog.md +3 -4
  224. package/script/test/empty.expected.md +2 -2
  225. package/esm/deps/deno.land/std@0.173.0/semver/mod.js +0 -1420
  226. package/script/deps/deno.land/std@0.173.0/semver/mod.js +0 -1458
  227. package/types/src/deps.d.ts +0 -1
  228. /package/{types → esm}/_dnt.polyfills.d.ts +0 -0
  229. /package/{types → esm}/_dnt.shims.d.ts +0 -0
  230. /package/{types → esm}/bin.d.ts +0 -0
  231. /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/_util/asserts.d.ts +0 -0
  232. /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/_util/asserts.js +0 -0
  233. /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/_util/os.d.ts +0 -0
  234. /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/_util/os.js +0 -0
  235. /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/flags/mod.d.ts +0 -0
  236. /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/_constants.d.ts +0 -0
  237. /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/_constants.js +0 -0
  238. /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/_interface.d.ts +0 -0
  239. /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/_interface.js +0 -0
  240. /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/common.d.ts +0 -0
  241. /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/common.js +0 -0
  242. /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/glob.d.ts +0 -0
  243. /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/glob.js +0 -0
  244. /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/separator.d.ts +0 -0
  245. /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/separator.js +0 -0
  246. /package/{types → esm}/deps/deno.land/std@0.51.0/fs/eol.d.ts +0 -0
  247. /package/{types → esm}/deps/deno.land/x/ini@v2.1.0/ini.d.ts +0 -0
  248. /package/{types → esm}/deps/deno.land/x/ini@v2.1.0/mod.d.ts +0 -0
  249. /package/{types → esm}/mod.d.ts +0 -0
  250. /package/{types → esm}/src/Change.d.ts +0 -0
  251. /package/{types → esm}/src/parser.d.ts +0 -0
  252. /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/_util/asserts.js +0 -0
  253. /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/_util/os.js +0 -0
  254. /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/_constants.js +0 -0
  255. /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/_interface.js +0 -0
  256. /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/common.js +0 -0
  257. /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/glob.js +0 -0
  258. /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/separator.js +0 -0
@@ -4,7 +4,7 @@
4
4
  // This module is browser compatible.
5
5
  import * as dntShim from "../../../../_dnt.shims.js";
6
6
  import { CHAR_BACKWARD_SLASH, CHAR_COLON, CHAR_DOT, CHAR_QUESTION_MARK, } from "./_constants.js";
7
- import { _format, assertPath, encodeWhitespace, isPathSeparator, isWindowsDeviceRoot, normalizeString, } from "./_util.js";
7
+ import { _format, assertPath, encodeWhitespace, isPathSeparator, isPosixPathSeparator, isWindowsDeviceRoot, lastPathSegment, normalizeString, stripSuffix, stripTrailingSeparators, } from "./_util.js";
8
8
  import { assert } from "../_util/asserts.js";
9
9
  export const sep = "\\";
10
10
  export const delimiter = ";";
@@ -508,7 +508,7 @@ export function toNamespacedPath(path) {
508
508
  }
509
509
  /**
510
510
  * Return the directory path of a `path`.
511
- * @param path to determine the directory path for
511
+ * @param path - path to extract the directory from.
512
512
  */
513
513
  export function dirname(path) {
514
514
  assertPath(path);
@@ -598,25 +598,26 @@ export function dirname(path) {
598
598
  else
599
599
  end = rootEnd;
600
600
  }
601
- return path.slice(0, end);
601
+ return stripTrailingSeparators(path.slice(0, end), isPosixPathSeparator);
602
602
  }
603
603
  /**
604
- * Return the last portion of a `path`. Trailing directory separators are ignored.
605
- * @param path to process
606
- * @param ext of path directory
604
+ * Return the last portion of a `path`.
605
+ * Trailing directory separators are ignored, and optional suffix is removed.
606
+ *
607
+ * @param path - path to extract name from.
608
+ * @param [suffix] - suffix to remove from extracted name.
607
609
  */
608
- export function basename(path, ext = "") {
609
- if (ext !== undefined && typeof ext !== "string") {
610
- throw new TypeError('"ext" argument must be a string');
611
- }
610
+ export function basename(path, suffix = "") {
612
611
  assertPath(path);
613
- let start = 0;
614
- let end = -1;
615
- let matchedSlash = true;
616
- let i;
612
+ if (path.length === 0)
613
+ return path;
614
+ if (typeof suffix !== "string") {
615
+ throw new TypeError(`Suffix must be a string. Received ${JSON.stringify(suffix)}`);
616
+ }
617
617
  // Check for a drive letter prefix so as not to mistake the following
618
618
  // path separator as an extra separator at the end of the path that can be
619
619
  // disregarded
620
+ let start = 0;
620
621
  if (path.length >= 2) {
621
622
  const drive = path.charCodeAt(0);
622
623
  if (isWindowsDeviceRoot(drive)) {
@@ -624,73 +625,9 @@ export function basename(path, ext = "") {
624
625
  start = 2;
625
626
  }
626
627
  }
627
- if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
628
- if (ext.length === path.length && ext === path)
629
- return "";
630
- let extIdx = ext.length - 1;
631
- let firstNonSlashEnd = -1;
632
- for (i = path.length - 1; i >= start; --i) {
633
- const code = path.charCodeAt(i);
634
- if (isPathSeparator(code)) {
635
- // If we reached a path separator that was not part of a set of path
636
- // separators at the end of the string, stop now
637
- if (!matchedSlash) {
638
- start = i + 1;
639
- break;
640
- }
641
- }
642
- else {
643
- if (firstNonSlashEnd === -1) {
644
- // We saw the first non-path separator, mark this as the end of our
645
- // path component in case we don't match a whole suffix
646
- matchedSlash = false;
647
- firstNonSlashEnd = i + 1;
648
- end = firstNonSlashEnd;
649
- }
650
- if (extIdx >= 0) {
651
- // Try to match the explicit suffix
652
- if (code === ext.charCodeAt(extIdx)) {
653
- if (--extIdx === -1) {
654
- // We matched whole suffix, so mark this as the end of our path
655
- // component
656
- end = i;
657
- }
658
- }
659
- else {
660
- // Suffix character does not match, so bail out early
661
- // from checking rest of characters
662
- extIdx = -1;
663
- }
664
- }
665
- }
666
- }
667
- if (end === -1)
668
- return "";
669
- if (start === end)
670
- end = firstNonSlashEnd;
671
- return path.slice(start, end);
672
- }
673
- else {
674
- for (i = path.length - 1; i >= start; --i) {
675
- if (isPathSeparator(path.charCodeAt(i))) {
676
- // If we reached a path separator that was not part of a set of path
677
- // separators at the end of the string, stop now
678
- if (!matchedSlash) {
679
- start = i + 1;
680
- break;
681
- }
682
- }
683
- else if (end === -1) {
684
- // We saw the first non-path separator, mark this as the end of our
685
- // path component
686
- matchedSlash = false;
687
- end = i + 1;
688
- }
689
- }
690
- if (end === -1)
691
- return "";
692
- return path.slice(start, end);
693
- }
628
+ const lastSegment = lastPathSegment(path, isPathSeparator, start);
629
+ const strippedSegment = stripTrailingSeparators(lastSegment, isPathSeparator);
630
+ return suffix ? stripSuffix(strippedSegment, suffix) : strippedSegment;
694
631
  }
695
632
  /**
696
633
  * Return the extension of the `path` with leading period.
@@ -829,13 +766,14 @@ export function parse(path) {
829
766
  // `path` contains just a drive root, exit early to avoid
830
767
  // unnecessary work
831
768
  ret.root = ret.dir = path;
769
+ ret.base = "\\";
832
770
  return ret;
833
771
  }
834
772
  rootEnd = 3;
835
773
  }
836
774
  }
837
775
  else {
838
- // `path` contains just a drive root, exit early to avoid
776
+ // `path` contains just a relative drive root, exit early to avoid
839
777
  // unnecessary work
840
778
  ret.root = ret.dir = path;
841
779
  return ret;
@@ -847,6 +785,7 @@ export function parse(path) {
847
785
  // `path` contains just a path separator, exit early to avoid
848
786
  // unnecessary work
849
787
  ret.root = ret.dir = path;
788
+ ret.base = "\\";
850
789
  return ret;
851
790
  }
852
791
  if (rootEnd > 0)
@@ -905,6 +844,8 @@ export function parse(path) {
905
844
  ret.base = path.slice(startPart, end);
906
845
  ret.ext = path.slice(startDot, end);
907
846
  }
847
+ // Fallback to '\' in case there is no basename
848
+ ret.base = ret.base || "\\";
908
849
  // If the directory is the root, use the entire root as the `dir` including
909
850
  // the trailing slash if any (`C:\abc` -> `C:\`). Otherwise, strip out the
910
851
  // trailing slash (`C:\abc\def` -> `C:\abc`).
@@ -0,0 +1,42 @@
1
+ import { Operator } from "./types.js";
2
+ export declare function compareNumber(a: number, b: number): 1 | 0 | -1;
3
+ export declare function checkIdentifier(v1: ReadonlyArray<string | number>, v2: ReadonlyArray<string | number>): 1 | 0 | -1;
4
+ export declare function compareIdentifier(v1: ReadonlyArray<string | number>, v2: ReadonlyArray<string | number>): 1 | 0 | -1;
5
+ declare const re: RegExp[];
6
+ declare const src: string[];
7
+ declare const NUMERICIDENTIFIER: number;
8
+ declare const FULL: number;
9
+ declare const XRANGE: number;
10
+ declare const TILDE: number;
11
+ declare const CARET: number;
12
+ declare const COMPARATOR: number;
13
+ declare const HYPHENRANGE: number;
14
+ declare const STAR: number;
15
+ /**
16
+ * Returns true if the value is a valid SemVer number.
17
+ *
18
+ * Must be a number. Must not be NaN. Can be positive or negative infinity.
19
+ * Can be between 0 and MAX_SAFE_INTEGER.
20
+ * @param value The value to check
21
+ * @returns True if its a valid semver number
22
+ */
23
+ export declare function isValidNumber(value: unknown): value is number;
24
+ export declare const MAX_LENGTH = 256;
25
+ /**
26
+ * Returns true if the value is a valid semver pre-release or build identifier.
27
+ *
28
+ * Must be a string. Must be between 1 and 256 characters long. Must match
29
+ * the regular expression /[0-9A-Za-z-]+/.
30
+ * @param value The value to check
31
+ * @returns True if the value is a valid semver string.
32
+ */
33
+ export declare function isValidString(value: unknown): value is string;
34
+ /**
35
+ * Checks to see if the value is a valid Operator string.
36
+ *
37
+ * Adds a type assertion if true.
38
+ * @param value The value to check
39
+ * @returns True if the value is a valid Operator string otherwise false.
40
+ */
41
+ export declare function isValidOperator(value: unknown): value is Operator;
42
+ export { CARET, COMPARATOR, FULL, HYPHENRANGE, NUMERICIDENTIFIER, re, src, STAR, TILDE, XRANGE, };
@@ -0,0 +1,230 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ export function compareNumber(a, b) {
3
+ if (isNaN(a) || isNaN(b)) {
4
+ throw new Error("Comparison against non-numbers");
5
+ }
6
+ return a === b ? 0 : a < b ? -1 : 1;
7
+ }
8
+ export function checkIdentifier(v1, v2) {
9
+ // NOT having a prerelease is > having one
10
+ // But NOT having a build is < having one
11
+ if (v1.length && !v2.length) {
12
+ return -1;
13
+ }
14
+ else if (!v1.length && v2.length) {
15
+ return 1;
16
+ }
17
+ else {
18
+ return 0;
19
+ }
20
+ }
21
+ export function compareIdentifier(v1, v2) {
22
+ let i = 0;
23
+ do {
24
+ const a = v1[i];
25
+ const b = v2[i];
26
+ if (a === undefined && b === undefined) {
27
+ // same length is equal
28
+ return 0;
29
+ }
30
+ else if (b === undefined) {
31
+ // longer > shorter
32
+ return 1;
33
+ }
34
+ else if (a === undefined) {
35
+ // shorter < longer
36
+ return -1;
37
+ }
38
+ else if (typeof a === "string" && typeof b === "number") {
39
+ // string > number
40
+ return 1;
41
+ }
42
+ else if (typeof a === "number" && typeof b === "string") {
43
+ // number < string
44
+ return -1;
45
+ }
46
+ else if (a < b) {
47
+ return -1;
48
+ }
49
+ else if (a > b) {
50
+ return 1;
51
+ }
52
+ else {
53
+ // If they're equal, continue comparing segments.
54
+ continue;
55
+ }
56
+ } while (++i);
57
+ // It can't ever reach here, but typescript doesn't realize that so
58
+ // add this line so the return type is inferred correctly.
59
+ return 0;
60
+ }
61
+ // The actual regexps
62
+ const re = [];
63
+ const src = [];
64
+ let R = 0;
65
+ // The following Regular Expressions can be used for tokenizing,
66
+ // validating, and parsing SemVer version strings.
67
+ // ## Numeric Identifier
68
+ // A single `0`, or a non-zero digit followed by zero or more digits.
69
+ const NUMERICIDENTIFIER = R++;
70
+ src[NUMERICIDENTIFIER] = "0|[1-9]\\d*";
71
+ // ## Non-numeric Identifier
72
+ // Zero or more digits, followed by a letter or hyphen, and then zero or
73
+ // more letters, digits, or hyphens.
74
+ const NONNUMERICIDENTIFIER = R++;
75
+ src[NONNUMERICIDENTIFIER] = "\\d*[a-zA-Z-][a-zA-Z0-9-]*";
76
+ // ## Main Version
77
+ // Three dot-separated numeric identifiers.
78
+ const MAINVERSION = R++;
79
+ const nid = src[NUMERICIDENTIFIER];
80
+ src[MAINVERSION] = `(${nid})\\.(${nid})\\.(${nid})`;
81
+ // ## Pre-release Version Identifier
82
+ // A numeric identifier, or a non-numeric identifier.
83
+ const PRERELEASEIDENTIFIER = R++;
84
+ src[PRERELEASEIDENTIFIER] = "(?:" + src[NUMERICIDENTIFIER] + "|" +
85
+ src[NONNUMERICIDENTIFIER] + ")";
86
+ // ## Pre-release Version
87
+ // Hyphen, followed by one or more dot-separated pre-release version
88
+ // identifiers.
89
+ const PRERELEASE = R++;
90
+ src[PRERELEASE] = "(?:-(" +
91
+ src[PRERELEASEIDENTIFIER] +
92
+ "(?:\\." +
93
+ src[PRERELEASEIDENTIFIER] +
94
+ ")*))";
95
+ // ## Build Metadata Identifier
96
+ // Any combination of digits, letters, or hyphens.
97
+ const BUILDIDENTIFIER = R++;
98
+ src[BUILDIDENTIFIER] = "[0-9A-Za-z-]+";
99
+ // ## Build Metadata
100
+ // Plus sign, followed by one or more period-separated build metadata
101
+ // identifiers.
102
+ const BUILD = R++;
103
+ src[BUILD] = "(?:\\+(" + src[BUILDIDENTIFIER] + "(?:\\." +
104
+ src[BUILDIDENTIFIER] + ")*))";
105
+ // ## Full Version String
106
+ // A main version, followed optionally by a pre-release version and
107
+ // build metadata.
108
+ // Note that the only major, minor, patch, and pre-release sections of
109
+ // the version string are capturing groups. The build metadata is not a
110
+ // capturing group, because it should not ever be used in version
111
+ // comparison.
112
+ const FULL = R++;
113
+ const FULLPLAIN = "v?" + src[MAINVERSION] + src[PRERELEASE] + "?" + src[BUILD] +
114
+ "?";
115
+ src[FULL] = "^" + FULLPLAIN + "$";
116
+ const GTLT = R++;
117
+ src[GTLT] = "((?:<|>)?=?)";
118
+ // Something like "2.*" or "1.2.x".
119
+ // Note that "x.x" is a valid xRange identifier, meaning "any version"
120
+ // Only the first item is strictly required.
121
+ const XRANGEIDENTIFIER = R++;
122
+ src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + "|x|X|\\*";
123
+ const XRANGEPLAIN = R++;
124
+ src[XRANGEPLAIN] = "[v=\\s]*(" +
125
+ src[XRANGEIDENTIFIER] +
126
+ ")" +
127
+ "(?:\\.(" +
128
+ src[XRANGEIDENTIFIER] +
129
+ ")" +
130
+ "(?:\\.(" +
131
+ src[XRANGEIDENTIFIER] +
132
+ ")" +
133
+ "(?:" +
134
+ src[PRERELEASE] +
135
+ ")?" +
136
+ src[BUILD] +
137
+ "?" +
138
+ ")?)?";
139
+ const XRANGE = R++;
140
+ src[XRANGE] = "^" + src[GTLT] + "\\s*" + src[XRANGEPLAIN] + "$";
141
+ // Tilde ranges.
142
+ // Meaning is "reasonably at or greater than"
143
+ const LONETILDE = R++;
144
+ src[LONETILDE] = "(?:~>?)";
145
+ const TILDE = R++;
146
+ src[TILDE] = "^" + src[LONETILDE] + src[XRANGEPLAIN] + "$";
147
+ // Caret ranges.
148
+ // Meaning is "at least and backwards compatible with"
149
+ const LONECARET = R++;
150
+ src[LONECARET] = "(?:\\^)";
151
+ const CARET = R++;
152
+ src[CARET] = "^" + src[LONECARET] + src[XRANGEPLAIN] + "$";
153
+ // A simple gt/lt/eq thing, or just "" to indicate "any version"
154
+ const COMPARATOR = R++;
155
+ src[COMPARATOR] = "^" + src[GTLT] + "\\s*(" + FULLPLAIN + ")$|^$";
156
+ // Something like `1.2.3 - 1.2.4`
157
+ const HYPHENRANGE = R++;
158
+ src[HYPHENRANGE] = "^\\s*(" +
159
+ src[XRANGEPLAIN] +
160
+ ")" +
161
+ "\\s+-\\s+" +
162
+ "(" +
163
+ src[XRANGEPLAIN] +
164
+ ")" +
165
+ "\\s*$";
166
+ // Star ranges basically just allow anything at all.
167
+ const STAR = R++;
168
+ src[STAR] = "(<|>)?=?\\s*\\*";
169
+ // Compile to actual regexp objects.
170
+ // All are flag-free, unless they were created above with a flag.
171
+ for (let i = 0; i < R; i++) {
172
+ if (!re[i]) {
173
+ re[i] = new RegExp(src[i]);
174
+ }
175
+ }
176
+ /**
177
+ * Returns true if the value is a valid SemVer number.
178
+ *
179
+ * Must be a number. Must not be NaN. Can be positive or negative infinity.
180
+ * Can be between 0 and MAX_SAFE_INTEGER.
181
+ * @param value The value to check
182
+ * @returns True if its a valid semver number
183
+ */
184
+ export function isValidNumber(value) {
185
+ return (typeof value === "number" &&
186
+ !Number.isNaN(value) && (!Number.isFinite(value) ||
187
+ (0 <= value && value <= Number.MAX_SAFE_INTEGER)));
188
+ }
189
+ export const MAX_LENGTH = 256;
190
+ /**
191
+ * Returns true if the value is a valid semver pre-release or build identifier.
192
+ *
193
+ * Must be a string. Must be between 1 and 256 characters long. Must match
194
+ * the regular expression /[0-9A-Za-z-]+/.
195
+ * @param value The value to check
196
+ * @returns True if the value is a valid semver string.
197
+ */
198
+ export function isValidString(value) {
199
+ return (typeof value === "string" &&
200
+ value.length > 0 &&
201
+ value.length <= MAX_LENGTH &&
202
+ !!value.match(/[0-9A-Za-z-]+/));
203
+ }
204
+ /**
205
+ * Checks to see if the value is a valid Operator string.
206
+ *
207
+ * Adds a type assertion if true.
208
+ * @param value The value to check
209
+ * @returns True if the value is a valid Operator string otherwise false.
210
+ */
211
+ export function isValidOperator(value) {
212
+ if (typeof value !== "string")
213
+ return false;
214
+ switch (value) {
215
+ case "":
216
+ case "=":
217
+ case "==":
218
+ case "===":
219
+ case "!==":
220
+ case "!=":
221
+ case ">":
222
+ case ">=":
223
+ case "<":
224
+ case "<=":
225
+ return true;
226
+ default:
227
+ return false;
228
+ }
229
+ }
230
+ export { CARET, COMPARATOR, FULL, HYPHENRANGE, NUMERICIDENTIFIER, re, src, STAR, TILDE, XRANGE, };
@@ -0,0 +1,9 @@
1
+ import type { Operator, SemVer } from "./types.js";
2
+ /**
3
+ * Do a comparison of two semantic version objects based on the given operator
4
+ * @param s0 The left side of the comparison
5
+ * @param operator The operator to use for the comparison
6
+ * @param s1 The right side of the comparison
7
+ * @returns True or false based on the operator
8
+ */
9
+ export declare function cmp(s0: SemVer, operator: Operator, s1: SemVer): boolean;
@@ -0,0 +1,35 @@
1
+ import { eq } from "./eq.js";
2
+ import { neq } from "./neq.js";
3
+ import { gte } from "./gte.js";
4
+ import { gt } from "./gt.js";
5
+ import { lt } from "./lt.js";
6
+ import { lte } from "./lte.js";
7
+ /**
8
+ * Do a comparison of two semantic version objects based on the given operator
9
+ * @param s0 The left side of the comparison
10
+ * @param operator The operator to use for the comparison
11
+ * @param s1 The right side of the comparison
12
+ * @returns True or false based on the operator
13
+ */
14
+ export function cmp(s0, operator, s1) {
15
+ switch (operator) {
16
+ case "":
17
+ case "=":
18
+ case "==":
19
+ case "===":
20
+ return eq(s0, s1);
21
+ case "!=":
22
+ case "!==":
23
+ return neq(s0, s1);
24
+ case ">":
25
+ return gt(s0, s1);
26
+ case ">=":
27
+ return gte(s0, s1);
28
+ case "<":
29
+ return lt(s0, s1);
30
+ case "<=":
31
+ return lte(s0, s1);
32
+ default:
33
+ throw new TypeError(`Invalid operator: ${operator}`);
34
+ }
35
+ }
@@ -0,0 +1,8 @@
1
+ import type { SemVerComparator } from "./types.js";
2
+ /**
3
+ * Formats the comparator into a string
4
+ * @example >=0.0.0
5
+ * @param comparator
6
+ * @returns A string representation of the comparator
7
+ */
8
+ export declare function comparatorFormat(comparator: SemVerComparator): string;
@@ -0,0 +1,11 @@
1
+ import { format } from "./format.js";
2
+ /**
3
+ * Formats the comparator into a string
4
+ * @example >=0.0.0
5
+ * @param comparator
6
+ * @returns A string representation of the comparator
7
+ */
8
+ export function comparatorFormat(comparator) {
9
+ const { semver, operator } = comparator;
10
+ return `${operator}${format(semver)}`;
11
+ }
@@ -0,0 +1,8 @@
1
+ import type { SemVerComparator } from "./types.js";
2
+ /**
3
+ * Returns true if the range of possible versions intersects with the other comparators set of possible versions
4
+ * @param c0 The left side comparator
5
+ * @param c1 The right side comparator
6
+ * @returns True if any part of the comparators intersect
7
+ */
8
+ export declare function comparatorIntersects(c0: SemVerComparator, c1: SemVerComparator): boolean;
@@ -0,0 +1,45 @@
1
+ import { gte } from "./gte.js";
2
+ import { lte } from "./lte.js";
3
+ /**
4
+ * Returns true if the range of possible versions intersects with the other comparators set of possible versions
5
+ * @param c0 The left side comparator
6
+ * @param c1 The right side comparator
7
+ * @returns True if any part of the comparators intersect
8
+ */
9
+ export function comparatorIntersects(c0, c1) {
10
+ const l0 = c0.min;
11
+ const l1 = c0.max;
12
+ const r0 = c1.min;
13
+ const r1 = c1.max;
14
+ // We calculate the min and max ranges of both comparators.
15
+ // The minimum min is 0.0.0, the maximum max is ANY.
16
+ //
17
+ // Comparators with equality operators have the same min and max.
18
+ //
19
+ // We then check to see if the min's of either range falls within the span of the other range.
20
+ //
21
+ // A couple of intersection examples:
22
+ // ```
23
+ // l0 ---- l1
24
+ // r0 ---- r1
25
+ // ```
26
+ // ```
27
+ // l0 ---- l1
28
+ // r0 ---- r1
29
+ // ```
30
+ // ```
31
+ // l0 ------ l1
32
+ // r0--r1
33
+ // ```
34
+ // ```
35
+ // l0 - l1
36
+ // r0 - r1
37
+ // ```
38
+ //
39
+ // non-intersection example
40
+ // ```
41
+ // l0 -- l1
42
+ // r0 -- r1
43
+ // ```
44
+ return (gte(l0, r0) && lte(l0, r1)) || (gte(r0, l0) && lte(r0, l1));
45
+ }
@@ -0,0 +1,9 @@
1
+ import type { Operator, SemVer } from "./types.js";
2
+ /**
3
+ * The maximum version that could match this comparator.
4
+ *
5
+ * If an invalid comparator is given such as <0.0.0 then
6
+ * an out of range semver will be returned.
7
+ * @returns the version, the MAX version or the next smallest patch version
8
+ */
9
+ export declare function comparatorMax(semver: SemVer, operator: Operator): SemVer;
@@ -0,0 +1,45 @@
1
+ import { ANY, INVALID, MAX } from "./constants.js";
2
+ /**
3
+ * The maximum version that could match this comparator.
4
+ *
5
+ * If an invalid comparator is given such as <0.0.0 then
6
+ * an out of range semver will be returned.
7
+ * @returns the version, the MAX version or the next smallest patch version
8
+ */
9
+ export function comparatorMax(semver, operator) {
10
+ if (semver === ANY) {
11
+ return MAX;
12
+ }
13
+ switch (operator) {
14
+ case "!=":
15
+ case "!==":
16
+ case ">":
17
+ case ">=":
18
+ return MAX;
19
+ case "":
20
+ case "=":
21
+ case "==":
22
+ case "===":
23
+ case "<=":
24
+ return semver;
25
+ case "<": {
26
+ const patch = semver.patch - 1;
27
+ const minor = patch >= 0 ? semver.minor : semver.minor - 1;
28
+ const major = minor >= 0 ? semver.major : semver.major - 1;
29
+ // if you try to do <0.0.0 it will Give you -∞.∞.∞
30
+ // which means no SemVer can compare successfully to it.
31
+ if (major < 0) {
32
+ return INVALID;
33
+ }
34
+ else {
35
+ return {
36
+ major,
37
+ minor: minor >= 0 ? minor : Number.POSITIVE_INFINITY,
38
+ patch: patch >= 0 ? patch : Number.POSITIVE_INFINITY,
39
+ prerelease: [],
40
+ build: [],
41
+ };
42
+ }
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,8 @@
1
+ import type { Operator, SemVer } from "./types.js";
2
+ /**
3
+ * The minimum semantic version that could match this comparator
4
+ * @param semver The semantic version of the comparator
5
+ * @param operator The operator of the comparator
6
+ * @returns The minimum valid semantic version
7
+ */
8
+ export declare function comparatorMin(semver: SemVer, operator: Operator): SemVer;
@@ -0,0 +1,32 @@
1
+ import { ANY, MAX, MIN } from "./constants.js";
2
+ import { gt } from "./gt.js";
3
+ import { increment } from "./increment.js";
4
+ /**
5
+ * The minimum semantic version that could match this comparator
6
+ * @param semver The semantic version of the comparator
7
+ * @param operator The operator of the comparator
8
+ * @returns The minimum valid semantic version
9
+ */
10
+ export function comparatorMin(semver, operator) {
11
+ if (semver === ANY) {
12
+ return MIN;
13
+ }
14
+ switch (operator) {
15
+ case ">":
16
+ return semver.prerelease.length > 0
17
+ ? increment(semver, "pre")
18
+ : increment(semver, "patch");
19
+ case "!=":
20
+ case "!==":
21
+ case "<=":
22
+ case "<":
23
+ // The min(<0.0.0) is MAX
24
+ return gt(semver, MIN) ? MIN : MAX;
25
+ case ">=":
26
+ case "":
27
+ case "=":
28
+ case "==":
29
+ case "===":
30
+ return semver;
31
+ }
32
+ }
@@ -0,0 +1,10 @@
1
+ import type { SemVer } from "./types.js";
2
+ /**
3
+ * Compare two semantic version objects.
4
+ *
5
+ * Returns `0` if `v1 === v2`, or `1` if `v1` is greater, or `-1` if `v2` is
6
+ * greater.
7
+ *
8
+ * Sorts in ascending order if passed to `Array.sort()`,
9
+ */
10
+ export declare function compare(s0: SemVer, s1: SemVer): 1 | 0 | -1;