跪拜 Guibai
← Back to the summary

Astro 7 Ships a Full Rust Toolchain, Replacing Go Across Compiler, Bundler, and Markdown

Rust Beats Go Again, Astro 7 Debuts — What Does "Everything Can Be Rustified" Mean?

👇 Today's Headlines

Breaking information barriers, getting closer to global frontend. Hello everyone, I'm Lin Yubing.

Rust literally translates to "rust." Rewriting software from other languages in Rust is jokingly called "rustification" (Rustify).

In frontend infrastructure, tech stacks originally based on Go are gradually being "rustified" by Rust. Rust increasingly shows a trend of "dimensional strike" against the Go language:

Now, the Astro team has officially announced the release of its 7th major version. The biggest upgrade is that the compiler, originally implemented in Go, has also been "rustified" into a Rust-rewritten compiler...

image.png

The extreme performance of the Markdown engine and compiler is the biggest highlight of Astro 7. Let's take a look at how Rust "rustifies" Astro, making it the fastest version in history.

👉 New Rust Compiler

Astro 7 adopts a new compiler rewritten in Rust, replacing the previous Go-based compiler, to compile .astro format components with high performance.

The Rust compiler is based on Evan You's Oxc compiler under the hood, and uses Lightning CSS to handle CSS scoping — the CSS preprocessor Vite will adopt by default in the future. These are all tools that have already been "rustified" by Rust.

image.png

The new Rust compiler is currently largely backward-compatible with the old Go compiler, except for the following special cases:

For example, line breaks between inline elements no longer produce visible spaces:

image.png

The Rust compiler also follows Rolldown's model, publishing native binaries for different platforms, with a WASM (WebAssembly) fallback.

👉 Rust-Powered Vite 8

Astro 7 upgrades from Vite 7 to Vite 8, a revolutionary version of Vite because Vite 8 integrates the Rust-based Rolldown + Oxc under the hood, replacing the Go-based esbuild + rollup.

image.png

Rolldown's plugin system is compatible with the rollup API, but its speed is at least 10 times faster, up to 30 times.

Vite 8 includes a compatibility layer that can automatically convert legacy esbuild and rollupOptions configurations into Rolldown's equivalent configuration.

Therefore, after Astro 7 adopts Vite 8, most projects can upgrade seamlessly without changing configurations, directly enjoying faster build speeds.

👉 Markdown Rustification

Using Rust to rewrite frontend infrastructure might not be surprising anymore, but now more general development tech stacks are also starting to be "rustified."

Astro 7 defaults to using satteri as the processing pipeline for Markdown and MDX, which is also a Rust-based processor.

image.png

Under the hood, satteri uses pulldown-cmark to parse CommonMark syntax, and Oxc to parse MDX extended expressions. These are all Rust native libraries with astonishing performance.

But performance is not the only advantage. Some previously pluggable features are now directly implemented in Rust as built-in features, such as GitHub-flavored Markdown syntax, which no longer requires extra plugins.

For non-default features, you can configure whether to enable them in astro.config.js:

image.png

Furthermore, Astro's Markdown processing pipeline was originally based on unified, involving plugins from the Markdown ecosystem like remark and rehype. Not all of these plugins have been rewritten in Rust yet.

But you can implement them using satteri's plugin API, or use the original JS processing pipeline:

image.png

In fact, the performance improvement brought by Astro's new Rust compiler is not the main point. As a top-5 SSG (Static Site Generator) on GitHub, the performance improvement from rustifying the Markdown ecosystem is even more significant.

Taking the build of Astro's official documentation as an example, in isolation, the new Rust compiler's build speed improved by about 6% compared to the old Go compiler, because .astro compilation is generally not the performance bottleneck. Processing large amounts of Markdown is the real performance killer.

Now, Astro's Markdown processor has also been rustified. Combined with the Rust compiler, the superposition of both performances is even more obvious. Moreover, as website scale increases, sites using more Markdown will see more significant performance improvements.

👇 Key Summary

The Astro team officially announced the release of Astro 7, in which a large amount of Go and JS infrastructure has been rewritten in Rust ("rustified"), making it the fastest version in Astro's evolutionary history:

image.png

The Rust industrial revolution continues. This is not only happening in JS/TS-related frontend infrastructure but is also spreading to broader development tech stacks based on other languages like Go, squeezing out native performance to provide programmers with an extremely smooth development experience.

In the future, the mainstream of frontend infrastructure might no longer be "Go vs Rust," but "Go to Rust" (Everything can be rustified).

👍 That's all for this issue of Frontend Daily. If it helped you, feel free to like, check in, recommend, or share.

🙏 To my followers, see you in the next issue, bye bye~~~

cat-thank.gif

👇 References:

Comments

Top 1 from juejin.cn, machine-translated. The original thread is authoritative.

Z哥哈哈哈

1