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
@@ -749,7 +749,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
msg.participant ??= node.attrs.participant
msg.messageTimestamp = +node.attrs.t!
const fullMsg = proto.WebMessageInfo.fromObject(msg)
const fullMsg = proto.WebMessageInfo.create(msg as proto.IWebMessageInfo)
await upsertMessage(fullMsg, 'append')
}
})
@@ -1182,7 +1182,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
? Buffer.from(plaintextNode.content, 'binary')
: Buffer.from(plaintextNode.content as Uint8Array)
const messageProto = proto.Message.decode(contentBuf)
const fullMessage = proto.WebMessageInfo.fromObject({
const fullMessage = proto.WebMessageInfo.create({
key: {
remoteJid: from,
id: child.attrs.message_id || child.attrs.server_id,
@@ -1313,7 +1313,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
msg.message = { call: { callKey: Buffer.from(call.id) } }
}
const protoMsg = proto.WebMessageInfo.fromObject(msg)
const protoMsg = proto.WebMessageInfo.create(msg)
upsertMessage(protoMsg, call.offline ? 'append' : 'notify')
}
})