@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.
- package/ARCHITECTURE.md +593 -0
- package/CHANGELOG.md +35 -0
- package/FUNDING.md +141 -0
- package/LICENSE.md +21 -0
- package/README.md +195 -0
- package/SECURITY.md +82 -0
- package/changelog/compare/diff.d.ts +128 -0
- package/changelog/compare/diff.d.ts.map +1 -0
- package/changelog/compare/index.cjs.js +628 -0
- package/changelog/compare/index.cjs.js.map +1 -0
- package/changelog/compare/index.d.ts +4 -0
- package/changelog/compare/index.d.ts.map +1 -0
- package/changelog/compare/index.esm.js +612 -0
- package/changelog/compare/index.esm.js.map +1 -0
- package/changelog/compare/is-equal.d.ts +114 -0
- package/changelog/compare/is-equal.d.ts.map +1 -0
- package/changelog/index.cjs.js +6448 -0
- package/changelog/index.cjs.js.map +1 -0
- package/changelog/index.d.ts +6 -0
- package/changelog/index.d.ts.map +1 -0
- package/changelog/index.esm.js +6358 -0
- package/changelog/index.esm.js.map +1 -0
- package/changelog/models/changelog.d.ts +86 -0
- package/changelog/models/changelog.d.ts.map +1 -0
- package/changelog/models/commit-ref.d.ts +51 -0
- package/changelog/models/commit-ref.d.ts.map +1 -0
- package/changelog/models/entry.d.ts +84 -0
- package/changelog/models/entry.d.ts.map +1 -0
- package/changelog/models/index.cjs.js +2043 -0
- package/changelog/models/index.cjs.js.map +1 -0
- package/changelog/models/index.d.ts +11 -0
- package/changelog/models/index.d.ts.map +1 -0
- package/changelog/models/index.esm.js +2026 -0
- package/changelog/models/index.esm.js.map +1 -0
- package/changelog/models/schema.d.ts +68 -0
- package/changelog/models/schema.d.ts.map +1 -0
- package/changelog/models/section.d.ts +25 -0
- package/changelog/models/section.d.ts.map +1 -0
- package/changelog/operations/add-entry.d.ts +56 -0
- package/changelog/operations/add-entry.d.ts.map +1 -0
- package/changelog/operations/add-item.d.ts +18 -0
- package/changelog/operations/add-item.d.ts.map +1 -0
- package/changelog/operations/filter-by-predicate.d.ts +81 -0
- package/changelog/operations/filter-by-predicate.d.ts.map +1 -0
- package/changelog/operations/filter-by-range.d.ts +63 -0
- package/changelog/operations/filter-by-range.d.ts.map +1 -0
- package/changelog/operations/filter-entries.d.ts +9 -0
- package/changelog/operations/filter-entries.d.ts.map +1 -0
- package/changelog/operations/index.cjs.js +2455 -0
- package/changelog/operations/index.cjs.js.map +1 -0
- package/changelog/operations/index.d.ts +15 -0
- package/changelog/operations/index.d.ts.map +1 -0
- package/changelog/operations/index.esm.js +2411 -0
- package/changelog/operations/index.esm.js.map +1 -0
- package/changelog/operations/merge.d.ts +88 -0
- package/changelog/operations/merge.d.ts.map +1 -0
- package/changelog/operations/remove-entry.d.ts +45 -0
- package/changelog/operations/remove-entry.d.ts.map +1 -0
- package/changelog/operations/remove-section.d.ts +50 -0
- package/changelog/operations/remove-section.d.ts.map +1 -0
- package/changelog/operations/transform.d.ts +143 -0
- package/changelog/operations/transform.d.ts.map +1 -0
- package/changelog/parse/index.cjs.js +1282 -0
- package/changelog/parse/index.cjs.js.map +1 -0
- package/changelog/parse/index.d.ts +5 -0
- package/changelog/parse/index.d.ts.map +1 -0
- package/changelog/parse/index.esm.js +1275 -0
- package/changelog/parse/index.esm.js.map +1 -0
- package/changelog/parse/line.d.ts +48 -0
- package/changelog/parse/line.d.ts.map +1 -0
- package/changelog/parse/parser.d.ts +16 -0
- package/changelog/parse/parser.d.ts.map +1 -0
- package/changelog/parse/tokenizer.d.ts +49 -0
- package/changelog/parse/tokenizer.d.ts.map +1 -0
- package/changelog/serialize/index.cjs.js +574 -0
- package/changelog/serialize/index.cjs.js.map +1 -0
- package/changelog/serialize/index.d.ts +6 -0
- package/changelog/serialize/index.d.ts.map +1 -0
- package/changelog/serialize/index.esm.js +564 -0
- package/changelog/serialize/index.esm.js.map +1 -0
- package/changelog/serialize/templates.d.ts +81 -0
- package/changelog/serialize/templates.d.ts.map +1 -0
- package/changelog/serialize/to-json.d.ts +57 -0
- package/changelog/serialize/to-json.d.ts.map +1 -0
- package/changelog/serialize/to-string.d.ts +30 -0
- package/changelog/serialize/to-string.d.ts.map +1 -0
- package/commits/index.cjs.js +648 -0
- package/commits/index.cjs.js.map +1 -0
- package/commits/index.d.ts +3 -0
- package/commits/index.d.ts.map +1 -0
- package/commits/index.esm.js +629 -0
- package/commits/index.esm.js.map +1 -0
- package/commits/models/breaking.d.ts +39 -0
- package/commits/models/breaking.d.ts.map +1 -0
- package/commits/models/commit-type.d.ts +32 -0
- package/commits/models/commit-type.d.ts.map +1 -0
- package/commits/models/conventional.d.ts +49 -0
- package/commits/models/conventional.d.ts.map +1 -0
- package/commits/models/index.cjs.js +207 -0
- package/commits/models/index.cjs.js.map +1 -0
- package/commits/models/index.d.ts +7 -0
- package/commits/models/index.d.ts.map +1 -0
- package/commits/models/index.esm.js +193 -0
- package/commits/models/index.esm.js.map +1 -0
- package/commits/parse/body.d.ts +18 -0
- package/commits/parse/body.d.ts.map +1 -0
- package/commits/parse/footer.d.ts +16 -0
- package/commits/parse/footer.d.ts.map +1 -0
- package/commits/parse/header.d.ts +15 -0
- package/commits/parse/header.d.ts.map +1 -0
- package/commits/parse/index.cjs.js +505 -0
- package/commits/parse/index.cjs.js.map +1 -0
- package/commits/parse/index.d.ts +5 -0
- package/commits/parse/index.d.ts.map +1 -0
- package/commits/parse/index.esm.js +499 -0
- package/commits/parse/index.esm.js.map +1 -0
- package/commits/parse/message.d.ts +17 -0
- package/commits/parse/message.d.ts.map +1 -0
- package/commits/utils/replace-char.d.ts +19 -0
- package/commits/utils/replace-char.d.ts.map +1 -0
- package/flow/executor/execute.d.ts +72 -0
- package/flow/executor/execute.d.ts.map +1 -0
- package/flow/executor/index.cjs.js +4402 -0
- package/flow/executor/index.cjs.js.map +1 -0
- package/flow/executor/index.d.ts +3 -0
- package/flow/executor/index.d.ts.map +1 -0
- package/flow/executor/index.esm.js +4398 -0
- package/flow/executor/index.esm.js.map +1 -0
- package/flow/factory.d.ts +58 -0
- package/flow/factory.d.ts.map +1 -0
- package/flow/index.cjs.js +8506 -0
- package/flow/index.cjs.js.map +1 -0
- package/flow/index.d.ts +7 -0
- package/flow/index.d.ts.map +1 -0
- package/flow/index.esm.js +8451 -0
- package/flow/index.esm.js.map +1 -0
- package/flow/models/flow.d.ts +130 -0
- package/flow/models/flow.d.ts.map +1 -0
- package/flow/models/index.cjs.js +285 -0
- package/flow/models/index.cjs.js.map +1 -0
- package/flow/models/index.d.ts +7 -0
- package/flow/models/index.d.ts.map +1 -0
- package/flow/models/index.esm.js +268 -0
- package/flow/models/index.esm.js.map +1 -0
- package/flow/models/step.d.ts +108 -0
- package/flow/models/step.d.ts.map +1 -0
- package/flow/models/types.d.ts +150 -0
- package/flow/models/types.d.ts.map +1 -0
- package/flow/presets/conventional.d.ts +59 -0
- package/flow/presets/conventional.d.ts.map +1 -0
- package/flow/presets/independent.d.ts +61 -0
- package/flow/presets/independent.d.ts.map +1 -0
- package/flow/presets/index.cjs.js +3903 -0
- package/flow/presets/index.cjs.js.map +1 -0
- package/flow/presets/index.d.ts +4 -0
- package/flow/presets/index.d.ts.map +1 -0
- package/flow/presets/index.esm.js +3889 -0
- package/flow/presets/index.esm.js.map +1 -0
- package/flow/presets/synced.d.ts +65 -0
- package/flow/presets/synced.d.ts.map +1 -0
- package/flow/steps/analyze-commits.d.ts +19 -0
- package/flow/steps/analyze-commits.d.ts.map +1 -0
- package/flow/steps/calculate-bump.d.ts +27 -0
- package/flow/steps/calculate-bump.d.ts.map +1 -0
- package/flow/steps/create-commit.d.ts +16 -0
- package/flow/steps/create-commit.d.ts.map +1 -0
- package/flow/steps/create-tag.d.ts +22 -0
- package/flow/steps/create-tag.d.ts.map +1 -0
- package/flow/steps/fetch-registry.d.ts +19 -0
- package/flow/steps/fetch-registry.d.ts.map +1 -0
- package/flow/steps/generate-changelog.d.ts +25 -0
- package/flow/steps/generate-changelog.d.ts.map +1 -0
- package/flow/steps/index.cjs.js +3523 -0
- package/flow/steps/index.cjs.js.map +1 -0
- package/flow/steps/index.d.ts +8 -0
- package/flow/steps/index.d.ts.map +1 -0
- package/flow/steps/index.esm.js +3504 -0
- package/flow/steps/index.esm.js.map +1 -0
- package/flow/steps/update-packages.d.ts +25 -0
- package/flow/steps/update-packages.d.ts.map +1 -0
- package/flow/utils/interpolate.d.ts +11 -0
- package/flow/utils/interpolate.d.ts.map +1 -0
- package/git/factory.d.ts +233 -0
- package/git/factory.d.ts.map +1 -0
- package/git/index.cjs.js +2863 -0
- package/git/index.cjs.js.map +1 -0
- package/git/index.d.ts +5 -0
- package/git/index.d.ts.map +1 -0
- package/git/index.esm.js +2785 -0
- package/git/index.esm.js.map +1 -0
- package/git/models/commit.d.ts +129 -0
- package/git/models/commit.d.ts.map +1 -0
- package/git/models/index.cjs.js +755 -0
- package/git/models/index.cjs.js.map +1 -0
- package/git/models/index.d.ts +7 -0
- package/git/models/index.d.ts.map +1 -0
- package/git/models/index.esm.js +729 -0
- package/git/models/index.esm.js.map +1 -0
- package/git/models/ref.d.ts +120 -0
- package/git/models/ref.d.ts.map +1 -0
- package/git/models/tag.d.ts +141 -0
- package/git/models/tag.d.ts.map +1 -0
- package/git/operations/commit.d.ts +97 -0
- package/git/operations/commit.d.ts.map +1 -0
- package/git/operations/head-info.d.ts +29 -0
- package/git/operations/head-info.d.ts.map +1 -0
- package/git/operations/index.cjs.js +1954 -0
- package/git/operations/index.cjs.js.map +1 -0
- package/git/operations/index.d.ts +14 -0
- package/git/operations/index.d.ts.map +1 -0
- package/git/operations/index.esm.js +1903 -0
- package/git/operations/index.esm.js.map +1 -0
- package/git/operations/log.d.ts +104 -0
- package/git/operations/log.d.ts.map +1 -0
- package/git/operations/manage-tags.d.ts +60 -0
- package/git/operations/manage-tags.d.ts.map +1 -0
- package/git/operations/query-tags.d.ts +88 -0
- package/git/operations/query-tags.d.ts.map +1 -0
- package/git/operations/stage.d.ts +66 -0
- package/git/operations/stage.d.ts.map +1 -0
- package/git/operations/status.d.ts +173 -0
- package/git/operations/status.d.ts.map +1 -0
- package/index.cjs.js +16761 -0
- package/index.cjs.js.map +1 -0
- package/index.d.ts +102 -0
- package/index.d.ts.map +1 -0
- package/index.esm.js +16427 -0
- package/index.esm.js.map +1 -0
- package/package.json +200 -0
- package/registry/factory.d.ts +18 -0
- package/registry/factory.d.ts.map +1 -0
- package/registry/index.cjs.js +543 -0
- package/registry/index.cjs.js.map +1 -0
- package/registry/index.d.ts +5 -0
- package/registry/index.d.ts.map +1 -0
- package/registry/index.esm.js +535 -0
- package/registry/index.esm.js.map +1 -0
- package/registry/models/index.cjs.js +69 -0
- package/registry/models/index.cjs.js.map +1 -0
- package/registry/models/index.d.ts +6 -0
- package/registry/models/index.d.ts.map +1 -0
- package/registry/models/index.esm.js +66 -0
- package/registry/models/index.esm.js.map +1 -0
- package/registry/models/package-info.d.ts +55 -0
- package/registry/models/package-info.d.ts.map +1 -0
- package/registry/models/registry.d.ts +62 -0
- package/registry/models/registry.d.ts.map +1 -0
- package/registry/models/version-info.d.ts +67 -0
- package/registry/models/version-info.d.ts.map +1 -0
- package/registry/npm/cache.d.ts +50 -0
- package/registry/npm/cache.d.ts.map +1 -0
- package/registry/npm/client.d.ts +30 -0
- package/registry/npm/client.d.ts.map +1 -0
- package/registry/npm/index.cjs.js +456 -0
- package/registry/npm/index.cjs.js.map +1 -0
- package/registry/npm/index.d.ts +4 -0
- package/registry/npm/index.d.ts.map +1 -0
- package/registry/npm/index.esm.js +451 -0
- package/registry/npm/index.esm.js.map +1 -0
- package/semver/compare/compare.d.ts +100 -0
- package/semver/compare/compare.d.ts.map +1 -0
- package/semver/compare/index.cjs.js +386 -0
- package/semver/compare/index.cjs.js.map +1 -0
- package/semver/compare/index.d.ts +3 -0
- package/semver/compare/index.d.ts.map +1 -0
- package/semver/compare/index.esm.js +370 -0
- package/semver/compare/index.esm.js.map +1 -0
- package/semver/compare/sort.d.ts +36 -0
- package/semver/compare/sort.d.ts.map +1 -0
- package/semver/format/index.cjs.js +58 -0
- package/semver/format/index.cjs.js.map +1 -0
- package/semver/format/index.d.ts +2 -0
- package/semver/format/index.d.ts.map +1 -0
- package/semver/format/index.esm.js +53 -0
- package/semver/format/index.esm.js.map +1 -0
- package/semver/format/to-string.d.ts +31 -0
- package/semver/format/to-string.d.ts.map +1 -0
- package/semver/increment/bump.d.ts +37 -0
- package/semver/increment/bump.d.ts.map +1 -0
- package/semver/increment/index.cjs.js +223 -0
- package/semver/increment/index.cjs.js.map +1 -0
- package/semver/increment/index.d.ts +2 -0
- package/semver/increment/index.d.ts.map +1 -0
- package/semver/increment/index.esm.js +219 -0
- package/semver/increment/index.esm.js.map +1 -0
- package/semver/index.cjs.js +1499 -0
- package/semver/index.cjs.js.map +1 -0
- package/semver/index.d.ts +6 -0
- package/semver/index.d.ts.map +1 -0
- package/semver/index.esm.js +1458 -0
- package/semver/index.esm.js.map +1 -0
- package/semver/models/index.cjs.js +153 -0
- package/semver/models/index.cjs.js.map +1 -0
- package/semver/models/index.d.ts +5 -0
- package/semver/models/index.d.ts.map +1 -0
- package/semver/models/index.esm.js +139 -0
- package/semver/models/index.esm.js.map +1 -0
- package/semver/models/range.d.ts +83 -0
- package/semver/models/range.d.ts.map +1 -0
- package/semver/models/version.d.ts +78 -0
- package/semver/models/version.d.ts.map +1 -0
- package/semver/parse/index.cjs.js +799 -0
- package/semver/parse/index.cjs.js.map +1 -0
- package/semver/parse/index.d.ts +5 -0
- package/semver/parse/index.d.ts.map +1 -0
- package/semver/parse/index.esm.js +793 -0
- package/semver/parse/index.esm.js.map +1 -0
- package/semver/parse/range.d.ts +38 -0
- package/semver/parse/range.d.ts.map +1 -0
- package/semver/parse/version.d.ts +49 -0
- package/semver/parse/version.d.ts.map +1 -0
- package/workspace/discovery/changelog-path.d.ts +21 -0
- package/workspace/discovery/changelog-path.d.ts.map +1 -0
- package/workspace/discovery/dependencies.d.ts +145 -0
- package/workspace/discovery/dependencies.d.ts.map +1 -0
- package/workspace/discovery/discover-changelogs.d.ts +76 -0
- package/workspace/discovery/discover-changelogs.d.ts.map +1 -0
- package/workspace/discovery/index.cjs.js +2300 -0
- package/workspace/discovery/index.cjs.js.map +1 -0
- package/workspace/discovery/index.d.ts +13 -0
- package/workspace/discovery/index.d.ts.map +1 -0
- package/workspace/discovery/index.esm.js +2283 -0
- package/workspace/discovery/index.esm.js.map +1 -0
- package/workspace/discovery/packages.d.ts +83 -0
- package/workspace/discovery/packages.d.ts.map +1 -0
- package/workspace/index.cjs.js +4445 -0
- package/workspace/index.cjs.js.map +1 -0
- package/workspace/index.d.ts +52 -0
- package/workspace/index.d.ts.map +1 -0
- package/workspace/index.esm.js +4394 -0
- package/workspace/index.esm.js.map +1 -0
- package/workspace/models/index.cjs.js +284 -0
- package/workspace/models/index.cjs.js.map +1 -0
- package/workspace/models/index.d.ts +10 -0
- package/workspace/models/index.d.ts.map +1 -0
- package/workspace/models/index.esm.js +261 -0
- package/workspace/models/index.esm.js.map +1 -0
- package/workspace/models/project.d.ts +118 -0
- package/workspace/models/project.d.ts.map +1 -0
- package/workspace/models/workspace.d.ts +139 -0
- package/workspace/models/workspace.d.ts.map +1 -0
- package/workspace/operations/batch-update.d.ts +99 -0
- package/workspace/operations/batch-update.d.ts.map +1 -0
- package/workspace/operations/cascade-bump.d.ts +125 -0
- package/workspace/operations/cascade-bump.d.ts.map +1 -0
- package/workspace/operations/index.cjs.js +2675 -0
- package/workspace/operations/index.cjs.js.map +1 -0
- package/workspace/operations/index.d.ts +12 -0
- package/workspace/operations/index.d.ts.map +1 -0
- package/workspace/operations/index.esm.js +2663 -0
- package/workspace/operations/index.esm.js.map +1 -0
- package/workspace/operations/validate.d.ts +85 -0
- 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,SAAU,OAAO,CAAC,CAAS,EAAE,CAAS,EAAA;;IAE1C,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,EAAE;AACvB,QAAA,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,GAAG,CAAC;IACnC;IACA,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,EAAE;AACvB,QAAA,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,GAAG,CAAC;IACnC;IACA,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,EAAE;AACvB,QAAA,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,GAAG,CAAC;IACnC;;;AAIA,IAAA,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;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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 @@
|
|
|
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,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;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"}
|