@ubjs/wasm 0.31.0-7 → 0.31.0-8

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.
@@ -6,7 +6,7 @@
6
6
  // An async function as one entry the caller awaits. The player runs UniFFI's
7
7
  // poll loop here, so a caller behind a channel pays one round trip per await
8
8
  // rather than one per poll.
9
- import { uniffiDriveRustFuture, } from "@ubjs/core";
9
+ import { uniffiAsyncEntry, } from "@ubjs/core";
10
10
  import { copyAndFreeRustBufferView, specializeExport, } from "./call.js";
11
11
  import { FfiType } from "./ffi-type.js";
12
12
  import { CONT_DEF, RUST_FUTURE_CONTINUATION } from "./future.js";
@@ -68,12 +68,5 @@ export function buildAsyncEntry(ctx, exports, fnName, def) {
68
68
  : value;
69
69
  },
70
70
  };
71
- const argCount = def.args.length;
72
- return function asyncEntry(...args) {
73
- const status = args[argCount];
74
- const signal = args[argCount + 1];
75
- // Before any await: lowered RustBuffer args alias wasm memory.
76
- const rustFuture = start(...args.slice(0, argCount));
77
- return uniffiDriveRustFuture(rustFuture, fns, status, signal);
78
- };
71
+ return uniffiAsyncEntry(def.args.length, start, fns);
79
72
  }
@@ -5,7 +5,12 @@ import { FutureRegistry } from "./future.js";
5
5
  import { type ModuleDefinitions } from "@ubjs/core";
6
6
  export type { ModuleDefinitions };
7
7
  export type WasmSource = WebAssembly.Module | ArrayBuffer | Uint8Array | Response | URL | string;
8
- export type NativeModuleInterface = Record<string, (...args: any[]) => any>;
8
+ /** What `registerSync` returns: a function per definition, and the buffer
9
+ * pair the runtime answers itself, as `@ubjs/worker`'s receiver needs. */
10
+ export type NativeModuleInterface = Record<string, (...args: any[]) => any> & {
11
+ rustbuffer_alloc(n: number): Uint8Array;
12
+ rustbuffer_free(view: Uint8Array): void;
13
+ };
9
14
  /**
10
15
  * Resolver for unrecognized wasm import modules. The runner side may run
11
16
  * `wasm-bindgen-cli --target bundler` against the cdylib, leaving the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubjs/wasm",
3
- "version": "0.31.0-7",
3
+ "version": "0.31.0-8",
4
4
  "description": "WebAssembly player runtime for uniffi-bindgen-react-native generated bindings.",
5
5
  "homepage": "https://github.com/jhugman/uniffi-bindgen-react-native",
6
6
  "repository": {
@@ -35,7 +35,7 @@
35
35
  "test": "node --test --import tsx './core/tests/*.test.ts'"
36
36
  },
37
37
  "peerDependencies": {
38
- "@ubjs/core": "^0.31.0-7"
38
+ "@ubjs/core": "^0.31.0-8"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@ubjs/core": "file:../../typescript",