json-brook 0.0.2 → 0.0.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # json-brook
2
2
 
3
+ ## 0.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 删除无效依赖
8
+
3
9
  ## 0.0.2
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -1,12 +1,40 @@
1
1
  # JsonBrook
2
2
 
3
- > 流式解析Json数据
3
+ ![演示视频](assets/showcase.gif)
4
+
5
+ > 流式解析Json数据
4
6
  > 实现上参考了[json-to-ast](https://github.com/vtrushin/json-to-ast)
5
7
 
6
- ## 当前进度
8
+ ## 快速入门
9
+
10
+ ```typescript
11
+ import { createJsonBrook } from "json-brook";
12
+
13
+ const jsonBrook = createJsonBrook();
14
+
15
+ const sample = `{
16
+ "string": "welcome to json brook",
17
+ "number": 20241102,
18
+ "boolean": true,
19
+ "array": ["a", "b", "c"],
20
+ "null": null
21
+ }`;
22
+
23
+ for (const char of sample) {
24
+ jsonBrook.write(char);
25
+ console.log(jsonBrook.getCurrent());
26
+ }
27
+
28
+ jsonBrook.end();
29
+ console.log(jsonBrook.getCurrent());
30
+ ```
31
+
32
+ ## API
33
+ `createJsonBrook` 返回一个JsonBrook实例,JsonBrook实例具有以下方法:
34
+ * `write` 接受字符串并解析,如果解析失败会抛错
35
+ * `end` 结束输入并解析Json数据(针对比较极端的纯数字形式解析,需要知道当前输入已结束),如果解析失败会抛错
36
+ * `getCurrent` 获取当前解析结果
37
+
38
+ ## 在线尝试
39
+ [codesandbox](https://codesandbox.io/p/sandbox/4v5slw)
7
40
 
8
- - [x] token 解析
9
- - [x] ast 解析
10
- - [x] 生成数据
11
- - [ ] 添加单测
12
- - [ ] 新增主页
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-brook",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "parse json data streamly",
5
5
  "keywords": [
6
6
  "json",
@@ -31,7 +31,6 @@
31
31
  "devDependencies": {
32
32
  "@biomejs/biome": "1.8.3",
33
33
  "@modern-js/module-tools": "2.60.3",
34
- "@modern-js/plugin-rspress": "1.33.1",
35
34
  "@types/jest": "^29.5.14",
36
35
  "@types/node": "~16.11.7",
37
36
  "jest": "^29.7.0",