js-bao 0.12.0-alpha.13 → 0.12.0-alpha.15

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/README.md CHANGED
@@ -1599,6 +1599,24 @@ See the `examples/` directory for complete working examples:
1599
1599
  Changes a consumer of this package can observe, including the on-disk
1600
1600
  behaviour of `js-bao/cloudflare/do` (`DurableObjectEngine`). Newest first.
1601
1601
 
1602
+ - **A db3 binds with no `Y.Doc`; the browser entry loads Yjs on demand**
1603
+ (unreleased). `connectDocument(id, null, permission, { documentFormat: 3 })`
1604
+ binds a db3, and the connected record's `yDoc` is `null` for a format-3
1605
+ document whatever was passed (`ConnectedDocument.yDoc` is now
1606
+ `Y.Doc | null`). A format-1 connect with `null` is refused, naming the fix.
1607
+ `ModelRegistry.initializeAllForDocument` and `BaseModel.initializeForDocument`
1608
+ take `Y.Doc | null` too. The browser entry (`js-bao/browser`, the `browser`
1609
+ condition) imports `yjs` only at the first format-1 `connectDocument`, or
1610
+ when `loadYjs()` is awaited, so an app that only uses db3s never loads it.
1611
+ Its CommonJS file (`dist/browser.cjs`) loads Yjs at the same moment with
1612
+ `require("yjs")`, so it shares the copy a CommonJS caller requires. Every entry exports `loadYjs()`, `yjsLoaded()` and `YjsNotLoadedError`; on
1613
+ the `node`, default and `cloudflare` entries Yjs is static and `loadYjs()`
1614
+ resolves at once. On the browser entry, every helper that takes a `Y.Doc`
1615
+ (`discoverSchema`, `syncModelMeta` and the rest) throws `YjsNotLoadedError`
1616
+ until Yjs is loaded: `await loadYjs()` first when you use one on a `Y.Doc` of
1617
+ your own before any format-1 document is connected. `yjs` stays a peer
1618
+ dependency; an app that wants it in its startup bundle imports it once
1619
+ statically.
1602
1620
  - **Breaking: format 2 (large document) is removed** (0.12.0). Every
1603
1621
  `models/format2*` export that served the epoch overlay is gone — the record
1604
1622
  store and its asynchronous host, the overlay observer and fold, the epoch