Git Product home page Git Product logo

caniuse-lite's Introduction

Browserslist Cult Of Martians

Browserslist logo by Anton Popov

The config to share target browsers and Node.js versions between different front-end tools. It is used in:

All tools will find target browsers automatically, when you add the following to package.json:

  "browserslist": [
    "defaults and fully supports es6-module",
    "maintained node versions"
  ]

Or in .browserslistrc config:

# Browsers that we support

defaults and fully supports es6-module
maintained node versions

Developers set their version lists using queries like last 2 versions to be free from updating versions manually. Browserslist will use caniuse-lite with Can I Use data for this queries.

You can check how config works at our playground: browsersl.ist

browsersl.ist website

Sponsored by Evil Martians  Supported by Cube

Table of Contents

Sponsors

Browserslist needs your support. We are accepting donations at Open Collective.

Sponsored by Springer Nature Technology      Sponsored by Workleap

Tools

Analyze your Browserslist Config

  • Run npx browserslist in your project directory to see project’s target browsers. This CLI tool is built-in and available in any project with Autoprefixer.
  • browserslist-lint checks your config for popular mistakes.

Update caniuse-lite

Show “We do not support your browser” Banner

Get Statistics for >5% in my stats:

Others

Text Editors

These extensions will add syntax highlighting for .browserslistrc files.

Best Practices

  • There is a defaults query, which gives a reasonable configuration for most users:

      "browserslist": [
        "defaults"
      ]
  • If you want to change the default set of browsers, we recommend including last 2 versions, not dead, > 0.2%. This is because last n versions on its own does not add popular old versions, while only using a percentage of usage numbers above 0.2% will in the long run make popular browsers even more popular. We might run into a monopoly and stagnation situation, as we had with Internet Explorer 6. Please use this setting with caution.

  • Select browsers directly (last 2 Chrome versions) only if you are making a web app for a kiosk with one browser. There are a lot of browsers on the market. If you are making general web app you should respect browsers diversity.

  • Don’t remove browsers just because you don’t know them. Opera Mini has 100 million users in Africa and it is more popular in the global market than Microsoft Edge. Chinese QQ Browsers has more market share than Firefox and desktop Safari combined.

Queries

Browserslist will use browsers and Node.js versions query from one of these sources:

  1. .browserslistrc config file in current or parent directories.
  2. browserslist key in package.json file in current or parent directories.
  3. browserslist config file in current or parent directories.
  4. BROWSERSLIST environment variable.
  5. If the above methods did not produce a valid result Browserslist will use defaults: > 0.5%, last 2 versions, Firefox ESR, not dead.

Query Composition

An or combiner can use the keyword or as well as ,. last 1 version or > 1% is equal to last 1 version, > 1%.

and query combinations are also supported to perform an intersection of all the previous queries: last 1 version or chrome > 75 and > 1% will select (browser last version or Chrome since 76) and more than 1% marketshare.

There are 3 different ways to combine queries as depicted below. First you start with a single query and then we combine the queries to get our final list.

Obviously you can not start with a not combiner, since there is no left-hand side query to combine it with. The left-hand is always resolved as and combiner even if or is used (this is an API implementation specificity).

Query combiner type Illustration Example
or/, combiner
(union)
Union of queries > .5% or last 2 versions
> .5%, last 2 versions
and combiner
(intersection)
intersection of queries > .5% and last 2 versions
not combiner
(relative complement)
Relative complement of queries These three are equivalent to one another:
> .5% and not last 2 versions
> .5% or not last 2 versions
> .5%, not last 2 versions

A quick way to test your query is to do npx browserslist '> 0.3%, not dead' in your terminal.

Full List

You can specify the browser and Node.js versions by queries (case insensitive):

  • defaults: Browserslist’s default browsers (> 0.5%, last 2 versions, Firefox ESR, not dead).
  • By usage statistics:
    • > 5%: browsers versions selected by global usage statistics. >=, < and <= work too.
    • > 5% in US: uses USA usage statistics. It accepts two-letter country code.
    • > 5% in alt-AS: uses Asia region usage statistics. List of all region codes can be found at caniuse-lite/data/regions.
    • > 5% in my stats: uses custom usage data.
    • > 5% in browserslist-config-mycompany stats: uses custom usage data from browserslist-config-mycompany/browserslist-stats.json.
    • cover 99.5%: most popular browsers that provide coverage.
    • cover 99.5% in US: same as above, with two-letter country code.
    • cover 99.5% in my stats: uses custom usage data.
  • Last versions:
    • last 2 versions: the last 2 versions for each browser.
    • last 2 Chrome versions: the last 2 versions of Chrome browser.
    • last 2 major versions or last 2 iOS major versions: all minor/patch releases of last 2 major versions.
  • dead: browsers without official support or updates for 24 months. Right now it is IE 11, IE_Mob 11, BlackBerry 10, BlackBerry 7, Samsung 4, OperaMobile 12.1 and all versions of Baidu.
  • Node.js versions:
    • node 10 and node 10.4: selects latest Node.js 10.x.x or 10.4.x release.
    • last 2 node versions: select 2 latest Node.js releases.
    • last 2 node major versions: select 2 latest major-version Node.js releases.
    • current node: Node.js version used by Browserslist right now.
    • maintained node versions: all Node.js versions, which are still maintained by Node.js Foundation.
  • Browsers versions:
    • iOS 7: the iOS browser version 7 directly. Note, that op_mini has special version all.
    • Firefox > 20: versions of Firefox newer than 20. >=, < and <= work too. It also works with Node.js.
    • ie 6-8: selects an inclusive range of versions.
    • Firefox ESR: the latest Firefox Extended Support Release.
    • PhantomJS 2.1 and PhantomJS 1.9: selects Safari versions similar to PhantomJS runtime.
  • extends browserslist-config-mycompany: take queries from browserslist-config-mycompany npm package.
  • By browser support:
    In these example queries es6 and es6-module are the the feat parameter from the URL of the Can I Use page. A list of all available features can be found at caniuse-lite/data/features.
    • fully supports es6: browsers with full support for specific features. For example, fully supports css-grid will omit Edge 12-15, as those browser versions are marked as having partial support.
    • partially supports es6-module or supports es6-module: browsers with full or partial support for specific features. For example, partially supports css-grid will include Edge 12-15 support, as those browser versions are marked as having partial support.
  • browserslist config: the browsers defined in Browserslist config. Useful in Differential Serving to modify user’s config like browserslist config and fully supports es6-module.
  • since 2015 or last 2 years: all versions released since year 2015 (also since 2015-03 and since 2015-03-10).
  • unreleased versions or unreleased Chrome versions: alpha and beta versions.
  • not ie <= 8: exclude IE 8 and lower from previous queries.

You can add not to any query.

Grammar Definition

There is a grammar specification about the query syntax, which may be helpful if you're implementing a parser or something else.

Debug

Run npx browserslist in a project directory to see which browsers were selected by your queries.

$ npx browserslist
and_chr 61
and_ff 56
and_qq 1.2
and_uc 11.4
android 56
baidu 7.12
bb 10
chrome 62
edge 16
firefox 56
ios_saf 11
opera 48
safari 11
samsung 5

Browsers

The following table maps browser names & their target devices into identifiers used by browserslist.

Browser Name Desktop Android iOS Other Mobile
Android (WebView) Android
Baidu Baidu
BlackBerry BlackBerry bb
Chrome Chrome ChromeAndroid and_chr ↪︎ ios_saf2
Edge Edge ↪︎ and_chr ↪︎ ios_saf2
Electron Electron
Firefox Firefox ff FirefoxAndroid and_ff ↪︎ ios_saf2
Internet Explorer Explorer ie ie_mob
Node.js Node
KaiOS Browser kaios
Opera Opera op_mob 1 ↪︎ ios_saf2
Opera Mini3 OperaMini op_mini
QQ browser and_qq
Safari Safari iOS ios_saf
Samsung Internet Samsung
UC Browser UCAndroid and_uc
  • ↪︎ name implies that the browser uses the same engine captured by name
  • 1 Opera Mobile ≈ Chrome Android
  • 2 All iOS browsers use WebKit
  • 3 Opera Mini has 2 modes “Extreme” and “High” for data saving. op_mini targets at the “Extreme” one. “High” is compatible with the normal Opera Mobile.

Config File

package.json

If you want to reduce config files in project root, you can specify browsers in package.json with browserslist key:

{
  "private": true,
  "dependencies": {
    "autoprefixer": "^6.5.4"
  },
  "browserslist": [
    "last 1 version",
    "> 1%",
    "not dead"
  ]
}

.browserslistrc

Separated Browserslist config should be named .browserslistrc and have browsers queries split by a new line. Each line is combined with the or combiner. Comments starts with # symbol:

# Browsers that we support

last 1 version
> 1%
not dead # no browsers without security updates

Browserslist will check config in every directory in path. So, if tool process app/styles/main.css, you can put config to root, app/ or app/styles.

You can specify direct path in BROWSERSLIST_CONFIG environment variables.

Shareable Configs

You can use the following query to reference an exported Browserslist config from another package:

  "browserslist": [
    "extends browserslist-config-mycompany"
  ]

For security reasons, external configuration only supports packages that have the browserslist-config- prefix. npm scoped packages are also supported, by naming or prefixing the module with @scope/browserslist-config, such as @scope/browserslist-config or @scope/browserslist-config-mycompany.

If you don’t accept Browserslist queries from users, you can disable the validation by using the or BROWSERSLIST_DANGEROUS_EXTEND environment variable.

BROWSERSLIST_DANGEROUS_EXTEND=1 npx webpack

Because this uses npm's resolution, you can also reference specific files in a package:

  "browserslist": [
    "extends browserslist-config-mycompany/desktop",
    "extends browserslist-config-mycompany/mobile"
  ]

When writing a shared Browserslist package, just export an array. browserslist-config-mycompany/index.js:

module.exports = [
  'last 1 version',
  '> 1%',
  'not dead'
]

You can also include a browserslist-stats.json file as part of your shareable config at the root and query it using > 5% in browserslist-config-mycompany stats. It uses the same format as extends and the dangerousExtend property as above.

You can export configs for different environments and select environment by BROWSERSLIST_ENV or env option in your tool:

module.exports = {
  development: [
    'last 1 version'
  ],
  production: [
    'last 1 version',
    '> 1%',
    'not dead'
  ]
}

Configuring for Different Environments

You can also specify different browser queries for various environments. Browserslist will choose query according to BROWSERSLIST_ENV or NODE_ENV variables. If none of them is declared, Browserslist will firstly look for production queries and then use defaults.

In package.json:

  "browserslist": {
    "production": [
      "> 1%",
      "not dead"
    ],
    "modern": [
      "last 1 chrome version",
      "last 1 firefox version"
    ],
    "ssr": [
      "node 12"
    ]
  }

In .browserslistrc config:

[production]
> 1%
not dead

[modern]
last 1 chrome version
last 1 firefox version

[ssr]
node 12

Custom Usage Data

If you have a website, you can query against the usage statistics of your site. browserslist-ga will ask access to Google Analytics and then generate browserslist-stats.json:

npx browserslist-ga

Or you can use browserslist-ga-export to convert Google Analytics data without giving a password for Google account.

You can generate usage statistics file by any other method. File format should be like:

{
  "ie": {
    "6": 0.01,
    "7": 0.4,
    "8": 1.5
  },
  "chrome": {},}

Note that you can query against your custom usage data while also querying against global or regional data. For example, the query > 1% in my stats, > 5% in US, 10% is permitted.

JS API

const browserslist = require('browserslist')

// Your CSS/JS build tool code
function process (source, opts) {
  const browsers = browserslist(opts.overrideBrowserslist, {
    stats: opts.stats,
    path:  opts.file,
    env:   opts.env
  })
  // Your code to add features for selected browsers
}

Queries can be a string "> 1%, not dead" or an array ['> 1%', 'not dead'].

If a query is missing, Browserslist will look for a config file. You can provide a path option (that can be a file) to find the config file relatively to it.

Options:

  • path: file or a directory path to look for config file. Default is ..
  • env: what environment section use from config. Default is production.
  • stats: custom usage statistics data.
  • config: path to config if you want to set it manually.
  • ignoreUnknownVersions: do not throw on direct query (like ie 12). Default is false.
  • dangerousExtend: Disable security checks for extend query. Default is false.
  • throwOnMissing: throw an error if env is not found. Default is false.
  • mobileToDesktop: Use desktop browsers if Can I Use doesn’t have data about this mobile version. Can I Use has only data about latest versions of mobile browsers. By default, last 2 and_ff versions returns and_ff 90 and with this option it returns and_ff 91, and_ff 90. This option may lead to unknown browser version error (in example Can I Use doesn’t have data for and_ff 91 yet). Default is false.

For non-JS environment and debug purpose you can use CLI tool:

browserslist "> 1%, not dead"

You can get total users coverage for selected browsers by JS API:

browserslist.coverage(browserslist('> 1%'))
//=> 81.4
browserslist.coverage(browserslist('> 1% in US'), 'US')
//=> 83.1
browserslist.coverage(browserslist('> 1% in my stats'), 'my stats')
//=> 83.1
browserslist.coverage(browserslist('> 1% in my stats', { stats }), stats)
//=> 82.2

Or by CLI:

$ browserslist --coverage "> 1%"
These browsers account for 81.4% of all users globally
$ browserslist --coverage=US "> 1% in US"
These browsers account for 83.1% of all users in the US
$ browserslist --coverage "> 1% in my stats"
These browsers account for 83.1% of all users in custom statistics
$ browserslist --coverage "> 1% in my stats" --stats=./stats.json
These browsers account for 83.1% of all users in custom statistics

Environment Variables

If a tool uses Browserslist inside, you can change the Browserslist settings with environment variables:

  • BROWSERSLIST with browsers queries.

    BROWSERSLIST="> 5%" npx webpack
  • BROWSERSLIST_CONFIG with path to config file.

    BROWSERSLIST_CONFIG=./config/browserslist npx webpack
  • BROWSERSLIST_ENV with environments string.

    BROWSERSLIST_ENV="development" npx webpack
  • BROWSERSLIST_STATS with path to the custom usage data for > 1% in my stats query.

    BROWSERSLIST_STATS=./config/usage_data.json npx webpack
  • BROWSERSLIST_DISABLE_CACHE if you want to disable config reading cache.

    BROWSERSLIST_DISABLE_CACHE=1 npx webpack
  • BROWSERSLIST_DANGEROUS_EXTEND to disable security shareable config name check.

    BROWSERSLIST_DANGEROUS_EXTEND=1 npx webpack
  • BROWSERSLIST_ROOT_PATH to prevent reading files above this path.

    BROWSERSLIST_ROOT_PATH=. npx webpack

Cache

Browserslist caches the configuration it reads from package.json and browserslist files, as well as knowledge about the existence of files, for the duration of the hosting process.

To clear these caches, use:

browserslist.clearCaches()

To disable the caching altogether, set the BROWSERSLIST_DISABLE_CACHE environment variable.

Security Contact

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.

For Enterprise

Available as part of the Tidelift Subscription.

The maintainers of browserslist and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

Browsers Data Updating

See update-browserslist-db docs

caniuse-lite's People

Contributors

ai avatar andyjansson avatar ben-eb avatar beretta1979 avatar ddbeck avatar dependabot[bot] avatar floodcode avatar ljharb avatar lukewarlow avatar natureshadow avatar romainmenke avatar yisibl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

caniuse-lite's Issues

Is this version released 1.0.30000929?

When I try to install 1.0.30000929 version using,
npm install caniuse-lite@^1.0.30000929
It is successfully installed. But I am not able to see this version in the releases page and not in package.json version property.

Can someone help?
Maybe it's a dumb question.

require(...).feature is not a function

I started getting this error just today while running "npm run build" in my react app.

react-scripts build
/home/pi/builds/nxsWiCCc/0/XYZ/node_modules/autoprefixer/lib/supports.js:15
var data = require('caniuse-lite').feature(require('caniuse-lite/data/features/css-featurequeries.js'));
^
TypeError: require(...).feature is not a function

Add tests and CI coverage

There's been some discussion regarding adding caniuse-lite as a dependency of eslint-plugin-compat. I'm somewhat reluctant to add tests if this module doesn't have any tests. What are thoughts on adding some tests to this project?

missing ) after argument list

I am using the package with node 10.16.0, npm 6.9.0 in Windows on https://github.com/maximegris/angular-electron.

If I run npm run start i gert the following error

missing ) after argument list
C:\Users\Admin\Downloads\angular-electron\node_modules\caniuse-lite\data\features\srcset.js:4
        /* [retval, out] */__RPC__deref_out_opt __x_ABI_CWindows_CFoundation_CIUriRuntimeClass * * value
                           ^^^^^^^^^^^^^^^^^^^^

SyntaxError: missing ) after argument list
    at Module._compile (internal/modules/cjs/loader.js:721:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (C:\Users\Admin\Downloads\angular-electron\node_modules\caniuse-lite\data\features.js:1:23438)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (C:\Users\Admin\Downloads\angular-electron\node_modules\caniuse-lite\dist\unpacker\features.js:11:35)

Missing release binary for 1.0.30000999 in github

Hi, the latest release on npmjs is 1.0.30000999 while binary for it is missing in here on github. This is causing exact issues as in issue #26 while generating typescript angular client. npm while installing dependencies fails to find latest release version. Please publish compiled binaries for latest version.

TypeError: Cannot read property 'prefix_exceptions' of undefined

Hi, I have a create-react-app application and I started seeing this build error recently coming from the caniuse-lite node module.

11:18:33 PM: Creating an optimized production build...
11:23:37 PM: Failed to compile.
11:23:37 PM: 
11:23:37 PM: ./src/index.css
11:23:37 PM: TypeError: Cannot read property 'prefix_exceptions' of undefined
11:23:37 PM:     at Array.map (<anonymous>)
11:23:38 PM: npm ERR! code ELIFECYCLE
11:23:38 PM: npm ERR! errno 1

I downgraded to [email protected] and build works but the latest version is not working.

Regression in version 1.0.30001168

We're using the following query in .browserslistrc:

defaults
not IE 11
not op_mini all
chrome 80

We're on caniuse-lite version 1.0.30001165. When updating to 1.0.30001168 (using npx browserslist@latest --update-db), the above query also causes the following diff in matched browsers:

+ android 4.4.3-4.4.4
+ firefox 84
- firefox 78
+ firefox 60
+ ie_mob 11

firefox 84 makes sense since it's new, but including ie_mob and android 4.4.3-4.4.4 as well as firefox esr targeting an older version (7860) looks like a regression. Is this a problem with caniuse-lite, or does it come from browserslist/caniuse-db?

Zlib deflate compression ?

Hi Ben,

I was playing around the source and thought about how to compress it further. Did you think about using a compression algorithm like gzip or deflate ? We have zlib built-in in Node that provides that. I made some tests and got these results for data folder size :

  • original: 895 267 bytes
  • gzip: 390 530 bytes
  • deflate: 382 478 bytes

43% compression rate looks pretty good to me 👍

The caveat is that you can't require() raw deflate data, so the unpacker needs a refactor. I don't think it implies API breaking changes though, but I don't know much about how the raw data is currently used. Also, we need an alternative to zlib for usage in the browser, like pako

Error: Cannot find module '../../data/browsers'

[email protected] start D:\workspace\github\redux\examples\todos
react-scripts start

internal/modules/cjs/loader.js:638
throw err;
^

Error: Cannot find module '../../data/browsers'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (D:\workspace\github\redux\examples\todos\node_modules\caniuse-lite\dist\unpacker\browsers.js:6:35)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (D:\workspace\github\redux\examples\todos\node_modules\caniuse-lite\dist\unpacker\agents.js:8:17)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)

Is "1.0.30000967" is no more a valid version?

Hey, Right now I am building a angular application and when I build my application using "@angular-devkit/build-angular": "0.803.21" It is using "@babel/preset-env": "7.7.6" which use "browserslist": "^4.6.0" which uses "caniuse-lite": "1.0.30000967". So it throws an error that says:

"ERROR: Error: Browserslist: caniuse-lite is outdated. Please run next command npm update"

but I think there is no latest version for angular devkit other than I mentioned above.

Way to load agents and region separatly

With Size Limit I found, that when I import simple function:

var region = require('caniuse-lite').region

I import a huge caniuse-lite/data/features/*.

My main concern that importing many unnecessary files will loose resources on JS parsing.
Maybe we can add API like:

var agents = require('caniuse-lite/agents')
var region = require('caniuse-lite/region')

It will not break public API.

404 caniuse-lite-1.0.30000938.tgz

hi all

I try to install caniuse-lite:

npm i caniuse-lite

But I get a 404 Not Found
npm ERR! 404 Not Found: caniuse-lite@ ... caniuse-lite-1.0.30000938.tgz

Looks like something went wrong with 938 release.

image

Cannot find module 'caniuse-lite/dist/unpacker/agents'

● Test suite failed to run

Cannot find module 'caniuse-lite/dist/unpacker/agents'

at Object. (node_modules/@babel/preset-env/node_modules/browserslist/index.js:2:14)
On Gitlab Test Unit Runner

.babelrc
{ "presets": [ "@babel/preset-env", "@babel/preset-react" ], "plugins": [ "module:@trans-ui/components", "syntax-dynamic-import", "transform-class-properties" ], "env": { "production": { "plugins": [ [ "transform-react-remove-prop-types", { "mode": "wrap", "ignoreFilenames": [ "node_modules" ] } ] ] }, "test": { "presets": [ [ "@babel/preset-env", { "targets": { "node": "current" } } ], "@babel/preset-react" ], "plugins": [ "module:@trans-ui/components", "babel-plugin-dynamic-import-node" ] } } }
.package.json
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/node": "^7.4.5",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/plugin-proposal-object-rest-spread": "^7.4.4",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/polyfill": "7.0.0",
"@babel/preset-env": "7.0.0",
"@babel/preset-react": "7.0.0",
"assets": "^2.1.0",
"auto-styles-loader": "^1.0.2",
"autoprefixer": "6.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^8.2.3",
"babel-istanbul": "^0.12.1",
"babel-jest": "^24.8.0",
"babel-loader": "^8.0.0",
"babel-plugin-dynamic-import-node": "^1.2.0",
"babel-plugin-module-resolver": "^3.2.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.14",
"clean-webpack-plugin": "^0.1.19",
"css-loader": "^0.28.11",
"directory-named-webpack-plugin": "^4.0.0",
"eslint": "^4.13.1",
"eslint-config-airbnb": "^14.0.0",
"eslint-config-google": "^0.9.1",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-jest": "^21.3.2",
"eslint-plugin-jsx-a11y": "^6.0.0",
"eslint-plugin-react": "^6.8.0",

Regression version 1.0.30000975 es6-module doesn't include Safari 10.1 and returns incorrect data for 9.1

Version 1.0.30000975 introduced a regression were safari 10.1 is not being returned when checking es6-module feature other than that it is returning that safari 9.1 has partial support which is not the case.

This data doesn't match with the caniuse-db and worked correctly in the previous version of caniuse-lite.

caniuse-db

"safari": {
  "3.1": "n",
  "3.2": "n",
  "4": "n",
  "5": "n",
  "5.1": "n",
  "6": "n",
  "6.1": "n",
  "7": "n",
  "7.1": "n",
  "8": "n",
  "9": "n",
  "9.1": "n",
  "10": "n",
  "10.1": "a #4 #5",
  "11": "y",
  "11.1": "y",
  "12": "y",
  "12.1": "y",
  "13": "y",
  "TP": "y"
},

caniuse-lite

  safari: { 
     '4': 'n',
     '5': 'n',
     '6': 'n',
     '7': 'n',
     '8': 'n',
     '9': 'n',
     '10': 'n',
     '11': 'y',
     '12': 'y',
     '13': 'y',
     '70': 'n',
     '78': 'n',
     '12.1': 'y',
     '11.1': 'y',
     '3.5': 'y',
     '3.2': 'n',
     '5.1': 'n',
     '6.1': 'n',
     '7.1': 'n',
     '9.1': 'a #4 #5'
}

Cannot find module 'babel-preset-env' from '/node_modules/@babel/preset-env/node_modules/caniuse-lite'

I am trying to build my project via "node:8.9.2-alpine" docker image.

[email protected] build /
babel-node tools/run build "--release" "--verbose"

/node_modules/@babel/core/lib/config/option-manager.js:120
throw e;
^

Error: [BABEL] /node_modules/@babel/preset-env/node_modules/caniuse-lite/dist/unpacker/agents.js: Cannot find module 'babel-preset-env' from '/node_modules/@babel/preset-env/node_modules/caniuse-lite'

  • Did you mean "@babel/env"?
    at Function.module.exports [as sync] (/node_modules/resolve/lib/sync.js:40:15)
    at resolveStandardizedName (/node_modules/@babel/core/lib/config/loading/files/plugins.js:78:29)
    at resolvePreset (/node_modules/@babel/core/lib/config/loading/files/plugins.js:31:10)
    at loadPreset (/node_modules/@babel/core/lib/config/loading/files/plugins.js:50:18)
    at createDescriptor (/node_modules/@babel/core/lib/config/option-manager.js:443:21)
    at /node_modules/@babel/core/lib/config/option-manager.js:173:12
    at Array.map ()
    at /node_modules/@babel/core/lib/config/option-manager.js:172:48
    at cachedFunction (/node_modules/@babel/core/lib/config/caching.js:40:17)
    at /node_modules/@babel/core/lib/config/option-manager.js:90:14

package.json file

  "dependencies": {
    "@babel/polyfill": "7.0.0-beta.34",
   ...
}

"devDependencies": {
    "@babel/core": "7.0.0-beta.34",
    "@babel/node": "7.0.0-beta.34",
    "@babel/plugin-transform-react-constant-elements": "7.0.0-beta.34",
    "@babel/plugin-transform-react-inline-elements": "7.0.0-beta.34",
    "@babel/plugin-transform-react-jsx-self": "7.0.0-beta.34",
    "@babel/plugin-transform-react-jsx-source": "7.0.0-beta.34",
    "@babel/preset-env": "7.0.0-beta.34",
    "@babel/preset-flow": "7.0.0-beta.34",
    "@babel/preset-react": "7.0.0-beta.34",
    "@babel/preset-stage-2": "7.0.0-beta.34",
    .....
}

.babelrc.js


module.exports = {
  presets: [
    [
      '@babel/preset-env',
      {
        targets: {
          node: 'current',
        },
      },
    ],
    '@babel/preset-stage-2',
    '@babel/preset-flow',
    '@babel/preset-react',
  ],
  ignore: ['node_modules', 'build'],
};

Link to features

Add a comment on each feature file with a link to the actual feature page, so it's possible to find them searching by text in the source code files. Related to #47

Data packed with wrong version of caniuse-db

It seems that the generated files in the ./data folder that are published to npm are generated with the wrong version of caniuse-db. If I manually run the npm run pack script the generated files do match the correct version of caniuse-db.

I included a zip with the different ./data/agents.js file as an example:

  • one file is the current file on master (version 1.0.30001023 / commit ab8f1ec)
  • one file is packed with caniuse-db 1.0.30001021
  • one file is packed with caniuse-db 1.0.30001023
    agents.zip

As you can see the file for version 1.0.30001023 matches caniuse-db 1.0.30001021 instead. Probably there is a problem with your automated builds.

I noticed this because browserslist does not return edge version 79 in it's query results for this version :)

Wrong `css-placeholder`

Since data/features/css-placeholder.js was modified last day, autoprefixer has changed its behaviour when adding prefixer for placeholder styles, as the file stated that ie 10 and ie 11 were not in the compatibility list.

Correct browser list should be show as followed:

and_qq 1.2,android 2.1,android 2.2,android 2.3,android 3,android 4,android 4.1,android 4.4,android 4.4.3-4.4.4,android 60,bb 7,bb 10,chrome 4,chrome 5,chrome 6,chrome 7,chrome 8,chrome 9,chrome 10,chrome 11,chrome 12,chrome 12.1,chrome 13,chrome 14,chrome 15,chrome 16,chrome 17,chrome 18,chrome 19,chrome 20,chrome 21,chrome 22,chrome 23,chrome 24,chrome 25,chrome 26,chrome 27,chrome 28,chrome 29,chrome 30,chrome 31,chrome 33,chrome 34,chrome 35,chrome 36,chrome 37,chrome 38,chrome 39,chrome 40,chrome 41,chrome 42,chrome 43,chrome 44,chrome 45,chrome 46,chrome 47,chrome 48,chrome 49,chrome 50,chrome 51,chrome 52,chrome 53,chrome 54,chrome 55,chrome 56,edge 12,edge 13,edge 14,edge 15,edge 16,edge 17,edge 18,firefox 4,firefox 5,firefox 6,firefox 7,firefox 8,firefox 9,firefox 10,firefox 11,firefox 12,firefox 12.1,firefox 13,firefox 14,firefox 15,firefox 16,firefox 17,firefox 18,firefox 19,firefox 20,firefox 21,firefox 22,firefox 23,firefox 24,firefox 25,firefox 26,firefox 27,firefox 28,firefox 29,firefox 30,firefox 31,firefox 33,firefox 34,firefox 35,firefox 36,firefox 37,firefox 38,firefox 39,firefox 40,firefox 41,firefox 42,firefox 43,firefox 44,firefox 45,firefox 46,firefox 47,firefox 48,firefox 49,firefox 50,ie 10,ie 11,ie_mob 10,ie_mob 11,ios_saf 5.0-5.1,ios_saf 6.0-6.1,ios_saf 7.0-7.1,ios_saf 8,ios_saf 8.1-8.4,ios_saf 9.0-9.2,ios_saf 9.3,ios_saf 10.0-10.2,ios_saf 60,opera 12.1,opera 15,opera 16,opera 17,opera 18,opera 19,opera 20,opera 21,opera 22,opera 23,opera 24,opera 25,opera 26,opera 27,opera 28,opera 29,opera 30,opera 31,opera 33,opera 34,opera 35,opera 36,opera 37,opera 38,opera 39,opera 40,opera 41,opera 42,opera 43,safari 5,safari 5.1,safari 6,safari 6.1,safari 7,safari 7.1,safari 8,safari 9,safari 9.1,safari 10,samsung 4,samsung 5,samsung 6.2

But I got the wrong one last day:

browsers: and_qq 1.2,android 2.1,android 2.2,android 2.3,android 3,android 4,android 4.1,android 4.2-4.3,android 4.4.3-4.4.4,android 4.4,bb 7,bb 10,chrome 4,chrome 5,chrome 6,chrome 7,chrome 8,chrome 9,chrome 10,chrome 11,chrome 12,chrome 13,chrome 14,chrome 15,chrome 16,chrome 17,chrome 18,chrome 19,chrome 20,chrome 21,chrome 22,chrome 23,chrome 24,chrome 25,chrome 26,chrome 27,chrome 28,chrome 29,chrome 30,chrome 31,chrome 32,chrome 33,chrome 34,chrome 35,chrome 36,chrome 37,chrome 38,chrome 39,chrome 40,chrome 41,chrome 42,chrome 43,chrome 44,chrome 45,chrome 46,chrome 47,chrome 48,chrome 49,chrome 50,chrome 51,chrome 52,chrome 53,chrome 54,chrome 55,chrome 56,edge 12,edge 13,edge 14,edge 15,edge 16,edge 17,edge 18,firefox 19,firefox 20,firefox 21,firefox 22,firefox 23,firefox 24,firefox 25,firefox 26,firefox 27,firefox 28,firefox 29,firefox 30,firefox 31,firefox 32,firefox 33,firefox 34,firefox 35,firefox 36,firefox 37,firefox 38,firefox 39,firefox 40,firefox 41,firefox 42,firefox 43,firefox 44,firefox 45,firefox 46,firefox 47,firefox 48,firefox 49,firefox 50,ie_mob 10,ie_mob 11,ios_saf 4.2-4.3,ios_saf 5.0-5.1,ios_saf 6.0-6.1,ios_saf 7.0-7.1,ios_saf 8,ios_saf 8.1-8.4,ios_saf 9.0-9.2,ios_saf 9.3,ios_saf 10.0-10.2,opera 15,opera 16,opera 17,opera 18,opera 19,opera 20,opera 21,opera 22,opera 23,opera 24,opera 25,opera 26,opera 27,opera 28,opera 29,opera 30,opera 31,opera 32,opera 33,opera 34,opera 35,opera 36,opera 37,opera 38,opera 39,opera 40,opera 41,opera 42,opera 43,safari 5,safari 5.1,safari 6,safari 6.1,safari 7,safari 7.1,safari 8,safari 9,safari 9.1,safari 10,samsung 4,samsung 5,samsung 6.2

It resulted in a wrong prefixer generated:

.input::-webkit-input-placeholder {
    color: black;
}

.input::-ms-input-placeholder {
    color: black;
}

.input::placeholder {
    color: black;
}

Apparently, it has missed the following style for IE10 and IE11:

.input:-ms-input-placeholder {
    color: black;
}

Android Edge Chromium needs to be a separate class "and_edge"

Currently seems to get lumped in as Edge.
Current Edge (edge-chromimium) on desktop is 90.
Current Edge Chromium on Android is 46.

This REALLY throws the version checking out. Need another browser defined - and_edge?
This would seem to follow the pattern for chrome, although the windows and android version both seem to be on v90 at present.

Region data and release versions do not match for "and_chr"

Hi,

I'm using caniuse-lite to create a summary of usage % for the browser support targets we are currently aiming for. I'm using the release_date property on the agents to create a list of versions to summarize usage for.

I noticed that 'and_chr' is behaving a bit oddly though. It's only tracking data for one version (not the weird part), but the version in release_date and the version in the usage data do not match. The release_date seems to show the latest version and it's release date, but the usage is always summarized under the version key '0'. Is this intended? The "regular" agents/browsers (e.g. Chrome/Firefox/Safari/Edge/IE) did not show any weird or similar behavior.

import { agents, region } from 'caniuse-lite';
import ww from 'caniuse-lite/data/regions/alt-ww.js';

agents['and_chr'].release_date;
// { "79": 1575936000 }
region(ww)['and_chr'];
// { "0": 34.422267 }

https://stackblitz.com/edit/js-zcjlru

Cannot find module 'caniuse-lite'

├─ [email protected]

error:
Module build failed: Error: Cannot find module 'caniuse-lite' (While processing preset: "/usr/local/openresty/nginx/html/study-manage/node_modules/babel-preset-env/lib/index.js")
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object. (/usr/local/openresty/nginx/html/study-manage/node_modules/babel-preset-env/node_modules/browserslist/index.js:5:15)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object. (/usr/local/openresty/nginx/html/study-manage/node_modules/babel-preset-env/lib/targets-parser.js:5:21)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object. (/usr/local/openresty/nginx/html/study-manage/node_modules/babel-preset-env/lib/index.js:33:22)
at Module._compile (module.js:569:30)
@ multi babel-polyfill ./src/main.js�[39m�[22m

demotion : "caniuse-lite": "1.0.30000697",
restore

Browsers names

doiuse right now uses caniuse-db. I tried to convert it to caniuse-lite, but found that we need a agents[browsers].browser field with browser name.

License not recommended for software?

The description for CC Attribution 4.0 Int on GitHub reads as:

Permits almost any use subject to providing credit and license notice. Frequently used for media assets and educational materials. The most common license for Open Access scientific publications. Not recommended for software.

Not recommended for software is a bit concerning considering this is attached to a piece of software. Is there a better license that this project can be released under? If not, can you speak to why this license was selected and the implications of using it in a project?

Thanks!

TypeError: region is not a function (from browserslist)

I think this is related or the same issue as #70

versions :

TypeError: region is not a function

Trace :

TypeError: region is not a function
    at Object.loadCountry (/node_modules/browserslist/node.js:234:23)
    at Function.select (/node_modules/browserslist/index.js:898:11)
    at /node_modules/browserslist/index.js:336:33
    at Array.reduce (<anonymous>)
    at resolve (/node_modules/browserslist/index.js:318:18)
    at browserslist (/node_modules/browserslist/index.js:444:21)
    at /node_modules/postcss-preset-env/index.js:434:29
    at creator (/node_modules/postcss/lib/postcss.js:133:35)

Code from browserslist :

https://github.com/browserslist/browserslist/blob/main/node.js#L234

var feature = require('caniuse-lite/dist/unpacker/feature').default
var region = require('caniuse-lite/dist/unpacker/region').default

var compressed = require('caniuse-lite/data/regions/' + code + '.js')
var usageData = region(compressed)

Change 9555387f697fd5507aae3f660c291c881b6f9e7e seems cause exports structure changes

In commit 9555387f697fd5507aae3f660c291c881b6f9e7e

-export { agents } from './agents'
-export { default as feature } from './feature'
-export { features } from './features'
-export { default as region } from './region'
+module.exports.agents = require('./agents')
+module.exports.feature = require('./feature')
+module.exports.features = require('./features')
+module.exports.region = require('./region')

causes

require('caniuse-lite').agents;
// => { ie: ..., edge: ..., }
// now became
// => { agents: { ie: ..., edge: ..., }}

require('caniuse-lite').features;
// => { aac: ..., }
// now became
// => { features: { aac: ..., }}

This causes errors in using of autoprefixer, etc.

Add Safari iOS 12.2 support

Hi, we are relying on browserslist-useragent to display a warning in our webapp asking users to upgrade old browsers.

This package depends on caniuse-lite, and it seems we have a problem with safari 12.2 on iOS, it does not match the query described on the issue here: browserslist/browserslist-useragent#40

I installed the latest caniuse-lite package (1.0.30000957) to make sure it was not already fixed, and it's not. Am i correct thinking this is a caniuse-lite db issue ?

No matching version found for caniuse-lite@^1.0.30001004

Hi,
I'm getting the following error on my CI server
npm ERR! code ETARGET
npm ERR! notarget No matching version found for caniuse-lite@^1.0.30001004
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

🚨 Project sustainability

This project needs a $5 commitment per month to run automatically. I am no longer willing to spend any more money on the server that is taking care of this and will be terminating it, and all further work on this project, on the 24th of July 2017, unless the $5 per month goal is met.

If it is important to you to have faster caniuse data downloads from npm & smaller client side builds, then please consider supporting this project financially. Thank you.

Patreon: https://www.patreon.com/beneb
Paypal: https://www.paypal.me/benebinfo

opera version looks too old

I use it by browserslist with db version 1.0.30001230.

$ npm exec browserslist "last 2 Opera major versions"
opera 73
opera 72

Opera's latest version is 73 but currently Opera's real last version is 76.

Can I help to update?

no firefox ver. 85

Firefox version 85 was released January 26, 2021
I have run updating browserslist db:
npx browserslist@latest --update-db
image
but stll latet version of firefox is 84:
npx browserslist@latest
image

How I can get correct last version of firefox?

Inefficient Storage

You've indicated that one of the goals for caniuse-lite is reduced disk space usage. I'm strongly in favor of that because I bundle many node modules into an app that I ship.

However, because caniuse-lite is broken up into TONS of tiny files, the module is actually incredibly inefficient when stored on disk. As the screenshot below shows, there's 944KB of actual data in the caniuse-lite module, but that's broken up across hundreds of files that are just a few bytes each. The trouble is that the smallest block the operating system can assign on disk is 4KB, so each of these tiny files actually consumes 4,000 bytes on disk.

In short, 67% of the space that caniuse-lite consumes on disk is simply waste because the operating system can't assign blocks small enough for the tiny files you've created. It would be nice to consolidate this. You're hardly the only offender; this is a super common problem with JavaScript in the node community. Everyone's sort of taken modularization to INCREDIBLE extremes.

screen shot 2017-06-11 at 15 51 40

Updating to 1.0.30001185 breaks application

I was trying to get an updated version of this package and after running the following command, I can no longer build the application:

npm update --depth 10 caniuse-lite

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.