initial commit
This commit is contained in:
398
node_modules/browserslist/CHANGELOG.md
generated
vendored
Normal file
398
node_modules/browserslist/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,398 @@
|
||||
# Change Log
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## 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>
|
||||
|
||||
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.
|
||||
584
node_modules/browserslist/README.md
generated
vendored
Normal file
584
node_modules/browserslist/README.md
generated
vendored
Normal file
@@ -0,0 +1,584 @@
|
||||
# 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`:
|
||||
|
||||
```js
|
||||
"browserslist": [
|
||||
"last 1 version",
|
||||
"> 1%",
|
||||
"maintained node versions",
|
||||
"not dead"
|
||||
]
|
||||
```
|
||||
|
||||
Or in `.browserslistrc` config:
|
||||
|
||||
```yaml
|
||||
# Browsers that we support
|
||||
|
||||
last 1 version
|
||||
> 1%
|
||||
maintained node versions
|
||||
not dead
|
||||
```
|
||||
|
||||
Developers set versions list in queries like `last 2 version`
|
||||
to be free from updating versions manually.
|
||||
Browserslist will use [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.
|
||||
|
||||
You can test Browserslist queries in [online demo].
|
||||
[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
|
||||
[Autoprefixer]: https://github.com/postcss/autoprefixer
|
||||
[online demo]: https://browserl.ist/
|
||||
[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
|
||||
|
||||
1. [Tools](#tools)
|
||||
2. [Best Practices](#best-practices)
|
||||
3. [Queries](#queries)
|
||||
4. [Config File](#config-file)
|
||||
5. [Configuring for Different Environments](#configuring-for-different-environments)
|
||||
6. [Custom Usage Data](#custom-usage-data)
|
||||
7. [JS API](#js-api)
|
||||
8. [Environment Variables](#environment-variables)
|
||||
9. [Cache](#cache)
|
||||
|
||||
## Tools
|
||||
|
||||
* [`browserslist-ga`] downloads 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.
|
||||
* [`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-ruby`]: https://github.com/browserslist/browserslist-useragent-ruby
|
||||
[`browserslist-useragent`]: https://github.com/pastelsky/browserslist-useragent
|
||||
[`browserslist-useragent-regexp`]: https://github.com/browserslist/browserslist-useragent-regexp
|
||||
[`browserslist-ga`]: https://github.com/browserslist/browserslist-ga
|
||||
[`caniuse-api`]: https://github.com/Nyalab/caniuse-api
|
||||
[`browserslist-browserstack`]: https://github.com/xeroxinteractive/browserslist-browserstack
|
||||
|
||||
|
||||
## Best Practices
|
||||
|
||||
* 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.
|
||||
* 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 to combine
|
||||
`last 1 version`, `not dead` with `> 0.2%` (or `> 1% in US`,
|
||||
`> 1% in my stats`). `last n versions` adds too many dead browsers
|
||||
and does not add popular old versions. Choosing 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.
|
||||
* 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 this 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 the previous query: `last 1 version and > 1%`.
|
||||
|
||||
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.
|
||||
|
||||
| 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) |  | `> .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):
|
||||
|
||||
* `> 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].
|
||||
* `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].
|
||||
* `maintained node versions`: all Node.js versions, which are [still maintained]
|
||||
by Node.js Foundation.
|
||||
* `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.
|
||||
* `extends browserslist-config-mycompany`: take queries from
|
||||
`browserslist-config-mycompany` npm package.
|
||||
* `ie 6-8`: selects an inclusive range of versions.
|
||||
* `Firefox > 20`: versions of Firefox newer than 20.
|
||||
`>=`, `<` and `<=` work too. It also works with Node.js.
|
||||
* `iOS 7`: the iOS browser version 7 directly.
|
||||
* `Firefox ESR`: the latest [Firefox ESR] version.
|
||||
* `unreleased versions` or `unreleased Chrome versions`:
|
||||
alpha and beta versions.
|
||||
* `last 2 major versions` or `last 2 iOS major versions`:
|
||||
all minor/patch releases of last 2 major versions.
|
||||
* `since 2015` or `last 2 years`: all versions released since year 2015
|
||||
(also `since 2015-03` and `since 2015-03-10`).
|
||||
* `dead`: browsers without official support or updates for 24 months.
|
||||
Right now it is `IE 10`, `IE_Mob 10`, `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.
|
||||
* `defaults`: Browserslist’s default browsers
|
||||
(`> 0.5%, last 2 versions, Firefox ESR, not dead`).
|
||||
* `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
|
||||
[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. 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 `dangerousExtend` option:
|
||||
|
||||
```js
|
||||
browserslist(queries, { path, dangerousExtend: true })
|
||||
```
|
||||
|
||||
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'
|
||||
]
|
||||
```
|
||||
|
||||
|
||||
## 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
|
||||
```
|
||||
|
||||
Of course, 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`]: 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 some tool use Browserslist inside, you can change browsers settings
|
||||
by [environment variables]:
|
||||
|
||||
* `BROWSERSLIST` with browsers queries.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST="> 5%" gulp css
|
||||
```
|
||||
|
||||
* `BROWSERSLIST_CONFIG` with path to config file.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST_CONFIG=./config/browserslist gulp css
|
||||
```
|
||||
|
||||
* `BROWSERSLIST_ENV` with environments string.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST_ENV="development" gulp css
|
||||
```
|
||||
|
||||
* `BROWSERSLIST_STATS` with path to the custom usage data
|
||||
for `> 1% in my stats` query.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST_STATS=./config/usage_data.json gulp css
|
||||
```
|
||||
|
||||
* `BROWSERSLIST_DISABLE_CACHE` if you want to disable config reading cache.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST_DISABLE_CACHE=1 gulp css
|
||||
```
|
||||
|
||||
[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
|
||||
41
node_modules/browserslist/browser.js
generated
vendored
Normal file
41
node_modules/browserslist/browser.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
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 is not supported ' +
|
||||
'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
|
||||
}
|
||||
135
node_modules/browserslist/cli.js
generated
vendored
Normal file
135
node_modules/browserslist/cli.js
generated
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var fs = require('fs')
|
||||
|
||||
var browserslist = require('./')
|
||||
var pkg = require('./package.json')
|
||||
var args = process.argv.slice(2)
|
||||
|
||||
var USAGE = 'Usage:\n' +
|
||||
' ' + pkg.name + '\n' +
|
||||
' ' + pkg.name + ' "QUERIES"\n' +
|
||||
' ' + pkg.name + ' --json "QUERIES"\n' +
|
||||
' ' + pkg.name + ' --config="path/to/browserlist/file"\n' +
|
||||
' ' + pkg.name + ' --coverage "QUERIES"\n' +
|
||||
' ' + pkg.name + ' --coverage=US "QUERIES"\n' +
|
||||
' ' + pkg.name + ' --coverage=US,RU,global "QUERIES"\n' +
|
||||
' ' + pkg.name + ' --env="environment name defined in config"\n' +
|
||||
' ' + pkg.name + ' --stats="path/to/browserlist/stats/file"'
|
||||
|
||||
function isArg (arg) {
|
||||
return args.some(function (str) {
|
||||
return str === arg || str.indexOf(arg + '=') === 0
|
||||
})
|
||||
}
|
||||
|
||||
function error (msg) {
|
||||
process.stderr.write(pkg.name + ': ' + 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(pkg.name + ' ' + pkg.version + '\n')
|
||||
} 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 {
|
||||
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
|
||||
1013
node_modules/browserslist/index.js
generated
vendored
Normal file
1013
node_modules/browserslist/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
318
node_modules/browserslist/node.js
generated
vendored
Normal file
318
node_modules/browserslist/node.js
generated
vendored
Normal file
@@ -0,0 +1,318 @@
|
||||
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 loc = path.resolve(file)
|
||||
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
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
loadQueries: function loadQueries (context, name) {
|
||||
if (!context.dangerousExtend) checkExtend(name)
|
||||
// eslint-disable-next-line security/detect-non-literal-require
|
||||
var queries = require(require.resolve(name, { paths: ['.'] }))
|
||||
if (!Array.isArray(queries)) {
|
||||
throw new BrowserslistError(
|
||||
'`' + name + '` config exports not an array of queries')
|
||||
}
|
||||
return queries
|
||||
},
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
},
|
||||
|
||||
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) {
|
||||
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 data = region(compressed)
|
||||
usage[country] = { }
|
||||
for (var i in data) {
|
||||
for (var j in data[i]) {
|
||||
usage[country][i + ' ' + j] = data[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 cacheKey = isFile(from) ? path.dirname(from) : from
|
||||
if (cacheKey in configCache) {
|
||||
return configCache[cacheKey]
|
||||
}
|
||||
|
||||
var resolved = eachParent(from, function (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) {
|
||||
configCache[cacheKey] = resolved
|
||||
}
|
||||
return resolved
|
||||
},
|
||||
|
||||
clearCaches: function clearCaches () {
|
||||
dataTimeChecked = false
|
||||
filenessCache = { }
|
||||
configCache = { }
|
||||
},
|
||||
|
||||
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) {
|
||||
var command = 'npm update'
|
||||
eachParent(__filename, function (dir) {
|
||||
var pckg = path.join(dir, 'package.json')
|
||||
var yarnLock = path.join(dir, 'yarn.lock')
|
||||
if (isFile(pckg) && isFile(yarnLock)) {
|
||||
command = 'yarn upgrade'
|
||||
}
|
||||
})
|
||||
console.warn(
|
||||
'Browserslist: caniuse-lite is outdated. ' +
|
||||
'Please run next command `' + command + '`'
|
||||
)
|
||||
}
|
||||
},
|
||||
|
||||
currentNode: function currentNode () {
|
||||
return 'node ' + process.versions.node
|
||||
}
|
||||
}
|
||||
67
node_modules/browserslist/package.json
generated
vendored
Normal file
67
node_modules/browserslist/package.json
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"_from": "browserslist@^4.6.3",
|
||||
"_id": "browserslist@4.6.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-D2Nk3W9JL9Fp/gIcWei8LrERCS+eXu9AM5cfXA8WEZ84lFks+ARnZ0q/R69m2SV3Wjma83QDDPxsNKXUwdIsyA==",
|
||||
"_location": "/browserslist",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "browserslist@^4.6.3",
|
||||
"name": "browserslist",
|
||||
"escapedName": "browserslist",
|
||||
"rawSpec": "^4.6.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.6.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/autoprefixer",
|
||||
"/caniuse-api",
|
||||
"/postcss-colormin",
|
||||
"/postcss-merge-rules",
|
||||
"/postcss-minify-params",
|
||||
"/postcss-normalize-unicode",
|
||||
"/postcss-reduce-initial",
|
||||
"/stylehacks"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.6.6.tgz",
|
||||
"_shasum": "6e4bf467cde520bc9dbdf3747dafa03531cec453",
|
||||
"_spec": "browserslist@^4.6.3",
|
||||
"_where": "D:\\Air66 Files\\dev_sites\\www.airurl.dev.cc\\user\\plugins\\air66Theme\\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.30000984",
|
||||
"electron-to-chromium": "^1.3.191",
|
||||
"node-releases": "^1.1.25"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-env-preset",
|
||||
"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.6.6"
|
||||
}
|
||||
Reference in New Issue
Block a user