mirror of
https://github.com/biobulkbende/biobulkbende.org.git
synced 2025-10-11 15:14:59 +00:00
structure, layout and automation
This commit is contained in:
480
node_modules/browserslist/CHANGELOG.md
generated
vendored
Normal file
480
node_modules/browserslist/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,480 @@
|
||||
# Change Log
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## 4.14.2
|
||||
* Fixed `--update-db` on Windows (by James Ross).
|
||||
* Improved `--update-db` output.
|
||||
|
||||
## 4.14.1
|
||||
* Added `--update-db` explanation (by Justin Zelinsky).
|
||||
|
||||
## 4.14
|
||||
* Add `BROWSERSLIST_DANGEROUS_EXTEND` support (by Timo Mayer).
|
||||
|
||||
## 4.13
|
||||
* Added `supports` query to select browsers (by Jesús Leganés-Combarro).
|
||||
|
||||
## 4.12.2
|
||||
* Update Firefox ESR.
|
||||
|
||||
## 4.12.1
|
||||
* Update `package.json` scanning tool for `--update-db` (by Luke Edwards).
|
||||
* Improve docs (by Mukundan Senthil).
|
||||
* Drop Node.js 13.0-13.6 support because of ES modules bug in that versions.
|
||||
|
||||
## 4.12
|
||||
* Add environments to shared configs (by Yevgeny Petukhov).
|
||||
* Fix docs (by Dmitry Statsenko and Thomas Pozzo di Borgo).
|
||||
|
||||
## 4.11.1
|
||||
* Fix Node.js 6 support.
|
||||
|
||||
## 4.11
|
||||
* Add `npx browserslist --mobile-to-desktop` (by James Ross).
|
||||
|
||||
## 4.10
|
||||
* Add `npx browserslist --update-db` (by Ivan Solovev).
|
||||
|
||||
## 4.9.1
|
||||
* Normalize incorrect Can I Use regional data (by Huáng Jùnliàng).
|
||||
|
||||
## 4.9
|
||||
* Add `node X-Y` query support (by Yuping Zuo).
|
||||
|
||||
## 4.8.7
|
||||
* Fix `last N major versions` (by Valeriy Trubachev).
|
||||
|
||||
## 4.8.6
|
||||
* Fix `Unknown version 10 of op_mob` error in `mobileToDesktop` option.
|
||||
|
||||
## 4.8.5
|
||||
* Fix `last N browsers` again after new `caniuse-db` API changes.
|
||||
|
||||
## 4.8.4
|
||||
* Fix released versions detection for queries like `last N browsers`.
|
||||
* Add IE 11 Mobile to `dead` browsers.
|
||||
|
||||
## 4.8.3
|
||||
* Fix warning message (by Anton Ivanov).
|
||||
|
||||
## 4.8.2
|
||||
* Fix `Cannot convert undefined or null to object` (by Antoine Clausse).
|
||||
* Fix `mobileToDesktop` in `defaults` (by Huáng Jùnliàng).
|
||||
|
||||
## 4.8.1
|
||||
* Fix Chrome and `mobileToDesktop` (by Huáng Jùnliàng).
|
||||
|
||||
## 4.8
|
||||
* Add `> 5% in browserslist-config-my stats` query (by Andrew Leedham).
|
||||
* Improve docs (by Danny van Kooten).
|
||||
|
||||
## 4.7.3
|
||||
* Add funding link for `npm fund`.
|
||||
|
||||
## 4.7.2
|
||||
* Add cache for query parsing.
|
||||
* Improve config caching (by Kārlis Gaņģis).
|
||||
* Update Firefox ESR.
|
||||
|
||||
## 4.7.1
|
||||
* Improve caching.
|
||||
|
||||
## 4.7
|
||||
* Add PhantomJS queries.
|
||||
* Improve docs (by Dorian Koehring).
|
||||
|
||||
## 4.6.6
|
||||
* Remove Safari from `dead` query.
|
||||
|
||||
## 4.6.5
|
||||
* Add Samsung 4 browser to `dead` query.
|
||||
* Remove dirty fix for `android all` error.
|
||||
|
||||
## 4.6.4
|
||||
* Add Firefox 68 to `Firefox ESR` query.
|
||||
|
||||
## 4.6.3
|
||||
* Dirty fix for `android all` error.
|
||||
|
||||
## 4.6.2
|
||||
* Fix `last x version` and similar queries for Android (by Tony Ross).
|
||||
|
||||
## 4.6.1
|
||||
* Fix patch version support for Electron (by Kilian Valkhof).
|
||||
|
||||
## 4.6
|
||||
* Add `mobileToDesktop` option (by Nicolò Ribaudo).
|
||||
|
||||
## 4.5.6
|
||||
* Make `Node > 5` and `node > 5` queries case insensitive.
|
||||
|
||||
## 4.5.5
|
||||
* Fix CLI help (by Marcel Gerber).
|
||||
* Add KaiOS browser to docs.
|
||||
|
||||
## 4.5.4
|
||||
* Update docs (by Andrew Leedham and Dan Onoshko).
|
||||
|
||||
## 4.5.3
|
||||
* Fix splitting string to queries.
|
||||
|
||||
## 4.5.2
|
||||
* Show default browsers in CLI on project without config.
|
||||
|
||||
## 4.5.1
|
||||
* Improve text for the warning about outdated `caniuse-lite`.
|
||||
|
||||
## 4.5
|
||||
* Add `>=`, `>`, and `<=` support for Node.js version (by Mathspy Terabithian).
|
||||
|
||||
## 4.4.2
|
||||
* Allow to have string in `package.json` (by @dmarkhas).
|
||||
|
||||
## 4.4.1
|
||||
* Allow to use `.` in scope name of shareable config (by Gustav Nikolaj).
|
||||
|
||||
## 4.4
|
||||
* Added `and` and `or` keywords to combine queries (by Jon Ege Ronnenberg).
|
||||
|
||||
## 4.3.7
|
||||
* Fix fraction years support in `last 1.5 years` (by Clément P).
|
||||
* Fix version-less browser support.
|
||||
|
||||
## 4.3.6
|
||||
* Fix version-less browser support in custom statistics (by Alex Walter).
|
||||
|
||||
## 4.3.5
|
||||
* Fix `not` query for wrong Can I Use data.
|
||||
|
||||
## 4.3.4
|
||||
* Allow to update `node-releases` without new Browserslist releases.
|
||||
|
||||
## 4.3.3
|
||||
* Fix Node.js 11 support.
|
||||
|
||||
## 4.3.2
|
||||
* Fix `Unknown version 11 of Node.js` error (by Dan Onoshko).
|
||||
|
||||
## 4.3.1
|
||||
* Fix conflict between `caniuse-lite` and custom browsers statistics.
|
||||
|
||||
## 4.3
|
||||
* Allow to use `extends browserslist-config-a/file` (by @Schweinepriester).
|
||||
|
||||
## 4.2.1
|
||||
* Use new `node-releases` support (by Sergey Rubanov).
|
||||
|
||||
## 4.2
|
||||
* Add `--json` argument for CLI.
|
||||
* Allow to pass multiple areas in CLI by `--coverage=US,alt-AS,global`.
|
||||
|
||||
## 4.1.2
|
||||
* Better `unknow query` error message.
|
||||
* Use latest `node-releases`.
|
||||
|
||||
## 4.1.1
|
||||
* Update Firefox ESR versions.
|
||||
|
||||
## 4.1
|
||||
* Add `current node` query.
|
||||
* Add contributors widget to docs (by Sergey Surkov).
|
||||
|
||||
## 4.0.2
|
||||
* Fix new `node-releases` support (by Sergey Rubanov).
|
||||
* Fix error text (by Josh Smith).
|
||||
|
||||
## 4.0.1
|
||||
* Reduce npm package size.
|
||||
* Fix docs.
|
||||
|
||||
## 4.0.0 “Erinaceus amurensis”
|
||||
* Add `node X` and `maintained node versions` queries (by Pavel Vostrikov).
|
||||
* Remove Node.js 4 support.
|
||||
* Show warning if `caniuse-lite` is old (by Anton Tuzhik).
|
||||
* Add comma support in config file.
|
||||
|
||||
## 3.2.8
|
||||
* Add IE 9-5.5 to dead browsers.
|
||||
* Remove development configs from npm package.
|
||||
|
||||
## 3.2.7
|
||||
* Add Firefox 60 as Firefox ESR.
|
||||
|
||||
## 3.2.6
|
||||
* Add Opera Mini 12 to dead browsers.
|
||||
* Update docs (by Jamie Kyle).
|
||||
|
||||
## 3.2.5
|
||||
* Fix excluding Opera Mini and other browsers with `all` version.
|
||||
|
||||
## 3.2.4
|
||||
* Resolve shareable config from current working directory.
|
||||
|
||||
## 3.2.3
|
||||
* Fix `package.json` config validation for single string case.
|
||||
* Fix CLI error reporting.
|
||||
|
||||
## 3.2.2
|
||||
* Add `package.json` config validation.
|
||||
* Move project to `browserlist` GitHub organization.
|
||||
|
||||
## 3.2.1
|
||||
* Fix error text (by Steve Schrab).
|
||||
|
||||
## 3.2
|
||||
* Add `cover 99%` query (by Vasily Fedoseyev).
|
||||
* Add `cover 99% in US` query (by Vasily Fedoseyev).
|
||||
* Add `cover 99% in my stats` query (by Vasily Fedoseyev).
|
||||
* Add `"my stats"` support to `browserlist.coverage()` (by Vasily Fedoseyev).
|
||||
|
||||
## 3.1.2
|
||||
* Add more clear error on missed browser version.
|
||||
|
||||
## 3.1.1
|
||||
* Fix JSDoc (by Sylvain Pollet-Villard).
|
||||
|
||||
## 3.1
|
||||
* Add `ignoreUnknownVersions` option.
|
||||
* Fix docs (by Pascal Duez).
|
||||
|
||||
## 3.0 “Atelerix sclateri”
|
||||
* Remove country statistics from client-side build of Browserslist.
|
||||
* Change `> 1%` to `> 0.5%` in default query.
|
||||
* Add `not dead` to default query.
|
||||
* Change default environment to `production` (by Marco Fugaro).
|
||||
* Add `dead` query support with IE 10 and BlackBerry browser.
|
||||
* Add multiple environments in one section support (by Evilebot Tnawi).
|
||||
* Add custom statistics support to `browserlist.coverage()`.
|
||||
* Fix `path` option check.
|
||||
|
||||
## 2.11.3
|
||||
* Fix for `path: undefined` option.
|
||||
|
||||
## 2.11.2
|
||||
* Remove Node.js specific code from webpack build.
|
||||
|
||||
## 2.11.1
|
||||
* Fix using Browserslist in browser with `path` but without `fs`.
|
||||
|
||||
## 2.11
|
||||
* Add `last 2 years` query support (by James Harris).
|
||||
|
||||
## 2.10.2
|
||||
* Fix Browserify support.
|
||||
|
||||
## 2.10.1
|
||||
* Fix using Browserslist without `process` (by Andrew Patton).
|
||||
|
||||
## 2.10
|
||||
* Add `< 1%` and `<= 1%` queries support (by August Kaiser).
|
||||
|
||||
## 2.9.1
|
||||
* Fix unknown query on trailing spaces in query.
|
||||
|
||||
## 2.9
|
||||
* Add `last Electron versions` and `last Electron major versions` queries
|
||||
(by Louis Mouhat).
|
||||
|
||||
## 2.8
|
||||
* Add `since 2016-03` and `since 2016-03-20` queries support (by Andrew Blick).
|
||||
|
||||
## 2.7
|
||||
* Add `since 2016` queries support (by Igor Deryabin).
|
||||
|
||||
## 2.6.1
|
||||
* Fix `Path must be a string` error.
|
||||
|
||||
## 2.6
|
||||
* By default load config from current directory in CLI tool.
|
||||
|
||||
## 2.5.1
|
||||
* Allow `@scope/browserlist-config` config name (by Jamie Connolly).
|
||||
|
||||
## 2.5
|
||||
* Add `extends` query (by YellowKirby).
|
||||
|
||||
## 2.4.1
|
||||
* Throw error if `package.json` contain `browserlist` instead of `browserslist`.
|
||||
|
||||
## 2.4
|
||||
* Add `last n major versions` query (by John Sanders).
|
||||
|
||||
## 2.3.3
|
||||
* Fix browsers support.
|
||||
|
||||
## 2.3.2
|
||||
* Fix `> 0` query for browsers with one version (by Nikolay Solovyov).
|
||||
|
||||
## 2.3.1
|
||||
* Reduce library size.
|
||||
|
||||
## 2.3
|
||||
* Add `unreleased versions` and `unreleased Chrome versions` queries.
|
||||
|
||||
## 2.2.2
|
||||
* Fix `Path must be a string` error (by Pieter Beulque).
|
||||
|
||||
## 2.2.1
|
||||
* Fix security issue with regions dynamic `require`.
|
||||
|
||||
## 2.2
|
||||
* Add region usage statistics support (by Clément P).
|
||||
|
||||
## 2.1.5
|
||||
* Remove Firefox 45 from Firefox ESR.
|
||||
|
||||
## 2.1.4
|
||||
* Use both ESR versions when they actual.
|
||||
|
||||
## 2.1.3
|
||||
* Add warning on first exclude query.
|
||||
|
||||
## 2.1.2
|
||||
* Fix non-Node.js environments support.
|
||||
|
||||
## 2.1.1
|
||||
* Fix CLI arguments parsing.
|
||||
|
||||
## 2.1
|
||||
* Add `>= 5%`, `>= 5% in US` and `>= 5% in my stats` queries.
|
||||
|
||||
## 2.0 “Atelerix frontalis”
|
||||
* `last n versions` returns versions for all browsers, not only main browsers.
|
||||
* Cache file system operations (by Aarni Koskela).
|
||||
* Use `caniuse-lite` 1 MB instead of `caniuse-db` 7 MB (by Ben Briggs).
|
||||
* Add `.browserslistrc` config support.
|
||||
* Add QQ Browser for Android support.
|
||||
* Add tests for CLI (by Zhulduz Zhankenova).
|
||||
|
||||
## 1.7.7
|
||||
* Update Firefox ESR.
|
||||
|
||||
## 1.7.6
|
||||
* Fix Android Chrome selection.
|
||||
|
||||
## 1.7.5
|
||||
* Fix combining `not` query with country based statistics.
|
||||
* Fix `--env` argument in CLI (by Tuure Savuoja).
|
||||
|
||||
## 1.7.4
|
||||
* Speed up browser sorting (by Aarni Koskela).
|
||||
|
||||
## 1.7.3
|
||||
* Fix config finding when directory was passed to `path` (by Aarni Koskela).
|
||||
|
||||
## 1.7.2
|
||||
* Fix config finding algorithm (by Aarni Koskela).
|
||||
|
||||
## 1.7.1
|
||||
* Fix unreleased browsers version detection.
|
||||
|
||||
## 1.7
|
||||
* Add `--config` and `--env` arguments to CLI (by Jarek Rencz).
|
||||
|
||||
## 1.6
|
||||
* Convert Electron version to Chrome (by Kilian Valkhof).
|
||||
* Fix `0` version mistake in Can I Use data.
|
||||
|
||||
## 1.5.2
|
||||
* Fix browser versions ordering (by Marco Massarotto).
|
||||
|
||||
## 1.5.1
|
||||
* Fix error on `package.json` and `browserslist` in same directory.
|
||||
|
||||
## 1.5
|
||||
* Add `package.json` support (by Stepan Kuzmin).
|
||||
* Add environments support (by Maksim Semenov and openlibser).
|
||||
* Add `browserslist-stats.json` file support (by Oleh Aloshkin).
|
||||
* Add `config` option to CLI (by Evilebot Tnawi).
|
||||
* Add JSDoc.
|
||||
* Fix tests on Windows (by Anna Stoliar).
|
||||
* Don’t set custom usage statistics globally.
|
||||
|
||||
## 1.4
|
||||
* Add `defaults` keyword.
|
||||
|
||||
## 1.3.6
|
||||
* Add `UCAndroid` alias to `and_uc` (by Evilebot Tnawi).
|
||||
|
||||
## 1.3.5
|
||||
* Fix Opera Mini support. Use `op_mini all`.
|
||||
|
||||
## 1.3.4
|
||||
* Add space-less `>1%` and `>.5%` syntax support (by Andreas Lind).
|
||||
|
||||
## 1.3.3
|
||||
* Clean `0` versions in some country-based requests.
|
||||
|
||||
## 1.3.2
|
||||
* Update Firefox ESR.
|
||||
|
||||
## 1.3.1
|
||||
* Add Safari TP support.
|
||||
|
||||
## 1.3
|
||||
* Add coverage for specific country (by Joshua Wise).
|
||||
|
||||
## 1.2
|
||||
* Add `browserslist.coverage()` method.
|
||||
* Add `--coverage` and `-c` argument to CLI.
|
||||
* Add `-v` argument support to CLI.
|
||||
* Better error handling in CLI.
|
||||
|
||||
## 1.1.3
|
||||
* Fix jspm support (by Sean Anderson).
|
||||
|
||||
## 1.1.2
|
||||
* Fix jspm support (by Sean Anderson).
|
||||
|
||||
## 1.1.1
|
||||
* Fix space-less `>10%` and `>10% in my stats` queries.
|
||||
* Normalize error messages.
|
||||
* Remove development files from npm package.
|
||||
|
||||
## 1.1
|
||||
* Added query against custom browser usage data (by Daniel Rey).
|
||||
|
||||
## 1.0.1
|
||||
* Update Firefox ESR (by Rouven Weßling).
|
||||
|
||||
## 1.0 “Atelerix algirus”
|
||||
* Remove Opera 12.1 from default query.
|
||||
* Add `not` keyword and exclude browsers by query.
|
||||
* Add Microsoft Edge support (by Andrey Polischuk).
|
||||
* Add CLI for debug and non-JS usage (by Luke Horvat).
|
||||
* Use own class in Browserslist errors.
|
||||
|
||||
## 0.5
|
||||
* Add version ranges `IE 6-9` (by Ben Briggs).
|
||||
|
||||
## 0.4
|
||||
* Add `config` option and `BROWSERSLIST_CONFIG` environment variable support.
|
||||
* Add symlink config support.
|
||||
|
||||
## 0.3.3
|
||||
* Fix DynJS compatibility (by Nick Howes).
|
||||
|
||||
## 0.3.2
|
||||
* Fix joined versions on versions query (by Vincent De Oliveira).
|
||||
|
||||
## 0.3.1
|
||||
* Fix global variable leak (by Peter Müller).
|
||||
|
||||
## 0.3
|
||||
* Takes queries from `BROWSERSLIST` environment variable.
|
||||
|
||||
## 0.2
|
||||
* Return Can I Use joined versions as `ios_saf 7.0-7.1`.
|
||||
|
||||
## 0.1.3
|
||||
* Better work with Can I Use joined versions like `ios_saf 7.0-7.1`.
|
||||
* Browserslist now understands `ios_saf 7.0` or `ios_saf 7`.
|
||||
|
||||
## 0.1.2
|
||||
* Do not create global `browserslist` var (by Maxime Thirouin).
|
||||
|
||||
## 0.1.1
|
||||
* Sort browsers by name and version.
|
||||
|
||||
## 0.1 “Atelerix albiventris”
|
||||
* Initial release.
|
20
node_modules/browserslist/LICENSE
generated
vendored
Normal file
20
node_modules/browserslist/LICENSE
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2014 Andrey Sitnik <andrey@sitnik.ru> and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
694
node_modules/browserslist/README.md
generated
vendored
Normal file
694
node_modules/browserslist/README.md
generated
vendored
Normal file
@ -0,0 +1,694 @@
|
||||
# Browserslist [![Cult Of Martians][cult-img]][cult]
|
||||
|
||||
<img width="120" height="120" alt="Browserslist logo by Anton Lovchikov"
|
||||
src="https://browserslist.github.io/browserslist/logo.svg" align="right">
|
||||
|
||||
The config to share target browsers and Node.js versions between different
|
||||
front-end tools. It is used in:
|
||||
|
||||
* [Autoprefixer]
|
||||
* [Babel]
|
||||
* [postcss-preset-env]
|
||||
* [eslint-plugin-compat]
|
||||
* [stylelint-no-unsupported-browser-features]
|
||||
* [postcss-normalize]
|
||||
* [obsolete-webpack-plugin]
|
||||
|
||||
All tools will find target browsers automatically,
|
||||
when you add the following to `package.json`:
|
||||
|
||||
```json
|
||||
"browserslist": [
|
||||
"defaults",
|
||||
"not IE 11",
|
||||
"not IE_Mob 11",
|
||||
"maintained node versions"
|
||||
]
|
||||
```
|
||||
|
||||
Or in `.browserslistrc` config:
|
||||
|
||||
```yaml
|
||||
# Browsers that we support
|
||||
|
||||
defaults
|
||||
not IE 11
|
||||
not IE_Mob 11
|
||||
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.
|
||||
|
||||
Browserslist will take queries from tool option,
|
||||
`browserslist` config, `.browserslistrc` config,
|
||||
`browserslist` section in `package.json` or environment variables.
|
||||
|
||||
[Browserslist Example] shows how every tool uses Browserslist.
|
||||
|
||||
[cult-img]: https://cultofmartians.com/assets/badges/badge.svg
|
||||
[cult]: https://cultofmartians.com/done.html
|
||||
|
||||
<a href="https://evilmartians.com/?utm_source=browserslist">
|
||||
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
|
||||
alt="Sponsored by Evil Martians" width="236" height="54">
|
||||
</a>
|
||||
|
||||
[stylelint-no-unsupported-browser-features]: https://github.com/ismay/stylelint-no-unsupported-browser-features
|
||||
[eslint-plugin-compat]: https://github.com/amilajack/eslint-plugin-compat
|
||||
[Browserslist Example]: https://github.com/browserslist/browserslist-example
|
||||
[postcss-preset-env]: https://github.com/jonathantneal/postcss-preset-env
|
||||
[postcss-normalize]: https://github.com/jonathantneal/postcss-normalize
|
||||
[`caniuse-lite`]: https://github.com/ben-eb/caniuse-lite
|
||||
[Autoprefixer]: https://github.com/postcss/autoprefixer
|
||||
[Can I Use]: https://caniuse.com/
|
||||
[Babel]: https://github.com/babel/babel/tree/master/packages/babel-preset-env
|
||||
[obsolete-webpack-plugin]: https://github.com/ElemeFE/obsolete-webpack-plugin
|
||||
|
||||
## Table of Contents
|
||||
|
||||
* [Tools](#tools)
|
||||
* [Best Practices](#best-practices)
|
||||
* [Browsers Data Updating](#browsers-data-updating)
|
||||
* [Queries](#queries)
|
||||
* [Query Composition](#query-composition)
|
||||
* [Full List](#full-list)
|
||||
* [Debug](#debug)
|
||||
* [Browsers](#browsers)
|
||||
* [Config File](#config-file)
|
||||
* [`package.json`](#packagejson)
|
||||
* [`.browserslistrc`](#browserslistrc)
|
||||
* [Shareable Configs](#shareable-configs)
|
||||
* [Configuring for Different Environments](#configuring-for-different-environments)
|
||||
* [Custom Usage Data](#custom-usage-data)
|
||||
* [JS API](#js-api)
|
||||
* [Environment Variables](#environment-variables)
|
||||
* [Cache](#cache)
|
||||
* [Security Contact](#security-contact)
|
||||
* [For Enterprise](#for-enterprise)
|
||||
|
||||
## Tools
|
||||
|
||||
* [`browserl.ist`](https://browserl.ist/) is an online tool to check
|
||||
what browsers will be selected by some query.
|
||||
* [`browserslist-ga`] and [`browserslist-ga-export`] download your website
|
||||
browsers statistics to use it in `> 0.5% in my stats` query.
|
||||
* [`browserslist-useragent-regexp`] compiles Browserslist query to a RegExp
|
||||
to test browser useragent.
|
||||
* [`browserslist-useragent-ruby`] is a Ruby library to checks browser
|
||||
by user agent string to match Browserslist.
|
||||
* [`browserslist-browserstack`] runs BrowserStack tests for all browsers
|
||||
in Browserslist config.
|
||||
* [`browserslist-adobe-analytics`] use Adobe Analytics data to target browsers.
|
||||
* [`caniuse-api`] returns browsers which support some specific feature.
|
||||
* 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-useragent-regexp`]: https://github.com/browserslist/browserslist-useragent-regexp
|
||||
[`browserslist-adobe-analytics`]: https://github.com/xeroxinteractive/browserslist-adobe-analytics
|
||||
[`browserslist-useragent-ruby`]: https://github.com/browserslist/browserslist-useragent-ruby
|
||||
[`browserslist-browserstack`]: https://github.com/xeroxinteractive/browserslist-browserstack
|
||||
[`browserslist-ga-export`]: https://github.com/browserslist/browserslist-ga-export
|
||||
[`browserslist-useragent`]: https://github.com/pastelsky/browserslist-useragent
|
||||
[`browserslist-ga`]: https://github.com/browserslist/browserslist-ga
|
||||
[`caniuse-api`]: https://github.com/Nyalab/caniuse-api
|
||||
|
||||
|
||||
## Best Practices
|
||||
|
||||
* There is a `defaults` query, which gives a reasonable configuration
|
||||
for most users:
|
||||
|
||||
```json
|
||||
"browserslist": [
|
||||
"defaults"
|
||||
]
|
||||
```
|
||||
|
||||
* If you want to change the default set of browsers, we recommend combining
|
||||
`last 2 versions`, `not dead` with a usage number like `> 0.2%`. This is
|
||||
because `last n versions` on its own does not add popular old versions, while
|
||||
only using a percentage 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.
|
||||
|
||||
|
||||
## Browsers Data Updating
|
||||
|
||||
`npx browserslist@latest --update-db` updates `caniuse-lite` version
|
||||
in your npm, yarn or pnpm lock file.
|
||||
|
||||
You need to do it regularly for two reasons:
|
||||
|
||||
1. To use the latest browser’s versions and statistics in queries like
|
||||
`last 2 versions` or `>1%`. For example, if you created your project
|
||||
2 years ago and did not update your dependencies, `last 1 version`
|
||||
will return 2 year old browsers.
|
||||
2. `caiuse-lite` deduplication: to synchronize version in different tools.
|
||||
|
||||
> What is deduplication?
|
||||
|
||||
Due to how npm architecture is setup, you may have a situation
|
||||
where you have multiple versions of a single dependency required.
|
||||
|
||||
Imagine you begin a project, and you add `autoprefixer` as a dependency.
|
||||
npm looks for the latest `caniuse-lite` version (1.0.30000700) and adds it to
|
||||
`package-lock.json` under `autoprefixer` dependencies.
|
||||
|
||||
A year later, you decide to add Babel. At this moment, we have a
|
||||
new version of `canuse-lite` (1.0.30000900). npm took the latest version
|
||||
and added it to your lock file under `@babel/preset-env` dependencies.
|
||||
|
||||
Now your lock file looks like this:
|
||||
|
||||
```ocaml
|
||||
autoprefixer 7.1.4
|
||||
browserslist 3.1.1
|
||||
caniuse-lite 1.0.30000700
|
||||
@babel/preset-env 7.10.0
|
||||
browserslist 4.13.0
|
||||
caniuse-lite 1.0.30000900
|
||||
```
|
||||
|
||||
As you can see, we now have two versions of `caniuse-lite` installed.
|
||||
|
||||
|
||||
## Queries
|
||||
|
||||
Browserslist will use browsers and Node.js versions query
|
||||
from one of these sources:
|
||||
|
||||
1. `browserslist` key in `package.json` file in current or parent directories.
|
||||
**We recommend this way.**
|
||||
2. `.browserslistrc` config 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 is 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 <br> (union) |  | `> .5% or last 2 versions` <br> `> .5%, last 2 versions` |
|
||||
| `and` combiner <br> (intersection) |  | `> .5% and last 2 versions` |
|
||||
| `not` combiner <br> (relative complement) |  | All those three are equivalent to the first one <br> `> .5% and not last 2 versions` <br> `> .5% or not last 2 versions` <br> `> .5%, not last 2 versions` |
|
||||
|
||||
_A quick way to test your query is to do `npx browserslist '> 0.5%, not IE 11'`
|
||||
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`).
|
||||
* `> 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].
|
||||
* `dead`: browsers without official support or updates for 24 months.
|
||||
Right now it is `IE 10`, `IE_Mob 11`, `BlackBerry 10`, `BlackBerry 7`,
|
||||
`Samsung 4` and `OperaMobile 12.1`.
|
||||
* `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.
|
||||
* `node 10` and `node 10.4`: selects latest Node.js `10.x.x`
|
||||
or `10.4.x` release.
|
||||
* `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.
|
||||
* `iOS 7`: the iOS browser version 7 directly.
|
||||
* `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 ESR] version.
|
||||
* `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.
|
||||
* `supports es6-module`: browsers with support for specific features.
|
||||
`es6-module` here is the `feat` parameter at the URL of the [Can I Use]
|
||||
page. A list of all available features can be found at
|
||||
[`caniuse-lite/data/features`].
|
||||
* `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 browsers selected by previous queries.
|
||||
|
||||
You can add `not ` to any query.
|
||||
|
||||
[`caniuse-lite/data/regions`]: https://github.com/ben-eb/caniuse-lite/tree/master/data/regions
|
||||
[`caniuse-lite/data/features`]: https://github.com/ben-eb/caniuse-lite/tree/master/data/features
|
||||
[two-letter country code]: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
|
||||
[custom usage data]: #custom-usage-data
|
||||
[still maintained]: https://github.com/nodejs/Release
|
||||
[Can I Use]: https://caniuse.com/
|
||||
|
||||
|
||||
### Debug
|
||||
|
||||
Run `npx browserslist` in project directory to see what browsers was selected
|
||||
by your queries.
|
||||
|
||||
```sh
|
||||
$ 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
|
||||
|
||||
Names are case insensitive:
|
||||
|
||||
* `Android` for Android WebView.
|
||||
* `Baidu` for Baidu Browser.
|
||||
* `BlackBerry` or `bb` for Blackberry browser.
|
||||
* `Chrome` for Google Chrome.
|
||||
* `ChromeAndroid` or `and_chr` for Chrome for Android
|
||||
* `Edge` for Microsoft Edge.
|
||||
* `Electron` for Electron framework. It will be converted to Chrome version.
|
||||
* `Explorer` or `ie` for Internet Explorer.
|
||||
* `ExplorerMobile` or `ie_mob` for Internet Explorer Mobile.
|
||||
* `Firefox` or `ff` for Mozilla Firefox.
|
||||
* `FirefoxAndroid` or `and_ff` for Firefox for Android.
|
||||
* `iOS` or `ios_saf` for iOS Safari.
|
||||
* `Node` for Node.js.
|
||||
* `Opera` for Opera.
|
||||
* `OperaMini` or `op_mini` for Opera Mini.
|
||||
* `OperaMobile` or `op_mob` for Opera Mobile.
|
||||
* `QQAndroid` or `and_qq` for QQ Browser for Android.
|
||||
* `Safari` for desktop Safari.
|
||||
* `Samsung` for Samsung Internet.
|
||||
* `UCAndroid` or `and_uc` for UC Browser for Android.
|
||||
* `kaios` for KaiOS Browser.
|
||||
|
||||
|
||||
## Config File
|
||||
|
||||
### `package.json`
|
||||
|
||||
If you want to reduce config files in project root, you can specify
|
||||
browsers in `package.json` with `browserslist` key:
|
||||
|
||||
```json
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"autoprefixer": "^6.5.4"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 1 version",
|
||||
"> 1%",
|
||||
"IE 10"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### `.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:
|
||||
|
||||
```yaml
|
||||
# Browsers that we support
|
||||
|
||||
last 1 version
|
||||
> 1%
|
||||
IE 10 # sorry
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
```json
|
||||
"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
|
||||
or `dangerousExtend` option.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST_DANGEROUS_EXTEND=1 npx webpack
|
||||
```
|
||||
|
||||
Because this uses `npm`'s resolution, you can also reference specific files
|
||||
in a package:
|
||||
|
||||
```json
|
||||
"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`:
|
||||
|
||||
```js
|
||||
module.exports = [
|
||||
'last 1 version',
|
||||
'> 1%',
|
||||
'ie 10'
|
||||
]
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
development: [
|
||||
'last 1 version'
|
||||
],
|
||||
production: [
|
||||
'last 1 version',
|
||||
'> 1%',
|
||||
'ie 10'
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## 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`:
|
||||
|
||||
```js
|
||||
"browserslist": {
|
||||
"production": [
|
||||
"> 1%",
|
||||
"ie 10"
|
||||
],
|
||||
"modern": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version"
|
||||
],
|
||||
"ssr": [
|
||||
"node 12"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
In `.browserslistrc` config:
|
||||
|
||||
```ini
|
||||
[production]
|
||||
> 1%
|
||||
ie 10
|
||||
|
||||
[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:
|
||||
|
||||
```js
|
||||
{
|
||||
"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.
|
||||
|
||||
[`browserslist-ga-export`]: https://github.com/browserslist/browserslist-ga-export
|
||||
[`browserslist-ga`]: https://github.com/browserslist/browserslist-ga
|
||||
[Can I Use]: https://caniuse.com/
|
||||
|
||||
|
||||
## JS API
|
||||
|
||||
```js
|
||||
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%, IE 10"`
|
||||
or an array `['> 1%', 'IE 10']`.
|
||||
|
||||
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.`
|
||||
* `mobileToDesktop`: Use desktop browsers if Can I Use doesn’t have data
|
||||
about this mobile version. For instance, Browserslist will return
|
||||
`chrome 20` on `and_chr 20` query (Can I Use has only data only about
|
||||
latest versions of mobile browsers). Default is `false`.
|
||||
|
||||
For non-JS environment and debug purpose you can use CLI tool:
|
||||
|
||||
```sh
|
||||
browserslist "> 1%, IE 10"
|
||||
```
|
||||
|
||||
You can get total users coverage for selected browsers by JS API:
|
||||
|
||||
```js
|
||||
browserslist.coverage(browserslist('> 1%'))
|
||||
//=> 81.4
|
||||
```
|
||||
|
||||
```js
|
||||
browserslist.coverage(browserslist('> 1% in US'), 'US')
|
||||
//=> 83.1
|
||||
```
|
||||
|
||||
```js
|
||||
browserslist.coverage(browserslist('> 1% in my stats'), 'my stats')
|
||||
//=> 83.1
|
||||
```
|
||||
|
||||
```js
|
||||
browserslist.coverage(browserslist('> 1% in my stats', { stats }), stats)
|
||||
//=> 82.2
|
||||
```
|
||||
|
||||
Or by CLI:
|
||||
|
||||
```sh
|
||||
$ browserslist --coverage "> 1%"
|
||||
These browsers account for 81.4% of all users globally
|
||||
```
|
||||
|
||||
```sh
|
||||
$ browserslist --coverage=US "> 1% in US"
|
||||
These browsers account for 83.1% of all users in the US
|
||||
```
|
||||
|
||||
```sh
|
||||
$ browserslist --coverage "> 1% in my stats"
|
||||
These browsers account for 83.1% of all users in custom statistics
|
||||
```
|
||||
|
||||
```sh
|
||||
$ 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.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST="> 5%" npx webpack
|
||||
```
|
||||
|
||||
* `BROWSERSLIST_CONFIG` with path to config file.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST_CONFIG=./config/browserslist npx webpack
|
||||
```
|
||||
|
||||
* `BROWSERSLIST_ENV` with environments string.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST_ENV="development" npx webpack
|
||||
```
|
||||
|
||||
* `BROWSERSLIST_STATS` with path to the custom usage data
|
||||
for `> 1% in my stats` query.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST_STATS=./config/usage_data.json npx webpack
|
||||
```
|
||||
|
||||
* `BROWSERSLIST_DISABLE_CACHE` if you want to disable config reading cache.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST_DISABLE_CACHE=1 npx webpack
|
||||
```
|
||||
|
||||
* `BROWSERSLIST_DANGEROUS_EXTEND` to disable security shareable config
|
||||
name check.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST_DANGEROUS_EXTEND=1 npx webpack
|
||||
```
|
||||
|
||||
[environment variables]: https://en.wikipedia.org/wiki/Environment_variable
|
||||
|
||||
|
||||
## 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:
|
||||
|
||||
```js
|
||||
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.
|
||||
|
||||
[Tidelift security contact]: https://tidelift.com/security
|
||||
|
||||
|
||||
## 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.](https://tidelift.com/subscription/pkg/npm-browserslist?utm_source=npm-browserslist&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
46
node_modules/browserslist/browser.js
generated
vendored
Normal file
46
node_modules/browserslist/browser.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
var BrowserslistError = require('./error')
|
||||
|
||||
function noop () { }
|
||||
|
||||
module.exports = {
|
||||
loadQueries: function loadQueries () {
|
||||
throw new BrowserslistError(
|
||||
'Sharable configs are not supported in client-side build of Browserslist')
|
||||
},
|
||||
|
||||
getStat: function getStat (opts) {
|
||||
return opts.stats
|
||||
},
|
||||
|
||||
loadConfig: function loadConfig (opts) {
|
||||
if (opts.config) {
|
||||
throw new BrowserslistError(
|
||||
'Browserslist config are not supported in client-side build')
|
||||
}
|
||||
},
|
||||
|
||||
loadCountry: function loadCountry () {
|
||||
throw new BrowserslistError(
|
||||
'Country statistics are not supported ' +
|
||||
'in client-side build of Browserslist')
|
||||
},
|
||||
|
||||
loadFeature: function loadFeature () {
|
||||
throw new BrowserslistError(
|
||||
'Supports queries are not available in client-side build of Browserslist')
|
||||
},
|
||||
|
||||
currentNode: function currentNode (resolve, context) {
|
||||
return resolve(['maintained node versions'], context)[0]
|
||||
},
|
||||
|
||||
parseConfig: noop,
|
||||
|
||||
readConfig: noop,
|
||||
|
||||
findConfig: noop,
|
||||
|
||||
clearCaches: noop,
|
||||
|
||||
oldDataWarning: noop
|
||||
}
|
145
node_modules/browserslist/cli.js
generated
vendored
Executable file
145
node_modules/browserslist/cli.js
generated
vendored
Executable file
@ -0,0 +1,145 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var fs = require('fs')
|
||||
|
||||
var browserslist = require('./')
|
||||
var updateDb = require('./update-db')
|
||||
var pkg = require('./package.json')
|
||||
|
||||
var args = process.argv.slice(2)
|
||||
|
||||
var USAGE = 'Usage:\n' +
|
||||
' npx browserslist\n' +
|
||||
' npx browserslist "QUERIES"\n' +
|
||||
' npx browserslist --json "QUERIES"\n' +
|
||||
' npx browserslist --config="path/to/browserlist/file"\n' +
|
||||
' npx browserslist --coverage "QUERIES"\n' +
|
||||
' npx browserslist --coverage=US "QUERIES"\n' +
|
||||
' npx browserslist --coverage=US,RU,global "QUERIES"\n' +
|
||||
' npx browserslist --env="environment name defined in config"\n' +
|
||||
' npx browserslist --stats="path/to/browserlist/stats/file"\n' +
|
||||
' npx browserslist --mobile-to-desktop\n' +
|
||||
' npx browserslist --update-db'
|
||||
|
||||
function isArg (arg) {
|
||||
return args.some(function (str) {
|
||||
return str === arg || str.indexOf(arg + '=') === 0
|
||||
})
|
||||
}
|
||||
|
||||
function error (msg) {
|
||||
process.stderr.write('browserslist: ' + msg + '\n')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
if (isArg('--help') || isArg('-h')) {
|
||||
process.stdout.write(pkg.description + '.\n\n' + USAGE + '\n')
|
||||
} else if (isArg('--version') || isArg('-v')) {
|
||||
process.stdout.write('browserslist ' + pkg.version + '\n')
|
||||
} else if (isArg('--update-db')) {
|
||||
updateDb(function (str) {
|
||||
process.stdout.write(str)
|
||||
})
|
||||
} else {
|
||||
var mode = 'browsers'
|
||||
var opts = { }
|
||||
var queries
|
||||
var areas
|
||||
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
if (args[i][0] !== '-') {
|
||||
queries = args[i].replace(/^["']|["']$/g, '')
|
||||
continue
|
||||
}
|
||||
|
||||
var arg = args[i].split('=')
|
||||
var name = arg[0]
|
||||
var value = arg[1]
|
||||
|
||||
if (value) value = value.replace(/^["']|["']$/g, '')
|
||||
|
||||
if (name === '--config' || name === '-b') {
|
||||
opts.config = value
|
||||
} else if (name === '--env' || name === '-e') {
|
||||
opts.env = value
|
||||
} else if (name === '--stats' || name === '-s') {
|
||||
opts.stats = value
|
||||
} else if (name === '--coverage' || name === '-c') {
|
||||
if (mode !== 'json') mode = 'coverage'
|
||||
if (value) {
|
||||
areas = value.split(',')
|
||||
} else {
|
||||
areas = ['global']
|
||||
}
|
||||
} else if (name === '--json') {
|
||||
mode = 'json'
|
||||
} else if (name === '--mobile-to-desktop') {
|
||||
opts.mobileToDesktop = true
|
||||
} else {
|
||||
error('Unknown arguments ' + args[i] + '.\n\n' + USAGE)
|
||||
}
|
||||
}
|
||||
|
||||
var browsers
|
||||
try {
|
||||
browsers = browserslist(queries, opts)
|
||||
} catch (e) {
|
||||
if (e.name === 'BrowserslistError') {
|
||||
error(e.message)
|
||||
} else {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
var coverage
|
||||
if (mode === 'browsers') {
|
||||
browsers.forEach(function (browser) {
|
||||
process.stdout.write(browser + '\n')
|
||||
})
|
||||
} else if (areas) {
|
||||
coverage = areas.map(function (area) {
|
||||
var stats
|
||||
if (area !== 'global') {
|
||||
stats = area
|
||||
} else if (opts.stats) {
|
||||
stats = JSON.parse(fs.readFileSync(opts.stats))
|
||||
}
|
||||
var result = browserslist.coverage(browsers, stats)
|
||||
var round = Math.round(result * 100) / 100.0
|
||||
|
||||
return [area, round]
|
||||
})
|
||||
|
||||
if (mode === 'coverage') {
|
||||
var prefix = 'These browsers account for '
|
||||
process.stdout.write(prefix)
|
||||
coverage.forEach(function (data, index) {
|
||||
var area = data[0]
|
||||
var round = data[1]
|
||||
var end = 'globally'
|
||||
if (area && area !== 'global') {
|
||||
end = 'in the ' + area.toUpperCase()
|
||||
} else if (opts.stats) {
|
||||
end = 'in custom statistics'
|
||||
}
|
||||
|
||||
if (index !== 0) {
|
||||
process.stdout.write(prefix.replace(/./g, ' '))
|
||||
}
|
||||
|
||||
process.stdout.write(round + '% of all users ' + end + '\n')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (mode === 'json') {
|
||||
var data = { browsers: browsers }
|
||||
if (coverage) {
|
||||
data.coverage = coverage.reduce(function (object, j) {
|
||||
object[j[0]] = j[1]
|
||||
return object
|
||||
}, { })
|
||||
}
|
||||
process.stdout.write(JSON.stringify(data, null, ' ') + '\n')
|
||||
}
|
||||
}
|
12
node_modules/browserslist/error.js
generated
vendored
Normal file
12
node_modules/browserslist/error.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
function BrowserslistError (message) {
|
||||
this.name = 'BrowserslistError'
|
||||
this.message = message
|
||||
this.browserslist = true
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, BrowserslistError)
|
||||
}
|
||||
}
|
||||
|
||||
BrowserslistError.prototype = Error.prototype
|
||||
|
||||
module.exports = BrowserslistError
|
1174
node_modules/browserslist/index.js
generated
vendored
Normal file
1174
node_modules/browserslist/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
386
node_modules/browserslist/node.js
generated
vendored
Normal file
386
node_modules/browserslist/node.js
generated
vendored
Normal file
@ -0,0 +1,386 @@
|
||||
var feature = require('caniuse-lite/dist/unpacker/feature').default
|
||||
var region = require('caniuse-lite/dist/unpacker/region').default
|
||||
var path = require('path')
|
||||
var fs = require('fs')
|
||||
|
||||
var BrowserslistError = require('./error')
|
||||
|
||||
var IS_SECTION = /^\s*\[(.+)]\s*$/
|
||||
var CONFIG_PATTERN = /^browserslist-config-/
|
||||
var SCOPED_CONFIG__PATTERN = /@[^/]+\/browserslist-config(-|$|\/)/
|
||||
var TIME_TO_UPDATE_CANIUSE = 6 * 30 * 24 * 60 * 60 * 1000
|
||||
var FORMAT = 'Browserslist config should be a string or an array ' +
|
||||
'of strings with browser queries'
|
||||
|
||||
var dataTimeChecked = false
|
||||
var filenessCache = { }
|
||||
var configCache = { }
|
||||
function checkExtend (name) {
|
||||
var use = ' Use `dangerousExtend` option to disable.'
|
||||
if (!CONFIG_PATTERN.test(name) && !SCOPED_CONFIG__PATTERN.test(name)) {
|
||||
throw new BrowserslistError(
|
||||
'Browserslist config needs `browserslist-config-` prefix. ' + use)
|
||||
}
|
||||
if (name.replace(/^@[^/]+\//, '').indexOf('.') !== -1) {
|
||||
throw new BrowserslistError(
|
||||
'`.` not allowed in Browserslist config name. ' + use)
|
||||
}
|
||||
if (name.indexOf('node_modules') !== -1) {
|
||||
throw new BrowserslistError(
|
||||
'`node_modules` not allowed in Browserslist config.' + use)
|
||||
}
|
||||
}
|
||||
|
||||
function isFile (file) {
|
||||
if (file in filenessCache) {
|
||||
return filenessCache[file]
|
||||
}
|
||||
var result = fs.existsSync(file) && fs.statSync(file).isFile()
|
||||
if (!process.env.BROWSERSLIST_DISABLE_CACHE) {
|
||||
filenessCache[file] = result
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
function eachParent (file, callback) {
|
||||
var dir = isFile(file) ? path.dirname(file) : file
|
||||
var loc = path.resolve(dir)
|
||||
do {
|
||||
var result = callback(loc)
|
||||
if (typeof result !== 'undefined') return result
|
||||
} while (loc !== (loc = path.dirname(loc)))
|
||||
return undefined
|
||||
}
|
||||
|
||||
function check (section) {
|
||||
if (Array.isArray(section)) {
|
||||
for (var i = 0; i < section.length; i++) {
|
||||
if (typeof section[i] !== 'string') {
|
||||
throw new BrowserslistError(FORMAT)
|
||||
}
|
||||
}
|
||||
} else if (typeof section !== 'string') {
|
||||
throw new BrowserslistError(FORMAT)
|
||||
}
|
||||
}
|
||||
|
||||
function pickEnv (config, opts) {
|
||||
if (typeof config !== 'object') return config
|
||||
|
||||
var name
|
||||
if (typeof opts.env === 'string') {
|
||||
name = opts.env
|
||||
} else if (process.env.BROWSERSLIST_ENV) {
|
||||
name = process.env.BROWSERSLIST_ENV
|
||||
} else if (process.env.NODE_ENV) {
|
||||
name = process.env.NODE_ENV
|
||||
} else {
|
||||
name = 'production'
|
||||
}
|
||||
|
||||
return config[name] || config.defaults
|
||||
}
|
||||
|
||||
function parsePackage (file) {
|
||||
var config = JSON.parse(fs.readFileSync(file))
|
||||
if (config.browserlist && !config.browserslist) {
|
||||
throw new BrowserslistError(
|
||||
'`browserlist` key instead of `browserslist` in ' + file
|
||||
)
|
||||
}
|
||||
var list = config.browserslist
|
||||
if (Array.isArray(list) || typeof list === 'string') {
|
||||
list = { defaults: list }
|
||||
}
|
||||
for (var i in list) {
|
||||
check(list[i])
|
||||
}
|
||||
|
||||
return list
|
||||
}
|
||||
|
||||
function latestReleaseTime (agents) {
|
||||
var latest = 0
|
||||
for (var name in agents) {
|
||||
var dates = agents[name].releaseDate || { }
|
||||
for (var key in dates) {
|
||||
if (latest < dates[key]) {
|
||||
latest = dates[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
return latest * 1000
|
||||
}
|
||||
|
||||
function normalizeStats (data, stats) {
|
||||
if (stats && 'dataByBrowser' in stats) {
|
||||
stats = stats.dataByBrowser
|
||||
}
|
||||
|
||||
if (typeof stats !== 'object') return undefined
|
||||
|
||||
var normalized = { }
|
||||
for (var i in stats) {
|
||||
var versions = Object.keys(stats[i])
|
||||
if (
|
||||
versions.length === 1 &&
|
||||
data[i] &&
|
||||
data[i].versions.length === 1
|
||||
) {
|
||||
var normal = Object.keys(data[i].versions)[0]
|
||||
normalized[i] = { }
|
||||
normalized[i][normal] = stats[i][versions[0]]
|
||||
} else {
|
||||
normalized[i] = stats[i]
|
||||
}
|
||||
}
|
||||
|
||||
return normalized
|
||||
}
|
||||
|
||||
function normalizeUsageData (usageData, data) {
|
||||
for (var browser in usageData) {
|
||||
var browserUsage = usageData[browser]
|
||||
// eslint-disable-next-line max-len
|
||||
// https://github.com/browserslist/browserslist/issues/431#issuecomment-565230615
|
||||
// caniuse-db returns { 0: "percentage" } for `and_*` regional stats
|
||||
if ('0' in browserUsage) {
|
||||
var versions = data[browser].versions
|
||||
browserUsage[versions[versions.length - 1]] = browserUsage[0]
|
||||
delete browserUsage[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
loadQueries: function loadQueries (ctx, name) {
|
||||
if (!ctx.dangerousExtend && !process.env.BROWSERSLIST_DANGEROUS_EXTEND) {
|
||||
checkExtend(name)
|
||||
}
|
||||
// eslint-disable-next-line security/detect-non-literal-require
|
||||
var queries = require(require.resolve(name, { paths: ['.'] }))
|
||||
if (queries) {
|
||||
if (Array.isArray(queries)) {
|
||||
return queries
|
||||
} else if (typeof queries === 'object') {
|
||||
if (!queries.defaults) queries.defaults = []
|
||||
return pickEnv(queries, ctx, name)
|
||||
}
|
||||
}
|
||||
throw new BrowserslistError(
|
||||
'`' + name + '` config exports not an array of queries' +
|
||||
' or an object of envs'
|
||||
)
|
||||
},
|
||||
|
||||
loadStat: function loadStat (ctx, name, data) {
|
||||
if (!ctx.dangerousExtend && !process.env.BROWSERSLIST_DANGEROUS_EXTEND) {
|
||||
checkExtend(name)
|
||||
}
|
||||
// eslint-disable-next-line security/detect-non-literal-require
|
||||
var stats = require(
|
||||
require.resolve(
|
||||
path.join(name, 'browserslist-stats.json'),
|
||||
{ paths: ['.'] }
|
||||
)
|
||||
)
|
||||
return normalizeStats(data, stats)
|
||||
},
|
||||
|
||||
getStat: function getStat (opts, data) {
|
||||
var stats
|
||||
if (opts.stats) {
|
||||
stats = opts.stats
|
||||
} else if (process.env.BROWSERSLIST_STATS) {
|
||||
stats = process.env.BROWSERSLIST_STATS
|
||||
} else if (opts.path && path.resolve && fs.existsSync) {
|
||||
stats = eachParent(opts.path, function (dir) {
|
||||
var file = path.join(dir, 'browserslist-stats.json')
|
||||
return isFile(file) ? file : undefined
|
||||
})
|
||||
}
|
||||
if (typeof stats === 'string') {
|
||||
try {
|
||||
stats = JSON.parse(fs.readFileSync(stats))
|
||||
} catch (e) {
|
||||
throw new BrowserslistError('Can\'t read ' + stats)
|
||||
}
|
||||
}
|
||||
return normalizeStats(data, stats)
|
||||
},
|
||||
|
||||
loadConfig: function loadConfig (opts) {
|
||||
if (process.env.BROWSERSLIST) {
|
||||
return process.env.BROWSERSLIST
|
||||
} else if (opts.config || process.env.BROWSERSLIST_CONFIG) {
|
||||
var file = opts.config || process.env.BROWSERSLIST_CONFIG
|
||||
if (path.basename(file) === 'package.json') {
|
||||
return pickEnv(parsePackage(file), opts)
|
||||
} else {
|
||||
return pickEnv(module.exports.readConfig(file), opts)
|
||||
}
|
||||
} else if (opts.path) {
|
||||
return pickEnv(module.exports.findConfig(opts.path), opts)
|
||||
} else {
|
||||
return undefined
|
||||
}
|
||||
},
|
||||
|
||||
loadCountry: function loadCountry (usage, country, data) {
|
||||
var code = country.replace(/[^\w-]/g, '')
|
||||
if (!usage[code]) {
|
||||
// eslint-disable-next-line security/detect-non-literal-require
|
||||
var compressed = require('caniuse-lite/data/regions/' + code + '.js')
|
||||
var usageData = region(compressed)
|
||||
normalizeUsageData(usageData, data)
|
||||
usage[country] = { }
|
||||
for (var i in usageData) {
|
||||
for (var j in usageData[i]) {
|
||||
usage[country][i + ' ' + j] = usageData[i][j]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
loadFeature: function loadFeature (features, name) {
|
||||
name = name.replace(/[^\w-]/g, '')
|
||||
if (features[name]) return
|
||||
|
||||
// eslint-disable-next-line security/detect-non-literal-require
|
||||
var compressed = require('caniuse-lite/data/features/' + name + '.js')
|
||||
var stats = feature(compressed).stats
|
||||
features[name] = { }
|
||||
for (var i in stats) {
|
||||
for (var j in stats[i]) {
|
||||
features[name][i + ' ' + j] = stats[i][j]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
parseConfig: function parseConfig (string) {
|
||||
var result = { defaults: [] }
|
||||
var sections = ['defaults']
|
||||
|
||||
string.toString()
|
||||
.replace(/#[^\n]*/g, '')
|
||||
.split(/\n|,/)
|
||||
.map(function (line) {
|
||||
return line.trim()
|
||||
})
|
||||
.filter(function (line) {
|
||||
return line !== ''
|
||||
})
|
||||
.forEach(function (line) {
|
||||
if (IS_SECTION.test(line)) {
|
||||
sections = line.match(IS_SECTION)[1].trim().split(' ')
|
||||
sections.forEach(function (section) {
|
||||
if (result[section]) {
|
||||
throw new BrowserslistError(
|
||||
'Duplicate section ' + section + ' in Browserslist config'
|
||||
)
|
||||
}
|
||||
result[section] = []
|
||||
})
|
||||
} else {
|
||||
sections.forEach(function (section) {
|
||||
result[section].push(line)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return result
|
||||
},
|
||||
|
||||
readConfig: function readConfig (file) {
|
||||
if (!isFile(file)) {
|
||||
throw new BrowserslistError('Can\'t read ' + file + ' config')
|
||||
}
|
||||
return module.exports.parseConfig(fs.readFileSync(file))
|
||||
},
|
||||
|
||||
findConfig: function findConfig (from) {
|
||||
from = path.resolve(from)
|
||||
|
||||
var passed = []
|
||||
var resolved = eachParent(from, function (dir) {
|
||||
if (dir in configCache) {
|
||||
return configCache[dir]
|
||||
}
|
||||
|
||||
passed.push(dir)
|
||||
|
||||
var config = path.join(dir, 'browserslist')
|
||||
var pkg = path.join(dir, 'package.json')
|
||||
var rc = path.join(dir, '.browserslistrc')
|
||||
|
||||
var pkgBrowserslist
|
||||
if (isFile(pkg)) {
|
||||
try {
|
||||
pkgBrowserslist = parsePackage(pkg)
|
||||
} catch (e) {
|
||||
if (e.name === 'BrowserslistError') throw e
|
||||
console.warn(
|
||||
'[Browserslist] Could not parse ' + pkg + '. Ignoring it.'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (isFile(config) && pkgBrowserslist) {
|
||||
throw new BrowserslistError(
|
||||
dir + ' contains both browserslist and package.json with browsers'
|
||||
)
|
||||
} else if (isFile(rc) && pkgBrowserslist) {
|
||||
throw new BrowserslistError(
|
||||
dir + ' contains both .browserslistrc and package.json with browsers'
|
||||
)
|
||||
} else if (isFile(config) && isFile(rc)) {
|
||||
throw new BrowserslistError(
|
||||
dir + ' contains both .browserslistrc and browserslist'
|
||||
)
|
||||
} else if (isFile(config)) {
|
||||
return module.exports.readConfig(config)
|
||||
} else if (isFile(rc)) {
|
||||
return module.exports.readConfig(rc)
|
||||
} else {
|
||||
return pkgBrowserslist
|
||||
}
|
||||
})
|
||||
if (!process.env.BROWSERSLIST_DISABLE_CACHE) {
|
||||
passed.forEach(function (dir) {
|
||||
configCache[dir] = resolved
|
||||
})
|
||||
}
|
||||
return resolved
|
||||
},
|
||||
|
||||
clearCaches: function clearCaches () {
|
||||
dataTimeChecked = false
|
||||
filenessCache = { }
|
||||
configCache = { }
|
||||
|
||||
this.cache = { }
|
||||
},
|
||||
|
||||
oldDataWarning: function oldDataWarning (agentsObj) {
|
||||
if (dataTimeChecked) return
|
||||
dataTimeChecked = true
|
||||
if (process.env.BROWSERSLIST_IGNORE_OLD_DATA) return
|
||||
|
||||
var latest = latestReleaseTime(agentsObj)
|
||||
var halfYearAgo = Date.now() - TIME_TO_UPDATE_CANIUSE
|
||||
|
||||
if (latest !== 0 && latest < halfYearAgo) {
|
||||
console.warn(
|
||||
'Browserslist: caniuse-lite is outdated. Please run:\n' +
|
||||
'npx browserslist@latest --update-db\n' +
|
||||
'\n' +
|
||||
'Why you should do it regularly:\n' +
|
||||
'https://github.com/browserslist/browserslist#browsers-data-updating'
|
||||
)
|
||||
}
|
||||
},
|
||||
|
||||
currentNode: function currentNode () {
|
||||
return 'node ' + process.versions.node
|
||||
}
|
||||
}
|
68
node_modules/browserslist/package.json
generated
vendored
Normal file
68
node_modules/browserslist/package.json
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
{
|
||||
"_from": "browserslist@^4.12.0",
|
||||
"_id": "browserslist@4.14.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-HI4lPveGKUR0x2StIz+2FXfDk9SfVMrxn6PLh1JeGUwcuoDkdKZebWiyLRJ68iIPDpMI4JLVDf7S7XzslgWOhw==",
|
||||
"_location": "/browserslist",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "browserslist@^4.12.0",
|
||||
"name": "browserslist",
|
||||
"escapedName": "browserslist",
|
||||
"rawSpec": "^4.12.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.12.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/autoprefixer"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.14.2.tgz",
|
||||
"_shasum": "1b3cec458a1ba87588cc5e9be62f19b6d48813ce",
|
||||
"_spec": "browserslist@^4.12.0",
|
||||
"_where": "/home/outis/Documents/Sites/BBB/node_modules/autoprefixer",
|
||||
"author": {
|
||||
"name": "Andrey Sitnik",
|
||||
"email": "andrey@sitnik.ru"
|
||||
},
|
||||
"bin": {
|
||||
"browserslist": "cli.js"
|
||||
},
|
||||
"browser": {
|
||||
"./node.js": "./browser.js",
|
||||
"path": false
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/browserslist/browserslist/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"caniuse-lite": "^1.0.30001125",
|
||||
"electron-to-chromium": "^1.3.564",
|
||||
"escalade": "^3.0.2",
|
||||
"node-releases": "^1.1.61"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-env-preset",
|
||||
"engines": {
|
||||
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
|
||||
},
|
||||
"funding": {
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/browserslist"
|
||||
},
|
||||
"homepage": "https://github.com/browserslist/browserslist#readme",
|
||||
"keywords": [
|
||||
"caniuse",
|
||||
"browsers",
|
||||
"target"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "browserslist",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/browserslist/browserslist.git"
|
||||
},
|
||||
"version": "4.14.2"
|
||||
}
|
147
node_modules/browserslist/update-db.js
generated
vendored
Normal file
147
node_modules/browserslist/update-db.js
generated
vendored
Normal file
@ -0,0 +1,147 @@
|
||||
var childProcess = require('child_process')
|
||||
var escalade = require('escalade/sync')
|
||||
var path = require('path')
|
||||
var fs = require('fs')
|
||||
|
||||
var BrowserslistError = require('./error')
|
||||
|
||||
function detectLockfile () {
|
||||
var packageDir = escalade('.', function (dir, names) {
|
||||
return names.indexOf('package.json') !== -1 ? dir : ''
|
||||
})
|
||||
|
||||
if (!packageDir) {
|
||||
throw new BrowserslistError(
|
||||
'Cannot find package.json. ' +
|
||||
'Is it a right project to run npx browserslist --update-db?'
|
||||
)
|
||||
}
|
||||
|
||||
var lockfileNpm = path.join(packageDir, 'package-lock.json')
|
||||
var lockfileYarn = path.join(packageDir, 'yarn.lock')
|
||||
var lockfilePnpm = path.join(packageDir, 'pnpm-lock.yaml')
|
||||
|
||||
/* istanbul ignore next */
|
||||
if (fs.existsSync(lockfilePnpm)) {
|
||||
return { mode: 'pnpm', file: lockfilePnpm }
|
||||
} else if (fs.existsSync(lockfileNpm)) {
|
||||
return { mode: 'npm', file: lockfileNpm }
|
||||
} else if (fs.existsSync(lockfileYarn)) {
|
||||
return { mode: 'yarn', file: lockfileYarn }
|
||||
} else {
|
||||
throw new BrowserslistError(
|
||||
'No lockfile found. Run "npm install", "yarn install" or "pnpm install"'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function getCurrentVersion (lock) {
|
||||
var match
|
||||
/* istanbul ignore if */
|
||||
if (lock.mode === 'pnpm') {
|
||||
match = /\/caniuse-lite\/([^:]+):/.exec(lock.content)
|
||||
if (match[1]) return match[1]
|
||||
} else if (lock.mode === 'npm') {
|
||||
var dependencies = JSON.parse(lock.content).dependencies
|
||||
if (dependencies && dependencies['caniuse-lite']) {
|
||||
return dependencies['caniuse-lite'].version
|
||||
}
|
||||
} else if (lock.mode === 'yarn') {
|
||||
match = /caniuse-lite@[^:]+:\r?\n\s+version\s+"([^"]+)"/.exec(lock.content)
|
||||
if (match[1]) return match[1]
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
function getLatestInfo () {
|
||||
return JSON.parse(
|
||||
childProcess.execSync('npm show caniuse-lite --json').toString()
|
||||
)
|
||||
}
|
||||
|
||||
function updateLockfile (lock, latest) {
|
||||
if (lock.mode === 'npm') {
|
||||
var fixed = deletePackage(JSON.parse(lock.content))
|
||||
return JSON.stringify(fixed, null, ' ')
|
||||
} else {
|
||||
var lines = lock.content.split('\n')
|
||||
var i
|
||||
/* istanbul ignore if */
|
||||
if (lock.mode === 'pnpm') {
|
||||
for (i = 0; i < lines.length; i++) {
|
||||
if (lines[i].indexOf('caniuse-lite:') >= 0) {
|
||||
lines[i] = lines[i].replace(/: .*$/, ': ' + latest.version)
|
||||
} else if (lines[i].indexOf('/caniuse-lite') >= 0) {
|
||||
lines[i] = lines[i].replace(/\/[^/:]+:/, '/' + latest.version + ':')
|
||||
for (i = i + 1; i < lines.length; i++) {
|
||||
if (lines[i].indexOf('integrity: ') !== -1) {
|
||||
lines[i] = lines[i].replace(
|
||||
/integrity: .+/, 'integrity: ' + latest.dist.integrity
|
||||
)
|
||||
} else if (lines[i].indexOf(' /') !== -1) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (lock.mode === 'yarn') {
|
||||
for (i = 0; i < lines.length; i++) {
|
||||
if (lines[i].indexOf('caniuse-lite@') !== -1) {
|
||||
lines[i + 1] = lines[i + 1].replace(
|
||||
/version "[^"]+"/, 'version "' + latest.version + '"'
|
||||
)
|
||||
lines[i + 2] = lines[i + 2].replace(
|
||||
/resolved "[^"]+"/, 'resolved "' + latest.dist.tarball + '"'
|
||||
)
|
||||
lines[i + 3] = lines[i + 3].replace(
|
||||
/integrity .+/, 'integrity ' + latest.dist.integrity
|
||||
)
|
||||
i += 4
|
||||
}
|
||||
}
|
||||
}
|
||||
return lines.join('\n')
|
||||
}
|
||||
}
|
||||
|
||||
function deletePackage (node) {
|
||||
if (node.dependencies) {
|
||||
delete node.dependencies['caniuse-lite']
|
||||
for (var i in node.dependencies) {
|
||||
node.dependencies[i] = deletePackage(node.dependencies[i])
|
||||
}
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
module.exports = function updateDB (print) {
|
||||
var lock = detectLockfile()
|
||||
lock.content = fs.readFileSync(lock.file).toString()
|
||||
|
||||
var current = getCurrentVersion(lock)
|
||||
var latest = getLatestInfo()
|
||||
|
||||
if (typeof current === 'string') {
|
||||
print('Current version: ' + current + '\n')
|
||||
}
|
||||
print(
|
||||
'New version: ' + latest.version + '\n' +
|
||||
'Removing old caniuse-lite from lock file…\n'
|
||||
)
|
||||
|
||||
fs.writeFileSync(lock.file, updateLockfile(lock, latest))
|
||||
|
||||
print(
|
||||
'Installing new caniuse-lite version…\n' +
|
||||
'$ ' + lock.mode + ' install\n'
|
||||
)
|
||||
try {
|
||||
childProcess.execSync(lock.mode + ' install')
|
||||
} catch (e) /* istanbul ignore next */ {
|
||||
print(e.stack)
|
||||
print('\nProblem with `' + lock.mode + ' install` call. Run it manually.\n')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
print('caniuse-lite has been successfully updated\n')
|
||||
}
|
Reference in New Issue
Block a user