Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
You are probably thinking something like "... but mate, you just came out with v3 a couple of months ago ... another rewrite?"
Yes because v3 was still not clean and "nightmarish" to maintain:
reflected-ffi/direct/encoder
and itsdecoder
utilities which are always fast, work with buffers, shared or not, but also arrays, and use always the fastest/easiest compromise that ensure correctness and it's 100% test covered. encoder and decoder are still part of the options though but the default is not JSON anymore, it's something that can travel at native speed as buffer in both postMessage and/or WebSocket messages and it's still as fast as it can get in most common cases. Abuffer
extra option has been added to also pass buffers as these are and avoid bloat and conversion of typed views which was crucial to unlock some use case.Long story short, this module is now way more essential, the reflected-ffi has zero dependencies so that it can keep pace with ease and it doesn't even need to be bundled (which is always suggested, still ...) so that it can be tested in isolation out of the box without needing import maps or other things.
New in v4
ffi
field that contains:document.body.children[2].outerHTML
(single roundtrip)postMessage
and WebSockets synchronous and asynchronous dances, nothing elseBreaking in v4
All encoders and decoders, all dependencies that are not used/needed, and the whole proxy folder has been removed, making the
package.json
easier to reason about and follow but if you were reaching out this module to use any of those dependencies these are not available anymore but of course,v3
still offer those and encoder or decoder are still compatible with this API so you can eventually port previous code to work with this latest version of the library.