@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,223 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Safe copies of Number built-in methods and constants.
|
|
5
|
+
*
|
|
6
|
+
* These references are captured at module initialization time to protect against
|
|
7
|
+
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
8
|
+
*
|
|
9
|
+
* @module @hyperfrontend/immutable-api-utils/built-in-copy/number
|
|
10
|
+
*/
|
|
11
|
+
// Capture references at module initialization time
|
|
12
|
+
const _parseInt = globalThis.parseInt;
|
|
13
|
+
const _isNaN = globalThis.isNaN;
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// Parsing
|
|
16
|
+
// ============================================================================
|
|
17
|
+
/**
|
|
18
|
+
* (Safe copy) Parses a string and returns an integer.
|
|
19
|
+
*/
|
|
20
|
+
const parseInt = _parseInt;
|
|
21
|
+
// ============================================================================
|
|
22
|
+
// Global Type Checking (legacy, less strict)
|
|
23
|
+
// ============================================================================
|
|
24
|
+
/**
|
|
25
|
+
* (Safe copy) Global isNaN function (coerces to number first, less strict than Number.isNaN).
|
|
26
|
+
*/
|
|
27
|
+
const globalIsNaN = _isNaN;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new SemVer object.
|
|
31
|
+
*
|
|
32
|
+
* @param options - Version components
|
|
33
|
+
* @returns A new SemVer object
|
|
34
|
+
*/
|
|
35
|
+
function createSemVer(options) {
|
|
36
|
+
return {
|
|
37
|
+
major: options.major,
|
|
38
|
+
minor: options.minor,
|
|
39
|
+
patch: options.patch,
|
|
40
|
+
prerelease: options.prerelease ?? [],
|
|
41
|
+
build: options.build ?? [],
|
|
42
|
+
raw: options.raw,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Increments a version based on the bump type.
|
|
48
|
+
*
|
|
49
|
+
* @param version - The version to increment
|
|
50
|
+
* @param type - The type of bump (major, minor, patch, etc.)
|
|
51
|
+
* @param prereleaseId - Optional prerelease identifier for prerelease bumps
|
|
52
|
+
* @returns A new incremented SemVer
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* increment(parseVersion('1.2.3'), 'minor') // 1.3.0
|
|
56
|
+
* increment(parseVersion('1.2.3'), 'major') // 2.0.0
|
|
57
|
+
* increment(parseVersion('1.2.3'), 'prerelease', 'alpha') // 1.2.4-alpha.0
|
|
58
|
+
*/
|
|
59
|
+
function increment(version, type, prereleaseId) {
|
|
60
|
+
switch (type) {
|
|
61
|
+
case 'major':
|
|
62
|
+
return createSemVer({
|
|
63
|
+
major: version.major + 1,
|
|
64
|
+
minor: 0,
|
|
65
|
+
patch: 0,
|
|
66
|
+
prerelease: [],
|
|
67
|
+
build: [],
|
|
68
|
+
});
|
|
69
|
+
case 'minor':
|
|
70
|
+
return createSemVer({
|
|
71
|
+
major: version.major,
|
|
72
|
+
minor: version.minor + 1,
|
|
73
|
+
patch: 0,
|
|
74
|
+
prerelease: [],
|
|
75
|
+
build: [],
|
|
76
|
+
});
|
|
77
|
+
case 'patch':
|
|
78
|
+
// If version has prerelease, just remove it (1.2.3-alpha -> 1.2.3)
|
|
79
|
+
if (version.prerelease.length > 0) {
|
|
80
|
+
return createSemVer({
|
|
81
|
+
major: version.major,
|
|
82
|
+
minor: version.minor,
|
|
83
|
+
patch: version.patch,
|
|
84
|
+
prerelease: [],
|
|
85
|
+
build: [],
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return createSemVer({
|
|
89
|
+
major: version.major,
|
|
90
|
+
minor: version.minor,
|
|
91
|
+
patch: version.patch + 1,
|
|
92
|
+
prerelease: [],
|
|
93
|
+
build: [],
|
|
94
|
+
});
|
|
95
|
+
case 'premajor':
|
|
96
|
+
return createSemVer({
|
|
97
|
+
major: version.major + 1,
|
|
98
|
+
minor: 0,
|
|
99
|
+
patch: 0,
|
|
100
|
+
prerelease: [prereleaseId ?? 'alpha', '0'],
|
|
101
|
+
build: [],
|
|
102
|
+
});
|
|
103
|
+
case 'preminor':
|
|
104
|
+
return createSemVer({
|
|
105
|
+
major: version.major,
|
|
106
|
+
minor: version.minor + 1,
|
|
107
|
+
patch: 0,
|
|
108
|
+
prerelease: [prereleaseId ?? 'alpha', '0'],
|
|
109
|
+
build: [],
|
|
110
|
+
});
|
|
111
|
+
case 'prepatch':
|
|
112
|
+
return createSemVer({
|
|
113
|
+
major: version.major,
|
|
114
|
+
minor: version.minor,
|
|
115
|
+
patch: version.patch + 1,
|
|
116
|
+
prerelease: [prereleaseId ?? 'alpha', '0'],
|
|
117
|
+
build: [],
|
|
118
|
+
});
|
|
119
|
+
case 'prerelease':
|
|
120
|
+
return incrementPrerelease(version, prereleaseId);
|
|
121
|
+
case 'none':
|
|
122
|
+
default:
|
|
123
|
+
return version;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Increments the prerelease portion of a version.
|
|
128
|
+
*
|
|
129
|
+
* @param version - The version to increment
|
|
130
|
+
* @param id - Optional prerelease identifier
|
|
131
|
+
* @returns A new version with incremented prerelease
|
|
132
|
+
*/
|
|
133
|
+
function incrementPrerelease(version, id) {
|
|
134
|
+
const prerelease = [...version.prerelease];
|
|
135
|
+
if (prerelease.length === 0) {
|
|
136
|
+
// No existing prerelease - start at patch+1 with id.0
|
|
137
|
+
return createSemVer({
|
|
138
|
+
major: version.major,
|
|
139
|
+
minor: version.minor,
|
|
140
|
+
patch: version.patch + 1,
|
|
141
|
+
prerelease: [id ?? 'alpha', '0'],
|
|
142
|
+
build: [],
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
// Check if the last identifier is numeric
|
|
146
|
+
const lastIdx = prerelease.length - 1;
|
|
147
|
+
const last = prerelease[lastIdx];
|
|
148
|
+
const lastNum = parseInt(last, 10);
|
|
149
|
+
if (!globalIsNaN(lastNum)) {
|
|
150
|
+
// Increment the numeric part
|
|
151
|
+
prerelease[lastIdx] = String(lastNum + 1);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
// Append .0
|
|
155
|
+
prerelease.push('0');
|
|
156
|
+
}
|
|
157
|
+
// If a different id is specified, replace the base identifier
|
|
158
|
+
if (id && prerelease.length > 0 && prerelease[0] !== id) {
|
|
159
|
+
prerelease[0] = id;
|
|
160
|
+
// Reset numeric part
|
|
161
|
+
if (prerelease.length > 1) {
|
|
162
|
+
prerelease[prerelease.length - 1] = '0';
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return createSemVer({
|
|
166
|
+
major: version.major,
|
|
167
|
+
minor: version.minor,
|
|
168
|
+
patch: version.patch,
|
|
169
|
+
prerelease,
|
|
170
|
+
build: [],
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Calculates the difference type between two versions.
|
|
175
|
+
*
|
|
176
|
+
* @param older - The older version
|
|
177
|
+
* @param newer - The newer version
|
|
178
|
+
* @returns The type of difference, or null if versions are equal
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* diff(parseVersion('1.0.0'), parseVersion('2.0.0')) // 'major'
|
|
182
|
+
* diff(parseVersion('1.0.0'), parseVersion('1.1.0')) // 'minor'
|
|
183
|
+
* diff(parseVersion('1.0.0'), parseVersion('1.0.1')) // 'patch'
|
|
184
|
+
*/
|
|
185
|
+
function diff(older, newer) {
|
|
186
|
+
// Check major
|
|
187
|
+
if (older.major !== newer.major) {
|
|
188
|
+
if (newer.prerelease.length > 0) {
|
|
189
|
+
return 'premajor';
|
|
190
|
+
}
|
|
191
|
+
return 'major';
|
|
192
|
+
}
|
|
193
|
+
// Check minor
|
|
194
|
+
if (older.minor !== newer.minor) {
|
|
195
|
+
if (newer.prerelease.length > 0) {
|
|
196
|
+
return 'preminor';
|
|
197
|
+
}
|
|
198
|
+
return 'minor';
|
|
199
|
+
}
|
|
200
|
+
// Check patch
|
|
201
|
+
if (older.patch !== newer.patch) {
|
|
202
|
+
if (newer.prerelease.length > 0) {
|
|
203
|
+
return 'prepatch';
|
|
204
|
+
}
|
|
205
|
+
return 'patch';
|
|
206
|
+
}
|
|
207
|
+
// Check prerelease
|
|
208
|
+
if (older.prerelease.length !== newer.prerelease.length) {
|
|
209
|
+
return 'prerelease';
|
|
210
|
+
}
|
|
211
|
+
for (let i = 0; i < older.prerelease.length; i++) {
|
|
212
|
+
if (older.prerelease[i] !== newer.prerelease[i]) {
|
|
213
|
+
return 'prerelease';
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
// Versions are equal (ignoring build)
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
exports.diff = diff;
|
|
221
|
+
exports.increment = increment;
|
|
222
|
+
exports.incrementPrerelease = incrementPrerelease;
|
|
223
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/number/index.ts","../../../../../../../../../../libs/versioning/src/semver/models/version.ts","../../../../../../../../../../libs/versioning/src/semver/increment/bump.ts"],"sourcesContent":[null,null,null],"names":[],"mappings":";;AAAA;;;;;;;AAOG;AAEH;AAEA,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ;AAErC,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK;AAwE/B;AACA;AACA;AAEA;;AAEG;AACI,MAAM,QAAQ,GAAG,SAAS;AAOjC;AACA;AACA;AAEA;;AAEG;AACI,MAAM,WAAW,GAAG,MAAM;;ACzEjC;;;;;AAKG;AACG,SAAU,YAAY,CAAC,OAA0E,EAAA;IACrG,OAAO;QACL,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;AACpB,QAAA,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE;AACpC,QAAA,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE;QAC1B,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB;AACH;;AC5CA;;;;;;;;;;;;AAYG;SACa,SAAS,CAAC,OAAe,EAAE,IAAc,EAAE,YAAqB,EAAA;IAC9E,QAAQ,IAAI;AACV,QAAA,KAAK,OAAO;AACV,YAAA,OAAO,YAAY,CAAC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AAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;AAC/B,YAAA,OAAO,UAAU;QACnB;AACA,QAAA,OAAO,OAAO;IAChB;;IAGA,IAAI,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,EAAE;QAC/B,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;AAC/B,YAAA,OAAO,UAAU;QACnB;AACA,QAAA,OAAO,OAAO;IAChB;;AAGA,IAAA,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,KAAK,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE;AACvD,QAAA,OAAO,YAAY;IACrB;AAEA,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAChD,QAAA,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;AAC/C,YAAA,OAAO,YAAY;QACrB;IACF;;AAGA,IAAA,OAAO,IAAI;AACb;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/versioning/src/semver/increment/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe copies of Number built-in methods and constants.
|
|
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/number
|
|
8
|
+
*/
|
|
9
|
+
// Capture references at module initialization time
|
|
10
|
+
const _parseInt = globalThis.parseInt;
|
|
11
|
+
const _isNaN = globalThis.isNaN;
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// Parsing
|
|
14
|
+
// ============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* (Safe copy) Parses a string and returns an integer.
|
|
17
|
+
*/
|
|
18
|
+
const parseInt = _parseInt;
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// Global Type Checking (legacy, less strict)
|
|
21
|
+
// ============================================================================
|
|
22
|
+
/**
|
|
23
|
+
* (Safe copy) Global isNaN function (coerces to number first, less strict than Number.isNaN).
|
|
24
|
+
*/
|
|
25
|
+
const globalIsNaN = _isNaN;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Creates a new SemVer object.
|
|
29
|
+
*
|
|
30
|
+
* @param options - Version components
|
|
31
|
+
* @returns A new SemVer object
|
|
32
|
+
*/
|
|
33
|
+
function createSemVer(options) {
|
|
34
|
+
return {
|
|
35
|
+
major: options.major,
|
|
36
|
+
minor: options.minor,
|
|
37
|
+
patch: options.patch,
|
|
38
|
+
prerelease: options.prerelease ?? [],
|
|
39
|
+
build: options.build ?? [],
|
|
40
|
+
raw: options.raw,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Increments a version based on the bump type.
|
|
46
|
+
*
|
|
47
|
+
* @param version - The version to increment
|
|
48
|
+
* @param type - The type of bump (major, minor, patch, etc.)
|
|
49
|
+
* @param prereleaseId - Optional prerelease identifier for prerelease bumps
|
|
50
|
+
* @returns A new incremented SemVer
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* increment(parseVersion('1.2.3'), 'minor') // 1.3.0
|
|
54
|
+
* increment(parseVersion('1.2.3'), 'major') // 2.0.0
|
|
55
|
+
* increment(parseVersion('1.2.3'), 'prerelease', 'alpha') // 1.2.4-alpha.0
|
|
56
|
+
*/
|
|
57
|
+
function increment(version, type, prereleaseId) {
|
|
58
|
+
switch (type) {
|
|
59
|
+
case 'major':
|
|
60
|
+
return createSemVer({
|
|
61
|
+
major: version.major + 1,
|
|
62
|
+
minor: 0,
|
|
63
|
+
patch: 0,
|
|
64
|
+
prerelease: [],
|
|
65
|
+
build: [],
|
|
66
|
+
});
|
|
67
|
+
case 'minor':
|
|
68
|
+
return createSemVer({
|
|
69
|
+
major: version.major,
|
|
70
|
+
minor: version.minor + 1,
|
|
71
|
+
patch: 0,
|
|
72
|
+
prerelease: [],
|
|
73
|
+
build: [],
|
|
74
|
+
});
|
|
75
|
+
case 'patch':
|
|
76
|
+
// If version has prerelease, just remove it (1.2.3-alpha -> 1.2.3)
|
|
77
|
+
if (version.prerelease.length > 0) {
|
|
78
|
+
return createSemVer({
|
|
79
|
+
major: version.major,
|
|
80
|
+
minor: version.minor,
|
|
81
|
+
patch: version.patch,
|
|
82
|
+
prerelease: [],
|
|
83
|
+
build: [],
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return createSemVer({
|
|
87
|
+
major: version.major,
|
|
88
|
+
minor: version.minor,
|
|
89
|
+
patch: version.patch + 1,
|
|
90
|
+
prerelease: [],
|
|
91
|
+
build: [],
|
|
92
|
+
});
|
|
93
|
+
case 'premajor':
|
|
94
|
+
return createSemVer({
|
|
95
|
+
major: version.major + 1,
|
|
96
|
+
minor: 0,
|
|
97
|
+
patch: 0,
|
|
98
|
+
prerelease: [prereleaseId ?? 'alpha', '0'],
|
|
99
|
+
build: [],
|
|
100
|
+
});
|
|
101
|
+
case 'preminor':
|
|
102
|
+
return createSemVer({
|
|
103
|
+
major: version.major,
|
|
104
|
+
minor: version.minor + 1,
|
|
105
|
+
patch: 0,
|
|
106
|
+
prerelease: [prereleaseId ?? 'alpha', '0'],
|
|
107
|
+
build: [],
|
|
108
|
+
});
|
|
109
|
+
case 'prepatch':
|
|
110
|
+
return createSemVer({
|
|
111
|
+
major: version.major,
|
|
112
|
+
minor: version.minor,
|
|
113
|
+
patch: version.patch + 1,
|
|
114
|
+
prerelease: [prereleaseId ?? 'alpha', '0'],
|
|
115
|
+
build: [],
|
|
116
|
+
});
|
|
117
|
+
case 'prerelease':
|
|
118
|
+
return incrementPrerelease(version, prereleaseId);
|
|
119
|
+
case 'none':
|
|
120
|
+
default:
|
|
121
|
+
return version;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Increments the prerelease portion of a version.
|
|
126
|
+
*
|
|
127
|
+
* @param version - The version to increment
|
|
128
|
+
* @param id - Optional prerelease identifier
|
|
129
|
+
* @returns A new version with incremented prerelease
|
|
130
|
+
*/
|
|
131
|
+
function incrementPrerelease(version, id) {
|
|
132
|
+
const prerelease = [...version.prerelease];
|
|
133
|
+
if (prerelease.length === 0) {
|
|
134
|
+
// No existing prerelease - start at patch+1 with id.0
|
|
135
|
+
return createSemVer({
|
|
136
|
+
major: version.major,
|
|
137
|
+
minor: version.minor,
|
|
138
|
+
patch: version.patch + 1,
|
|
139
|
+
prerelease: [id ?? 'alpha', '0'],
|
|
140
|
+
build: [],
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
// Check if the last identifier is numeric
|
|
144
|
+
const lastIdx = prerelease.length - 1;
|
|
145
|
+
const last = prerelease[lastIdx];
|
|
146
|
+
const lastNum = parseInt(last, 10);
|
|
147
|
+
if (!globalIsNaN(lastNum)) {
|
|
148
|
+
// Increment the numeric part
|
|
149
|
+
prerelease[lastIdx] = String(lastNum + 1);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
// Append .0
|
|
153
|
+
prerelease.push('0');
|
|
154
|
+
}
|
|
155
|
+
// If a different id is specified, replace the base identifier
|
|
156
|
+
if (id && prerelease.length > 0 && prerelease[0] !== id) {
|
|
157
|
+
prerelease[0] = id;
|
|
158
|
+
// Reset numeric part
|
|
159
|
+
if (prerelease.length > 1) {
|
|
160
|
+
prerelease[prerelease.length - 1] = '0';
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return createSemVer({
|
|
164
|
+
major: version.major,
|
|
165
|
+
minor: version.minor,
|
|
166
|
+
patch: version.patch,
|
|
167
|
+
prerelease,
|
|
168
|
+
build: [],
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Calculates the difference type between two versions.
|
|
173
|
+
*
|
|
174
|
+
* @param older - The older version
|
|
175
|
+
* @param newer - The newer version
|
|
176
|
+
* @returns The type of difference, or null if versions are equal
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* diff(parseVersion('1.0.0'), parseVersion('2.0.0')) // 'major'
|
|
180
|
+
* diff(parseVersion('1.0.0'), parseVersion('1.1.0')) // 'minor'
|
|
181
|
+
* diff(parseVersion('1.0.0'), parseVersion('1.0.1')) // 'patch'
|
|
182
|
+
*/
|
|
183
|
+
function diff(older, newer) {
|
|
184
|
+
// Check major
|
|
185
|
+
if (older.major !== newer.major) {
|
|
186
|
+
if (newer.prerelease.length > 0) {
|
|
187
|
+
return 'premajor';
|
|
188
|
+
}
|
|
189
|
+
return 'major';
|
|
190
|
+
}
|
|
191
|
+
// Check minor
|
|
192
|
+
if (older.minor !== newer.minor) {
|
|
193
|
+
if (newer.prerelease.length > 0) {
|
|
194
|
+
return 'preminor';
|
|
195
|
+
}
|
|
196
|
+
return 'minor';
|
|
197
|
+
}
|
|
198
|
+
// Check patch
|
|
199
|
+
if (older.patch !== newer.patch) {
|
|
200
|
+
if (newer.prerelease.length > 0) {
|
|
201
|
+
return 'prepatch';
|
|
202
|
+
}
|
|
203
|
+
return 'patch';
|
|
204
|
+
}
|
|
205
|
+
// Check prerelease
|
|
206
|
+
if (older.prerelease.length !== newer.prerelease.length) {
|
|
207
|
+
return 'prerelease';
|
|
208
|
+
}
|
|
209
|
+
for (let i = 0; i < older.prerelease.length; i++) {
|
|
210
|
+
if (older.prerelease[i] !== newer.prerelease[i]) {
|
|
211
|
+
return 'prerelease';
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// Versions are equal (ignoring build)
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export { diff, increment, incrementPrerelease };
|
|
219
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/number/index.ts","../../../../../../../../../../libs/versioning/src/semver/models/version.ts","../../../../../../../../../../libs/versioning/src/semver/increment/bump.ts"],"sourcesContent":[null,null,null],"names":[],"mappings":"AAAA;;;;;;;AAOG;AAEH;AAEA,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ;AAErC,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK;AAwE/B;AACA;AACA;AAEA;;AAEG;AACI,MAAM,QAAQ,GAAG,SAAS;AAOjC;AACA;AACA;AAEA;;AAEG;AACI,MAAM,WAAW,GAAG,MAAM;;ACzEjC;;;;;AAKG;AACG,SAAU,YAAY,CAAC,OAA0E,EAAA;IACrG,OAAO;QACL,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;AACpB,QAAA,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE;AACpC,QAAA,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE;QAC1B,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB;AACH;;AC5CA;;;;;;;;;;;;AAYG;SACa,SAAS,CAAC,OAAe,EAAE,IAAc,EAAE,YAAqB,EAAA;IAC9E,QAAQ,IAAI;AACV,QAAA,KAAK,OAAO;AACV,YAAA,OAAO,YAAY,CAAC;AAClB,gBAAA,KAAK,EAAE,OAAO,CAAC,KAAK,GAAG,CAAC;AACxB,gBAAA,KAAK,EAAE,CAAC;AACR,gBAAA,KAAK,EAAE,CAAC;AACR,gBAAA,UAAU,EAAE,EAAE;AACd,gBAAA,KAAK,EAAE,EAAE;AACV,aAAA,CAAC;AAEJ,QAAA,KAAK,OAAO;AACV,YAAA,OAAO,YAAY,CA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