Skip to content

oxc-project/oxc-browserslist

Repository files navigation

Crates.io Docs.rs

MIT licensed Build Status Code Coverage CodSpeed Badge Sponsors Discord chat

oxc-browserslist

Rust port of Browserslist, forked from browserslist-rs.

The original crate did not meet the criteria of oxc, the following changes are made:

  • reduced compilation speed from one minute to a few seconds
  • improved some runtime performance, e.g. improve sort method, precompute versions
  • removed all unnecessary, heavy or slow dependencies: nom, time, ahash, chrono, either, indexmap, itertools, once_cell, string_cache
  • reduced binary size through data compression. 863K (this crate) vs 3.2M (original crate).

Usage

See docs.rs/oxc-browserslist.

Limitation

Only custom usage is not supported: > 0.5% in my stats or cover 99.5% in my stats.

Example

Inspect query result by running the example:

cargo run --example inspect -- <query>

You can also specify additional options, for example:

cargo run --example inspect -- --mobile-to-desktop 'last 2 versions, not dead'

Testing

Unit and Integration Tests

cargo test

Property-Based Testing

Property-based tests generate random queries and compare results with the npm browserslist CLI.

# Install npm browserslist first
pnpm install

# Run property-based tests
cargo test --test proptest

Fuzzing

Fuzzing tests use libFuzzer to find edge cases.

# Install cargo-fuzz
cargo install cargo-fuzz

# Run the fuzzer
cd fuzz
cargo +nightly fuzz run fuzz_resolve

My sponsors

About

Rust port of browserslist

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Contributors 14