Skip to content

Let's talk about static code generation #512

@dcodeIO

Description

@dcodeIO

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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions