The tool like Browserslist, but written in Rust.

Overview

browserslist-rs

The tool like Browserslist, but written in Rust.

Try it out

Before trying this crate, you're required to get Rust installed. Then, clone this repository.

Now, you can try and inspect query result by running example with Cargo:

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`

To get more help, you can run:

cargo run --example inspect -- -h

Limitations

The features below aren't supported currently:

  • Custom usage like > 0.5% in my stats or > 0.5% in XX.
  • Custom usage like cover 99.5% in my stats or cover 99.5% in XX.
  • Extending custom config like extends browserslist-config-mycompany.
  • Specifying feature name like supports es6-module.

License

MIT License

Copyright (c) 2021-present Pig Fang

Comments
  • Could you please expose caniuse mod?

    Could you please expose caniuse mod?

    Thanks for what you did for this project, we are planing to port the autoprefixer in rust, we found this project which is super nice. but the caniuse mod is not expose, so i am wonder if you are willing to expose it?

    opened by IWANABETHATGUY 7
  • Does `target.'cfg(target =

    Does `target.'cfg(target = "wasm32-unknown-unknown")'.dependencies` work?

    Context: https://github.com/nextest-rs/nextest/issues/499

    The author said

    I checked and target is definitely not supported by Cargo -- it always evaluates to false

    So I'm not sure if it's working. The official cargo doc

    If it's working, I'll reopen the issue above

    opened by kdy1 5
  • Move to Browserslist org

    Move to Browserslist org

    Do you want to move your repo to Browserslist, org? It will show an official level of your amazing project?

    You will be still main maintainer and I will ask only for queries compatibility (which is already OK).

    opened by ai 4
  • Wasm module not contain all data, as rust package

    Wasm module not contain all data, as rust package

    Thanks for your work.

    I am not a Rust developer, so I apologize in advance if the problem and question are stupid.

    I am trying to use this library to made web page with wasm module (for fun). Wasm module works, you can check results here (it is draft, no design) - https://browserlist.leopard.in.ua/ (repo here - https://github.com/le0pard/browserlist )

    Looks like problem the same, as I mentioned in https://github.com/g-plane/browserslist-rs/issues/4#issue-1074920938 - library return versions without browser names.

    image

    In cargo run --example inspect -- <query> everything works correctly.

    rustc version - 1.57.0 (f1edd0429 2021-11-29) browserslist-rs taken from HEAD - https://github.com/le0pard/browserlist/blob/main/browserslist-wasm/Cargo.toml#L17

    Build you can see here: https://github.com/le0pard/browserlist/runs/4598534242?check_suite_focus=true (used wasm-pack)

    Is this possible, that wasm-pack doing some optimisation and remove from wasm package data, which package need for work?

    Thanks for help.

    opened by le0pard 3
  • Using newer chrono features without depending on a new enough chrono

    Using newer chrono features without depending on a new enough chrono

    You're using Utc.with_ymd_and_hms https://github.com/browserslist/browserslist-rs/blob/1abf8eeb95516442b73b86ffaaacbae22ae0b085/src/queries/since.rs#L10

    while depending on just Chrono >=0.4 https://github.com/browserslist/browserslist-rs/blob/1abf8eeb95516442b73b86ffaaacbae22ae0b085/Cargo.toml#L55

    but that method was added relatively recently on Nov 9 https://github.com/chronotope/chrono/commit/7ba090d484cb93f73e5a7803dd62e4c4295f3b50 and is only included in chrono 0.4.23 and newer.

    opened by tv42 2
  • feat: support wasi by tweaking cfg attributes

    feat: support wasi by tweaking cfg attributes

    Adds support for wasi. Previously the crate could be compiled to wasi, but still relied on wasm-bindgen to check for the current node environment so it could not be used outside of a JS runtime.

    I am making this PR to try to get swc, which depends on this crate, to run to wasi but this is a blocking issue. I might not be considering some use case but I'm willing to make any requested changes :)

    opened by zebp 2
  • Browserslist wasm with web interface

    Browserslist wasm with web interface

    Hello.

    I am have idea to build browserslist wasm with web interface, which will work even offline (by using service worker). I found your project and I want to thanks for great job.

    I am start build wasm module based on your library, but now find out you also doing some work with it too (based on commits). I decided to ask, maybe you have similar idea and in this case I don't need waste time on this. Or maybe you working on the wasm module for some different needs (maybe it will be published as npm package)?

    P.S. Big thanks for code. I did try to load rust was module, but looks like it return names only for firefox browsers:

      import init, {browserslist} from './../browserslist-wasm/pkg'
    
      init().then(() => {
        console.log(browserslist('>1%, Firefox ESR, not dead, not ie 11, not op_mini all'))
      })
    

    I uploaded code here (if you want check yourself): https://github.com/le0pard/browserlist

    Screenshot 2021-12-09 at 01 01 21

    opened by le0pard 2
  • refactor(cargo): remove unused features

    refactor(cargo): remove unused features

    This PR removes serde-serialize from wasm-bindgen:

    For the context, it is depreacted https://github.com/rustwasm/wasm-bindgen/pull/3031 and it is one of the culprit causes tricky circular dependency issue https://github.com/tkaitchuck/aHash/issues/95.

    Alternative recommendation is to use serde-wasm-bindgen, which seems already being used and looks like serde-serialize is not being used anyway.

    opened by kwonoj 0
  • Compress data

    Compress data

    Binaries including are very large because there are many repetitions of browser names:

    Bildschirmfoto 2022-06-02 um 12 01 31

    caniuse-lite uses some mechanisms to compress the database:

    • https://github.com/browserslist/caniuse-lite#why
    • For example https://unpkg.com/browse/[email protected]/data/browserVersions.js
    opened by mischnic 0
Releases(v0.12.3)
Owner
Pig Fang
❤️ 🐷
Pig Fang
Freebsd-embedded-hal - Like linux-embedded-hal but FreeBSD

freebsd-embedded-hal Implementation of embedded-hal traits for FreeBSD devices: gpio: using libgpio, with stateful and toggleable support, with suppor

null 2 Oct 1, 2022
Booru software for the 21st century. (Name is supposed to be like Puro, the big monster, but I failed..)

Pooru Booru software for the 21st century. Setup Setup is a little funky, but I hope to fix this funkyness down the road. First and foremost, you will

null 2 May 8, 2022
A lightweight distributed message queue. Like AWS SQS and RSMQ but on Postgres.

Postgres Message Queue (PGMQ) A lightweight distributed message queue. Like AWS SQS and RSMQ but on Postgres. Features Lightweight - Built with Rust a

Tembo 15 Jul 25, 2023
It's like Circus but totally different.

Read I do not know Rust. If you see something that is being done in a suboptimal way at a language-level, I'd love to hear it. If you want to argue ab

zkxjzmswkwl 4 Oct 5, 2023
A lightning fast version of tmux-fingers written in Rust, copy/pasting tmux like vimium/vimperator

tmux-thumbs A lightning fast version of tmux-fingers written in Rust for copy pasting with vimium/vimperator like hints. Usage Press ( prefix + Space

Ferran Basora 598 Jan 2, 2023
A Polkadot SDK-like state machine written from scratch in Rust.

Rust State Machine This repository is the basis for a tutorial teaching how to develop a simple state machine using Rust. Goal The goal of this tutori

Shawn Tabrizi 10 Nov 29, 2023
Catify, but built in rust

A simple project to prettify commit messages NOW IN RUST! Commit messages are good. They provide information about tons of things. But far too many co

Alecto Irene Perez 2 Oct 20, 2021
A simplified but faster version of Routerify

Routerify lite Routerify-lite is a simplified but faster version of Routerify. It only provides below functions: path matching error handling Why not

jinhua luo 7 Dec 30, 2022
Fibonacci, but different

n-days Fibonacci, but different? Problem You're given a workout in the 12 Days of Christmas style: 1. Burpee Bar Muscle-Up 2. Thrusters 3. Power Clean

Phillip Copley 0 Dec 24, 2021
rz-pipes, but with UNIX pipes. Replace a rizin command

rz-fluid rz-pipes, but with UNIX pipes. Replace a rizin command such as pdg @ $(is~mag[1]) with is~mag[1] | pdg @. Example cargo r -- --bin ../dump109

wcampbell 1 Jan 11, 2022
Bongo Copy Cat wants to be involved in everything you do but instead just imitates you hitting your keyboard all day. After all it's just a cat.

Bongo Copy Cat Introduction Bongo Copy Cat wants to be involved in everything you do but instead just imitates you hitting your keyboard all day. Afte

Abhijeet Singh 4 Jan 23, 2023
cargo-expand, but with Hygiene [WIP]

cargo-hexpand cargo-expand, but with Hygiene*. *Still very WIP. The problem cargo-expand works well, but it does not respect hygiene when expanding th

Sasha Pourcelot 20 Aug 9, 2023
Golang like WaitGroup implementation for sync/async Rust.

wg Golang like WaitGroup implementation for sync/async Rust.

Al Liu 8 Dec 6, 2022
Stopwatch lib for rust. Start, pause, reset and lap like any stopwatch.

Chronometer Stopwatch lib for rust. Start, pause, reset and lap like any stopwatch. Nothing special I'm just learning rust. Getting Started Add this l

Naoufel Berrada 2 Sep 29, 2022
Develop an async runtime like thing in Rust for educational purpose.

How-not-to-async-rs Develop an async runtime like thing in Rust for educational purpose. What this is not This is not going to be a blog post explaini

Arun Muralidharan 28 May 11, 2024
hado-rshado — A little macro for writing haskell-like do expressions without too much ceremony

hado Monadic haskell-like expressions brought to rust via the hado! macro What? A little macro for writing haskell-like do expressions without too muc

Lucas David Traverso 44 Jul 31, 2022
Convert number like 42 to forty-two

num2words Convert number like 42 to forty-two Usage This crate can be either used as a library or a binary. Library Example usage: use num2words::Num2

Asperatus 5 Mar 30, 2022
A Raycast/Spotlight like app shell using tauri

Tauri Shell This repo can be used as reference for building alfred/raycast/spotlight apps using Tauri. Usage This reference repository is using Svelte

Shivaprasad Bhat 6 Oct 27, 2022
Proc. macro to generate C-like `enum` tags.

Continuous Integration Documentation Crates.io #[derive(EnumTag)] This crate provides a proc. macro to derive the EnumTag trait for the given Rust enu

Robin Freyler 5 Mar 27, 2023