@runtimed/wasm 0.0.1 → 0.7.6-nightly.38878047291

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
@@ -1,3 +1,63 @@
1
- # @runtimed/wasm placeholder
1
+ # @runtimed/wasm
2
2
 
3
- This bootstrap version contains no executable code. It exists only to configure npm trusted publishing before real release artifacts are published. Install a real stable or nightly release once available.
3
+ The generated ESM WebAssembly bindings for runtimed notebook documents and room
4
+ state. This package carries the matching JavaScript, binary, and TypeScript
5
+ declarations from one retained release build. It has no npm dependencies.
6
+
7
+ Initialize once before constructing handles. Free handles when their owner is
8
+ finished with them. The generated declarations describe the complete API.
9
+
10
+ The declarations include `Symbol.dispose`. If your TypeScript library types do
11
+ not include it, add `ESNext.Disposable` (TypeScript 5.2 or newer) to
12
+ `compilerOptions.lib` alongside your usual libraries (for example,
13
+ `["ES2022", "DOM", "ESNext.Disposable"]`). This also applies when `lib` is unset
14
+ and your `target` selects older library types.
15
+
16
+ ```js
17
+ import init, { NotebookHandle } from "@runtimed/wasm";
18
+
19
+ // A browser server must serve the matching .wasm beside the generated module,
20
+ // or pass an explicit URL emitted by your bundler.
21
+ await init({ module_or_path: new URL("/assets/runtimed_wasm_bg.wasm", location.href) });
22
+ const notebook = NotebookHandle.create_bootstrap("example-client");
23
+ try {
24
+ console.log(JSON.parse(notebook.get_cells_json()));
25
+ } finally {
26
+ notebook.free();
27
+ }
28
+ ```
29
+
30
+ With a bundler that supports asset URL imports, use
31
+ `@runtimed/wasm/runtimed_wasm_bg.wasm?url` and pass that URL to `init`.
32
+ Plain browser ESM may call `await init()` when the generated module and its
33
+ binary are served together. Serve the binary as `application/wasm`.
34
+
35
+ Node's fetch does not load `file:` URLs. Read the exported binary and pass its
36
+ bytes explicitly (Node 22 or newer):
37
+
38
+ ```js
39
+ import { readFile } from "node:fs/promises";
40
+ import { initSync, NotebookHandle } from "@runtimed/wasm";
41
+
42
+ const bytes = await readFile(new URL(import.meta.resolve("@runtimed/wasm/runtimed_wasm_bg.wasm")));
43
+ initSync({ module: bytes });
44
+ const notebook = NotebookHandle.create_bootstrap("node-client");
45
+ notebook.free();
46
+ ```
47
+
48
+ The async initializer also accepts bytes or a compiled `WebAssembly.Module` as
49
+ `module_or_path`. This package does not connect to a daemon, start a kernel, or
50
+ provide the private `runtimed` TypeScript stores. Existing desktop and cloud
51
+ imports remain unchanged.
52
+
53
+ Pin an exact version and keep your lockfile. Stable releases use the checked-in
54
+ package version; nightly releases use `<version>-nightly.<release run ID>`.
55
+ `@runtimed/wasm/build-info.json` records source SHA, release identity, WASM
56
+ checksums, protocol source constants, and Automerge genesis hashes. Those facts
57
+ describe the build; matching package versions alone do not establish daemon or
58
+ host compatibility. Qualify the document, protocol, and host contracts you use.
59
+
60
+ `LICENSE` covers first-party code. `lib/THIRD_PARTY_NOTICES.md` contains the
61
+ licenses and notices of the Rust dependencies compiled into the module.
62
+ See the repository's [npm publishing runbook](../../docs/runbooks/npm-publishing.md)
63
+ for the retained-artifact workflow and the disabled-by-default bootstrap gate.