happy-rusty 1.9.0 → 1.9.1
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/CHANGELOG.md +13 -0
- package/dist/main.cjs +21 -1
- package/dist/main.cjs.map +1 -1
- package/dist/main.mjs +21 -1
- package/dist/main.mjs.map +1 -1
- package/dist/types.d.ts +52 -101
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.9.1] - 2026-01-16
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- **Performance**: `Channel` buffer replaced `Array` with `Queue` for O(1) shift operations
|
|
12
|
+
|
|
13
|
+
### Documentation
|
|
14
|
+
- Added `@since` tags to all public APIs
|
|
15
|
+
- Improved JSDoc consistency and formatting
|
|
16
|
+
|
|
17
|
+
### CI
|
|
18
|
+
- Changed JSR publish to trigger on release instead of push to main
|
|
19
|
+
|
|
8
20
|
## [1.9.0] - 2026-01-04
|
|
9
21
|
|
|
10
22
|
### Added
|
|
@@ -270,6 +282,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
270
282
|
- Full TypeScript support
|
|
271
283
|
- Comprehensive API matching Rust's Option and Result
|
|
272
284
|
|
|
285
|
+
[1.9.1]: https://github.com/JiangJie/happy-rusty/compare/v1.9.0...v1.9.1
|
|
273
286
|
[1.9.0]: https://github.com/JiangJie/happy-rusty/compare/v1.8.0...v1.9.0
|
|
274
287
|
[1.8.0]: https://github.com/JiangJie/happy-rusty/compare/v1.7.1...v1.8.0
|
|
275
288
|
[1.7.1]: https://github.com/JiangJie/happy-rusty/compare/v1.7.0...v1.7.1
|
package/dist/main.cjs
CHANGED
|
@@ -721,7 +721,7 @@ function Channel(capacity = Infinity) {
|
|
|
721
721
|
if (capacity < 0 || !Number.isInteger(capacity) && capacity !== Infinity) {
|
|
722
722
|
throw new RangeError("Channel capacity must be a non-negative integer or Infinity");
|
|
723
723
|
}
|
|
724
|
-
const buffer =
|
|
724
|
+
const buffer = new Queue();
|
|
725
725
|
let closed = false;
|
|
726
726
|
const sendWaitQueue = [];
|
|
727
727
|
const receiveWaitQueue = [];
|
|
@@ -957,6 +957,26 @@ function Channel(capacity = Infinity) {
|
|
|
957
957
|
close
|
|
958
958
|
});
|
|
959
959
|
}
|
|
960
|
+
class Queue {
|
|
961
|
+
data = [];
|
|
962
|
+
offset = 0;
|
|
963
|
+
get length() {
|
|
964
|
+
return this.data.length - this.offset;
|
|
965
|
+
}
|
|
966
|
+
push(item) {
|
|
967
|
+
this.data.push(item);
|
|
968
|
+
}
|
|
969
|
+
shift() {
|
|
970
|
+
const item = this.data[this.offset];
|
|
971
|
+
this.data[this.offset] = void 0;
|
|
972
|
+
this.offset++;
|
|
973
|
+
if (this.offset > 1024 && this.offset * 2 > this.data.length) {
|
|
974
|
+
this.data = this.data.slice(this.offset);
|
|
975
|
+
this.offset = 0;
|
|
976
|
+
}
|
|
977
|
+
return item;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
960
980
|
|
|
961
981
|
function Lazy(fn) {
|
|
962
982
|
let value;
|