Support `@bufbuild/protobuf`
Add support for @bufbuild/protobuf runtime
This PR adds support for generating service definitions compatible with the @bufbuild/protobuf runtime, a popular and conformant protobuf implementation.
What this PR does:
Adds a new plugin option called runtime to select the protobuf runtime. Supported values are bufbuild-protobuf and defaults to use google-protobuf. When the runtime is set to bufbuild-protobuf, the plugin generates service definitions that use @bufbuild/protobuf's message types and serialization methods instead of the default runtime.
Why this change?
@bufbuild/protobuf supports Editions and passes significantly more conformance tests than currently supported runtimes, ensuring better protocol buffer compatibility.
Usage
Alongside grpc-tools, users will need to install @bufbuild/protoc-gen-es and change the grpc_tools_node_protoc call to use the new runtime and use the protoc-gen-es:
npm install -g grpc-tools @bufbuild/protoc-gen-es
grpc_tools_node_protoc --es_out=target=js,js_import_style=legacy_commonjs:../helloworld/static_codegen_es/ --grpc_out=grpc_js,runtime=bufbuild-protobuf:../helloworld/static_codegen_es/ helloworld.proto
Alternatives
Happy to discuss other options like a separate runtime package or plugin package. Having either of those will also bring TypeScript and ESM support.
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: timostamm / name: Timo Stamm (fc392e920f4fa2618041857945407378dea3fecf)
- :white_check_mark: login: srikrsna-buf / name: Sri Krishna (40b50ff3b01ac211000fc0929185d4cf1f6c0d1b, 403a11151a81fd4c93dc539ec8268f92aee0ebfc, 80cb5379a75961517c13473fced90c013d77de4e, 34f253276593a511e8ea7be0c75065de6bbc3daa)
Hi any chance this will be reviewed? It would be great to have support for buf!