loro-crdt 1.15.0 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -0
- package/base64/index.js +743 -24
- package/base64/loro_wasm.d.ts +165 -0
- package/browser/index.js +17 -7
- package/browser/index.js.map +1 -1
- package/browser/loro_wasm.d.ts +165 -0
- package/browser/loro_wasm.js +45 -15
- package/browser/loro_wasm_bg.js +719 -17
- package/browser/loro_wasm_bg.wasm +0 -0
- package/browser/loro_wasm_bg.wasm.d.ts +21 -2
- package/browser/snippets/loro-wasm-0dc0eaeaf03de4ab/inline0.js +18 -0
- package/bundler/index.js +17 -7
- package/bundler/index.js.map +1 -1
- package/bundler/loro_wasm.d.ts +165 -0
- package/bundler/loro_wasm_bg.js +719 -17
- package/bundler/loro_wasm_bg.wasm +0 -0
- package/bundler/loro_wasm_bg.wasm.d.ts +21 -2
- package/bundler/snippets/loro-wasm-0dc0eaeaf03de4ab/inline0.js +18 -0
- package/nodejs/index.js +1 -1
- package/nodejs/index.js.map +1 -1
- package/nodejs/loro_wasm.d.ts +165 -0
- package/nodejs/loro_wasm.js +718 -17
- package/nodejs/loro_wasm_bg.wasm +0 -0
- package/nodejs/loro_wasm_bg.wasm.d.ts +21 -2
- package/nodejs/snippets/loro-wasm-0dc0eaeaf03de4ab/inline0.js +66 -0
- package/package.json +2 -2
- package/web/index.js +3 -2
- package/web/index.js.map +1 -1
- package/web/loro_wasm.d.ts +186 -2
- package/web/loro_wasm.js +709 -16
- package/web/loro_wasm_bg.wasm +0 -0
- package/web/loro_wasm_bg.wasm.d.ts +21 -2
- package/web/snippets/loro-wasm-0dc0eaeaf03de4ab/inline0.js +18 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,84 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.16.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 98b2ac6: Add bulk deep-read APIs on containers. `LoroMap`/`LoroList`/`LoroMovableList`/`LoroTree`/`LoroText` now expose `getDeepValueWithID()` returning the same `{ cid, value }` node shape as `LoroDoc.getDeepValueWithID()`. `LoroList` and `LoroMovableList` also expose `getRangeDeepValueWithID(start, end)` and `getRangeValue(start, end)` for reading a slice of a list in one WASM call; bounds are clamped (negatives to 0, overflows to the length) and empty or inverted ranges return `[]`. Detached containers throw a readable error instead of trapping.
|
|
8
|
+
|
|
9
|
+
Potentially breaking: the `cid` field in `getDeepValueWithID()` results is now the bare container id string (e.g. `cid:92@2311024965712536503:Map`, `cid:root-map:Map`) — exactly what the container's `id` property returns. Previously it was a Debug-style composite like `idx:85, id:cid:92@2311024965712536503:Map`. Update any consumer that parsed or matched the old `idx:N, id:...` shape.
|
|
10
|
+
|
|
11
|
+
- c594ee0: Add `toContainerTree()` to documents and attached containers. It returns independent recursive `{type, cid, value}` nodes and opaque ordinary `Value` nodes. Documents can select visible roots without creating missing roots. Text formatting applies to all descendants and is inferred in TypeScript. List and MovableList expose `toContainerTreeSlice(start, end)` with explicit `start`, `totalLength`, and `items`. Fixed JS construction, per-read key/peer reuse, and owned binary buffers avoid a public transport protocol.
|
|
12
|
+
|
|
13
|
+
Optional text configurations retain the default plain-text possibility in TypeScript. Literal root selections preserve their names as optional result properties.
|
|
14
|
+
|
|
15
|
+
Compile Node snippets to CommonJS so the package does not require `require(esm)` support.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- fcd039c: Fix wasm memory retention when reading a document container by container
|
|
20
|
+
(loro-dev/loro#1092).
|
|
21
|
+
|
|
22
|
+
Every read through a container handle (`LoroMap.keys()`/`get()`,
|
|
23
|
+
`LoroList.get()`, `LoroText.toJSON()`, ...) decoded the container's value into
|
|
24
|
+
an in-memory cache that was pinned for the lifetime of the document — about
|
|
25
|
+
4 KB per container, released only by `doc.free()`. Walking a large document
|
|
26
|
+
this way (the pattern loro-mirror's initial state build uses) retained ~4 KB ×
|
|
27
|
+
containers-ever-read and trapped wasm32 at the 4 GiB limit around one million
|
|
28
|
+
containers.
|
|
29
|
+
|
|
30
|
+
The decoded-value cache is now bounded (2048 entries, second-chance FIFO).
|
|
31
|
+
Evicted entries are pure caches over the KV store and are re-decoded on the
|
|
32
|
+
next read, so this only changes memory behavior, not API semantics.
|
|
33
|
+
`doc.free()` semantics are unchanged.
|
|
34
|
+
|
|
35
|
+
Measured on the issue's repro (570-turn document, 188k container handles,
|
|
36
|
+
release build): the handle walk retains no per-container memory (external
|
|
37
|
+
memory flat at ~84 MiB vs +641 MiB before) and runs ~10x faster
|
|
38
|
+
(1.28 s vs 12.5 s) thanks to the smaller working set.
|
|
39
|
+
|
|
40
|
+
- f03d283: Speed up `export({ mode: "shallow-snapshot" })` by up to ~20x on container-heavy documents with a large retained history.
|
|
41
|
+
|
|
42
|
+
Building the state at the shallow root used to check the live document out
|
|
43
|
+
backwards (latest -> root). That reverse diff makes the richtext/list diff
|
|
44
|
+
calculators rebuild a full CRDT tracker from empty for every container touched
|
|
45
|
+
in the range, which dominated the export cost: on a doc with ~66k containers
|
|
46
|
+
and ~720k streaming-edit ops, shallow export at a mid-history root took ~3.2s
|
|
47
|
+
versus ~1.5ms for a full snapshot. When at least 64k ops are retained since
|
|
48
|
+
the root, the root state is now reconstructed by replaying the pre-root
|
|
49
|
+
history forward into a temporary doc, and the latest state is read from the
|
|
50
|
+
live store directly without moving the document. The pre-root prefix is bounded
|
|
51
|
+
both relative to the tail (at most 16x the retained op count) and absolutely
|
|
52
|
+
(at most 1M ops) and decoded payload size (at most 32 MiB, estimated by
|
|
53
|
+
walking op payloads — recursing into nested values, style values, and commit
|
|
54
|
+
messages — before any value is copied; op counts miss value sizes, since a Map
|
|
55
|
+
write is one atom regardless of payload size), so a document whose
|
|
56
|
+
pre-root history is huge or byte-heavy and unrelated to the tail keeps the
|
|
57
|
+
previous checkout path. The same export drops to
|
|
58
|
+
~370ms and the produced blob is slightly smaller (~17% on the same fixture).
|
|
59
|
+
With a small retained range — including a root at the latest version — the
|
|
60
|
+
previous checkout path is kept: it is then equally fast and peaks at ~4x less
|
|
61
|
+
memory, so exporting a lazily imported document no longer materializes its
|
|
62
|
+
whole state. Exported blobs remain logically equivalent; detached or
|
|
63
|
+
already-shallow source docs also keep the previous code path.
|
|
64
|
+
|
|
65
|
+
Also fixes shallow snapshot export resurrecting, as an empty entry, a root
|
|
66
|
+
container deleted with `deleteRootContainer` before the shallow root.
|
|
67
|
+
|
|
68
|
+
- 7d26c7e: Reject updates concurrent with the shallow root frontier with
|
|
69
|
+
ImportUpdatesThatDependsOnOutdatedVersion instead of queuing them and panicking
|
|
70
|
+
while resolving a dependency that has already been trimmed. Rejected updates do
|
|
71
|
+
not enter pending storage; subsequent valid post-root updates still apply.
|
|
72
|
+
- 8874574: perf: cache `kind()` results on container wrappers. `kind()` returns a constant string per container class; it is now memoized after the first call, so repeated reads (e.g. tree traversal in loro-mirror) no longer cross into WASM or allocate a fresh JS string. This extends the existing `id` cache to `kind()`.
|
|
73
|
+
|
|
74
|
+
## 1.15.1
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- 34b1fae: Cache immutable container ids per JavaScript wrapper to avoid repeated WASM string decoding.
|
|
79
|
+
- 48b3c52: Keep malformed `cid:`-prefixed strings returned from `toJsonWithReplacer` as
|
|
80
|
+
plain strings instead of throwing while resolving them as container IDs.
|
|
81
|
+
|
|
3
82
|
## 1.15.0
|
|
4
83
|
|
|
5
84
|
### Minor Changes
|