@minigraf/browser 1.2.0 → 1.2.1
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 +58 -0
- package/minigraf_wasm.d.ts +1 -1
- package/minigraf_wasm.js +4 -7
- package/minigraf_wasm_bg.wasm +0 -0
- package/package.json +2 -1
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# minigraf (WebAssembly)
|
|
2
|
+
|
|
3
|
+
WebAssembly builds of [Minigraf](https://github.com/project-minigraf/minigraf) — zero-config,
|
|
4
|
+
single-file, embedded bi-temporal graph database with Datalog queries.
|
|
5
|
+
|
|
6
|
+
Two packages are published from this repo:
|
|
7
|
+
|
|
8
|
+
| Package | Target | Install |
|
|
9
|
+
|---------|--------|---------|
|
|
10
|
+
| [`@minigraf/browser`](https://www.npmjs.com/package/@minigraf/browser) | Browser (wasm-bindgen) | `npm install @minigraf/browser` |
|
|
11
|
+
| [`@minigraf/wasi`](https://www.npmjs.com/package/@minigraf/wasi) | Node.js / WASI runtimes | `npm install @minigraf/wasi` |
|
|
12
|
+
|
|
13
|
+
## Browser (`@minigraf/browser`)
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import init, { MiniGrafDb } from '@minigraf/browser'
|
|
17
|
+
|
|
18
|
+
await init()
|
|
19
|
+
|
|
20
|
+
const db = MiniGrafDb.inMemory()
|
|
21
|
+
db.execute('(transact [[:alice :name "Alice"]])')
|
|
22
|
+
|
|
23
|
+
const result = JSON.parse(db.execute('(query [:find ?n :where [?e :name ?n]])'))
|
|
24
|
+
console.log(result.results[0][0]) // "Alice"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## WASI (`@minigraf/wasi`)
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
import { instantiateMinigrafWasiWith } from '@minigraf/wasi'
|
|
31
|
+
import { WASI } from 'node:wasi'
|
|
32
|
+
|
|
33
|
+
const wasi = new WASI({ version: 'preview1' })
|
|
34
|
+
const instance = await instantiateMinigrafWasiWith(wasi)
|
|
35
|
+
// Use the WebAssembly instance exports
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Building from source
|
|
39
|
+
|
|
40
|
+
Requires Rust stable toolchain and `wasm-pack`.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Browser target
|
|
44
|
+
wasm-pack build --target web --features browser
|
|
45
|
+
|
|
46
|
+
# WASI target
|
|
47
|
+
cargo build --target wasm32-wasip1 --release
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Cascade release
|
|
51
|
+
|
|
52
|
+
This repo receives a `core-release` repository_dispatch from the minigraf monorepo
|
|
53
|
+
cascade whenever a new version of the `minigraf` core crate is published. The release
|
|
54
|
+
workflow pins the new version, commits, tags, and publishes both npm packages.
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
MIT OR Apache-2.0
|
package/minigraf_wasm.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ export interface InitOutput {
|
|
|
76
76
|
readonly browserdb_openInMemory: () => [number, number, number];
|
|
77
77
|
readonly wasm_bindgen__convert__closures_____invoke__h6588d25cdde23584: (a: number, b: number, c: any) => [number, number];
|
|
78
78
|
readonly wasm_bindgen__convert__closures_____invoke__h4bf2427f775cf424: (a: number, b: number, c: any, d: any) => void;
|
|
79
|
-
readonly
|
|
79
|
+
readonly wasm_bindgen__convert__closures_____invoke__h433d110f0824d0c1: (a: number, b: number, c: any) => void;
|
|
80
80
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
81
81
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
82
82
|
readonly __wbindgen_exn_store: (a: number) => void;
|
package/minigraf_wasm.js
CHANGED
|
@@ -170,9 +170,6 @@ function __wbg_get_imports() {
|
|
|
170
170
|
const ret = arg0.getAll();
|
|
171
171
|
return ret;
|
|
172
172
|
}, arguments); },
|
|
173
|
-
__wbg_getRandomValues_bf16787eede473f5: function() { return handleError(function (arg0, arg1) {
|
|
174
|
-
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
175
|
-
}, arguments); },
|
|
176
173
|
__wbg_get_507a50627bffa49b: function(arg0, arg1) {
|
|
177
174
|
const ret = arg0[arg1 >>> 0];
|
|
178
175
|
return ret;
|
|
@@ -364,8 +361,8 @@ function __wbg_get_imports() {
|
|
|
364
361
|
return ret;
|
|
365
362
|
},
|
|
366
363
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
367
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx:
|
|
368
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
364
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 343, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
365
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h433d110f0824d0c1);
|
|
369
366
|
return ret;
|
|
370
367
|
},
|
|
371
368
|
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
@@ -394,8 +391,8 @@ function __wbg_get_imports() {
|
|
|
394
391
|
};
|
|
395
392
|
}
|
|
396
393
|
|
|
397
|
-
function
|
|
398
|
-
wasm.
|
|
394
|
+
function wasm_bindgen__convert__closures_____invoke__h433d110f0824d0c1(arg0, arg1, arg2) {
|
|
395
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h433d110f0824d0c1(arg0, arg1, arg2);
|
|
399
396
|
}
|
|
400
397
|
|
|
401
398
|
function wasm_bindgen__convert__closures_____invoke__h6588d25cdde23584(arg0, arg1, arg2) {
|
package/minigraf_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
"name": "@minigraf/browser",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "wasm-pack build shim for Minigraf browser and WASI targets",
|
|
5
|
-
"version": "1.2.
|
|
5
|
+
"version": "1.2.1",
|
|
6
|
+
"license": "MIT OR Apache-2.0",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
8
9
|
"url": "https://github.com/project-minigraf/minigraf-wasm"
|