There have been quite a lot of requests for static code generation in the past. Personally, I'd not absolutely require it with v6's built-in codegen, but there certainly are valid use cases where having actual code to reference makes sense (i.e. when using TypeScript).
I know that a few people already started working on something for v5, so I added a static stub to v6's pbjs that can be used as a reference: https://github.com/dcodeIO/protobuf.js/blob/master/cli/targets/static.js
I also made sure that built-in code generation can be reused to write encode/decode functions on top of static code. See Type#decode / Type#encode for an example on how to bind a scope and make it output a function.
If you have any suggestions or want to tackle it, let me know!
There have been quite a lot of requests for static code generation in the past. Personally, I'd not absolutely require it with v6's built-in codegen, but there certainly are valid use cases where having actual code to reference makes sense (i.e. when using TypeScript).
I know that a few people already started working on something for v5, so I added a static stub to v6's pbjs that can be used as a reference: https://github.com/dcodeIO/protobuf.js/blob/master/cli/targets/static.js
I also made sure that built-in code generation can be reused to write encode/decode functions on top of static code. See Type#decode / Type#encode for an example on how to bind a scope and make it output a function.
If you have any suggestions or want to tackle it, let me know!