@williamthorsen/toolbelt.git 0.7.5 → 0.7.7
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/.meta/changelog.json
CHANGED
|
@@ -1,4 +1,54 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.7.7",
|
|
4
|
+
"date": "2026-11-15",
|
|
5
|
+
"sections": [
|
|
6
|
+
{
|
|
7
|
+
"title": "🐛 Bug fixes",
|
|
8
|
+
"audience": "all",
|
|
9
|
+
"items": [
|
|
10
|
+
{
|
|
11
|
+
"description": "Fixes the issue that `deriveBranchNumber` returned an inexact result for a ticket number beyond 2^53 and `NaN` for an infinite one, which now throws a `RangeError`. (#603)",
|
|
12
|
+
"hash": "45891e9363c9149ca5cce2a7df94bed0cf67d749",
|
|
13
|
+
"entry": 2
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"title": "📦 Dependencies",
|
|
19
|
+
"audience": "dev",
|
|
20
|
+
"items": [
|
|
21
|
+
{
|
|
22
|
+
"description": "Removes the `@williamthorsen/toolbelt.testing` devDependency, which neither package imports, from `atlassian` and `git`, along with the matching importer entries in `pnpm-lock.yaml`. (#602)",
|
|
23
|
+
"hash": "323db000fd15065be58d8f1d912350bce8dcbb89",
|
|
24
|
+
"entry": 1
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"title": "📚 Documentation",
|
|
30
|
+
"audience": "dev",
|
|
31
|
+
"items": [
|
|
32
|
+
{
|
|
33
|
+
"description": "Adds the `<!-- readme-type: library -->` marker to the top of `packages/git/README.md`, which declares it a library README as the `filesystem` README already is. (#595)",
|
|
34
|
+
"hash": "b4ad58db439ff0f88e871ea4db29c3cf4e489592",
|
|
35
|
+
"entry": 2
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"version": "0.7.6",
|
|
43
|
+
"date": "2026-11-13",
|
|
44
|
+
"sections": [
|
|
45
|
+
{
|
|
46
|
+
"title": "📦 Dependencies",
|
|
47
|
+
"audience": "dev",
|
|
48
|
+
"items": [{ "description": "Bumped `@williamthorsen/toolbelt.strings` to 9.0.0" }]
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
2
52
|
{
|
|
3
53
|
"version": "0.7.5",
|
|
4
54
|
"date": "2026-11-12",
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## 0.7.7 — 2026-11-15
|
|
6
|
+
|
|
7
|
+
### 🐛 Bug fixes
|
|
8
|
+
|
|
9
|
+
- Fixes the issue that `deriveBranchNumber` returned an inexact result for a ticket number beyond 2^53 and `NaN` for an infinite one, which now throws a `RangeError`. (#603)
|
|
10
|
+
|
|
11
|
+
### 📦 Dependencies
|
|
12
|
+
|
|
13
|
+
- Removes the `@williamthorsen/toolbelt.testing` devDependency, which neither package imports, from `atlassian` and `git`, along with the matching importer entries in `pnpm-lock.yaml`. (#602)
|
|
14
|
+
|
|
15
|
+
### 📚 Documentation
|
|
16
|
+
|
|
17
|
+
- Adds the `<!-- readme-type: library -->` marker to the top of `packages/git/README.md`, which declares it a library README as the `filesystem` README already is. (#595)
|
|
18
|
+
|
|
19
|
+
## 0.7.6 — 2026-11-13
|
|
20
|
+
|
|
21
|
+
### 📦 Dependencies
|
|
22
|
+
|
|
23
|
+
- Bumped `@williamthorsen/toolbelt.strings` to 9.0.0
|
|
24
|
+
|
|
5
25
|
## 0.7.5 — 2026-11-12
|
|
6
26
|
|
|
7
27
|
### 📦 Dependencies
|
package/README.md
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
<!-- readme-type: library -->
|
|
2
|
+
|
|
1
3
|
# @williamthorsen/toolbelt.git
|
|
2
4
|
|
|
3
5
|
Utilities for working with git.
|
|
4
6
|
|
|
5
|
-
<!-- section:release-notes
|
|
7
|
+
<!-- section:release-notes -->
|
|
8
|
+
## Release notes — v0.7.7 (2026-11-15)
|
|
9
|
+
|
|
10
|
+
### 🐛 Bug fixes
|
|
11
|
+
|
|
12
|
+
- Fixes the issue that `deriveBranchNumber` returned an inexact result for a ticket number beyond 2^53 and `NaN` for an infinite one, which now throws a `RangeError`. (#603)
|
|
13
|
+
<!-- /section:release-notes -->
|
|
6
14
|
|
|
7
15
|
## Installation
|
|
8
16
|
|
|
@@ -2,8 +2,9 @@ import { type BranchTicketRefOptions } from './findBranchTicketRef.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Derives a number from a branch name: the number of the ticket encoded by the name, or a hash of the name
|
|
4
4
|
* when it encodes none, so a branch always yields a stable number. `min` and `max` bound the result
|
|
5
|
-
* inclusively, and `offset` rotates it, wrapping at the bounds. Throws a RangeError on a malformed `key`,
|
|
6
|
-
* or
|
|
5
|
+
* inclusively, and `offset` rotates it, wrapping at the bounds. Throws a RangeError on a malformed `key`, if a
|
|
6
|
+
* bound or the offset is not a safe integer, if min exceeds max, if the range spans more than 2^32 values, or if
|
|
7
|
+
* the ticket number is too large to be finite.
|
|
7
8
|
*
|
|
8
9
|
* @category Git
|
|
9
10
|
* @experimental
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
+
import { indexIntoRange } from '@williamthorsen/toolbelt.numbers/candidate';
|
|
1
2
|
import { hashString } from '@williamthorsen/toolbelt.strings/candidate';
|
|
2
3
|
import { findBranchTicketRef } from "./findBranchTicketRef.js";
|
|
3
4
|
const MAX_UINT32 = 0xffff_ffff;
|
|
5
|
+
const UINT32_SIZE = 2 ** 32;
|
|
4
6
|
export function deriveBranchNumber(branch, options = {}) {
|
|
5
|
-
const digest = hashString(branch, options);
|
|
6
7
|
const ref = findBranchTicketRef(branch, options);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
if (ref === undefined) {
|
|
9
|
+
return hashString(branch, options);
|
|
10
|
+
}
|
|
10
11
|
const { max = MAX_UINT32, min = 0, offset = 0 } = options;
|
|
11
|
-
|
|
12
|
-
const shift = ((offset % size) + size) % size;
|
|
13
|
-
return min + ((value + shift) % size);
|
|
12
|
+
return indexIntoRange(ref.number, { max, maxSpan: UINT32_SIZE, min, offset });
|
|
14
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@williamthorsen/toolbelt.git",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.7",
|
|
4
4
|
"description": "Utilities for working with git",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"esm",
|
|
@@ -42,10 +42,8 @@
|
|
|
42
42
|
"dist/*"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@williamthorsen/toolbelt.
|
|
46
|
-
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"@williamthorsen/toolbelt.testing": "0.8.3"
|
|
45
|
+
"@williamthorsen/toolbelt.numbers": "8.1.0",
|
|
46
|
+
"@williamthorsen/toolbelt.strings": "9.0.1"
|
|
49
47
|
},
|
|
50
48
|
"engines": {
|
|
51
49
|
"node": ">=24.0.0"
|