doxum 0.1.7 → 0.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doxum",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "Doxum is a typed runtime for complex mutable documents.",
@@ -73,6 +73,13 @@ guidance.
73
73
 
74
74
  ## Read through readers
75
75
 
76
+ Use `import type { Infer } from 'doxum'` to name schema-derived values:
77
+ `Infer<typeof task>` for a node and `Infer<typeof taskSchema>` for a document.
78
+ Generated object types and variant branches are flat, with readonly fields
79
+ and discriminants. Optional nodes include undefined; optional object members
80
+ can be omitted. User-provided scalar payload types retain their own structure
81
+ and mutability. Infer accepts nodes and schemas, not a raw shape object.
82
+
76
83
  The runtime does not expose its mutable document. Read through a callback:
77
84
 
78
85
  ```ts
@@ -58,6 +58,11 @@ const runtime = createDocument({
58
58
 
59
59
  ## 通过 reader 读取
60
60
 
61
+ 用 `import type { Infer } from 'doxum'` 命名 schema 推导的值类型:节点使用
62
+ `Infer<typeof task>`,整份文档使用 `Infer<typeof taskSchema>`。生成的对象与 variant
63
+ 分支是展平的结构,属性和判别字段均为 readonly。可选节点包含 undefined,对象中的可选成员
64
+ 可以省略。用户提供的标量载荷类型保留原本的结构和可变性。Infer 接收节点或 schema,不直接接收原始 shape 对象。
65
+
61
66
  runtime 不会暴露可变的 canonical document,应通过回调读取:
62
67
 
63
68
  ```ts