SIGN IN SIGN UP

feat: add synchronous host functions and native modules (#52)

* feat: add synchronous host functions and native modules

## Summary

- add a separate syncHostFunctions API with immediate guest return and throw semantics
- add a bounded per-invocation SharedArrayBuffer bridge using Atomics wait/waitAsync
- add native static, cyclic, aliased, dynamic, and TypeScript ES module loading
- preserve existing asynchronous host functions and continuation behavior

## Safety

- validate bridge state, sequence numbers, payload sizes, names, and aggregate request counts
- propagate cancellation through HostFunctionContext and tear down uncertain workers
- keep SharedArrayBuffer and Atomics inaccessible to guest JavaScript
- prohibit continuations after synchronous bridge use or module loading

## Compatibility

- support Node.js 20.19+ with a TypeScript transform fallback
- document the new APIs and add Node 20 and Node 22 CI coverage
- include a minor changeset and update package verification for the new runtime artifact

## Testing

- add synchronous return, throw, read-after-write, cancellation, isolation, flooding, and protocol hardening coverage
- add static, cyclic, aliased, dynamic, and TypeScript module coverage
- verify 273 tests plus formatting, typechecking, Node 20 smoke tests, and npm/pnpm package installation

* fix: harden synchronous bridge and module loading
M
Malte Ubl committed
a0b1c49601dfc8a0bbc06759553ec76de9ab2cd2
Parent: 81ebe55
Committed by GitHub <noreply@github.com> on 8/29/2026, 3:50:03 PM