Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.0] Moving away from JavaScript implementation #255

Open
thesayyn opened this issue Mar 1, 2024 · 1 comment
Open

[1.0] Moving away from JavaScript implementation #255

thesayyn opened this issue Mar 1, 2024 · 1 comment
Assignees
Labels
help wanted Extra attention is needed needs discussion A issue needs discussion and community interest
Milestone

Comments

@thesayyn
Copy link
Owner

thesayyn commented Mar 1, 2024

What is happening with Rust implementation

In summary, protoc-gen-ts continues to generate TypeScript code from proto files. However, there has been a shift from TypeScript to Rust in the project. This change is explained in more detail in the accompanying issue for the switch, citing reasons for the transition.

Implementation of protoc-gen-ts in JavaScript

  • javascript was hard to maintain and test due to slowness of tsc
  • the typescript package a peer dependency of protoc-gen-ts which broke the plugin if a wrong version was used. See npm package needs publishing to include fix for typescript >= 5 #225 It fails on Windows #86
  • generation speed of protoc-gen-ts was affected by NodeJS runtime performance.
  • depending on the typescript ast limited us is number of ways
  • it was impossible to get concurrency into the plugin.
  • javascript implementation did not pass the protobuf conformance tests.
  • typescript wasn't truly type safe

Implementation of protoc-gen-ts in Rust

  • concurrency built into the plugin
  • utilizing swc/ast APIs instead of tsc/ast APIs.
  • blazingly fast and easy to test
  • successfully passes conformance tests
  • truly type safe
  • capable of emitting both JS and TS thanks to swc.
  • eliminated whole class of issues that caused by NodeJS

Note

the plugin written is javascript is still the latest version published in npm, and it will stay that way for a while to avoid breaking people's code.
you can try out the protoc-gen-ts written in rust by running npm install @thesayyn/[email protected]

Caution

However, the protoc-gen-ts using Rust as its programming language should not affect the users, they will continue installing the plugin protoc-gen-ts.
But beware that protoc-gen-ts switching to Rust changed the emitted code in number of ways, please try the new plugin and report the issues back.

@thesayyn
Copy link
Owner Author

thesayyn commented Mar 1, 2024

Rolling releases of protoc-gen-ts with Rust can be found here: https://github.com/thesayyn/protoc-gen-ts/pkgs/npm/protoc-gen-ts

@thesayyn thesayyn added help wanted Extra attention is needed needs discussion A issue needs discussion and community interest labels Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed needs discussion A issue needs discussion and community interest
Projects
None yet
Development

No branches or pull requests

1 participant