NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm
npm, #2179 most downloaded on npm
Stringify JS values
Latest stable
1.8.1
Last release 11 days ago
11 Nov 2026
Release timing varies
gaps range from 9 days to 2 months
Most releases are documented
notes for 41 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
4 years old
105 releases · first in 2023
Drag across the ruler to compare, or tap a release to open it.
0d5c590: fromJSON and fromCrossJSON now decode a well-known symbol that appears more than once in a value. The second use used to become undefined, or
fromJSON and fromCrossJSON now decode a well-known symbol that appears more than once in a value. The second use used to become undefined, or failed as a malformed node when it was an object key. A value with two iterables or async iterables, such as [gen1, gen2], hit this.7fe0193: Add the optional validate plugin field and the v validators. validate lists a validator for each field of a plugin's node. When deserialize r
7fe0193: Add the optional validate plugin field and the v validators. validate lists a validator for each field of a plugin's node. When deserialize reads a listed field with ctx.deserialize, the decoded value is checked first, and SerovalPluginValidationError is thrown if it fails. It applies to fromJSON, fromCrossJSON and createCrossDeserializer. The validators are exported as v from seroval, and as a module from seroval/validator.
d1ada33: Add the seroval/read, seroval/write and seroval/shared entry points, so bundlers can put reading and writing in separate chunks.
seroval/read exports fromJSON, fromCrossJSON, createCrossDeserializer and deserialize.seroval/write exports the serializers, Serializer and getCrossReferenceHeader.seroval/shared exports what both sides use, such as createPlugin, Feature, Stream and the errors. seroval/read and seroval/write also export it.seroval still exports everything. All entry points load the same chunks, so classes keep one identity.Your coding agent can read these notes before it upgrades. Set up the MCP server →
7ae5573: Fix several parser edge cases:
7ae5573: Fix several parser edge cases:
refs map, so later calls and Serializer writes define those values again.then calls back more than once.SerovalParserError instead of exhausting memory.Buffer and other typed array subclasses serialize as their base typed array, and the typed array size limit applies to them.### Patch Changes - Harden decoding limits.
Harden string encoding and stream error handling.
Serialization reads an object's class from its prototype instead of its constructor property, and reads Date, Temporal, typed array and DataView value
constructor property, and reads Date, Temporal, typed array and DataView values through the built-in methods and getters instead of properties on the value. An object whose own constructor names a built-in class is now serialized as a plain object, and an object that only inherits a built-in prototype, such as Object.create(Date.prototype), is rejected.LiveStream class: about 570 bytes gzipped less for toJSONAsync, fromJSON or fromCrossJSON on the production ESM build, measured with seroval's bundle size report. An object made with Object.create(LiveStream.prototype) is no longer treated as a live stream.Read a RegExp's pattern and flags through the RegExp.prototype getters, so own source or flags properties on the value no longer change the output.
RegExp.prototype getters, so own source or flags properties on the value no longer change the output.d85ec3f: Keep two round-trip cases intact. An object whose own constructor key holds a falsy value, such as { constructor: undefined }, now keeps Obje
constructor key holds a falsy value, such as { constructor: undefined }, now keeps Object.prototype instead of coming back with a null prototype. A null-prototype object with an own __proto__ key, or any object serialized with Feature.ObjectAssign disabled, no longer turns equal-looking values such as two new Set() into one shared object in serialize, crossSerialize and compileJSON output.No changes in this release.
No changes in this release.
3a60f79: Republish the 1.7.2 changes through CI with npm provenance. 1.7.2 was published manually without an attestation, so pnpm's trustPolicy: no-do
trustPolicy: no-downgrade refused to install it (#278). No code changes.737afa1: fromJSON and fromCrossJSON no longer cause unhandled rejections. A payload with a rejected promise in a field the caller never reads could st
fromJSON and fromCrossJSON no longer cause unhandled rejections. A payload with a rejected promise in a field the caller never reads could stop a Node.js process. Code that awaits the promise still gets the rejection.b703710: createCrossDeserializer no longer causes unhandled rejections. This covers a rejected promise that the caller never reads, and a pending prom
createCrossDeserializer no longer causes unhandled rejections. This covers a rejected promise that the caller never reads, and a pending promise that abort rejects. Code that awaits the promise still gets the rejection.serialize, toJSON, crossSerialize and toCrossJSON now throw when the value contains an async iterable or a ReadableStream, as they do for a promise. Before, they sent a stream that never got its values. Use an async or streaming function to send them.serialize, toJSON, crossSerialize and toCrossJSON now send a createStream stream that has ended with all its events. A stream that is still open, or a live stream, now throws. Before, they sent an empty stream that never ended.Mark Feature.ArrowFunction and SerovalMissingReferenceError as deprecated. Neither has any effect.
assignSharedRefsOnly option to crossSerialize and crossSerializeAsync. It stores only the values the output reads more than once in $R, which makes shorter output when no later script refers back to it.createCrossDeserializer, a session for cross-reference JSON records that tracks unsettled promises and open streams, reports how many are still pending, and can abort them with a caller-supplied reason when the transport fails.createLiveStream(), a single-consumer stream that holds one event at a time and resolves each producer write only after the serialized record is accepted. crossSerializeStream and toCrossJSONStream callbacks may now return a promise; the next record, and the acceptance of the source event behind it, wait for it to settle. Records discovered while parsing an event are emitted after the record that introduces them, one callback runs at a time, onDone waits for the last callback and is not called after an output failure, and cleanup runs every callback once. Async iterables and ReadableStream values read their next chunk only after the previous record is accepted. Existing streaming plugin lifecycle hooks remain available; parsing a live stream is the preferred way to connect an incremental source.>=10 to >=20 in engines, remove the no-op typesVersions from seroval, give seroval-plugins main, module and types fields plus a typesVersions entry that points at the emitted web declarations, and link the plugins package to the workspace copy of seroval.skipPlainObjects plugin field. A plugin that sets it to true is not tested against plain objects, which makes parsing faster when most values are plain objects.6d92c38: - Export SerializeOptions, SerializeAsyncOptions, ToJSONOptions and ToJSONAsyncOptions, the option types of serialize, serializeAsync, toJSON and toJSONAsync.
Feature.ArrowFunction and SerovalMissingReferenceError as deprecated. Neither has any effect.8b4214f: Reuse the resolved plugin list when the same plugins array is passed again, so each call no longer rebuilds it.
b7edc16: Create leaf nodes with only their t, i and s fields, cutting tree memory for primitive-heavy payloads.
dcf9a69: Report the depth limit error with its own error code.
e118511: Derive the well-known symbol name and lookup tables and the error constructor names from their single source tables.
1e13e04: Avoid temporary reference lookup wrappers in the parsers and resolve named references with one registry lookup.
c643404: The documentation moved to https://seroval.vercel.app. The READMEs and the package homepages now link to it.
3234e88: Honor depthLimit in every serializer entry point and in fromJSON, wrap failures raised while emitting output in SerovalSerializationError, and report a node id that is assigned twice with SerovalConflictedNodeIdError.
a1e185a: Build with an explicit ES2020 syntax target so the emitted syntax floor no longer follows engines.node, keeping nullish coalescing and optional chaining as written.
3b49dc3: Inline feature bits inside the library with an internal const enum. The exported Feature enum is unchanged.
d171f53: Replace the isValidIdentifier regex and first-character string slice with a charCodeAt scan.
641e424: serialize and serializeAsync no longer add an unused placeholder variable to every payload that contains a Map. It is now declared only when a Map entry needs it, so a plain Map serializes to new Map([...]).
26d263f: Define the global __SEROVAL_REFS__ store on the first createReference call instead of at import time, and mark the package side-effect free so bundlers can drop unused modules.
20de609: Export the Stream, Sequence and LiveStream classes so bundlers can drop them when unused.
f0ff974: Merge duplicated node creators, promise result and stream call handlers, and share one Temporal name table.
bd9cac0: Skip the escape loop for strings that need no escaping, escape the rest by switching on charCodeAt, and decode escapes without a per-match replace callback.
5426ea8: Check extensibility first when reading object flags so ordinary objects need one native call.
0cb3c78: Omit trailing empty fields when creating nodes.
090f5be: Generate deferred assignment expressions in one pass without an intermediate array or merged assignment objects.
37ed929: Walk object properties with Object.keys instead of Object.entries so parsing no longer allocates a key/value pair per property.
11c4446: Replace internal plugin context wrapper classes with plain objects so Rspack and webpack can tree-shake unused parser, serializer, and deserializer modules.
a758b08: Preserve reserved own property names in cyclic objects and retain Error __proto__ data properties without changing their prototypes.
Compatibility note: Error __proto__ fields previously dropped are now preserved as own data properties. Copying these results with Object.assign({}, value) can change the destination's prototype. Use { ...value } for shallow copies; later merges still require safe handling.
93adf62: Size parser child arrays up front, and stop awaiting primitives in the async parser.
96a3214: Release private references and cleanup callbacks when a Serializer closes, prevent reentrant completion, and finish other writes' cleanup when a callback throws.
f698afa: Release stream parser subscriptions and buffered nodes after use, and complete serialization once after buffered chunks are emitted.
e5d493e: Classify object keys with a first-character check so the serializer only parses keys that can be numeric, and emit deferred key assignments through one helper.
883f47f: Share the parser's marked reference set with serializer contexts instead of copying it, so streaming serializers no longer pay O(references) per emitted node.
d1cbe82: Streaming serializers reuse one plugin context per depth, so values handled by plugins no longer allocate a new context each.
a295de9: Classify objects once in a shared getObjectKind helper so the sync, stream and async parsers no longer carry separate copies of the class checks and feature gates.
f907408: Preserve stream event order during async parsing and wait for earlier chunks before completing. Live writes are accepted after their parsed event is placed.
Stop sources on parse or output failure, forward cancellation reasons, and release owned callbacks and records. Keep the original error when cleanup also fails, reject cleanup failures after otherwise successful parsing, and retain existing streaming plugin lifecycle hooks.
Keep incidental primitive callback returns synchronous. Only objects and functions are inspected for thenables, and the callable then is invoked without reading its call property.
Disposing crossSerializeStream or toCrossJSONStream no longer invokes onDone: disposal abandons output rather than completing it. Callers that close a response in onDone must also close it when disposing. Serializer.close() still invokes onDone. A failed Serializer.write() only stops that write; sibling streams and subsequent writes remain active. SerializerOptions.onError remains required.
258c8e3: toJSON, crossSerialize and toCrossJSON now throw when the value contains a promise, like serialize already did. Before, they sent a promise that never settled. Use an async or streaming function to send promises.
fa4f346: Allow bundlers to remove unused iterator factories from consumers that do not need deserialization.
7d2153c: Keep unused symbol and constant tables out of consumer bundles and register the reference store with one global lookup.
e70d7f6: Remove unused parser and deserializer context state and share guarded typed-array and DataView decoding.
5a49e1a: Unify TypedArray and DataView node creation, parsing, and serialization helpers.
d0a7135: Preserve cyclic Map entries when deferred assignments remove placeholders, and bound generated assignment chains so large graphs can be evalu
undefined in place of that object.undefined entry to the outer Map, because the placeholder entry was written before its value was declared.1313ebb: Name a typed array's constructor from the array's internal type instead of value.constructor.name. An own constructor property on a typed arr
value.constructor.name. An own constructor property on a typed array could put arbitrary code into the output of serialize, crossSerialize and the streaming functions.f94ee0b: Serialize a RegExp whose source contains < with the RegExp constructor, so a source such as [ ] can no longer close the script element the ou
< with the RegExp constructor, so a source such as [</script>] can no longer close the script element the output is embedded in.5754cfd: Use TypeScript private members in the internal Stream class instead of # private fields. Builds that target older Node.js versions no longer
private members in the internal Stream class instead of # private fields. Builds that target older Node.js versions no longer convert each field access into a helper function call.5d3eb6b: Reject functions that carry a then method as promise values during fromJSON and fromCrossJSON deserialization, the same as thenable objects.
then method as promise values during fromJSON and fromCrossJSON deserialization, the same as thenable objects.next() during serialization. An iterator that always threw previously made serialization loop forever.fromJSON deserialization. Previously the check used the type recorded for the source's id, and an id missing from m could be reused to pass a plain object as the source.Stream and Sequence types with real classes and check their identity with instanceof instead of a marker property. Untrusted input can no longer forge a stream or sequence by copying a __SEROVAL_STREAM__ or __SEROVAL_SEQUENCE__ key. A stream or sequence read back through the eval-based deserialize is a plain object rather than a class instance, so re-serializing that value no longer detects it as a stream or sequence.fromJSON and fromCrossJSON deserialization, rejecting malformed input where the list is replaced by an array-like object.fromJSON and fromCrossJSON deserialization. Each must be an integer from -1 up to the last element index. A malformed index could previously produce an iterator that never finishes.c7520ad: Skip escape replacement when decoding strings without backslashes.
0233519: Stop pulling async iterators and call their return method when streaming serialization is cancelled.
Validate the backing source of an iterator, async iterator, readable stream, and abort signal during deserialization, and export isStream.
isStream.Validate the buffer source of a typed array or DataView during deserialization.
DataView during deserialization.### Patch Changes - fix typed array max length
### Patch Changes - guard thenables
### Patch Changes - f84d457: fix CJS/ESM builds
c9dbda4: Serialized constructors now survive name-preserving bundler transforms (e.g. esbuild keepNames, which some platforms apply to hosted code dow
keepNames, which some platforms apply to hosted code downstream of the app's own build): every nested function in a toString()-serialized constructor uses method shorthand, so no bundle-scoped name helper leaks into payloads evaluated in realms that never loaded the bundle.### Patch Changes - fix depth limit
fix: streaming serialization cleanup
Credits to @spokodev and @greymoth-jp
fix internal type map missing in cross context
fix deserialization internal type check
### Patch Changes - 56a47ee: fix #74
fix depthLimit on streaming mode
ac27f21: feat: restricted plugin format
### Patch Changes - fix byte lengths
### Patch Changes - 3995cc1: security enhancements
### Minor Changes - aae0bc1: Project restructure
Nothing published for this version
Nothing published for this version
Move AbortSignal to seroval-plugins/web
AbortSignal to seroval-plugins/web
AbortSignal is a web standard.onParse, pushPendingState, popPendingState and parseWithError in Plugin API.status and value is now replaced with s (0, 1, 2 as pending, success, failure) and v respectively.new Date(NaN) is a thing.Nothing published for this version
Add AbortSignal to serializable values
AbortSignal to serializable valuesNothing published for this version
This feature adds a very basic OpaqueReference class. The purpose of this class is to wrap user-specified values into "opaque references": references
This feature adds a very basic OpaqueReference class. The purpose of this class is to wrap user-specified values into "opaque references": references that are hidden from the serializer. An OpaqueReference contains two values: the original value it is trying to hide, and an optional replacement value, which is what the serializer "sees".
A replacement value can only be a value that seroval can serialize. By default, a replacement value is undefined.
Example:
import { serialize, deserialize, OpaqueReference } from 'seroval';
const example = {
transparent: "This is a transparent value.",
opaque: new OpaqueReference('This is an opaque value.'),
};
// You can still access the original value:
console.log(example.opaque.value);
// but now it's different
const deserialized = deserialize(serialize(example));
console.log(deserialized.opaque); // undefined
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Deprecate some feature flags. The following features can no longer be disabled:
createStream https://github.com/lxsmnsyc/seroval/pull/36/commits/a4039554433b785197572252afe24810067e75aa
ReadableStream isn't a JS standard and so there was no counterpart to Promise when it comes to streaming data, so I had to introduce a minimal streaming primitive that is both portable and serializable.seroval-plugins https://github.com/lxsmnsyc/seroval/pull/36/commits/22dcc59d2e165340809b81adaba8799a0049d7cc
createStream has been introduced, seroval is no longer dependent from the ReadableStream API, which makes seroval no longer tied to the Web API too.seroval-plugins/web
BlobCustomEventDOMExceptionEventFileFormDataHeadersReadableStreamRequestResponseURLSearchParamsURLSetMapPromiseBigIntTypedArraySymbolWebAPIPromise and AsyncIterable is now supported in sync mode, but will only generate a non-resolving instance.extends option to Plugins API. This allows the plugins to require other plugins in case the feature is required (e.g. Request relies on both Headers and ReadableStream)RegExp serializationFull Changelog: https://github.com/lxsmnsyc/seroval/compare/v0.15.1...v1.0.0
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Deprecate MethodShorthand and ArrayPrototypeValues in Feature
toCrossJSONtoCrossJSONAsynctoCrossJSONStreamfromCrossJSONReadableStream in async modesAsyncIterable in async and streaming modesSymbol.toStringTag and Symbol.isConcatSpreadable in serialized propertiesMethodShorthand and ArrayPrototypeValues in FeatureIterable serialization outputisIterableNothing published for this version
Nothing published for this version
One column per quarter.