js-bao 0.12.0-alpha.8 → 0.12.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/README.md +21 -0
- package/dist/browser.cjs +24127 -9232
- package/dist/browser.d.cts +6683 -731
- package/dist/browser.d.ts +6683 -731
- package/dist/browser.js +19983 -5087
- package/dist/client.cjs +599 -85
- package/dist/client.d.cts +2947 -450
- package/dist/client.d.ts +2947 -450
- package/dist/client.js +599 -85
- package/dist/cloudflare-do.cjs +6653 -4322
- package/dist/cloudflare-do.d.cts +4385 -698
- package/dist/cloudflare-do.d.ts +4385 -698
- package/dist/cloudflare-do.js +6564 -4233
- package/dist/cloudflare.cjs +1175 -156
- package/dist/cloudflare.d.cts +3029 -453
- package/dist/cloudflare.d.ts +3029 -453
- package/dist/cloudflare.js +1175 -156
- package/dist/codegen-v2.cjs +2627 -598
- package/dist/codegen.cjs +21 -9
- package/dist/format2-broker.js +11 -11
- package/dist/format2-worker.js +19066 -8282
- package/dist/index.cjs +26946 -10734
- package/dist/index.d.cts +7524 -696
- package/dist/index.d.ts +7524 -696
- package/dist/index.js +26770 -10720
- package/dist/node.cjs +27582 -11701
- package/dist/node.d.cts +6978 -801
- package/dist/node.d.ts +6978 -801
- package/dist/node.js +27617 -11852
- package/dist/record-log.cjs +1019 -54
- package/dist/record-log.d.cts +676 -29
- package/dist/record-log.d.ts +676 -29
- package/dist/record-log.js +1019 -54
- package/dist/sqlite3.wasm +0 -0
- package/package.json +22 -10
package/README.md
CHANGED
|
@@ -1310,6 +1310,9 @@ public server path).
|
|
|
1310
1310
|
|
|
1311
1311
|
- **Vite / Create React App**: copy `node_modules/sql.js/dist/sql-wasm.wasm` into
|
|
1312
1312
|
your project's `public/` directory so it is served at `/sql-wasm.wasm`.
|
|
1313
|
+
Copy it from the sql.js that js-bao resolved, and again whenever that version
|
|
1314
|
+
changes: sql.js only loads the wasm built with it, and a wasm from another
|
|
1315
|
+
version rejects `ensureReady()` with a `sql.js wasm mismatch` error.
|
|
1313
1316
|
- **Custom path**: if the wasm lives elsewhere, point at it via `DatabaseConfig`:
|
|
1314
1317
|
|
|
1315
1318
|
```typescript
|
|
@@ -1596,6 +1599,24 @@ See the `examples/` directory for complete working examples:
|
|
|
1596
1599
|
Changes a consumer of this package can observe, including the on-disk
|
|
1597
1600
|
behaviour of `js-bao/cloudflare/do` (`DurableObjectEngine`). Newest first.
|
|
1598
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.
|
|
1599
1620
|
- **Breaking: format 2 (large document) is removed** (0.12.0). Every
|
|
1600
1621
|
`models/format2*` export that served the epoch overlay is gone — the record
|
|
1601
1622
|
store and its asynchronous host, the overlay observer and fold, the epoch
|