Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/obj-diff/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [Unreleased]

## [0.16.0] - 2026-07-17

### Added
- `serialize(diff)` / `deserialize(wire)` — a self-describing JSON wire format for diffs. `diff()` returns live objects by reference, so `JSON.stringify` mangles them (`Date`→string, `Map`/`Set`→`{}`, `TypedArray`→numeric-keyed object, `BigInt`→throws). `serialize` keeps `value`/`path` readable but replaces each special value with a lightweight reference token `"@n"` and collects the real types in a per-op `$refs` table (`{ "n": { _t, _v } }`); `deserialize` resolves the tokens back into live typed values so a `patch()` on the far side reconstructs the correct objects. Covers `Date`, `RegExp`, `Map`, `Set`, all `TypedArray`s, `ArrayBuffer`, `DataView`, `Error` (+ standard subclasses), boxed primitives, `BigInt`, `NaN`/`±Infinity`/`-0`, `undefined`, and `Temporal` values, nested to any depth (incl. `Map`/`Set`/object keys in `path`). Real strings shaped like `"@n"` are escaped. Symbols, functions, class instances, and circular references throw. Deserializing a `Temporal` value needs a `Temporal` implementation on `globalThis`.
- Native diffing support for all **Temporal** types (`Temporal.Instant`, `PlainDate`, `PlainTime`, `PlainDateTime`, `PlainYearMonth`, `PlainMonthDay`, `ZonedDateTime`, `Duration`). They are compared as immutable, atomic values — replaced wholesale via a single `CHANGED` op when they differ, and preserved by reference through `patch()`. Equality uses each type's own `.equals()`; `Duration` (which has no `.equals()`) is compared structurally by its canonical string, so two equal-length but differently-expressed durations (e.g. `PT2H` vs `PT120M`) are treated as a change and the exact value is reconstructed on patch. Detection is brand-based (`Symbol.toStringTag`), so it works with the native global or the `@js-temporal/polyfill`.
Expand Down
2 changes: 1 addition & 1 deletion packages/obj-diff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"json",
"track"
],
"version": "0.15.0",
"version": "0.16.0",
"author": {
"name": "Thanga Ganapathy",
"email": "ganapathy888@gmail.com",
Expand Down
Loading