feat(WAProto): Optimize protobuf generation for 80%+ bundle size reduction (#1665)

* chore: remove comments and veirfy from generated proto files (improve size)

* refactor: replace fromObject with create for proto message instantiation and flag no beautiful

* chore: lint issues
This commit is contained in:
João Lucas de Oliveira Lopes
2025-09-07 08:08:11 -03:00
committed by GitHub
parent 9e04cce8d3
commit 4d4339dae6
15 changed files with 19728 additions and 190249 deletions
+3 -3
View File
@@ -161,7 +161,7 @@ export const encodeSyncdPatch = async (
state = { ...state, indexValueMap: { ...state.indexValueMap } }
const indexBuffer = Buffer.from(JSON.stringify(index))
const dataProto = proto.SyncActionData.fromObject({
const dataProto = proto.SyncActionData.create({
index: indexBuffer,
value: syncAction,
padding: new Uint8Array(0),
@@ -243,13 +243,13 @@ export const decodeSyncdMutations = async (
const syncAction = proto.SyncActionData.decode(result)
if (validateMacs) {
const hmac = hmacSign(syncAction.index!, key.indexKey)
const hmac = hmacSign(syncAction.index, key.indexKey)
if (Buffer.compare(hmac, record.index!.blob!) !== 0) {
throw new Boom('HMAC index verification failed')
}
}
const indexStr = Buffer.from(syncAction.index!).toString()
const indexStr = Buffer.from(syncAction.index).toString()
onMutation({ syncAction, index: JSON.parse(indexStr) })
ltGenerator.mix({