This collects doc comments of the form "ts: <some TS declaration>",
which can be written manually *or* generated by the various "bridge"
macros. If the declaration looks like a function, it also does some
substitution of Rust types for TypeScript types, to make
autogeneration easier.
This only works on functions using the macros in libsignal-bridge; for
anything else we'll keep using neon::ModuleContext::export_function
manually, at least for now.
One problem: borrowing a JsBuffer requires the JS engine to be locked,
but returning a new buffer requires using the JS engine. That means
having to incur a copy-in (for &[u8] parameters) or a copy-out (for
&[u8] results) unless we make bridge_fn signatures more complicated.
For now I've gone with a copy-in because it was easier to implement.
Neon by default requires N-API 6 and the version of Electron that is
used in Desktop only supports N-API 5. Without this feature, some
weird hacks are required to build on Windows.