@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,32 @@
1
+ export type CommitType = 'feat' | 'fix' | 'docs' | 'style' | 'refactor' | 'perf' | 'test' | 'build' | 'ci' | 'chore' | 'revert' | string;
2
+ export declare const COMMIT_TYPES: Record<string, {
3
+ description: string;
4
+ semverBump: 'major' | 'minor' | 'patch' | 'none';
5
+ }>;
6
+ export declare const RELEASE_TYPES: readonly CommitType[];
7
+ export declare const MINOR_TYPES: readonly CommitType[];
8
+ export declare const PATCH_TYPES: readonly CommitType[];
9
+ /**
10
+ * Checks if a commit type is a standard type.
11
+ *
12
+ * @param type - The commit type to check
13
+ * @returns True if the type is a standard conventional commit type
14
+ */
15
+ export declare function isStandardType(type: string): type is CommitType;
16
+ /**
17
+ * Checks if a commit type triggers a release.
18
+ *
19
+ * @param type - The commit type to check
20
+ * @returns True if the type triggers a release
21
+ */
22
+ export declare function isReleaseType(type: string): boolean;
23
+ /**
24
+ * Gets the semver bump level for a commit type.
25
+ * Returns 'none' for types that don't trigger a bump.
26
+ *
27
+ * @param type - The commit type
28
+ * @param breaking - Whether this is a breaking change
29
+ * @returns The semver bump level ('major', 'minor', 'patch', or 'none')
30
+ */
31
+ export declare function getSemverBump(type: string, breaking: boolean): 'major' | 'minor' | 'patch' | 'none';
32
+ //# sourceMappingURL=commit-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit-type.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/versioning/src/commits/models/commit-type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;AAExI,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;CAAE,CAYlH,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,SAAS,UAAU,EAAsC,CAAA;AACrF,eAAO,MAAM,WAAW,EAAE,SAAS,UAAU,EAAa,CAAA;AAC1D,eAAO,MAAM,WAAW,EAAE,SAAS,UAAU,EAA8B,CAAA;AAE3E;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,UAAU,CAE/D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAKnG"}
@@ -0,0 +1,49 @@
1
+ import type { CommitType } from './commit-type';
2
+ export interface CommitFooter {
3
+ /** Footer key (e.g., "BREAKING CHANGE", "Refs", "Fixes") */
4
+ readonly key: string;
5
+ /** Footer value */
6
+ readonly value: string;
7
+ /** Whether key used `:` or ` #` separator */
8
+ readonly separator: ':' | ' #';
9
+ }
10
+ /** Parsed conventional commit message per https://www.conventionalcommits.org/en/v1.0.0/ */
11
+ export interface ConventionalCommit {
12
+ /** Commit type (feat, fix, docs, etc.) */
13
+ readonly type: CommitType;
14
+ /** Optional scope in parentheses */
15
+ readonly scope?: string;
16
+ /** Subject line (after colon) */
17
+ readonly subject: string;
18
+ /** Full commit body */
19
+ readonly body?: string;
20
+ /** Parsed footer trailers */
21
+ readonly footers: readonly CommitFooter[];
22
+ /** Whether this is a breaking change */
23
+ readonly breaking: boolean;
24
+ /** Breaking change description (from footer or subject !) */
25
+ readonly breakingDescription?: string;
26
+ /** Original raw message */
27
+ readonly raw: string;
28
+ }
29
+ /**
30
+ * Creates a commit footer.
31
+ *
32
+ * @param key - Footer identifier such as 'Refs', 'Fixes', or 'BREAKING CHANGE'
33
+ * @param value - Associated content for the footer entry
34
+ * @param separator - Delimiter between key and value (':' or ' #')
35
+ * @returns A new CommitFooter object
36
+ */
37
+ export declare function createCommitFooter(key: string, value: string, separator?: ':' | ' #'): CommitFooter;
38
+ /**
39
+ * Creates a conventional commit.
40
+ *
41
+ * @param type - The commit type (e.g., 'feat', 'fix')
42
+ * @param subject - The commit subject line
43
+ * @param options - Optional configuration for scope, body, footers, etc.
44
+ * @returns A new ConventionalCommit object
45
+ */
46
+ export declare function createConventionalCommit(type: CommitType, subject: string, options?: Partial<Omit<ConventionalCommit, 'type' | 'subject' | 'raw'>> & {
47
+ raw?: string;
48
+ }): ConventionalCommit;
49
+ //# sourceMappingURL=conventional.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conventional.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/versioning/src/commits/models/conventional.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK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,207 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Creates a commit footer.
5
+ *
6
+ * @param key - Footer identifier such as 'Refs', 'Fixes', or 'BREAKING CHANGE'
7
+ * @param value - Associated content for the footer entry
8
+ * @param separator - Delimiter between key and value (':' or ' #')
9
+ * @returns A new CommitFooter object
10
+ */
11
+ function createCommitFooter(key, value, separator = ':') {
12
+ return {
13
+ key,
14
+ value,
15
+ separator,
16
+ };
17
+ }
18
+ /**
19
+ * Creates a conventional commit.
20
+ *
21
+ * @param type - The commit type (e.g., 'feat', 'fix')
22
+ * @param subject - The commit subject line
23
+ * @param options - Optional configuration for scope, body, footers, etc.
24
+ * @returns A new ConventionalCommit object
25
+ */
26
+ function createConventionalCommit(type, subject, options) {
27
+ const raw = options?.raw ?? buildRaw(type, subject, options);
28
+ return {
29
+ type,
30
+ subject,
31
+ scope: options?.scope,
32
+ body: options?.body,
33
+ footers: options?.footers ?? [],
34
+ breaking: options?.breaking ?? false,
35
+ breakingDescription: options?.breakingDescription,
36
+ raw,
37
+ };
38
+ }
39
+ /**
40
+ * Builds the raw commit message from parts.
41
+ *
42
+ * @param type - The commit type
43
+ * @param subject - The commit subject
44
+ * @param options - Optional configuration for building the message
45
+ * @returns The formatted raw commit message string
46
+ */
47
+ function buildRaw(type, subject, options) {
48
+ let header = type;
49
+ if (options?.scope) {
50
+ header += `(${options.scope})`;
51
+ }
52
+ if (options?.breaking) {
53
+ header += '!';
54
+ }
55
+ header += `: ${subject}`;
56
+ const parts = [header];
57
+ if (options?.body) {
58
+ parts.push('');
59
+ parts.push(options.body);
60
+ }
61
+ if (options?.footers?.length) {
62
+ parts.push('');
63
+ for (const footer of options.footers) {
64
+ parts.push(`${footer.key}${footer.separator}${footer.separator === ':' ? ' ' : ''}${footer.value}`);
65
+ }
66
+ }
67
+ return parts.join('\n');
68
+ }
69
+
70
+ const COMMIT_TYPES = {
71
+ feat: { description: 'A new feature', semverBump: 'minor' },
72
+ fix: { description: 'A bug fix', semverBump: 'patch' },
73
+ docs: { description: 'Documentation only changes', semverBump: 'none' },
74
+ style: { description: 'Code style changes (formatting, etc.)', semverBump: 'none' },
75
+ refactor: { description: 'Code refactoring without feature or fix', semverBump: 'none' },
76
+ perf: { description: 'Performance improvements', semverBump: 'patch' },
77
+ test: { description: 'Adding or updating tests', semverBump: 'none' },
78
+ build: { description: 'Build system or dependencies', semverBump: 'none' },
79
+ ci: { description: 'CI/CD configuration', semverBump: 'none' },
80
+ chore: { description: 'Other changes', semverBump: 'none' },
81
+ revert: { description: 'Revert a previous commit', semverBump: 'patch' },
82
+ };
83
+ const RELEASE_TYPES = ['feat', 'fix', 'perf', 'revert'];
84
+ const MINOR_TYPES = ['feat'];
85
+ const PATCH_TYPES = ['fix', 'perf', 'revert'];
86
+ /**
87
+ * Checks if a commit type is a standard type.
88
+ *
89
+ * @param type - The commit type to check
90
+ * @returns True if the type is a standard conventional commit type
91
+ */
92
+ function isStandardType(type) {
93
+ return type in COMMIT_TYPES;
94
+ }
95
+ /**
96
+ * Checks if a commit type triggers a release.
97
+ *
98
+ * @param type - The commit type to check
99
+ * @returns True if the type triggers a release
100
+ */
101
+ function isReleaseType(type) {
102
+ return RELEASE_TYPES.includes(type);
103
+ }
104
+ /**
105
+ * Gets the semver bump level for a commit type.
106
+ * Returns 'none' for types that don't trigger a bump.
107
+ *
108
+ * @param type - The commit type
109
+ * @param breaking - Whether this is a breaking change
110
+ * @returns The semver bump level ('major', 'minor', 'patch', or 'none')
111
+ */
112
+ function getSemverBump(type, breaking) {
113
+ if (breaking)
114
+ return 'major';
115
+ const info = COMMIT_TYPES[type];
116
+ return info?.semverBump ?? 'none';
117
+ }
118
+
119
+ /**
120
+ * Replaces all occurrences of a character in a string.
121
+ * Uses character-by-character iteration to avoid regex (ReDoS-safe).
122
+ *
123
+ * @param input - The input string
124
+ * @param target - The character to replace
125
+ * @param replacement - The replacement character
126
+ * @returns String with all occurrences replaced
127
+ */
128
+ function replaceChar(input, target, replacement) {
129
+ const result = [];
130
+ for (let i = 0; i < input.length; i++) {
131
+ result.push(input[i] === target ? replacement : input[i]);
132
+ }
133
+ return result.join('');
134
+ }
135
+ /**
136
+ * Replaces all hyphens with spaces.
137
+ * Convenience wrapper for normalizing footer keys.
138
+ *
139
+ * @param input - The input string
140
+ * @returns String with hyphens replaced by spaces
141
+ */
142
+ function hyphenToSpace(input) {
143
+ return replaceChar(input, '-', ' ');
144
+ }
145
+
146
+ /**
147
+ * Creates a breaking change from a subject indicator (!).
148
+ *
149
+ * @param description - Optional description of the breaking change
150
+ * @returns A BreakingChange object with source 'subject'
151
+ */
152
+ function createBreakingFromSubject(description) {
153
+ return {
154
+ isBreaking: true,
155
+ description,
156
+ source: 'subject',
157
+ };
158
+ }
159
+ /**
160
+ * Creates a breaking change from a footer.
161
+ *
162
+ * @param description - The description of the breaking change
163
+ * @returns A BreakingChange object with source 'footer'
164
+ */
165
+ function createBreakingFromFooter(description) {
166
+ return {
167
+ isBreaking: true,
168
+ description,
169
+ source: 'footer',
170
+ };
171
+ }
172
+ /**
173
+ * Creates a non-breaking change.
174
+ *
175
+ * @returns A BreakingChange object indicating no breaking change
176
+ */
177
+ function createNonBreaking() {
178
+ return {
179
+ isBreaking: false,
180
+ source: 'none',
181
+ };
182
+ }
183
+ /**
184
+ * Checks if a footer key indicates a breaking change.
185
+ *
186
+ * @param key - The footer key to check
187
+ * @returns True if the key indicates a breaking change
188
+ */
189
+ function isBreakingFooterKey(key) {
190
+ const normalized = hyphenToSpace(key.toUpperCase());
191
+ return normalized === 'BREAKING CHANGE';
192
+ }
193
+
194
+ exports.COMMIT_TYPES = COMMIT_TYPES;
195
+ exports.MINOR_TYPES = MINOR_TYPES;
196
+ exports.PATCH_TYPES = PATCH_TYPES;
197
+ exports.RELEASE_TYPES = RELEASE_TYPES;
198
+ exports.createBreakingFromFooter = createBreakingFromFooter;
199
+ exports.createBreakingFromSubject = createBreakingFromSubject;
200
+ exports.createCommitFooter = createCommitFooter;
201
+ exports.createConventionalCommit = createConventionalCommit;
202
+ exports.createNonBreaking = createNonBreaking;
203
+ exports.getSemverBump = getSemverBump;
204
+ exports.isBreakingFooterKey = isBreakingFooterKey;
205
+ exports.isReleaseType = isReleaseType;
206
+ exports.isStandardType = isStandardType;
207
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":["../../../../../../../../../../libs/versioning/src/commits/models/conventional.ts","../../../../../../../../../../libs/versioning/src/commits/models/commit-type.ts","../../../../../../../../../../libs/versioning/src/commits/utils/replace-char.ts","../../../../../../../../../../libs/versioning/src/commits/models/breaking.ts"],"sourcesContent":[null,null,null,null],"names":[],"mappings":";;AAwCA;;;;;;;AAOG;AACG,SAAU,kBAAkB,CAAC,GAAW,EAAE,KAAa,EAAE,YAAwB,GAAG,EAAA;IACxF,OAAO;QACL,GAAG;QACH,KAAK;QACL,SAAS;KACV;AACH;AAEA;;;;;;;AAOG;SACa,wBAAwB,CACtC,IAAgB,EAChB,OAAe,EACf,OAA0F,EAAA;AAE1F,IAAA,MAAM,GAAG,GAAG,OAAO,EAAE,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC;IAE5D,OAAO;QACL,IAAI;QACJ,OAAO;QACP,KAAK,EAAE,OAAO,EAAE,KAAK;QACrB,IAAI,EAAE,OAAO,EAAE,IAAI;AACnB,QAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,EAAE;AAC/B,QAAA,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,KAAK;QACpC,mBAAmB,EAAE,OAAO,EAAE,mBAAmB;QACjD,GAAG;KACJ;AACH;AAEA;;;;;;;AAOG;AACH,SAAS,QAAQ,CAAC,IAAgB,EAAE,OAAe,EAAE,OAAuE,EAAA;IAC1H,IAAI,MAAM,GAAG,IAAI;AAEjB,IAAA,IAAI,OAAO,EAAE,KAAK,EAAE;AAClB,QAAA,MAAM,IAAI,CAAA,CAAA,EAAI,OAAO,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AAE,EAAE;QACrC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,MAAM,GAAG,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3D;AAEA,IAAA,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;AACxB;AAEA;;;;;;AAMG;AACG,SAAU,aAAa,CAAC,KAAa,EAAA;IACzC,OAAO,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC;AACrC;;ACZA;;;;;AAKG;AACG,SAAU,yBAAyB,CAAC,WAAoB,EAAA;IAC5D,OAAO;AACL,QAAA,UAAU,EAAE,IAAI;QAChB,WAAW;AACX,QAAA,MAAM,EAAE,SAAS;KAClB;AACH;AAEA;;;;;AAKG;AACG,SAAU,wBAAwB,CAAC,WAAmB,EAAA;IAC1D,OAAO;AACL,QAAA,UAAU,EAAE,IAAI;QAChB,WAAW;AACX,QAAA,MAAM,EAAE,QAAQ;KACjB;AACH;AAEA;;;;AAIG;SACa,iBAAiB,GAAA;IAC/B,OAAO;AACL,QAAA,UAAU,EAAE,KAAK;AACjB,QAAA,MAAM,EAAE,MAAM;KACf;AACH;AAEA;;;;;AAKG;AACG,SAAU,mBAAmB,CAAC,GAAW,EAAA;IAC7C,MAAM,UAAU,GAAG,aAAa,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;IACnD,OAAO,UAAU,KAAK,iBAAiB;AACzC;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,7 @@
1
+ export type { ConventionalCommit, CommitFooter } from './conventional';
2
+ export type { CommitType } from './commit-type';
3
+ export type { BreakingChange } from './breaking';
4
+ export { createCommitFooter, createConventionalCommit } from './conventional';
5
+ export { COMMIT_TYPES, getSemverBump, isReleaseType, isStandardType, MINOR_TYPES, PATCH_TYPES, RELEASE_TYPES } from './commit-type';
6
+ export { createBreakingFromFooter, createBreakingFromSubject, createNonBreaking, isBreakingFooterKey } from './breaking';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/versioning/src/commits/models/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACtE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/C,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAC7E,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACnI,OAAO,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA"}
@@ -0,0 +1,193 @@
1
+ /**
2
+ * Creates a commit footer.
3
+ *
4
+ * @param key - Footer identifier such as 'Refs', 'Fixes', or 'BREAKING CHANGE'
5
+ * @param value - Associated content for the footer entry
6
+ * @param separator - Delimiter between key and value (':' or ' #')
7
+ * @returns A new CommitFooter object
8
+ */
9
+ function createCommitFooter(key, value, separator = ':') {
10
+ return {
11
+ key,
12
+ value,
13
+ separator,
14
+ };
15
+ }
16
+ /**
17
+ * Creates a conventional commit.
18
+ *
19
+ * @param type - The commit type (e.g., 'feat', 'fix')
20
+ * @param subject - The commit subject line
21
+ * @param options - Optional configuration for scope, body, footers, etc.
22
+ * @returns A new ConventionalCommit object
23
+ */
24
+ function createConventionalCommit(type, subject, options) {
25
+ const raw = options?.raw ?? buildRaw(type, subject, options);
26
+ return {
27
+ type,
28
+ subject,
29
+ scope: options?.scope,
30
+ body: options?.body,
31
+ footers: options?.footers ?? [],
32
+ breaking: options?.breaking ?? false,
33
+ breakingDescription: options?.breakingDescription,
34
+ raw,
35
+ };
36
+ }
37
+ /**
38
+ * Builds the raw commit message from parts.
39
+ *
40
+ * @param type - The commit type
41
+ * @param subject - The commit subject
42
+ * @param options - Optional configuration for building the message
43
+ * @returns The formatted raw commit message string
44
+ */
45
+ function buildRaw(type, subject, options) {
46
+ let header = type;
47
+ if (options?.scope) {
48
+ header += `(${options.scope})`;
49
+ }
50
+ if (options?.breaking) {
51
+ header += '!';
52
+ }
53
+ header += `: ${subject}`;
54
+ const parts = [header];
55
+ if (options?.body) {
56
+ parts.push('');
57
+ parts.push(options.body);
58
+ }
59
+ if (options?.footers?.length) {
60
+ parts.push('');
61
+ for (const footer of options.footers) {
62
+ parts.push(`${footer.key}${footer.separator}${footer.separator === ':' ? ' ' : ''}${footer.value}`);
63
+ }
64
+ }
65
+ return parts.join('\n');
66
+ }
67
+
68
+ const COMMIT_TYPES = {
69
+ feat: { description: 'A new feature', semverBump: 'minor' },
70
+ fix: { description: 'A bug fix', semverBump: 'patch' },
71
+ docs: { description: 'Documentation only changes', semverBump: 'none' },
72
+ style: { description: 'Code style changes (formatting, etc.)', semverBump: 'none' },
73
+ refactor: { description: 'Code refactoring without feature or fix', semverBump: 'none' },
74
+ perf: { description: 'Performance improvements', semverBump: 'patch' },
75
+ test: { description: 'Adding or updating tests', semverBump: 'none' },
76
+ build: { description: 'Build system or dependencies', semverBump: 'none' },
77
+ ci: { description: 'CI/CD configuration', semverBump: 'none' },
78
+ chore: { description: 'Other changes', semverBump: 'none' },
79
+ revert: { description: 'Revert a previous commit', semverBump: 'patch' },
80
+ };
81
+ const RELEASE_TYPES = ['feat', 'fix', 'perf', 'revert'];
82
+ const MINOR_TYPES = ['feat'];
83
+ const PATCH_TYPES = ['fix', 'perf', 'revert'];
84
+ /**
85
+ * Checks if a commit type is a standard type.
86
+ *
87
+ * @param type - The commit type to check
88
+ * @returns True if the type is a standard conventional commit type
89
+ */
90
+ function isStandardType(type) {
91
+ return type in COMMIT_TYPES;
92
+ }
93
+ /**
94
+ * Checks if a commit type triggers a release.
95
+ *
96
+ * @param type - The commit type to check
97
+ * @returns True if the type triggers a release
98
+ */
99
+ function isReleaseType(type) {
100
+ return RELEASE_TYPES.includes(type);
101
+ }
102
+ /**
103
+ * Gets the semver bump level for a commit type.
104
+ * Returns 'none' for types that don't trigger a bump.
105
+ *
106
+ * @param type - The commit type
107
+ * @param breaking - Whether this is a breaking change
108
+ * @returns The semver bump level ('major', 'minor', 'patch', or 'none')
109
+ */
110
+ function getSemverBump(type, breaking) {
111
+ if (breaking)
112
+ return 'major';
113
+ const info = COMMIT_TYPES[type];
114
+ return info?.semverBump ?? 'none';
115
+ }
116
+
117
+ /**
118
+ * Replaces all occurrences of a character in a string.
119
+ * Uses character-by-character iteration to avoid regex (ReDoS-safe).
120
+ *
121
+ * @param input - The input string
122
+ * @param target - The character to replace
123
+ * @param replacement - The replacement character
124
+ * @returns String with all occurrences replaced
125
+ */
126
+ function replaceChar(input, target, replacement) {
127
+ const result = [];
128
+ for (let i = 0; i < input.length; i++) {
129
+ result.push(input[i] === target ? replacement : input[i]);
130
+ }
131
+ return result.join('');
132
+ }
133
+ /**
134
+ * Replaces all hyphens with spaces.
135
+ * Convenience wrapper for normalizing footer keys.
136
+ *
137
+ * @param input - The input string
138
+ * @returns String with hyphens replaced by spaces
139
+ */
140
+ function hyphenToSpace(input) {
141
+ return replaceChar(input, '-', ' ');
142
+ }
143
+
144
+ /**
145
+ * Creates a breaking change from a subject indicator (!).
146
+ *
147
+ * @param description - Optional description of the breaking change
148
+ * @returns A BreakingChange object with source 'subject'
149
+ */
150
+ function createBreakingFromSubject(description) {
151
+ return {
152
+ isBreaking: true,
153
+ description,
154
+ source: 'subject',
155
+ };
156
+ }
157
+ /**
158
+ * Creates a breaking change from a footer.
159
+ *
160
+ * @param description - The description of the breaking change
161
+ * @returns A BreakingChange object with source 'footer'
162
+ */
163
+ function createBreakingFromFooter(description) {
164
+ return {
165
+ isBreaking: true,
166
+ description,
167
+ source: 'footer',
168
+ };
169
+ }
170
+ /**
171
+ * Creates a non-breaking change.
172
+ *
173
+ * @returns A BreakingChange object indicating no breaking change
174
+ */
175
+ function createNonBreaking() {
176
+ return {
177
+ isBreaking: false,
178
+ source: 'none',
179
+ };
180
+ }
181
+ /**
182
+ * Checks if a footer key indicates a breaking change.
183
+ *
184
+ * @param key - The footer key to check
185
+ * @returns True if the key indicates a breaking change
186
+ */
187
+ function isBreakingFooterKey(key) {
188
+ const normalized = hyphenToSpace(key.toUpperCase());
189
+ return normalized === 'BREAKING CHANGE';
190
+ }
191
+
192
+ export { COMMIT_TYPES, MINOR_TYPES, PATCH_TYPES, RELEASE_TYPES, createBreakingFromFooter, createBreakingFromSubject, createCommitFooter, createConventionalCommit, createNonBreaking, getSemverBump, isBreakingFooterKey, isReleaseType, isStandardType };
193
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../../../../../../../../../../libs/versioning/src/commits/models/conventional.ts","../../../../../../../../../../libs/versioning/src/commits/models/commit-type.ts","../../../../../../../../../../libs/versioning/src/commits/utils/replace-char.ts","../../../../../../../../../../libs/versioning/src/commits/models/breaking.ts"],"sourcesContent":[null,null,null,null],"names":[],"mappings":"AAwCA;;;;;;;AAOG;AACG,SAAU,kBAAkB,CAAC,GAAW,EAAE,KAAa,EAAE,YAAwB,GAAG,EAAA;IACxF,OAAO;QACL,GAAG;QACH,KAAK;QACL,SAAS;KACV;AACH;AAEA;;;;;;;AAOG;SACa,wBAAwB,CACtC,IAAgB,EAChB,OAAe,EACf,OAA0F,EAAA;AAE1F,IAAA,MAAM,GAAG,GAAG,OAAO,EAAE,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC;IAE5D,OAAO;QACL,IAAI;QACJ,OAAO;QACP,KAAK,EAAE,OAAO,EAAE,KAAK;QACrB,IAAI,EAAE,OAAO,EAAE,IAAI;AACnB,QAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,EAAE;AAC/B,QAAA,QAAQ,EAAE,OAAO,EAAE,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(may be multiline) */
3
+ body: string;
4
+ /** Index where the body ends (start of footers or end of message) */
5
+ endIndex: number;
6
+ }
7
+ /**
8
+ * Parses the body section of a commit message.
9
+ *
10
+ * The body starts after the first blank line and continues until
11
+ * we encounter a footer (key: value or key #value pattern) or end of message.
12
+ *
13
+ * @param lines - All lines of the commit message
14
+ * @param startIndex - Index to start looking for body (after header)
15
+ * @returns Parsed body or undefined if no body
16
+ */
17
+ export declare function parseBody(lines: string[], startIndex: number): ParsedBody | undefined;
18
+ //# sourceMappingURL=body.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"body.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/versioning/src/commits/parse/body.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAiDrF"}
@@ -0,0 +1,16 @@
1
+ import type { CommitFooter } from '../models/conventional';
2
+ export interface ParsedFooters {
3
+ /** All parsed footers */
4
+ footers: CommitFooter[];
5
+ /** Breaking change description if found */
6
+ breakingDescription?: string;
7
+ }
8
+ /**
9
+ * Parses the footer section of a commit message.
10
+ *
11
+ * @param lines - All lines of the commit message
12
+ * @param startIndex - Index where footers start
13
+ * @returns Parsed footers
14
+ */
15
+ export declare function parseFooters(lines: string[], startIndex: number): ParsedFooters;
16
+ //# sourceMappingURL=footer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/versioning/src/commits/parse/footer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAG1D,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,2CAA2C;IAC3C,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,aAAa,CAuC/E"}
@@ -0,0 +1,15 @@
1
+ import type { CommitType } from '../models/commit-type';
2
+ export interface ParsedHeader {
3
+ type: CommitType;
4
+ scope?: string;
5
+ subject: string;
6
+ breaking: boolean;
7
+ }
8
+ /**
9
+ * Parses a conventional commit header line.
10
+ *
11
+ * @param line - The first line of the commit message
12
+ * @returns Parsed header with type, scope, subject, and breaking flag
13
+ */
14
+ export declare function parseHeader(line: string): ParsedHeader;
15
+ //# sourceMappingURL=header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/versioning/src/commits/parse/header.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CA8DtD"}