browserslist-rs 0.7.0

Rust-ported Browserslist.

browserslist-rs is a Rust-based implementation of Browserslist.


This library bundles Can I Use data, Electron versions list and Node.js releases list, so it won't and doesn't need to access any data files.

Except several non-widely/non-frequently used features, this library works as same as the JavaScript-based implementation Browserslist.


It provides a simple API for querying which accepts a sequence of strings and options [Opts], then returns the result.

use browserslist::{Distrib, Opts, resolve, Error};

let distribs = resolve(["ie <= 6"], &Opts::new()).unwrap();
assert_eq!(distribs[0].name(), "ie");
assert_eq!(distribs[0].version(), "6");
assert_eq!(distribs[1].name(), "ie");
assert_eq!(distribs[1].version(), "5.5");

resolve(["yuru 1.0"], &Opts::new()),

The result isn't a list of strings, instead, it's a tuple struct called [Distrib]. If you need to retrieve something like JavaScript-based implementation of Browserslist, you can convert them to strings:

use browserslist::{Distrib, Opts, resolve, Error};

let distribs = resolve(["ie <= 6"], &Opts::new()).unwrap();
distribs.into_iter().map(|d| d.to_string()).collect::<Vec<_>>(),
vec![String::from("ie 6"), String::from("ie 5.5")]


This crate can be compiled as WebAssembly, without configuring any features manually.

Please note that browser and Deno can run WebAssembly, but those environments aren't Node.js, so you will receive an error when querying current node in those environments.


If you're going to use this crate in a Node.js addon via N-API directly or indirectly, we've supported for it. You just need to enable the node feature.

If you're targeting Node.js, we recommend you to use N-API over WebAssembly, because it's faster and less-limited than the WebAssembly-build.