Browserslist and caniuse checker

v1.0.0
io.github.Lawatch/browserslist-check Checked 4 days ago Published 19 days ago

Exact browsers a browserslist query targets, and whether a CSS/JS feature works in all (caniuse)

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

resolve_browsers Which browsers does this browserslist query target?

Runs the real browserslist (the code Babel, Autoprefixer, PostCSS, Vite, esbuild-plugin-browserslist and SWC use) on a query or on a .browserslistrc / package.json config, with up-to-date caniuse data, and returns the exact browser versions, the share of world (and country) usage they cover, what each part of the query adds or removes, and the traps: dead browsers, Opera Mini, IE, empty result, wrong config section. Use it instead of guessing what "defaults", "> 0.5%", "last 2 versions" or "cover 95%" mean today.

ParameterTypeDescription
configstring | array | objectInstead of query: the text of .browserslistrc, or the value of the "browserslist" key of package.json (string, array, or object with environments like { "production": [...], "development": [...] }).
envstringConfig section to use (like BROWSERSLIST_ENV / NODE_ENV). Default "production", then "defaults".
mobile_to_desktopbooleanSame as the browserslist mobileToDesktop option (used by Babel and Autoprefixer through their own settings).
package_jsonobject | stringInstead of query/config: the whole package.json; its "browserslist" key is read.
querystring | arrayA browserslist query, e.g. "> 0.5%, last 2 versions, not dead" or ["defaults", "not op_mini all"]. Wins over config.
regionstringOptional country code ("US", "FR", "IN") or "alt-eu", "alt-as"… to also get usage shares there.

check_support Can I use this web feature with my browserslist targets?

For one or more web features (caniuse ids or names: "css-has", ":has", "structuredClone", "dialog", "container queries", "fetch", "es6-module"…), checks every target browser version from the query/config with the caniuse data: fully supported, partial, needs a vendor prefix, behind a flag, or missing; which browsers fail and their usage share; the first version with full support per browser; and a plain verdict. Use it before using a modern CSS/JS/HTML feature, or to decide if a polyfill or fallback is needed.

ParameterTypeDescription
features *array | stringcaniuse feature ids or names. A name that matches several features returns the candidates.
configstring | array | objectInstead of query: the text of .browserslistrc, or the value of the "browserslist" key of package.json (string, array, or object with environments like { "production": [...], "development": [...] }).
envstringConfig section to use (like BROWSERSLIST_ENV / NODE_ENV). Default "production", then "defaults".
mobile_to_desktopbooleanSame as the browserslist mobileToDesktop option (used by Babel and Autoprefixer through their own settings).
package_jsonobject | stringInstead of query/config: the whole package.json; its "browserslist" key is read.
querystring | arrayA browserslist query, e.g. "> 0.5%, last 2 versions, not dead" or ["defaults", "not op_mini all"]. Wins over config.
regionstringOptional country code ("US", "FR", "IN") or "alt-eu", "alt-as"… to also get usage shares there.

find_feature Find the caniuse id of a web feature

Searches the caniuse feature list (id and title) and returns the matching ids with their world support share. Use it to get the right id for check_support or for a "supports <feature>" browserslist query.

ParameterTypeDescription
query *stringWords, e.g. "subgrid", "view transitions", "webp".
limitinteger