@hyperfrontend/versioning 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (353) hide show
  1. package/ARCHITECTURE.md +593 -0
  2. package/CHANGELOG.md +35 -0
  3. package/FUNDING.md +141 -0
  4. package/LICENSE.md +21 -0
  5. package/README.md +195 -0
  6. package/SECURITY.md +82 -0
  7. package/changelog/compare/diff.d.ts +128 -0
  8. package/changelog/compare/diff.d.ts.map +1 -0
  9. package/changelog/compare/index.cjs.js +628 -0
  10. package/changelog/compare/index.cjs.js.map +1 -0
  11. package/changelog/compare/index.d.ts +4 -0
  12. package/changelog/compare/index.d.ts.map +1 -0
  13. package/changelog/compare/index.esm.js +612 -0
  14. package/changelog/compare/index.esm.js.map +1 -0
  15. package/changelog/compare/is-equal.d.ts +114 -0
  16. package/changelog/compare/is-equal.d.ts.map +1 -0
  17. package/changelog/index.cjs.js +6448 -0
  18. package/changelog/index.cjs.js.map +1 -0
  19. package/changelog/index.d.ts +6 -0
  20. package/changelog/index.d.ts.map +1 -0
  21. package/changelog/index.esm.js +6358 -0
  22. package/changelog/index.esm.js.map +1 -0
  23. package/changelog/models/changelog.d.ts +86 -0
  24. package/changelog/models/changelog.d.ts.map +1 -0
  25. package/changelog/models/commit-ref.d.ts +51 -0
  26. package/changelog/models/commit-ref.d.ts.map +1 -0
  27. package/changelog/models/entry.d.ts +84 -0
  28. package/changelog/models/entry.d.ts.map +1 -0
  29. package/changelog/models/index.cjs.js +2043 -0
  30. package/changelog/models/index.cjs.js.map +1 -0
  31. package/changelog/models/index.d.ts +11 -0
  32. package/changelog/models/index.d.ts.map +1 -0
  33. package/changelog/models/index.esm.js +2026 -0
  34. package/changelog/models/index.esm.js.map +1 -0
  35. package/changelog/models/schema.d.ts +68 -0
  36. package/changelog/models/schema.d.ts.map +1 -0
  37. package/changelog/models/section.d.ts +25 -0
  38. package/changelog/models/section.d.ts.map +1 -0
  39. package/changelog/operations/add-entry.d.ts +56 -0
  40. package/changelog/operations/add-entry.d.ts.map +1 -0
  41. package/changelog/operations/add-item.d.ts +18 -0
  42. package/changelog/operations/add-item.d.ts.map +1 -0
  43. package/changelog/operations/filter-by-predicate.d.ts +81 -0
  44. package/changelog/operations/filter-by-predicate.d.ts.map +1 -0
  45. package/changelog/operations/filter-by-range.d.ts +63 -0
  46. package/changelog/operations/filter-by-range.d.ts.map +1 -0
  47. package/changelog/operations/filter-entries.d.ts +9 -0
  48. package/changelog/operations/filter-entries.d.ts.map +1 -0
  49. package/changelog/operations/index.cjs.js +2455 -0
  50. package/changelog/operations/index.cjs.js.map +1 -0
  51. package/changelog/operations/index.d.ts +15 -0
  52. package/changelog/operations/index.d.ts.map +1 -0
  53. package/changelog/operations/index.esm.js +2411 -0
  54. package/changelog/operations/index.esm.js.map +1 -0
  55. package/changelog/operations/merge.d.ts +88 -0
  56. package/changelog/operations/merge.d.ts.map +1 -0
  57. package/changelog/operations/remove-entry.d.ts +45 -0
  58. package/changelog/operations/remove-entry.d.ts.map +1 -0
  59. package/changelog/operations/remove-section.d.ts +50 -0
  60. package/changelog/operations/remove-section.d.ts.map +1 -0
  61. package/changelog/operations/transform.d.ts +143 -0
  62. package/changelog/operations/transform.d.ts.map +1 -0
  63. package/changelog/parse/index.cjs.js +1282 -0
  64. package/changelog/parse/index.cjs.js.map +1 -0
  65. package/changelog/parse/index.d.ts +5 -0
  66. package/changelog/parse/index.d.ts.map +1 -0
  67. package/changelog/parse/index.esm.js +1275 -0
  68. package/changelog/parse/index.esm.js.map +1 -0
  69. package/changelog/parse/line.d.ts +48 -0
  70. package/changelog/parse/line.d.ts.map +1 -0
  71. package/changelog/parse/parser.d.ts +16 -0
  72. package/changelog/parse/parser.d.ts.map +1 -0
  73. package/changelog/parse/tokenizer.d.ts +49 -0
  74. package/changelog/parse/tokenizer.d.ts.map +1 -0
  75. package/changelog/serialize/index.cjs.js +574 -0
  76. package/changelog/serialize/index.cjs.js.map +1 -0
  77. package/changelog/serialize/index.d.ts +6 -0
  78. package/changelog/serialize/index.d.ts.map +1 -0
  79. package/changelog/serialize/index.esm.js +564 -0
  80. package/changelog/serialize/index.esm.js.map +1 -0
  81. package/changelog/serialize/templates.d.ts +81 -0
  82. package/changelog/serialize/templates.d.ts.map +1 -0
  83. package/changelog/serialize/to-json.d.ts +57 -0
  84. package/changelog/serialize/to-json.d.ts.map +1 -0
  85. package/changelog/serialize/to-string.d.ts +30 -0
  86. package/changelog/serialize/to-string.d.ts.map +1 -0
  87. package/commits/index.cjs.js +648 -0
  88. package/commits/index.cjs.js.map +1 -0
  89. package/commits/index.d.ts +3 -0
  90. package/commits/index.d.ts.map +1 -0
  91. package/commits/index.esm.js +629 -0
  92. package/commits/index.esm.js.map +1 -0
  93. package/commits/models/breaking.d.ts +39 -0
  94. package/commits/models/breaking.d.ts.map +1 -0
  95. package/commits/models/commit-type.d.ts +32 -0
  96. package/commits/models/commit-type.d.ts.map +1 -0
  97. package/commits/models/conventional.d.ts +49 -0
  98. package/commits/models/conventional.d.ts.map +1 -0
  99. package/commits/models/index.cjs.js +207 -0
  100. package/commits/models/index.cjs.js.map +1 -0
  101. package/commits/models/index.d.ts +7 -0
  102. package/commits/models/index.d.ts.map +1 -0
  103. package/commits/models/index.esm.js +193 -0
  104. package/commits/models/index.esm.js.map +1 -0
  105. package/commits/parse/body.d.ts +18 -0
  106. package/commits/parse/body.d.ts.map +1 -0
  107. package/commits/parse/footer.d.ts +16 -0
  108. package/commits/parse/footer.d.ts.map +1 -0
  109. package/commits/parse/header.d.ts +15 -0
  110. package/commits/parse/header.d.ts.map +1 -0
  111. package/commits/parse/index.cjs.js +505 -0
  112. package/commits/parse/index.cjs.js.map +1 -0
  113. package/commits/parse/index.d.ts +5 -0
  114. package/commits/parse/index.d.ts.map +1 -0
  115. package/commits/parse/index.esm.js +499 -0
  116. package/commits/parse/index.esm.js.map +1 -0
  117. package/commits/parse/message.d.ts +17 -0
  118. package/commits/parse/message.d.ts.map +1 -0
  119. package/commits/utils/replace-char.d.ts +19 -0
  120. package/commits/utils/replace-char.d.ts.map +1 -0
  121. package/flow/executor/execute.d.ts +72 -0
  122. package/flow/executor/execute.d.ts.map +1 -0
  123. package/flow/executor/index.cjs.js +4402 -0
  124. package/flow/executor/index.cjs.js.map +1 -0
  125. package/flow/executor/index.d.ts +3 -0
  126. package/flow/executor/index.d.ts.map +1 -0
  127. package/flow/executor/index.esm.js +4398 -0
  128. package/flow/executor/index.esm.js.map +1 -0
  129. package/flow/factory.d.ts +58 -0
  130. package/flow/factory.d.ts.map +1 -0
  131. package/flow/index.cjs.js +8506 -0
  132. package/flow/index.cjs.js.map +1 -0
  133. package/flow/index.d.ts +7 -0
  134. package/flow/index.d.ts.map +1 -0
  135. package/flow/index.esm.js +8451 -0
  136. package/flow/index.esm.js.map +1 -0
  137. package/flow/models/flow.d.ts +130 -0
  138. package/flow/models/flow.d.ts.map +1 -0
  139. package/flow/models/index.cjs.js +285 -0
  140. package/flow/models/index.cjs.js.map +1 -0
  141. package/flow/models/index.d.ts +7 -0
  142. package/flow/models/index.d.ts.map +1 -0
  143. package/flow/models/index.esm.js +268 -0
  144. package/flow/models/index.esm.js.map +1 -0
  145. package/flow/models/step.d.ts +108 -0
  146. package/flow/models/step.d.ts.map +1 -0
  147. package/flow/models/types.d.ts +150 -0
  148. package/flow/models/types.d.ts.map +1 -0
  149. package/flow/presets/conventional.d.ts +59 -0
  150. package/flow/presets/conventional.d.ts.map +1 -0
  151. package/flow/presets/independent.d.ts +61 -0
  152. package/flow/presets/independent.d.ts.map +1 -0
  153. package/flow/presets/index.cjs.js +3903 -0
  154. package/flow/presets/index.cjs.js.map +1 -0
  155. package/flow/presets/index.d.ts +4 -0
  156. package/flow/presets/index.d.ts.map +1 -0
  157. package/flow/presets/index.esm.js +3889 -0
  158. package/flow/presets/index.esm.js.map +1 -0
  159. package/flow/presets/synced.d.ts +65 -0
  160. package/flow/presets/synced.d.ts.map +1 -0
  161. package/flow/steps/analyze-commits.d.ts +19 -0
  162. package/flow/steps/analyze-commits.d.ts.map +1 -0
  163. package/flow/steps/calculate-bump.d.ts +27 -0
  164. package/flow/steps/calculate-bump.d.ts.map +1 -0
  165. package/flow/steps/create-commit.d.ts +16 -0
  166. package/flow/steps/create-commit.d.ts.map +1 -0
  167. package/flow/steps/create-tag.d.ts +22 -0
  168. package/flow/steps/create-tag.d.ts.map +1 -0
  169. package/flow/steps/fetch-registry.d.ts +19 -0
  170. package/flow/steps/fetch-registry.d.ts.map +1 -0
  171. package/flow/steps/generate-changelog.d.ts +25 -0
  172. package/flow/steps/generate-changelog.d.ts.map +1 -0
  173. package/flow/steps/index.cjs.js +3523 -0
  174. package/flow/steps/index.cjs.js.map +1 -0
  175. package/flow/steps/index.d.ts +8 -0
  176. package/flow/steps/index.d.ts.map +1 -0
  177. package/flow/steps/index.esm.js +3504 -0
  178. package/flow/steps/index.esm.js.map +1 -0
  179. package/flow/steps/update-packages.d.ts +25 -0
  180. package/flow/steps/update-packages.d.ts.map +1 -0
  181. package/flow/utils/interpolate.d.ts +11 -0
  182. package/flow/utils/interpolate.d.ts.map +1 -0
  183. package/git/factory.d.ts +233 -0
  184. package/git/factory.d.ts.map +1 -0
  185. package/git/index.cjs.js +2863 -0
  186. package/git/index.cjs.js.map +1 -0
  187. package/git/index.d.ts +5 -0
  188. package/git/index.d.ts.map +1 -0
  189. package/git/index.esm.js +2785 -0
  190. package/git/index.esm.js.map +1 -0
  191. package/git/models/commit.d.ts +129 -0
  192. package/git/models/commit.d.ts.map +1 -0
  193. package/git/models/index.cjs.js +755 -0
  194. package/git/models/index.cjs.js.map +1 -0
  195. package/git/models/index.d.ts +7 -0
  196. package/git/models/index.d.ts.map +1 -0
  197. package/git/models/index.esm.js +729 -0
  198. package/git/models/index.esm.js.map +1 -0
  199. package/git/models/ref.d.ts +120 -0
  200. package/git/models/ref.d.ts.map +1 -0
  201. package/git/models/tag.d.ts +141 -0
  202. package/git/models/tag.d.ts.map +1 -0
  203. package/git/operations/commit.d.ts +97 -0
  204. package/git/operations/commit.d.ts.map +1 -0
  205. package/git/operations/head-info.d.ts +29 -0
  206. package/git/operations/head-info.d.ts.map +1 -0
  207. package/git/operations/index.cjs.js +1954 -0
  208. package/git/operations/index.cjs.js.map +1 -0
  209. package/git/operations/index.d.ts +14 -0
  210. package/git/operations/index.d.ts.map +1 -0
  211. package/git/operations/index.esm.js +1903 -0
  212. package/git/operations/index.esm.js.map +1 -0
  213. package/git/operations/log.d.ts +104 -0
  214. package/git/operations/log.d.ts.map +1 -0
  215. package/git/operations/manage-tags.d.ts +60 -0
  216. package/git/operations/manage-tags.d.ts.map +1 -0
  217. package/git/operations/query-tags.d.ts +88 -0
  218. package/git/operations/query-tags.d.ts.map +1 -0
  219. package/git/operations/stage.d.ts +66 -0
  220. package/git/operations/stage.d.ts.map +1 -0
  221. package/git/operations/status.d.ts +173 -0
  222. package/git/operations/status.d.ts.map +1 -0
  223. package/index.cjs.js +16761 -0
  224. package/index.cjs.js.map +1 -0
  225. package/index.d.ts +102 -0
  226. package/index.d.ts.map +1 -0
  227. package/index.esm.js +16427 -0
  228. package/index.esm.js.map +1 -0
  229. package/package.json +200 -0
  230. package/registry/factory.d.ts +18 -0
  231. package/registry/factory.d.ts.map +1 -0
  232. package/registry/index.cjs.js +543 -0
  233. package/registry/index.cjs.js.map +1 -0
  234. package/registry/index.d.ts +5 -0
  235. package/registry/index.d.ts.map +1 -0
  236. package/registry/index.esm.js +535 -0
  237. package/registry/index.esm.js.map +1 -0
  238. package/registry/models/index.cjs.js +69 -0
  239. package/registry/models/index.cjs.js.map +1 -0
  240. package/registry/models/index.d.ts +6 -0
  241. package/registry/models/index.d.ts.map +1 -0
  242. package/registry/models/index.esm.js +66 -0
  243. package/registry/models/index.esm.js.map +1 -0
  244. package/registry/models/package-info.d.ts +55 -0
  245. package/registry/models/package-info.d.ts.map +1 -0
  246. package/registry/models/registry.d.ts +62 -0
  247. package/registry/models/registry.d.ts.map +1 -0
  248. package/registry/models/version-info.d.ts +67 -0
  249. package/registry/models/version-info.d.ts.map +1 -0
  250. package/registry/npm/cache.d.ts +50 -0
  251. package/registry/npm/cache.d.ts.map +1 -0
  252. package/registry/npm/client.d.ts +30 -0
  253. package/registry/npm/client.d.ts.map +1 -0
  254. package/registry/npm/index.cjs.js +456 -0
  255. package/registry/npm/index.cjs.js.map +1 -0
  256. package/registry/npm/index.d.ts +4 -0
  257. package/registry/npm/index.d.ts.map +1 -0
  258. package/registry/npm/index.esm.js +451 -0
  259. package/registry/npm/index.esm.js.map +1 -0
  260. package/semver/compare/compare.d.ts +100 -0
  261. package/semver/compare/compare.d.ts.map +1 -0
  262. package/semver/compare/index.cjs.js +386 -0
  263. package/semver/compare/index.cjs.js.map +1 -0
  264. package/semver/compare/index.d.ts +3 -0
  265. package/semver/compare/index.d.ts.map +1 -0
  266. package/semver/compare/index.esm.js +370 -0
  267. package/semver/compare/index.esm.js.map +1 -0
  268. package/semver/compare/sort.d.ts +36 -0
  269. package/semver/compare/sort.d.ts.map +1 -0
  270. package/semver/format/index.cjs.js +58 -0
  271. package/semver/format/index.cjs.js.map +1 -0
  272. package/semver/format/index.d.ts +2 -0
  273. package/semver/format/index.d.ts.map +1 -0
  274. package/semver/format/index.esm.js +53 -0
  275. package/semver/format/index.esm.js.map +1 -0
  276. package/semver/format/to-string.d.ts +31 -0
  277. package/semver/format/to-string.d.ts.map +1 -0
  278. package/semver/increment/bump.d.ts +37 -0
  279. package/semver/increment/bump.d.ts.map +1 -0
  280. package/semver/increment/index.cjs.js +223 -0
  281. package/semver/increment/index.cjs.js.map +1 -0
  282. package/semver/increment/index.d.ts +2 -0
  283. package/semver/increment/index.d.ts.map +1 -0
  284. package/semver/increment/index.esm.js +219 -0
  285. package/semver/increment/index.esm.js.map +1 -0
  286. package/semver/index.cjs.js +1499 -0
  287. package/semver/index.cjs.js.map +1 -0
  288. package/semver/index.d.ts +6 -0
  289. package/semver/index.d.ts.map +1 -0
  290. package/semver/index.esm.js +1458 -0
  291. package/semver/index.esm.js.map +1 -0
  292. package/semver/models/index.cjs.js +153 -0
  293. package/semver/models/index.cjs.js.map +1 -0
  294. package/semver/models/index.d.ts +5 -0
  295. package/semver/models/index.d.ts.map +1 -0
  296. package/semver/models/index.esm.js +139 -0
  297. package/semver/models/index.esm.js.map +1 -0
  298. package/semver/models/range.d.ts +83 -0
  299. package/semver/models/range.d.ts.map +1 -0
  300. package/semver/models/version.d.ts +78 -0
  301. package/semver/models/version.d.ts.map +1 -0
  302. package/semver/parse/index.cjs.js +799 -0
  303. package/semver/parse/index.cjs.js.map +1 -0
  304. package/semver/parse/index.d.ts +5 -0
  305. package/semver/parse/index.d.ts.map +1 -0
  306. package/semver/parse/index.esm.js +793 -0
  307. package/semver/parse/index.esm.js.map +1 -0
  308. package/semver/parse/range.d.ts +38 -0
  309. package/semver/parse/range.d.ts.map +1 -0
  310. package/semver/parse/version.d.ts +49 -0
  311. package/semver/parse/version.d.ts.map +1 -0
  312. package/workspace/discovery/changelog-path.d.ts +21 -0
  313. package/workspace/discovery/changelog-path.d.ts.map +1 -0
  314. package/workspace/discovery/dependencies.d.ts +145 -0
  315. package/workspace/discovery/dependencies.d.ts.map +1 -0
  316. package/workspace/discovery/discover-changelogs.d.ts +76 -0
  317. package/workspace/discovery/discover-changelogs.d.ts.map +1 -0
  318. package/workspace/discovery/index.cjs.js +2300 -0
  319. package/workspace/discovery/index.cjs.js.map +1 -0
  320. package/workspace/discovery/index.d.ts +13 -0
  321. package/workspace/discovery/index.d.ts.map +1 -0
  322. package/workspace/discovery/index.esm.js +2283 -0
  323. package/workspace/discovery/index.esm.js.map +1 -0
  324. package/workspace/discovery/packages.d.ts +83 -0
  325. package/workspace/discovery/packages.d.ts.map +1 -0
  326. package/workspace/index.cjs.js +4445 -0
  327. package/workspace/index.cjs.js.map +1 -0
  328. package/workspace/index.d.ts +52 -0
  329. package/workspace/index.d.ts.map +1 -0
  330. package/workspace/index.esm.js +4394 -0
  331. package/workspace/index.esm.js.map +1 -0
  332. package/workspace/models/index.cjs.js +284 -0
  333. package/workspace/models/index.cjs.js.map +1 -0
  334. package/workspace/models/index.d.ts +10 -0
  335. package/workspace/models/index.d.ts.map +1 -0
  336. package/workspace/models/index.esm.js +261 -0
  337. package/workspace/models/index.esm.js.map +1 -0
  338. package/workspace/models/project.d.ts +118 -0
  339. package/workspace/models/project.d.ts.map +1 -0
  340. package/workspace/models/workspace.d.ts +139 -0
  341. package/workspace/models/workspace.d.ts.map +1 -0
  342. package/workspace/operations/batch-update.d.ts +99 -0
  343. package/workspace/operations/batch-update.d.ts.map +1 -0
  344. package/workspace/operations/cascade-bump.d.ts +125 -0
  345. package/workspace/operations/cascade-bump.d.ts.map +1 -0
  346. package/workspace/operations/index.cjs.js +2675 -0
  347. package/workspace/operations/index.cjs.js.map +1 -0
  348. package/workspace/operations/index.d.ts +12 -0
  349. package/workspace/operations/index.d.ts.map +1 -0
  350. package/workspace/operations/index.esm.js +2663 -0
  351. package/workspace/operations/index.esm.js.map +1 -0
  352. package/workspace/operations/validate.d.ts +85 -0
  353. package/workspace/operations/validate.d.ts.map +1 -0
@@ -0,0 +1,370 @@
1
+ /**
2
+ * Safe copies of Math built-in methods.
3
+ *
4
+ * These references are captured at module initialization time to protect against
5
+ * prototype pollution attacks. Import only what you need for tree-shaking.
6
+ *
7
+ * @module @hyperfrontend/immutable-api-utils/built-in-copy/math
8
+ */
9
+ // Capture references at module initialization time
10
+ const _Math = globalThis.Math;
11
+ // ============================================================================
12
+ // Min/Max
13
+ // ============================================================================
14
+ /**
15
+ * (Safe copy) Returns the larger of zero or more numbers.
16
+ */
17
+ const max$1 = _Math.max;
18
+
19
+ /**
20
+ * Safe copies of Number built-in methods and constants.
21
+ *
22
+ * These references are captured at module initialization time to protect against
23
+ * prototype pollution attacks. Import only what you need for tree-shaking.
24
+ *
25
+ * @module @hyperfrontend/immutable-api-utils/built-in-copy/number
26
+ */
27
+ // Capture references at module initialization time
28
+ const _parseInt = globalThis.parseInt;
29
+ // ============================================================================
30
+ // Parsing
31
+ // ============================================================================
32
+ /**
33
+ * (Safe copy) Parses a string and returns an integer.
34
+ */
35
+ const parseInt = _parseInt;
36
+
37
+ /**
38
+ * Compares two semantic versions.
39
+ *
40
+ * @param a - First version
41
+ * @param b - Second version
42
+ * @returns -1 if a < b, 0 if a == b, 1 if a > b
43
+ *
44
+ * @example
45
+ * compare(parseVersion('1.0.0'), parseVersion('2.0.0')) // -1
46
+ * compare(parseVersion('1.0.0'), parseVersion('1.0.0')) // 0
47
+ * compare(parseVersion('2.0.0'), parseVersion('1.0.0')) // 1
48
+ */
49
+ function compare(a, b) {
50
+ // Compare major, minor, patch
51
+ if (a.major !== b.major) {
52
+ return a.major < b.major ? -1 : 1;
53
+ }
54
+ if (a.minor !== b.minor) {
55
+ return a.minor < b.minor ? -1 : 1;
56
+ }
57
+ if (a.patch !== b.patch) {
58
+ return a.patch < b.patch ? -1 : 1;
59
+ }
60
+ // Compare prerelease
61
+ // Version with prerelease has lower precedence than release
62
+ if (a.prerelease.length === 0 && b.prerelease.length > 0) {
63
+ return 1; // a is release, b is prerelease -> a > b
64
+ }
65
+ if (a.prerelease.length > 0 && b.prerelease.length === 0) {
66
+ return -1; // a is prerelease, b is release -> a < b
67
+ }
68
+ // Both have prerelease - compare identifiers
69
+ const maxLen = max$1(a.prerelease.length, b.prerelease.length);
70
+ for (let i = 0; i < maxLen; i++) {
71
+ const aId = a.prerelease[i];
72
+ const bId = b.prerelease[i];
73
+ // Shorter prerelease array has lower precedence
74
+ if (aId === undefined && bId !== undefined) {
75
+ return -1;
76
+ }
77
+ if (aId !== undefined && bId === undefined) {
78
+ return 1;
79
+ }
80
+ if (aId === undefined || bId === undefined) {
81
+ continue;
82
+ }
83
+ // Compare identifiers
84
+ const cmp = compareIdentifiers(aId, bId);
85
+ if (cmp !== 0) {
86
+ return cmp;
87
+ }
88
+ }
89
+ return 0;
90
+ }
91
+ /**
92
+ * Checks if two versions are equal (ignoring build metadata).
93
+ *
94
+ * @param a - First version
95
+ * @param b - Second version
96
+ * @returns True if versions are equal
97
+ */
98
+ function eq(a, b) {
99
+ return compare(a, b) === 0;
100
+ }
101
+ /**
102
+ * Checks if a < b.
103
+ *
104
+ * @param a - First version to compare
105
+ * @param b - Second version to compare
106
+ * @returns True if a is less than b
107
+ */
108
+ function lt(a, b) {
109
+ return compare(a, b) === -1;
110
+ }
111
+ /**
112
+ * Checks if a <= b.
113
+ *
114
+ * @param a - First version to compare
115
+ * @param b - Second version to compare
116
+ * @returns True if a is less than or equal to b
117
+ */
118
+ function lte(a, b) {
119
+ return compare(a, b) !== 1;
120
+ }
121
+ /**
122
+ * Checks if a > b.
123
+ *
124
+ * @param a - First version to compare
125
+ * @param b - Second version to compare
126
+ * @returns True if a is greater than b
127
+ */
128
+ function gt(a, b) {
129
+ return compare(a, b) === 1;
130
+ }
131
+ /**
132
+ * Checks if a >= b.
133
+ *
134
+ * @param a - First version to compare
135
+ * @param b - Second version to compare
136
+ * @returns True if a is greater than or equal to b
137
+ */
138
+ function gte(a, b) {
139
+ return compare(a, b) !== -1;
140
+ }
141
+ /**
142
+ * Checks if a != b.
143
+ *
144
+ * @param a - First version to compare
145
+ * @param b - Second version to compare
146
+ * @returns True if versions are not equal
147
+ */
148
+ function neq(a, b) {
149
+ return compare(a, b) !== 0;
150
+ }
151
+ /**
152
+ * Checks if a version satisfies a comparator.
153
+ *
154
+ * @param version - Version to check
155
+ * @param comparator - Comparator to test against
156
+ * @returns True if version satisfies the comparator
157
+ */
158
+ function satisfiesComparator(version, comparator) {
159
+ const cmp = compare(version, comparator.version);
160
+ switch (comparator.operator) {
161
+ case '=':
162
+ return cmp === 0;
163
+ case '>':
164
+ return cmp === 1;
165
+ case '>=':
166
+ return cmp >= 0;
167
+ case '<':
168
+ return cmp === -1;
169
+ case '<=':
170
+ return cmp <= 0;
171
+ case '^':
172
+ case '~':
173
+ // These should have been expanded during parsing
174
+ // If we encounter them here, treat as >=
175
+ return cmp >= 0;
176
+ default:
177
+ return false;
178
+ }
179
+ }
180
+ /**
181
+ * Checks if a version satisfies a range.
182
+ *
183
+ * @param version - Version to check
184
+ * @param range - Range to test against
185
+ * @returns True if version satisfies the range
186
+ *
187
+ * @example
188
+ * satisfies(parseVersion('1.2.3'), parseRange('^1.0.0')) // true
189
+ * satisfies(parseVersion('2.0.0'), parseRange('^1.0.0')) // false
190
+ */
191
+ function satisfies(version, range) {
192
+ // Empty range matches any
193
+ if (range.sets.length === 0) {
194
+ return true;
195
+ }
196
+ // OR logic: at least one set must be satisfied
197
+ for (const set of range.sets) {
198
+ // AND logic: all comparators in set must be satisfied
199
+ let allSatisfied = true;
200
+ // Empty comparator set matches any
201
+ if (set.comparators.length === 0) {
202
+ return true;
203
+ }
204
+ for (const comp of set.comparators) {
205
+ if (!satisfiesComparator(version, comp)) {
206
+ allSatisfied = false;
207
+ break;
208
+ }
209
+ }
210
+ if (allSatisfied) {
211
+ return true;
212
+ }
213
+ }
214
+ return false;
215
+ }
216
+ /**
217
+ * Finds the maximum version that satisfies a range.
218
+ *
219
+ * @param versions - Array of versions to check
220
+ * @param range - Range to test against
221
+ * @returns The maximum satisfying version, or null if none satisfy
222
+ */
223
+ function maxSatisfying(versions, range) {
224
+ let max = null;
225
+ for (const version of versions) {
226
+ if (satisfies(version, range)) {
227
+ if (max === null || gt(version, max)) {
228
+ max = version;
229
+ }
230
+ }
231
+ }
232
+ return max;
233
+ }
234
+ /**
235
+ * Finds the minimum version that satisfies a range.
236
+ *
237
+ * @param versions - Array of versions to check
238
+ * @param range - Range to test against
239
+ * @returns The minimum satisfying version, or null if none satisfy
240
+ */
241
+ function minSatisfying(versions, range) {
242
+ let min = null;
243
+ for (const version of versions) {
244
+ if (satisfies(version, range)) {
245
+ if (min === null || lt(version, min)) {
246
+ min = version;
247
+ }
248
+ }
249
+ }
250
+ return min;
251
+ }
252
+ // ============================================================================
253
+ // Internal helpers
254
+ // ============================================================================
255
+ /**
256
+ * Compares two prerelease identifiers.
257
+ * Numeric identifiers have lower precedence than alphanumeric.
258
+ * Numeric identifiers are compared numerically.
259
+ * Alphanumeric identifiers are compared lexically.
260
+ *
261
+ * @param a - First prerelease identifier
262
+ * @param b - Second prerelease identifier
263
+ * @returns -1 if a < b, 0 if equal, 1 if a > b
264
+ */
265
+ function compareIdentifiers(a, b) {
266
+ const aIsNumeric = isNumeric(a);
267
+ const bIsNumeric = isNumeric(b);
268
+ // Numeric identifiers have lower precedence
269
+ if (aIsNumeric && !bIsNumeric) {
270
+ return -1;
271
+ }
272
+ if (!aIsNumeric && bIsNumeric) {
273
+ return 1;
274
+ }
275
+ // Both numeric - compare as numbers
276
+ if (aIsNumeric && bIsNumeric) {
277
+ const aNum = parseInt(a, 10);
278
+ const bNum = parseInt(b, 10);
279
+ if (aNum < bNum)
280
+ return -1;
281
+ if (aNum > bNum)
282
+ return 1;
283
+ return 0;
284
+ }
285
+ // Both alphanumeric - compare lexically
286
+ if (a < b)
287
+ return -1;
288
+ if (a > b)
289
+ return 1;
290
+ return 0;
291
+ }
292
+ /**
293
+ * Checks if a string consists only of digits.
294
+ *
295
+ * @param str - String to check for numeric content
296
+ * @returns True if string contains only digits
297
+ */
298
+ function isNumeric(str) {
299
+ if (str.length === 0)
300
+ return false;
301
+ for (let i = 0; i < str.length; i++) {
302
+ const code = str.charCodeAt(i);
303
+ if (code < 48 || code > 57) {
304
+ return false;
305
+ }
306
+ }
307
+ return true;
308
+ }
309
+
310
+ /**
311
+ * Sorts an array of versions in ascending order.
312
+ *
313
+ * @param versions - Array of versions to sort
314
+ * @returns A new sorted array
315
+ *
316
+ * @example
317
+ * sort([v2, v1, v3]) // [v1, v2, v3]
318
+ */
319
+ function sort(versions) {
320
+ return [...versions].sort(compare);
321
+ }
322
+ /**
323
+ * Sorts an array of versions in descending order.
324
+ *
325
+ * @param versions - Array of versions to sort
326
+ * @returns A new sorted array
327
+ *
328
+ * @example
329
+ * sortDescending([v1, v3, v2]) // [v3, v2, v1]
330
+ */
331
+ function sortDescending(versions) {
332
+ return [...versions].sort((a, b) => compare(b, a));
333
+ }
334
+ /**
335
+ * Returns the maximum version from an array.
336
+ *
337
+ * @param versions - Array of versions
338
+ * @returns The maximum version, or null if array is empty
339
+ */
340
+ function max(versions) {
341
+ if (versions.length === 0)
342
+ return null;
343
+ let maxVer = versions[0];
344
+ for (let i = 1; i < versions.length; i++) {
345
+ if (compare(versions[i], maxVer) === 1) {
346
+ maxVer = versions[i];
347
+ }
348
+ }
349
+ return maxVer;
350
+ }
351
+ /**
352
+ * Returns the minimum version from an array.
353
+ *
354
+ * @param versions - Array of versions
355
+ * @returns The minimum version, or null if array is empty
356
+ */
357
+ function min(versions) {
358
+ if (versions.length === 0)
359
+ return null;
360
+ let minVer = versions[0];
361
+ for (let i = 1; i < versions.length; i++) {
362
+ if (compare(versions[i], minVer) === -1) {
363
+ minVer = versions[i];
364
+ }
365
+ }
366
+ return minVer;
367
+ }
368
+
369
+ export { compare, eq, gt, gte, lt, lte, max, maxSatisfying, min, minSatisfying, neq, satisfies, satisfiesComparator, sort, sortDescending };
370
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/math/index.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/number/index.ts","../../../../../../../../../../libs/versioning/src/semver/compare/compare.ts","../../../../../../../../../../libs/versioning/src/semver/compare/sort.ts"],"sourcesContent":[null,null,null,null],"names":["max"],"mappings":"AAAA;;;;;;;AAOG;AAEH;AACA,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI;AAiF7B;AACA;AACA;AAEA;;AAEG;AACI,MAAMA,KAAG,GAAG,KAAK,CAAC,GAAG;;AClG5B;;;;;;;AAOG;AAEH;AAEA,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ;AA0ErC;AACA;AACA;AAEA;;AAEG;AACI,MAAM,QAAQ,GAAG,SAAS;;ACvFjC;;;;;;;;;;;AAWG;AACG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C;QACtB;IACF;AAEA,IAAA,OAAO,MAAM;AACf;AAEA;;;;;AAKG;AACG,SAAU,GAAG,CAAC,QAA2B,EAAA;AAC7C,IAAA,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,OAAO,IAAI;AAEtC,IAAA,IAAI,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC;AACxB,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACxC,QAAA,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE;AACvC,YAAA,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC;QACtB;IACF;AAEA,IAAA,OAAO,MAAM;AACf;;;;"}
@@ -0,0 +1,36 @@
1
+ import type { SemVer } from '../models/version';
2
+ /**
3
+ * Sorts an array of versions in ascending order.
4
+ *
5
+ * @param versions - Array of versions to sort
6
+ * @returns A new sorted array
7
+ *
8
+ * @example
9
+ * sort([v2, v1, v3]) // [v1, v2, v3]
10
+ */
11
+ export declare function sort(versions: readonly SemVer[]): SemVer[];
12
+ /**
13
+ * Sorts an array of versions in descending order.
14
+ *
15
+ * @param versions - Array of versions to sort
16
+ * @returns A new sorted array
17
+ *
18
+ * @example
19
+ * sortDescending([v1, v3, v2]) // [v3, v2, v1]
20
+ */
21
+ export declare function sortDescending(versions: readonly SemVer[]): SemVer[];
22
+ /**
23
+ * Returns the maximum version from an array.
24
+ *
25
+ * @param versions - Array of versions
26
+ * @returns The maximum version, or null if array is empty
27
+ */
28
+ export declare function max(versions: readonly SemVer[]): SemVer | null;
29
+ /**
30
+ * Returns the minimum version from an array.
31
+ *
32
+ * @param versions - Array of versions
33
+ * @returns The minimum version, or null if array is empty
34
+ */
35
+ export declare function min(versions: readonly SemVer[]): SemVer | null;
36
+ //# sourceMappingURL=sort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/versioning/src/semver/compare/sort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAG/C;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAE1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAEpE;AAED;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAW9D;AAED;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAW9D"}
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Converts a SemVer to its canonical string representation.
5
+ *
6
+ * @param version - The version to format
7
+ * @returns The version string (e.g., "1.2.3-alpha.1+build.123")
8
+ */
9
+ function format(version) {
10
+ let result = `${version.major}.${version.minor}.${version.patch}`;
11
+ if (version.prerelease.length > 0) {
12
+ result += '-' + version.prerelease.join('.');
13
+ }
14
+ if (version.build.length > 0) {
15
+ result += '+' + version.build.join('.');
16
+ }
17
+ return result;
18
+ }
19
+ /**
20
+ * Converts a SemVer to a string without prerelease/build.
21
+ *
22
+ * @param version - The version to format
23
+ * @returns The version string (e.g., "1.2.3")
24
+ */
25
+ function formatSimple(version) {
26
+ return `${version.major}.${version.minor}.${version.patch}`;
27
+ }
28
+ /**
29
+ * Converts a Range to its string representation.
30
+ *
31
+ * @param range - The range to format
32
+ * @returns The range string
33
+ */
34
+ function formatRange(range) {
35
+ if (range.raw) {
36
+ return range.raw;
37
+ }
38
+ if (range.sets.length === 0) {
39
+ return '*';
40
+ }
41
+ return range.sets.map((set) => set.comparators.map((c) => formatComparator(c)).join(' ')).join(' || ');
42
+ }
43
+ /**
44
+ * Converts a Comparator to its string representation.
45
+ *
46
+ * @param comparator - The comparator to format
47
+ * @returns The comparator string (e.g., ">=1.0.0")
48
+ */
49
+ function formatComparator(comparator) {
50
+ const op = comparator.operator === '=' ? '' : comparator.operator;
51
+ return op + format(comparator.version);
52
+ }
53
+
54
+ exports.format = format;
55
+ exports.formatComparator = formatComparator;
56
+ exports.formatRange = formatRange;
57
+ exports.formatSimple = formatSimple;
58
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":["../../../../../../../../../../libs/versioning/src/semver/format/to-string.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA;;;;;AAKG;AACG,SAAU,MAAM,CAAC,OAAe,EAAA;AACpC,IAAA,IAAI,MAAM,GAAG,CAAA,EAAG,OAAO,CAAC,KAAK,CAAA,CAAA,EAAI,OAAO,CAAC,KAAK,CAAA,CAAA,EAAI,OAAO,CAAC,KAAK,EAAE;IAEjE,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;QACjC,MAAM,IAAI,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC;IAC9C;IAEA,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QAC5B,MAAM,IAAI,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;IACzC;AAEA,IAAA,OAAO,MAAM;AACf;AAEA;;;;;AAKG;AACG,SAAU,YAAY,CAAC,OAAe,EAAA;AAC1C,IAAA,OAAO,CAAA,EAAG,OAAO,CAAC,KAAK,CAAA,CAAA,EAAI,OAAO,CAAC,KAAK,CAAA,CAAA,EAAI,OAAO,CAAC,KAAK,EAAE;AAC7D;AAEA;;;;;AAKG;AACG,SAAU,WAAW,CAAC,KAAY,EAAA;AACtC,IAAA,IAAI,KAAK,CAAC,GAAG,EAAE;QACb,OAAO,KAAK,CAAC,GAAG;IAClB;IAEA,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;AAC3B,QAAA,OAAO,GAAG;IACZ;AAEA,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;AACxG;AAEA;;;;;AAKG;AACG,SAAU,gBAAgB,CAAC,UAAsB,EAAA;AACrD,IAAA,MAAM,EAAE,GAAG,UAAU,CAAC,QAAQ,KAAK,GAAG,GAAG,EAAE,GAAG,UAAU,CAAC,QAAQ;IACjE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC;AACxC;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ export { format, formatSimple, formatRange, formatComparator } from './to-string';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/versioning/src/semver/format/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Converts a SemVer to its canonical string representation.
3
+ *
4
+ * @param version - The version to format
5
+ * @returns The version string (e.g., "1.2.3-alpha.1+build.123")
6
+ */
7
+ function format(version) {
8
+ let result = `${version.major}.${version.minor}.${version.patch}`;
9
+ if (version.prerelease.length > 0) {
10
+ result += '-' + version.prerelease.join('.');
11
+ }
12
+ if (version.build.length > 0) {
13
+ result += '+' + version.build.join('.');
14
+ }
15
+ return result;
16
+ }
17
+ /**
18
+ * Converts a SemVer to a string without prerelease/build.
19
+ *
20
+ * @param version - The version to format
21
+ * @returns The version string (e.g., "1.2.3")
22
+ */
23
+ function formatSimple(version) {
24
+ return `${version.major}.${version.minor}.${version.patch}`;
25
+ }
26
+ /**
27
+ * Converts a Range to its string representation.
28
+ *
29
+ * @param range - The range to format
30
+ * @returns The range string
31
+ */
32
+ function formatRange(range) {
33
+ if (range.raw) {
34
+ return range.raw;
35
+ }
36
+ if (range.sets.length === 0) {
37
+ return '*';
38
+ }
39
+ return range.sets.map((set) => set.comparators.map((c) => formatComparator(c)).join(' ')).join(' || ');
40
+ }
41
+ /**
42
+ * Converts a Comparator to its string representation.
43
+ *
44
+ * @param comparator - The comparator to format
45
+ * @returns The comparator string (e.g., ">=1.0.0")
46
+ */
47
+ function formatComparator(comparator) {
48
+ const op = comparator.operator === '=' ? '' : comparator.operator;
49
+ return op + format(comparator.version);
50
+ }
51
+
52
+ export { format, formatComparator, formatRange, formatSimple };
53
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../../../../../../../../../../libs/versioning/src/semver/format/to-string.ts"],"sourcesContent":[null],"names":[],"mappings":"AAGA;;;;;AAKG;AACG,SAAU,MAAM,CAAC,OAAe,EAAA;AACpC,IAAA,IAAI,MAAM,GAAG,CAAA,EAAG,OAAO,CAAC,KAAK,CAAA,CAAA,EAAI,OAAO,CAAC,KAAK,CAAA,CAAA,EAAI,OAAO,CAAC,KAAK,EAAE;IAEjE,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;QACjC,MAAM,IAAI,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC;IAC9C;IAEA,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QAC5B,MAAM,IAAI,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;IACzC;AAEA,IAAA,OAAO,MAAM;AACf;AAEA;;;;;AAKG;AACG,SAAU,YAAY,CAAC,OAAe,EAAA;AAC1C,IAAA,OAAO,CAAA,EAAG,OAAO,CAAC,KAAK,CAAA,CAAA,EAAI,OAAO,CAAC,KAAK,CAAA,CAAA,EAAI,OAAO,CAAC,KAAK,EAAE;AAC7D;AAEA;;;;;AAKG;AACG,SAAU,WAAW,CAAC,KAAY,EAAA;AACtC,IAAA,IAAI,KAAK,CAAC,GAAG,EAAE;QACb,OAAO,KAAK,CAAC,GAAG;IAClB;IAEA,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;AAC3B,QAAA,OAAO,GAAG;IACZ;AAEA,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;AACxG;AAEA;;;;;AAKG;AACG,SAAU,gBAAgB,CAAC,UAAsB,EAAA;AACrD,IAAA,MAAM,EAAE,GAAG,UAAU,CAAC,QAAQ,KAAK,GAAG,GAAG,EAAE,GAAG,UAAU,CAAC,QAAQ;IACjE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC;AACxC;;;;"}
@@ -0,0 +1,31 @@
1
+ import type { Range, Comparator } from '../models/range';
2
+ import type { SemVer } from '../models/version';
3
+ /**
4
+ * Converts a SemVer to its canonical string representation.
5
+ *
6
+ * @param version - The version to format
7
+ * @returns The version string (e.g., "1.2.3-alpha.1+build.123")
8
+ */
9
+ export declare function format(version: SemVer): string;
10
+ /**
11
+ * Converts a SemVer to a string without prerelease/build.
12
+ *
13
+ * @param version - The version to format
14
+ * @returns The version string (e.g., "1.2.3")
15
+ */
16
+ export declare function formatSimple(version: SemVer): string;
17
+ /**
18
+ * Converts a Range to its string representation.
19
+ *
20
+ * @param range - The range to format
21
+ * @returns The range string
22
+ */
23
+ export declare function formatRange(range: Range): string;
24
+ /**
25
+ * Converts a Comparator to its string representation.
26
+ *
27
+ * @param comparator - The comparator to format
28
+ * @returns The comparator string (e.g., ">=1.0.0")
29
+ */
30
+ export declare function formatComparator(comparator: Comparator): string;
31
+ //# sourceMappingURL=to-string.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"to-string.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/versioning/src/semver/format/to-string.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/C;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAY9C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAUhD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAG/D"}
@@ -0,0 +1,37 @@
1
+ import type { SemVer, BumpType } from '../models/version';
2
+ /**
3
+ * Increments a version based on the bump type.
4
+ *
5
+ * @param version - The version to increment
6
+ * @param type - The type of bump (major, minor, patch, etc.)
7
+ * @param prereleaseId - Optional prerelease identifier for prerelease bumps
8
+ * @returns A new incremented SemVer
9
+ *
10
+ * @example
11
+ * increment(parseVersion('1.2.3'), 'minor') // 1.3.0
12
+ * increment(parseVersion('1.2.3'), 'major') // 2.0.0
13
+ * increment(parseVersion('1.2.3'), 'prerelease', 'alpha') // 1.2.4-alpha.0
14
+ */
15
+ export declare function increment(version: SemVer, type: BumpType, prereleaseId?: string): SemVer;
16
+ /**
17
+ * Increments the prerelease portion of a version.
18
+ *
19
+ * @param version - The version to increment
20
+ * @param id - Optional prerelease identifier
21
+ * @returns A new version with incremented prerelease
22
+ */
23
+ export declare function incrementPrerelease(version: SemVer, id?: string): SemVer;
24
+ /**
25
+ * Calculates the difference type between two versions.
26
+ *
27
+ * @param older - The older version
28
+ * @param newer - The newer version
29
+ * @returns The type of difference, or null if versions are equal
30
+ *
31
+ * @example
32
+ * diff(parseVersion('1.0.0'), parseVersion('2.0.0')) // 'major'
33
+ * diff(parseVersion('1.0.0'), parseVersion('1.1.0')) // 'minor'
34
+ * diff(parseVersion('1.0.0'), parseVersion('1.0.1')) // 'patch'
35
+ */
36
+ export declare function diff(older: SemVer, newer: SemVer): BumpType | null;
37
+ //# sourceMappingURL=bump.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bump.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/versioning/src/semver/increment/bump.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAIzD;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAyExF;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CA2CxE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAsClE"}