Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork430
Description
I’m pretty close to building a Rust version of the extractor using SWC.
Therecent changes finally closed the gap between the Babel macro and SWC, so they’re now at feature parity. That was the hardest part, since most of the heavy lifting actually happens inside the macro itself.
When I say “extractor”, I don’t mean a full CLI rewrite. I’m talking only about the part that analyzes source files and extracts messages — the bit that’s currently done by Babel.
The idea is to ship the Rust extractor as a separate package at first, alongside the existing Babel one. After some real-world testing, it could become the default, while keeping the Babel extractor around for Vue and other JS-based setups.
To get there, we’d need to port@lingui/babel-plugin-extract-messages to Rust. The plugin is pretty small (~400 LOC), and I think an LLM could handle most of that work without much trouble.
After that, we can build a small Rust program on top of SWC, bake in all the required transforms, compile it into a single binary, and expose it to Node.js usingnapi-rs. In the end, this would just be a prebuilt binary with one job: extract messages.