@andreiltd/componentize-qjs-binding-win32-arm64-msvc 0.4.5 → 0.5.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/README.md +39 -3
- package/componentize-qjs.win32-arm64-msvc.node +0 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -24,11 +24,13 @@ Under the hood it:
|
|
|
24
24
|
3. Snapshots the initialized JS state with
|
|
25
25
|
[Wizer](https://github.com/bytecodealliance/wizer) so startup cost is paid at
|
|
26
26
|
build time, not at runtime.
|
|
27
|
+
4. Prunes explicitly marked one-time setup code with Walrus and strips
|
|
28
|
+
debug/build metadata from the snapshotted component.
|
|
27
29
|
|
|
28
30
|
## Prerequisites
|
|
29
31
|
|
|
30
|
-
Rust **1.
|
|
31
|
-
toolchain for PIC support in wasi-libc).
|
|
32
|
+
Rust **1.97** or later is required by Wasmtime (the `wasm32-wasip2` target also
|
|
33
|
+
needs a recent toolchain for PIC support in wasi-libc).
|
|
32
34
|
|
|
33
35
|
## Installation
|
|
34
36
|
|
|
@@ -186,7 +188,7 @@ a project root that contains shared files or `node_modules`.
|
|
|
186
188
|
| `bool` | `boolean` | |
|
|
187
189
|
| `u8`, `u16`, `u32` | `number` | |
|
|
188
190
|
| `s8`, `s16`, `s32` | `number` | |
|
|
189
|
-
| `u64`, `s64` | `
|
|
191
|
+
| `u64`, `s64` | `BigInt` | |
|
|
190
192
|
| `f32`, `f64` | `number` | |
|
|
191
193
|
| `char` | `string` | Must be exactly one Unicode scalar value |
|
|
192
194
|
| `string` | `string` | |
|
|
@@ -236,6 +238,34 @@ that import completes. Ownership is restored for unconsumed stream/future writes
|
|
|
236
238
|
and for imported calls cancelled before they start. Await imports using an
|
|
237
239
|
incoming borrowed resource before returning from its export.
|
|
238
240
|
|
|
241
|
+
### Cancelling Async Imports
|
|
242
|
+
|
|
243
|
+
A pending async import exposes a `cancel()` method on its Promise. Calling it
|
|
244
|
+
requests cancellation of that import. If cancellation succeeds, the original
|
|
245
|
+
Promise rejects with `async import cancelled`; a call that finishes first may
|
|
246
|
+
still resolve normally. The enclosing export remains active, so its catch/finally
|
|
247
|
+
blocks can await further host operations.
|
|
248
|
+
Await the original Promise before releasing resources it borrowed.
|
|
249
|
+
Call `cancel()` from the same async export invocation that started the import;
|
|
250
|
+
it has no effect from another export invocation.
|
|
251
|
+
|
|
252
|
+
Calls that complete immediately may have no `cancel` method; use optional
|
|
253
|
+
chaining when completion timing is unknown. Repeated cancellation is harmless,
|
|
254
|
+
and a saved cancellation function cannot affect a later call that reuses the
|
|
255
|
+
same runtime handle.
|
|
256
|
+
|
|
257
|
+
```js
|
|
258
|
+
const pending = service.compute(input);
|
|
259
|
+
const abort = () => pending.cancel?.();
|
|
260
|
+
signal.addEventListener("abort", abort);
|
|
261
|
+
try {
|
|
262
|
+
return await pending;
|
|
263
|
+
} finally {
|
|
264
|
+
signal.removeEventListener("abort", abort);
|
|
265
|
+
await service.release();
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
239
269
|
### Async Exports
|
|
240
270
|
|
|
241
271
|
Async exports are declared with the `async` keyword in WIT and implemented
|
|
@@ -476,6 +506,12 @@ acknowledges each operation's completion or cancellation.
|
|
|
476
506
|
|
|
477
507
|
Otherwise, call `.drop()` explicitly to release handles.
|
|
478
508
|
|
|
509
|
+
## Snapshot Initialization
|
|
510
|
+
|
|
511
|
+
Snapshot creation uses a 1 GiB host-call copy budget to accommodate large module
|
|
512
|
+
graphs. This allowance belongs to the build-time initializer; execution hosts
|
|
513
|
+
continue to choose their own budgets for instantiated components.
|
|
514
|
+
|
|
479
515
|
## Node.js API
|
|
480
516
|
|
|
481
517
|
The npm package exposes both a CLI and a programmatic API.
|
|
Binary file
|