@naeemo/capnp 0.1.0 → 0.3.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 +14 -3
- package/README.zh.md +14 -3
- package/dist/codegen/cli-v3.js +1857 -0
- package/dist/codegen/cli-v3.js.map +1 -0
- package/dist/index.cjs +2311 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2283 -28
- package/dist/index.js.map +1 -1
- package/package.json +9 -4
package/README.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# Cap'n Proto TypeScript
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@naeemo/capnp)
|
|
4
|
+
[](https://naeemo.github.io/capnp/)
|
|
5
|
+
|
|
3
6
|
A pure TypeScript implementation of Cap'n Proto, featuring zero-copy deserialization and full interoperability with the official C++ implementation.
|
|
4
7
|
|
|
5
|
-
[中文文档](./README.zh.md)
|
|
8
|
+
[📖 Documentation](https://naeemo.github.io/capnp/) | [中文文档](./README.zh.md)
|
|
6
9
|
|
|
7
10
|
## Features
|
|
8
11
|
|
|
@@ -41,10 +44,17 @@ console.log(data.getText(0)); // "Hello, Cap'n Proto!"
|
|
|
41
44
|
|
|
42
45
|
### Code Generation
|
|
43
46
|
|
|
44
|
-
Generate TypeScript types from your Cap'n Proto schema:
|
|
47
|
+
Generate TypeScript types from your Cap'n Proto schema using the V3 CLI (requires `capnp` tool installed):
|
|
45
48
|
|
|
46
49
|
```bash
|
|
47
|
-
|
|
50
|
+
# Generate single file
|
|
51
|
+
npx capnp-ts-codegen schema.capnp -o types.ts
|
|
52
|
+
|
|
53
|
+
# Generate multiple files to directory
|
|
54
|
+
npx capnp-ts-codegen schema.capnp -d ./generated
|
|
55
|
+
|
|
56
|
+
# With custom runtime import path
|
|
57
|
+
npx capnp-ts-codegen schema.capnp -o types.ts -r ../my-runtime
|
|
48
58
|
```
|
|
49
59
|
|
|
50
60
|
Generated code includes:
|
|
@@ -85,6 +95,7 @@ See [PERFORMANCE.md](./PERFORMANCE.md) for detailed benchmarks.
|
|
|
85
95
|
|
|
86
96
|
## Documentation
|
|
87
97
|
|
|
98
|
+
- [📖 Documentation Website](https://naeemo.github.io/capnp/)
|
|
88
99
|
- [API Documentation](./docs/API.md)
|
|
89
100
|
- [Performance Report](./PERFORMANCE.md)
|
|
90
101
|
- [Test Coverage](./TEST_COVERAGE.md)
|
package/README.zh.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# Cap'n Proto TypeScript
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@naeemo/capnp)
|
|
4
|
+
[](https://naeemo.github.io/capnp/)
|
|
5
|
+
|
|
3
6
|
纯 TypeScript 实现的 Cap'n Proto,支持零拷贝反序列化,与官方 C++ 实现完全兼容。
|
|
4
7
|
|
|
5
|
-
[English Documentation](./README.md)
|
|
8
|
+
[📖 文档网站](https://naeemo.github.io/capnp/) | [English Documentation](./README.md)
|
|
6
9
|
|
|
7
10
|
## 特性
|
|
8
11
|
|
|
@@ -41,10 +44,17 @@ console.log(data.getText(0)); // "你好,Cap'n Proto!"
|
|
|
41
44
|
|
|
42
45
|
### 代码生成
|
|
43
46
|
|
|
44
|
-
从 Cap'n Proto
|
|
47
|
+
使用 V3 CLI 从 Cap'n Proto schema 生成 TypeScript 类型(需要安装 `capnp` 工具):
|
|
45
48
|
|
|
46
49
|
```bash
|
|
47
|
-
|
|
50
|
+
# 生成单文件
|
|
51
|
+
npx capnp-ts-codegen schema.capnp -o types.ts
|
|
52
|
+
|
|
53
|
+
# 生成多文件到目录
|
|
54
|
+
npx capnp-ts-codegen schema.capnp -d ./generated
|
|
55
|
+
|
|
56
|
+
# 自定义运行时导入路径
|
|
57
|
+
npx capnp-ts-codegen schema.capnp -o types.ts -r ../my-runtime
|
|
48
58
|
```
|
|
49
59
|
|
|
50
60
|
生成的代码包括:
|
|
@@ -65,6 +75,7 @@ npx tsx src/cli/codegen.ts schema.capnp -o types.ts
|
|
|
65
75
|
|
|
66
76
|
## 文档
|
|
67
77
|
|
|
78
|
+
- [📖 文档网站](https://naeemo.github.io/capnp/)
|
|
68
79
|
- [API 文档](./docs/API.md)
|
|
69
80
|
- [性能报告](./PERFORMANCE.md)
|
|
70
81
|
- [测试覆盖](./TEST_COVERAGE.md)
|