@quillmark/wasm 0.125.0 → 0.126.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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  WebAssembly bindings for Quillmark.
4
4
 
5
- Maintained by [TTQ](https://tonguetoquill.com).
5
+ Maintained by [borb-sh](https://github.com/borb-sh).
6
6
 
7
7
  ## Overview
8
8
 
@@ -21,25 +21,10 @@ own linear memory, lazily loaded on the first render. The Engine clones a
21
21
  `Quill` / `Document` into that memory as data and frees the clones: you never
22
22
  hold a backend object or cross a memory boundary yourself.
23
23
 
24
- ## Build
24
+ ## Installation
25
25
 
26
26
  ```bash
27
- bash scripts/build-wasm.sh
28
- ```
29
-
30
- The script builds two variants, the core (no backend) and the render build
31
- (default features, both backends), each with `--target web` and `--weak-refs`
32
- enabled (see
33
- [Initialization](#initialization) and [Lifecycle](#lifecycle)). It then asserts
34
- none of them carries a `.wasm` ESM import or a top-level await.
35
-
36
- ## Test
37
-
38
- ```bash
39
- bash scripts/build-wasm.sh
40
- cd crates/bindings/wasm
41
- npm install
42
- npm test
27
+ npm install @quillmark/wasm
43
28
  ```
44
29
 
45
30
  ## Usage
@@ -147,6 +132,10 @@ const session = await engine.open(quill, doc); // one compile, current document
147
132
  `load` reads only `quill.backendId` and clones nothing. A failed load rejects
148
133
  with `runtime::backend_load_failed`, and the next call retries.
149
134
 
135
+ A render that traps (out of memory, a panic) rejects with
136
+ `runtime::backend_trapped`, the `WebAssembly.RuntimeError` on `cause`. The
137
+ build's state is then undefined: terminate the Worker or restart the process.
138
+
150
139
  ### The two doors: `Document.fromMarkdown` vs `quill.parse` / `quill.conform`
151
140
 
152
141
  `Document.fromMarkdown` is the quill-free **transport door** (migrations, `$ext`
@@ -157,7 +146,7 @@ as authored.
157
146
  `quill.parse` is the **bound door**, and the primary ingestion path. It is
158
147
  `Document.fromMarkdown` followed by `conform`: the returned document's declared
159
148
  content fields rest at one form per codec (a `richtext` field as the canonical
160
- content object, a `plaintext` field as its literal string), so `getStored`
149
+ content object, a `text` field as its literal string), so `getStored`
161
150
  answers "content object or string?" by the field's declared codec rather than by how the
162
151
  document was built. Parse warnings and the `conform::*` warnings both ride
163
152
  `doc.warnings`.
@@ -205,7 +194,9 @@ and writes that same value.
205
194
  mark `type` or island `type` outside the vocabulary. Those are refused from
206
195
  0.113 on; see that release's migration guide. An island `loss` is not one of
207
196
  them: 0.115 drops the key, so a row spelling one opens whatever the class and
208
- comes back without it.
197
+ comes back without it. From 0.126 on, a row whose `$quill` is a lone major,
198
+ `memo@1`, or whose body nests past 12 levels is refused too; rewrite it
199
+ before upgrading, as that release's migration guide shows.
209
200
  - **Downgrading is not.** `fromStored` rejects an *unknown* (i.e. newer)
210
201
  `schema` version rather than guessing at a format it predates. Don't feed
211
202
  documents written by a newer build back into an older one.
@@ -236,8 +227,8 @@ values from the `Document` payload: there is no separate form-view projection.
236
227
  `quill.validate(doc)` scores it without invoking the backend.
237
228
 
238
229
  `quill.exampleDocument()` returns the quill's example, a filled-in page whose
239
- values are made up, pinned to the quill's `name@version`; `undefined` when
240
- the quill has no `example.md` at its root.
230
+ values are made up, pinned to the quill's `name@MAJOR.MINOR`; `undefined`
231
+ when the quill has no `example.md` at its root.
241
232
 
242
233
  `quill.seedDocument()` returns a starter document: one card per kind, each
243
234
  carrying the kind's `seed` from `Quill.yaml` and no other field;
@@ -274,7 +265,7 @@ address. `getStored` is the verbatim transport read, distinct from the interpret
274
265
  `quill.reader(doc).get`; `bodyMarkdown` is the body markdown read (a `CardAddr`; a field's
275
266
  markdown is read through `quill.reader(doc).get(field)`). A content field's stored
276
267
  form rests per its declared codec through the bound door (a `richtext` field as
277
- the content object, a `plaintext` field as its literal string), and as authored
268
+ the content object, a `text` field as its literal string), and as authored
278
269
  through the transport door. For the `Content` either way read
279
270
  `quill.reader(doc).getContent(addr)`, which decodes through the codec the
280
271
  field's declared type names. Card-scoped verbs take a
@@ -334,7 +325,7 @@ ed.set("subject", "Q3 results"); // strict-committed to the s
334
325
  ed.setAll({ qty: "3", subject: "Q3" }); // all-or-nothing batch
335
326
  ed.reviseField("subject", "Q3 **results**"); // typed AND anchor-preserving; returns { delta, warnings }
336
327
  ed.set("titel", "x"); // throws UnknownField: a typo, not a fallback
337
- ed.card(2).set("body", "**note**"); // composable card, resolved by its $kind
328
+ ed.card(2).reviseBody("**note**"); // a composable card's body; its fields take set / setAll
338
329
  ```
339
330
 
340
331
  `DocumentWriter` / `CardWriter` are pure JS holding references to your existing
@@ -351,7 +342,7 @@ const v = quill.reader(doc);
351
342
  v.get("subject"); // the values form: every content leaf as its codec's text, else as stored
352
343
  v.getContent("subject"); // the same read as a `Content`, whichever lane stored it
353
344
  v.bodyMarkdown(); // the main body markdown (quill-free)
354
- v.card(0).get("body"); // a card field, resolved by its $kind
345
+ v.card(0).bodyMarkdown(); // a card's body markdown; its fields read through get
355
346
  v.resolve(); // the render view: blank-filled, coerced, each field tagged with its rung
356
347
  ```
357
348
 
@@ -544,11 +535,11 @@ call returns: `try { return engine.render(quill, doc); } finally
544
535
  { doc.free(); }`: is safe even on the first render, while the backend
545
536
  binary is still loading.
546
537
 
547
- The package floor is Node 24+ (`engines: { node: ">=24" }`) and current
538
+ The package floor is Node 22+ (`engines: { node: ">=22" }`) and current
548
539
  evergreen browsers; `--weak-refs` itself only needs Node 14.6+. The `using`
549
- sugar ([explicit resource management][erm]) is on that floor and optional;
540
+ sugar ([explicit resource management][erm]) needs Node 24 and is optional;
550
541
  an explicit `try` / `finally` is the equivalent, and the form that also runs
551
- in a browser that hasn't shipped it:
542
+ on Node 22 and in a browser that hasn't shipped it:
552
543
 
553
544
  ```ts
554
545
  const session = await engine.open(quill, doc);
@@ -563,6 +554,27 @@ try {
563
554
 
564
555
  [erm]: https://github.com/tc39/proposal-explicit-resource-management
565
556
 
557
+ ## Build
558
+
559
+ ```bash
560
+ bash scripts/build-wasm.sh
561
+ ```
562
+
563
+ The script builds two variants, the core (no backend) and the render build
564
+ (default features, both backends), each with `--target web` and `--weak-refs`
565
+ enabled (see
566
+ [Initialization](#initialization) and [Lifecycle](#lifecycle)). It then asserts
567
+ none of them carries a `.wasm` ESM import or a top-level await.
568
+
569
+ ## Test
570
+
571
+ ```bash
572
+ bash scripts/build-wasm.sh
573
+ cd crates/bindings/wasm
574
+ npm ci
575
+ npm test
576
+ ```
577
+
566
578
  ## Changelog
567
579
 
568
580
  See the [changelog](https://github.com/borb-sh/quillmark/blob/main/CHANGELOG.md)