Based on devalue, I wrote a new JS serialization library called devaluex, which supports asynchronous serialization and plugins. Through plugins, it supports types like Blob, Stream, Error, Request, Response, etc. It is still quite rudimentary at the moment and is mainly used for communication serialization between browser extension Content Script and Background, as JSON.stringify does not support many types.
I previously tried seroval (the SolidJS base library) and devalue (the Svelte base library). The authors support more features and use eval (very cleverly) for deserialization. Unfortunately, eval cannot be used in some environments (such as browser extensions). Although the authors also support a JSON mode, its performance is not as good as devalue, so I ultimately chose to wrap devalue.
rxliuli|9 months ago