@nxtedition/shared 4.0.1 → 4.0.2

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/lib/index.d.ts CHANGED
@@ -38,17 +38,20 @@ export declare class Writer {
38
38
  * Synchronously writes a message. Blocks (via `Atomics.wait`) until buffer space is available.
39
39
  * Writing more than "len" bytes in the callback will cause undefined behavior.
40
40
  */
41
- writeSync<U>(len: number, fn: (data: BufferRegion, opaque?: U) => number, opaque?: U): void;
41
+ writeSync(len: number, fn: (data: BufferRegion) => number): void;
42
+ writeSync<U>(len: number, fn: (data: BufferRegion, opaque: U) => number, opaque: U): void;
42
43
  /**
43
44
  * Non-blocking write attempt. Returns `false` if the buffer is full.
44
45
  * Writing more than "len" bytes in the callback will cause undefined behavior.
45
46
  */
46
- tryWrite<U>(len: number, fn: (data: BufferRegion, opaque?: U) => number, opaque?: U): boolean;
47
+ tryWrite(len: number, fn: (data: BufferRegion) => number): boolean;
48
+ tryWrite<U>(len: number, fn: (data: BufferRegion, opaque: U) => number, opaque: U): boolean;
47
49
  /**
48
50
  * Batches multiple writes within the callback. The write pointer is only
49
51
  * published to the reader when cork returns, reducing atomic operation overhead.
50
52
  */
51
- cork<T>(callback?: () => T): T | undefined;
53
+ cork(): void;
54
+ cork<T>(callback: () => T): T;
52
55
  /**
53
56
  * Publishes the pending write position to the reader.
54
57
  */
package/lib/index.js CHANGED
@@ -384,7 +384,9 @@ export class Writer {
384
384
  * Synchronously writes a message. Blocks (via `Atomics.wait`) until buffer space is available.
385
385
  * Writing more than "len" bytes in the callback will cause undefined behavior.
386
386
  */
387
- writeSync (len , fn , opaque ) {
387
+
388
+
389
+ writeSync (len , fn , opaque ) {
388
390
  if (typeof len !== 'number') {
389
391
  throw new TypeError('"len" must be a non-negative number')
390
392
  }
@@ -438,7 +440,9 @@ export class Writer {
438
440
  * Non-blocking write attempt. Returns `false` if the buffer is full.
439
441
  * Writing more than "len" bytes in the callback will cause undefined behavior.
440
442
  */
441
- tryWrite (len , fn , opaque ) {
443
+
444
+
445
+ tryWrite (len , fn , opaque ) {
442
446
  if (typeof len !== 'number') {
443
447
  throw new TypeError('"len" must be a non-negative number')
444
448
  }
@@ -472,6 +476,8 @@ export class Writer {
472
476
  * Batches multiple writes within the callback. The write pointer is only
473
477
  * published to the reader when cork returns, reducing atomic operation overhead.
474
478
  */
479
+
480
+
475
481
  cork (callback ) {
476
482
  this.#corked += 1
477
483
  if (callback != null) {
@@ -486,7 +492,7 @@ export class Writer {
486
492
  /**
487
493
  * Publishes the pending write position to the reader.
488
494
  */
489
- uncork() {
495
+ uncork() {
490
496
  if (this.#corked === 0) {
491
497
  return
492
498
  }
@@ -497,7 +503,7 @@ export class Writer {
497
503
  }
498
504
  }
499
505
 
500
- flushSync() {
506
+ flushSync() {
501
507
  if (this.#pending > 0) {
502
508
  Atomics.store(this.#state, WRITE_INDEX, this.#writePos)
503
509
  this.#pending = 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/shared",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -26,5 +26,6 @@
26
26
  "oxlint-tsgolint": "^0.13.0",
27
27
  "rimraf": "^6.1.3",
28
28
  "typescript": "^5.9.3"
29
- }
29
+ },
30
+ "gitHead": "c1c62c2a04a4f39c1450622ce6d5935e499a1128"
30
31
  }