@dolthub/doltlite-wasm 0.11.16
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/LICENSE.md +113 -0
- package/README.md +74 -0
- package/index.mjs +10 -0
- package/package.json +62 -0
- package/sqlite3-bundler-friendly.mjs +20526 -0
- package/sqlite3-node.mjs +17453 -0
- package/sqlite3-opfs-async-proxy.js +1105 -0
- package/sqlite3-worker1-bundler-friendly.mjs +35 -0
- package/sqlite3-worker1-promiser.mjs +320 -0
- package/sqlite3-worker1.mjs +35 -0
- package/sqlite3.mjs +20614 -0
- package/sqlite3.wasm +0 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
License Information
|
|
2
|
+
===================
|
|
3
|
+
|
|
4
|
+
Doltlite Extensions — Apache License 2.0
|
|
5
|
+
-----------------------------------------
|
|
6
|
+
|
|
7
|
+
The Doltlite extensions to SQLite — including the prolly tree storage
|
|
8
|
+
engine, chunk store, version control functions (dolt_commit, dolt_merge,
|
|
9
|
+
dolt_diff, etc.), and all related code in the following files — are
|
|
10
|
+
licensed under the Apache License, Version 2.0:
|
|
11
|
+
|
|
12
|
+
* `src/prolly_*.c` and `src/prolly_*.h` — Prolly tree implementation
|
|
13
|
+
* `src/chunk_store.c` and `src/chunk_store.h` — Content-addressed chunk store
|
|
14
|
+
* `src/pager_shim.c` — Pager shim for SQLite integration
|
|
15
|
+
* `src/doltlite*.c` and `src/doltlite*.h` — Version control functions
|
|
16
|
+
* `.github/` — CI/CD workflows
|
|
17
|
+
|
|
18
|
+
You may obtain a copy of the Apache License at:
|
|
19
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
20
|
+
|
|
21
|
+
Copyright 2024-2026 DoltHub, Inc.
|
|
22
|
+
|
|
23
|
+
SQLite Is Public Domain
|
|
24
|
+
-----------------------
|
|
25
|
+
|
|
26
|
+
The SQLite source code, including all of the files in the directories
|
|
27
|
+
listed in the bullets below are
|
|
28
|
+
[Public Domain](https://sqlite.org/copyright.html).
|
|
29
|
+
The authors have submitted written affidavits releasing their work to
|
|
30
|
+
the public for any use. Every byte of the public-domain code can be
|
|
31
|
+
traced back to the original authors. The files of this repository
|
|
32
|
+
that are public domain include the following:
|
|
33
|
+
|
|
34
|
+
* All of the primary SQLite source code files found in the
|
|
35
|
+
[src/ directory](https://sqlite.org/src/tree/src?type=tree&expand)
|
|
36
|
+
* All of the test cases and testing code in the
|
|
37
|
+
[test/ directory](https://sqlite.org/src/tree/test?type=tree&expand)
|
|
38
|
+
* All of the SQLite extension source code and test cases in the
|
|
39
|
+
[ext/ directory](https://sqlite.org/src/tree/ext?type=tree&expand)
|
|
40
|
+
* All code that ends up in the "sqlite3.c" and "sqlite3.h" build products
|
|
41
|
+
that actually implement the SQLite RDBMS.
|
|
42
|
+
* All of the code used to compile the
|
|
43
|
+
[command-line interface](https://sqlite.org/cli.html)
|
|
44
|
+
* All of the code used to build various utility programs such as
|
|
45
|
+
"sqldiff", "sqlite3_rsync", and "sqlite3_analyzer".
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
The public domain source files usually contain a header comment
|
|
49
|
+
similar to the following to make it clear that the software is
|
|
50
|
+
public domain.
|
|
51
|
+
|
|
52
|
+
> The author disclaims copyright to this source code. In place of
|
|
53
|
+
> a legal notice, here is a blessing:
|
|
54
|
+
>
|
|
55
|
+
> * May you do good and not evil.
|
|
56
|
+
> * May you find forgiveness for yourself and forgive others.
|
|
57
|
+
> * May you share freely, never taking more than you give.
|
|
58
|
+
|
|
59
|
+
Almost every file you find in this source repository will be
|
|
60
|
+
public domain. But there are a small number of exceptions:
|
|
61
|
+
|
|
62
|
+
Non-Public-Domain Code Included With This Source Repository AS A Convenience
|
|
63
|
+
----------------------------------------------------------------------------
|
|
64
|
+
|
|
65
|
+
This repository contains a (relatively) small amount of non-public-domain
|
|
66
|
+
code used to help implement the configuration and build logic. In other
|
|
67
|
+
words, there are some non-public-domain files used to implement:
|
|
68
|
+
|
|
69
|
+
> ./configure && make
|
|
70
|
+
|
|
71
|
+
In all cases, the non-public-domain files included with this
|
|
72
|
+
repository have generous BSD-style licenses. So anyone is free to
|
|
73
|
+
use any of the code in this source repository for any purpose, though
|
|
74
|
+
attribution may be required to reuse or republish the configure and
|
|
75
|
+
build scripts. None of the non-public-domain code ever actually reaches
|
|
76
|
+
the build products, such as "sqlite3.c", however, so no attribution is
|
|
77
|
+
required to use SQLite itself. The non-public-domain code consists of
|
|
78
|
+
scripts used to help compile SQLite. The non-public-domain code is
|
|
79
|
+
technically not part of SQLite. The non-public-domain code is
|
|
80
|
+
included in this repository as a convenience to developers, so that those
|
|
81
|
+
who want to build SQLite do not need to go download a bunch of
|
|
82
|
+
third-party build scripts in order to compile SQLite.
|
|
83
|
+
|
|
84
|
+
Non-public-domain code included in this respository includes:
|
|
85
|
+
|
|
86
|
+
* The ["autosetup"](http://msteveb.github.io/autosetup/) configuration
|
|
87
|
+
system that is contained (mostly) in the autosetup/ directory, but also
|
|
88
|
+
includes the "./configure" script at the top-level of this archive.
|
|
89
|
+
Autosetup has a separate BSD-style license. See the
|
|
90
|
+
[autosetup/LICENSE](http://msteveb.github.io/autosetup/license/)
|
|
91
|
+
for details.
|
|
92
|
+
|
|
93
|
+
* There are BSD-style licenses on some of the configuration
|
|
94
|
+
software found in the legacy autoconf/ directory and its
|
|
95
|
+
subdirectories.
|
|
96
|
+
|
|
97
|
+
* The vendored BLAKE3 reference implementation under `ext/blake3/`,
|
|
98
|
+
used by the prolly tree's content-addressing layer. Upstream is
|
|
99
|
+
dual-licensed under Apache License 2.0 (with LLVM exception) or
|
|
100
|
+
CC0 1.0 Universal — DoltLite redistributes under Apache 2.0
|
|
101
|
+
(the project-wide license). Source: BLAKE3 v1.8.5 from
|
|
102
|
+
https://github.com/BLAKE3-team/BLAKE3. See `ext/blake3/LICENSE`
|
|
103
|
+
and `ext/blake3/README.md` for the full license texts and a
|
|
104
|
+
description of DoltLite-specific modifications.
|
|
105
|
+
|
|
106
|
+
The following unix shell command can be run from the top-level
|
|
107
|
+
of this source repository in order to remove all non-public-domain
|
|
108
|
+
code:
|
|
109
|
+
|
|
110
|
+
> rm -rf configure autosetup autoconf
|
|
111
|
+
|
|
112
|
+
If you unpack this source repository and then run the command above, what
|
|
113
|
+
is left will be 100% public domain.
|
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# @dolthub/doltlite-wasm
|
|
2
|
+
|
|
3
|
+
[DoltLite](https://github.com/dolthub/doltlite) compiled to WebAssembly: a
|
|
4
|
+
drop-in SQLite build with Dolt-style version control — `dolt_commit`,
|
|
5
|
+
`dolt_branch`, `dolt_merge`, `dolt_diff`, and the rest — that runs in the
|
|
6
|
+
browser and in any JS runtime.
|
|
7
|
+
|
|
8
|
+
This is the WebAssembly distribution. For a native Node/Bun addon, use
|
|
9
|
+
[`@dolthub/doltlite`](https://github.com/dolthub/doltlite-node) instead.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @dolthub/doltlite-wasm
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Browser (OPFS-backed, persistent)
|
|
18
|
+
|
|
19
|
+
OPFS persistence requires the page be served cross-origin isolated (the
|
|
20
|
+
`COOP`/`COEP` headers below); without them you still get an in-memory database.
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
import { sqlite3InitModule } from '@dolthub/doltlite-wasm';
|
|
24
|
+
|
|
25
|
+
const sqlite3 = await sqlite3InitModule();
|
|
26
|
+
|
|
27
|
+
// Persistent across reloads when OPFS is available, in-memory otherwise.
|
|
28
|
+
const db = ('opfs' in sqlite3)
|
|
29
|
+
? new sqlite3.oo1.OpfsDb('/app.db')
|
|
30
|
+
: new sqlite3.oo1.DB(':memory:');
|
|
31
|
+
|
|
32
|
+
db.exec(`CREATE TABLE IF NOT EXISTS t(id INTEGER PRIMARY KEY, msg TEXT)`);
|
|
33
|
+
db.exec(`INSERT INTO t(msg) VALUES('hello')`);
|
|
34
|
+
db.exec(`SELECT dolt_commit('-A', '-m', 'first commit')`);
|
|
35
|
+
|
|
36
|
+
for (const row of db.selectObjects(`SELECT * FROM dolt_log`)) {
|
|
37
|
+
console.log(row.commit_hash, row.message);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Required headers for OPFS (cross-origin isolation):
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
Cross-Origin-Opener-Policy: same-origin
|
|
45
|
+
Cross-Origin-Embedder-Policy: require-corp
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Node / Bun
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
import { sqlite3InitModule } from '@dolthub/doltlite-wasm';
|
|
52
|
+
|
|
53
|
+
const sqlite3 = await sqlite3InitModule();
|
|
54
|
+
const db = new sqlite3.oo1.DB('/tmp/app.db');
|
|
55
|
+
db.exec(`CREATE TABLE t(x)`);
|
|
56
|
+
db.exec(`SELECT dolt_commit('-A', '-m', 'init')`);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Entry points
|
|
60
|
+
|
|
61
|
+
| Import | Use |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| `@dolthub/doltlite-wasm` | Default; bundler-friendly ESM init |
|
|
64
|
+
| `@dolthub/doltlite-wasm/sqlite3.mjs` | Plain ESM (no bundler) |
|
|
65
|
+
| `@dolthub/doltlite-wasm/sqlite3-node.mjs` | Node-specific entry |
|
|
66
|
+
| `@dolthub/doltlite-wasm/sqlite3-worker1-promiser.mjs` | Worker promiser API |
|
|
67
|
+
|
|
68
|
+
The JavaScript API is the upstream SQLite WASM API — see the
|
|
69
|
+
[sqlite3-wasm docs](https://sqlite.org/wasm). Everything there works; DoltLite
|
|
70
|
+
adds the `dolt_*` version-control functions and virtual tables on top.
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
Apache-2.0. See [LICENSE.md](./LICENSE.md). SQLite itself is public domain.
|
package/index.mjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Entry point for @dolthub/doltlite-wasm.
|
|
2
|
+
//
|
|
3
|
+
// Mirrors @sqlite.org/sqlite-wasm: the default export is the async module
|
|
4
|
+
// initializer. Await it to get the sqlite3 namespace, which has the dolt_*
|
|
5
|
+
// version-control functions already registered (the wasm build wires
|
|
6
|
+
// doltliteInstallAutoExt() into sqlite3_wasm_extra_init).
|
|
7
|
+
import sqlite3InitModule from './sqlite3-bundler-friendly.mjs';
|
|
8
|
+
|
|
9
|
+
export default sqlite3InitModule;
|
|
10
|
+
export { sqlite3InitModule };
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dolthub/doltlite-wasm",
|
|
3
|
+
"version": "0.11.16",
|
|
4
|
+
"description": "DoltLite compiled to WebAssembly: SQLite with Dolt-style version control (branches, commits, merge, diff) for the browser and any JS runtime.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.mjs",
|
|
7
|
+
"module": "index.mjs",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./index.mjs",
|
|
10
|
+
"./sqlite3.mjs": "./sqlite3.mjs",
|
|
11
|
+
"./sqlite3.wasm": "./sqlite3.wasm",
|
|
12
|
+
"./sqlite3-bundler-friendly.mjs": "./sqlite3-bundler-friendly.mjs",
|
|
13
|
+
"./sqlite3-node.mjs": "./sqlite3-node.mjs",
|
|
14
|
+
"./sqlite3-opfs-async-proxy.js": "./sqlite3-opfs-async-proxy.js",
|
|
15
|
+
"./sqlite3-worker1.mjs": "./sqlite3-worker1.mjs",
|
|
16
|
+
"./sqlite3-worker1-bundler-friendly.mjs": "./sqlite3-worker1-bundler-friendly.mjs",
|
|
17
|
+
"./sqlite3-worker1-promiser.mjs": "./sqlite3-worker1-promiser.mjs",
|
|
18
|
+
"./package.json": "./package.json"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"index.mjs",
|
|
22
|
+
"sqlite3.mjs",
|
|
23
|
+
"sqlite3.wasm",
|
|
24
|
+
"sqlite3-bundler-friendly.mjs",
|
|
25
|
+
"sqlite3-node.mjs",
|
|
26
|
+
"sqlite3-opfs-async-proxy.js",
|
|
27
|
+
"sqlite3-worker1.mjs",
|
|
28
|
+
"sqlite3-worker1-bundler-friendly.mjs",
|
|
29
|
+
"sqlite3-worker1-promiser.mjs",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE.md"
|
|
32
|
+
],
|
|
33
|
+
"keywords": [
|
|
34
|
+
"sqlite",
|
|
35
|
+
"wasm",
|
|
36
|
+
"webassembly",
|
|
37
|
+
"dolt",
|
|
38
|
+
"doltlite",
|
|
39
|
+
"version-control",
|
|
40
|
+
"database",
|
|
41
|
+
"opfs",
|
|
42
|
+
"local-first",
|
|
43
|
+
"git-for-data"
|
|
44
|
+
],
|
|
45
|
+
"homepage": "https://github.com/dolthub/doltlite#readme",
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "git+https://github.com/dolthub/doltlite.git",
|
|
49
|
+
"directory": "packaging/npm"
|
|
50
|
+
},
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/dolthub/doltlite/issues"
|
|
53
|
+
},
|
|
54
|
+
"author": "DoltHub, Inc.",
|
|
55
|
+
"license": "Apache-2.0",
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=18"
|
|
58
|
+
},
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public"
|
|
61
|
+
}
|
|
62
|
+
}
|