github vercel-labs/scriptc v0.0.33

latest releases: v0.4.16, v0.4.15, v0.4.14...
3 months ago

0.0.33

Features

  • Foreign-thread native callbacks are marshalled to the event loop. FFI format 5 adds invoke: "foreign" for retained, context-bearing, void callbacks. Thread-safe generated trampolines copy scalar/string/byte arguments into plain staging memory, wake the process loop, and return immediately; the loop delivers one callback per turn on the script thread with ref'd registration liveness, concurrent-producer FIFO safety, explicit release, throw propagation, and clean shutdown across both backends.
  • Native callbacks can be retained and explicitly released. FFI format 4 adds lifetime: "retained" registrations and paired release descriptors that reuse the original function-pointer trampoline. Registrations pin captured closures until the same function value is released, count duplicate registrations, support multiple context-bearing registrations and raw single-slot replacement, defer callback throws through later FFI pump calls, and clean up live registrations at process exit across both backends.
  • Native callbacks copy in strings and byte spans. FFI format 3 adds callback-only cstring parameters plus length-delimited string and bytes parameters. Trampolines in both backends copy native memory into owned scriptc values, decode malformed UTF-8 with U+FFFD replacement, preserve embedded NUL bytes in spans, and trap precise invalid null pointers before invoking the closure.
  • Array.prototype.filter accepts JavaScript-truthy predicate results. Static predicates may return strings, numbers, references, or supported unions and now keep elements according to JavaScript's ToBoolean rules instead of requiring a boolean result. Checked-dynamic calls without a predicate reach the runtime's callback error, while predicates whose return value was erased to void refuse rather than silently producing the wrong array.

Performance

  • Repeated builds avoid redundant compiler work. Validated native-toolchain metadata and same-output artifacts persist across CLI processes with dependency and content checks that preserve cache invalidation; Node 24's bytecode cache reduces CLI startup work, frontend type lowering is memoized and checker prefetch avoids unused AST queries, and library profiles gain a fast optimization: "dev" posture plus SCRIPTC_TIMING=1 phase diagnostics. The compiler CLI now requires Node 24 or newer.

Don't miss a new scriptc release

NewReleases is sending notifications on new releases.