@monlite/core 1.2.0 → 1.3.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 +6 -4
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -30
- package/dist/index.d.ts +46 -30
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -459,9 +459,10 @@ await engine.start();
|
|
|
459
459
|
```
|
|
460
460
|
|
|
461
461
|
Pull / push / two-way replication, last-write-wins (or custom) conflict
|
|
462
|
-
resolution, and pluggable adapters (`MongoAdapter`, `
|
|
463
|
-
monlite-to-monlite, `MemoryAdapter` for
|
|
464
|
-
|
|
462
|
+
resolution, and pluggable adapters (`MongoAdapter`, `PostgresAdapter`,
|
|
463
|
+
`MySqlAdapter`, `MonliteAdapter` for monlite-to-monlite, `MemoryAdapter` for
|
|
464
|
+
tests) — keep local monlite as the embedded runtime and a server DB as the cloud
|
|
465
|
+
of record. See the
|
|
465
466
|
[`@monlite/sync` README](https://www.npmjs.com/package/@monlite/sync) for details.
|
|
466
467
|
|
|
467
468
|
---
|
|
@@ -600,13 +601,14 @@ Redis/Mongo/Qdrant replacement. For scale, keep the real services and
|
|
|
600
601
|
|
|
601
602
|
## Drivers & zero dependencies
|
|
602
603
|
|
|
603
|
-
monlite talks to SQLite through a tiny driver adapter, so it runs on
|
|
604
|
+
monlite talks to SQLite through a tiny driver adapter, so it runs on
|
|
604
605
|
interchangeable backends:
|
|
605
606
|
|
|
606
607
|
| Backend | When it's used | Notes |
|
|
607
608
|
|---|---|---|
|
|
608
609
|
| **`node:sqlite`** | Built into Node **22.5+** | **Zero dependencies.** Still flagged experimental by Node, so it prints a one-time `ExperimentalWarning`. |
|
|
609
610
|
| **`better-sqlite3`** | When the package is installed | Battle-tested native driver. Works on Node 18/20/22, no warning. Install it yourself: `npm i better-sqlite3`. |
|
|
611
|
+
| **WASM (browser)** | Via [`@monlite/wasm`](https://www.npmjs.com/package/@monlite/wasm) | Runs monlite **in the browser** on SQLite-WASM (sql.js); pass `driver: wasmDriver(SQL)`. Snapshot persistence to IndexedDB/OPFS. |
|
|
610
612
|
|
|
611
613
|
By default (`driver: "auto"`) monlite uses `better-sqlite3` if it's installed,
|
|
612
614
|
otherwise falls back to the built-in `node:sqlite`. Force one explicitly:
|
package/dist/index.cjs
CHANGED
|
@@ -1615,7 +1615,11 @@ function loadNodeSqlite() {
|
|
|
1615
1615
|
return null;
|
|
1616
1616
|
}
|
|
1617
1617
|
}
|
|
1618
|
+
function isDriverInstance(d) {
|
|
1619
|
+
return typeof d === "object" && d !== null && typeof d.prepare === "function" && typeof d.exec === "function";
|
|
1620
|
+
}
|
|
1618
1621
|
function createDriver(filename, options = {}) {
|
|
1622
|
+
if (isDriverInstance(options.driver)) return options.driver;
|
|
1619
1623
|
const choice = options.driver ?? "auto";
|
|
1620
1624
|
if (options.encryption) {
|
|
1621
1625
|
if (choice === "node:sqlite") {
|