Migrates a self-contained subset of bridge/proto/longmsg.ts to the new
@snowluma/proton compile-time DSL form and verifies wire-format parity
against the legacy runtime ProtoSchema encoder. End-to-end proof that
the toolchain works in core's vitest pipeline.
What's covered:
- LongMsgUid / LongMsgSettings / SendLongMsgInfo / SendLongMsgReq /
SendLongMsgResp / SendLongMsgRespResult / RecvLongMsgInfo /
RecvLongMsgReq / RecvLongMsgResp / RecvLongMsgRespResult
- The three schemas that pull in PushMsgBody (LongMsgContent /
LongMsgAction / LongMsgResult) stay on the legacy API for now, since
migrating them requires also migrating message.ts and element.ts.
Toolchain changes:
- @snowluma/proton gets a tsup build step. The ./vite subpath now
points at the built dist/index.js so it is loadable as plain Node
ESM from vite.config.ts / vitest.config.ts (the source-only .ts
layout can't be consumed from outside the Vite transform pipeline).
The . (runtime) subpath stays at TS source — it's only ever
imported from user code, which IS Vite-transformed.
- prepare script ensures dist/ exists after pnpm install.
- @snowluma/core depends on @snowluma/proton (workspace:*) and adds
protobufVitePlugin() to its vitest config so test files get
transformed.
Documented divergence:
proton follows proto3 semantics: fields equal to their default value
(0 / false / "" / empty bytes) are NOT emitted on the wire. The legacy
runtime encoder always emits them. Both forms are round-trippable
through a conforming proto3 reader. The parity test pins this
behaviour explicitly.
8/8 parity tests pass.
44 lines
1.2 KiB
JSON
44 lines
1.2 KiB
JSON
{
|
|
"name": "@snowluma/proton",
|
|
"version": "1.8.5",
|
|
"private": true,
|
|
"type": "module",
|
|
"description": "Compile-time protobuf encoder/decoder generator for SnowLuma. TypeScript interfaces → fully-inlined, zero-runtime protobuf codec functions. Vendored from SnowLuma/protobuf-dsl (reference copy under dev/protobuf-dsl/) with edge-case fixes applied.",
|
|
"main": "./src/runtime.ts",
|
|
"types": "./protobuf.d.ts",
|
|
"exports": {
|
|
".": {
|
|
"types": "./protobuf.d.ts",
|
|
"default": "./src/runtime.ts"
|
|
},
|
|
"./vite": {
|
|
"types": "./src/index.ts",
|
|
"default": "./dist/index.js"
|
|
}
|
|
},
|
|
"scripts": {
|
|
"build": "tsup src/index.ts --format esm --out-dir dist --target node20 --external typescript --external vite",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"typecheck": "tsc --noEmit",
|
|
"prepare": "test -f dist/index.js || pnpm build"
|
|
},
|
|
"dependencies": {
|
|
"typescript": "catalog:"
|
|
},
|
|
"peerDependencies": {
|
|
"vite": "catalog:"
|
|
},
|
|
"peerDependenciesMeta": {
|
|
"vite": {
|
|
"optional": true
|
|
}
|
|
},
|
|
"devDependencies": {
|
|
"@types/node": "^24.12.2",
|
|
"tsup": "^8.5.0",
|
|
"vite": "catalog:",
|
|
"vitest": "^4.1.4"
|
|
}
|
|
}
|