将 cborg 从 6.x 升级到 7.x
根据 TypeScript 类型自动比较 cborg 6.2.1 与 7.0.0 的公开 API。签名变化表示可能存在不兼容变更,并非确定结论。
概要
| 已删除的导入路径 | 0 |
|---|---|
| 已删除的导出 | 0 |
| 已修改的签名 | 0 |
| 已删除的类或接口成员 | 2 |
| 已修改的类或接口成员 | 0 |
| 新增弃用 | 0 |
| 要求变化(engines、peer 依赖) | 0 |
| 新增导出 | 0 |
已删除的导出
未发现。
已修改的签名
未发现。
已删除的类或接口成员
| member | import | 之前 |
|---|---|---|
ByteWriter.chunks | cborg/interface | (number[] | ByteView<ArrayBufferLike>)[] |
DecodeOptions.strictUtf8 | cborg/interface | boolean | undefined |
已修改的类或接口成员
未发现。
新增弃用
未发现。
要求变化(engines、peer 依赖)
未发现。
这些版本之间的 changelog
软件包作者发布的文本,按原样显示。
7.0.0
### ⚠ BREAKING CHANGES
* **json:** validate numeric fractions and exponents
* **json:** cborg/json sorts map keys by UTF-8 bytes, not UTF-16 code units.
* **encode:** encoded float16 subnormals that are not powers of two (multiples of 2^-24 below 2^-14) are now a 3 byte f9 item, not 5 bytes. Anyone hashing or comparing those bytes sees different output.
* **encode:** anyone encoding boxed Number, String, Boolean or BigInt objects now gets the primitive's bytes. Before, they got an empty map or an index-keyed map (new String('a') gave {"0":"a"}).
* **decode:** the decode option strictUtf8 is removed. Callers still passing it get replacement-character decoding instead of an error. Rename it to rejectInvalidUtf8.
* **encode:** encode() of a Map whose keys encode to equal bytes, and encodeInto() with a destination that is not a Uint8Array, now throw. Both produced malformed or corrupt output before. Output from
* **encode:** type-level only. ByteWriter in cborg/interface drops chunks and requires pushArr(number[]) and pushBytes(Uint8Array). TypeScript code implementing ByteWriter or reading writer.chunks will not compile. No runtime export or encoded output changed.
### Features
* **bench:** compare base and head in separate processes and comment on PRs ([#237](https://github.com/rvagg/cborg/issues/237)) ([bc02bfd](https://github.com/rvagg/cborg/commit/bc02bfde4569bd1639ef5263e176b5215acff614))
* **cli:** annotate tags and decode CIDs in diagnostic output ([1db60bc](https://github.com/rvagg/cborg/commit/1db60bca45f78f8c951d897fea12b86c332d57cb))
* **cli:** expand tag 24 embedded CBOR in diagnostic output ([2a66a4d](https://github.com/rvagg/cborg/commit/2a66a4d3e8dfa711384b1270a6f51cf3483c4dd5))
### Bug Fixes
* **cli:** make diagnostic output consistent and reject malformed input ([#240](https://github.com/rvagg/cborg/issues/240)) ([e0b5a0d](https://github.com/rvagg/cborg/commit/e0b5a0de53c1e9b4f8d6048983c7edfe1ce40bc7))
* **cli:** validate --width, reject lossy JSON output, drop stack traces ([#238](https://github.com/rvagg/cborg/issues/238)) ([60f70da](https://github.com/rvagg/cborg/commit/60f70da2a5afc4b80e9f70691c6bbfa14e791908))
* **decode:** reject duplicate tagged-Map keys before values ([cc8d7cb](https://github.com/rvagg/cborg/commit/cc8d7cb76f76aa27ee9c5bf793c85bd8f87f8d75))
* **decode:** rename strictUtf8 to rejectInvalidUtf8 ([#234](https://github.com/rvagg/cborg/issues/234)) ([fa82030](https://github.com/rvagg/cborg/commit/fa82030d5cabef6a730ad3e6f2c4a1273a8002f2))
* **encode:** encode all float16 subnormals as float16 ([#236](https://github.com/rvagg/cborg/issues/236)) ([3b0ad88](https://github.com/rvagg/cborg/commit/3b0ad88f028ebc8686273755524194ae101543c6))
* **encode:** reject duplicate map keys and invalid encode inputs ([#233](https://github.com/rvagg/cborg/issues/233)) ([1ca3eb7](https://github.com/rvagg/cborg/commit/1ca3eb73c933f59c7d2a60853024159abaee8695))
* **encode:** unbox Number, String, Boolean and BigInt objects ([#23把这些数据交给你的 AI 智能体
Vigia 是免费的 MCP 服务器:你的编程智能体在写代码之前就能检查版本、不兼容变更和安全漏洞。无需注册,无需 API 密钥。
claude mcp add --transport http vigia https://vigia.coredls.cloud/mcp
添加到 Cursor添加到 VS Code★ 在 GitHub 上加星
任何其他 MCP 客户端
{ "mcpServers": { "vigia": { "url": "https://vigia.coredls.cloud/mcp" } } }常见问题
将 cborg 从 6 升级到 7 有哪些不兼容变更?
在 cborg 6.2.1 与 7.0.0 之间,Vigia 发现 0 个已删除的导出、0 个已修改的签名,以及 2 个已删除或修改的类或接口成员。
cborg 7 中弃用了哪些内容?
cborg 7.0.0 中有 0 个导出或成员新被标记为弃用。
供智能体使用
GET https://vigia.coredls.cloud/v1/packages/npm/cborg/upgrade?from=6.2.1&to=7.0.0