Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of supported browsers? #20

Closed
patricklafrance opened this issue Aug 24, 2023 · 4 comments
Closed

List of supported browsers? #20

patricklafrance opened this issue Aug 24, 2023 · 4 comments

Comments

@patricklafrance
Copy link

I am implementing a function to convert browserslist results to SWC targets, similar to https://github.com/marcofugaro/browserslist-to-esbuild/tree/main. I keep getting error messages like the following:

thread '<unnamed>' panicked at 'not implemented: Targets: {"bb": Query(Single("7")), "ie": Query(Single("5.5")), "edge": Query(Single("106")), "firefox": Query(Single("107")), "opera": Query(Single("92")), "android": Query(Single("115")), "chrome": Query(Single("107")), "samsung": Query(Single("12")), "safari": Query(Single("15.2"))}', C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\preset_env_base-0.4.5\src\query.rs:124:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
assets by status 1.1 KiB [cached] 2 assets
./src/index.ts 39 bytes [built] [code generated] [1 error]

I get these error messages from SWC but from my understanding SWC is delegating this to browserslist-rs.

I was wondering what targets does browserlist-rs support?

For example, "baidu", "kaios" and "bb" seems to be supported by the original browserslist tool but not by browserlist-rs.

Thank you!

Patrick

@g-plane
Copy link
Member

g-plane commented Aug 24, 2023

Look at this function:

fn encode_browser_name(name: &str) -> u8 {

@patricklafrance
Copy link
Author

patricklafrance commented Aug 24, 2023

Thank you for the quick answer, appreciated 🙏🏻

@patricklafrance
Copy link
Author

patricklafrance commented Aug 25, 2023

I hope it's fine if I ask here @g-plane, instead of on the SWC repository. I noticed that you are a contributor to both projects.

Do you have any idea why when I provide a target to SWC for any of the following browsers: "ios_saf", "op_mini", "bb", "ie_mob", "and_uc", "and_qq", "baidu", "kaios", I get an error similar to this?

ERROR in ./src/index.ts
Module build failed (from ./node_modules/.pnpm/swc-loader@0.2.3_@swc+core@1.3.78_webpack@5.88.2/node_modules/swc-loader/src/index.js):
Error: failed to handle: not implemented: Targets: {"samsung": Query(Single("12")), "edge": Query(Single("106")), "kaios": Query(Single("2.5")), "and_qq": Query(Single("13.1")), "ie_mob": Query(Single("10")), "op_mob": Query(Single("73")), "chrome": Query(Single("107")), "safari": Query(Single("15.2")), "opera": Query(Single("92")), "and_ff": Query(Single("115")), "and_uc": Query(Single("15.5")), "ie": Query(Single("5.5")), "and_chr": Query(Single("115")), "baidu": Query(Single("13.18")), "bb": Query(Single("7")), "firefox": Query(Single("107")), "ios_saf": Query(Single("15.2")), "android": Query(Single("115")), "op_mini": Query(Single("all"))}

According to this list: browserslist-rs/build.rs, they are all supported by browserslist-rs.

The following env.targets result in the previous error:

{
   env: {
      targets: {
        and_chr: '115',
        and_ff: '115',
        and_qq: '13.1',
        and_uc: '15.5',
        android: '115',
        baidu: '13.18',
        bb: '7',
        chrome: '107',
        edge: '106',
        firefox: '107',
        ie: '5.5',
        ie_mob: '10',
        ios_saf: '15.2',
        kaios: '2.5',
        op_mini: 'all',
        op_mob: '73',
        opera: '92',
        safari: '15.2',
        samsung: '12'
     }
   }
}

While the following is fine:

{
   env: {
      targets: {
         and_chr: '115',
         and_ff: '115',
         android: '115',
         chrome: '107',
         edge: '106',
         firefox: '107',
         ie: '5.5',
         op_mob: '73',
         opera: '92',
         safari: '15.2',
         samsung: '12'
      }
   }
}

Thank you,

Patrick

@g-plane
Copy link
Member

g-plane commented Aug 25, 2023

If you've installed Rust development environment, you can clone this repository and check your query with the command below:

cargo run --example inspect -- <query>

If it outputs result successfully, it means "browserslist-rs" works, then you need to consult SWC because they do additional transformations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants