@andreiltd/componentize-qjs-binding-win32-arm64-msvc 0.4.4 → 0.4.5

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/README.md CHANGED
@@ -227,6 +227,15 @@ output.blockingWriteAndFlush(chunk);
227
227
  `[static]` methods are exposed on the resource class and `[constructor]` makes
228
228
  the class callable with `new`.
229
229
 
230
+ Owned imported resources support `[Symbol.dispose]()` for deterministic
231
+ cleanup. Passing one to a WIT `own<T>` parameter transfers ownership and
232
+ invalidates the original wrapper. Borrowed wrappers expire when their component
233
+ call completes and cannot be transferred or disposed as owners. Resources lent
234
+ to an in-flight import remain alive and cannot be disposed or transferred until
235
+ that import completes. Ownership is restored for unconsumed stream/future writes
236
+ and for imported calls cancelled before they start. Await imports using an
237
+ incoming borrowed resource before returning from its export.
238
+
230
239
  ### Async Exports
231
240
 
232
241
  Async exports are declared with the `async` keyword in WIT and implemented
@@ -405,7 +414,7 @@ world async-value {
405
414
  ```
406
415
 
407
416
  ```js
408
- async function compute() {
417
+ export async function compute() {
409
418
  const { readable, writable } = wit.Future();
410
419
 
411
420
  // Write the value (fire-and-forget; completes when reader reads)
@@ -418,6 +427,16 @@ async function compute() {
418
427
  **Future type constants** follow the same pattern: `wit.Future.U32`,
419
428
  `wit.Future.STRING`, etc.
420
429
 
430
+ Future handles are deliberately not thenable: use `await readable.read()` to
431
+ obtain the payload. This keeps `return readable` in an async export from
432
+ implicitly consuming the future, and preserves nested future handles.
433
+ Repeated `read()` calls share the same Promise; a cancelled read rejects that
434
+ Promise and allows a subsequent read to retry.
435
+
436
+ `wit.Future.from(value, type)` adapts a value or Promise and returns
437
+ `{ readable, completion }`. Return its `readable` from an async export rather
438
+ than returning the payload Promise directly, which JavaScript would await.
439
+
421
440
  **FutureReadable methods:**
422
441
 
423
442
  | Method | Returns | Description |
@@ -436,17 +455,25 @@ async function compute() {
436
455
 
437
456
  ### Resource Cleanup
438
457
 
439
- Stream and future handles support
458
+ Owned imported resources, stream endpoints, and future endpoints support
440
459
  [Explicit Resource Management](https://github.com/tc39/proposal-explicit-resource-management)
441
460
  via `Symbol.dispose`. In environments that support `using`:
442
461
 
443
462
  ```js
444
463
  {
445
- using stream = wit.Stream();
446
- // stream.writable and stream.readable are auto-dropped when leaving scope
464
+ const stream = wit.Stream();
465
+ using writable = stream.writable;
466
+ using readable = stream.readable;
467
+ // Each endpoint is disposed when leaving scope.
447
468
  }
448
469
  ```
449
470
 
471
+ The factory's `{ readable, writable }` pair is not itself disposable.
472
+ Complete an endpoint's pending operation (or cancel it and await its
473
+ settlement) before leaving its `using` scope or calling `.drop()`.
474
+ Host-requested task cancellation retains pending ABI buffers until the host
475
+ acknowledges each operation's completion or cancellation.
476
+
450
477
  Otherwise, call `.drop()` explicitly to release handles.
451
478
 
452
479
  ## Node.js API
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andreiltd/componentize-qjs-binding-win32-arm64-msvc",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "cpu": [
5
5
  "arm64"
6
6
  ],