docs/development-guide/coding-style.md
We recommend to follow these guidelines when writing code for rolldown. They aren't very strict rules since we want to be flexible and we understand that under certain circumstances some of them can be counterproductive. Just try to follow as many of them as possible:
We tend to follow the suggestions of Rust API Guidelines. They are authored largely by the Rust library team, based on experiences building the Rust standard library and other crates in the Rust ecosystem.
We understand that there are cases that rules don't apply, but you should try to follow them as much as possible.
Examples:
Resolver and ResolverConfig, the file should be named resolver.rs, because Resolver is the main struct implemented in that file.ResolverConfig, the file should be named resolver_config.rs not config.rs.bundler.rs into bundler/bundler.rs instead of bundler/mod.rs.Motivation:
When you're reasoning rolldown's codebase, you often think in terms of structs, functions, and traits. If file names correspond directly to struct names, it becomes much easier to locate the relevant code quickly. This is especially helpful in a large codebase like rolldown, where you might have many files and modules.
In general, we have two environments for running different purposes of tests. See Testing for more information.
We enquire that you should first considering adding tests in Rust side, because
You could consider adding tests in Node.js with the following reasons:
rolldown package itself.