✨ What's New ✨
🖥️ @ubjs/electron
Run a native UniFFI library in an Electron utility process, and call it from a sandboxed page through the page's wasm2 --async bindings. See the Electron reference.
🔌 --async bindings connect through one port
ubrn generate wasm2 bindings --async also writes index.port.ts, whose uniffiInitAsync(port) connects every namespace through one port, and player-definitions.ts for the receiver on the far side. Use @ubjs/core and @ubjs/worker from this release.
⏳ @ubjs/node runs the async poll loop
@ubjs/node now drives each async function's future itself, as @ubjs/wasm does, and so gains a peer dependency on @ubjs/core. Abort in-flight async calls before calling unload().
🦊 What's Changed
@ubjs/nodeships its TypeScript types, and ESM named imports of all its exports work.- An
@ubjs/workerChannelPortmay carry aclosedpromise. When it settles, pending calls reject withChannelClosedError.
Fixes
jsi2: objects dropped withoutuniffiDestroy()are freed once Hermes collects them. Upgrade@ubjs/react-nativeand regenerate your bindings.jsi: strings, records and byte arrays that Rust passes to a JS callback no longer leak. Regenerate yourjsibindings (#510). Thank you @helios1138!@ubjs/nodeno longer leaks memory on each call to an async method of a callback interface implemented in JS (#469). Thank you @stupside!@ubjs/nodeworks in Electron, copying buffers where V8's memory cage refuses external ones (#514, replacing #417). Thank you @injaneity for the first version of this fix!@ubjs/nodeno longer deadlocks when an async call is cancelled while Rust wakes it.- A failing cancel or free is logged rather than thrown from an async call, and a free that a closed channel rejects is not logged at all.
- A type named
Cursorno longer collides with the runtime's ownCursorclass (#491). Thank you @zeenix! - A type named like a JavaScript global, such as
Object, no longer breaks the generated module: it becomesObject_(#497). Thank you @qalqi! - iOS frameworks carry
0.31.0rather than0.31.0-8as their bundle version, as App Store Connect requires (#512). Thank you @zzorba!
Testing and CI
--asyncfixtures also run against@ubjs/nodebehind a channel, and under real Electron through@ubjs/electron.- The N-API runtime's tests also run under Electron (#514).
preview-packages.ymlcan publish@ubjs/nodepreviews (#523).
⚠️ Breaking Changes
- Regenerated
napibindings need@ubjs/nodeand@ubjs/corefrom this release: on an older@ubjs/nodethey fail withIncompatiblePlayer. Existing bindings keep working. @ubjs/worker'sChannelPort.closedis now typed as a promise.@ubjs/node'sregister()now takes a definitions table rather than anyobject.- Types named like a JavaScript global get a trailing underscore even where they worked before: a Rust
Dateis nowDate_(#497).
Full Changelog: 0.31.0-7...0.31.0-8