browserslist
Advanced tools
Comparing version 4.11.1 to 4.12.0
# Change Log | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
## 4.12 | ||
* Add environments to shared configs (by Yevgeny Petukhov). | ||
* Fix docs (by Dmitry Statsenko and Thomas Pozzo di Borgo). | ||
## 4.11.1 | ||
@@ -5,0 +9,0 @@ * FIx Node.js 6 support. |
@@ -427,3 +427,4 @@ var jsReleases = require('node-releases/data/processed/envs.json') | ||
dangerousExtend: opts.dangerousExtend, | ||
mobileToDesktop: opts.mobileToDesktop | ||
mobileToDesktop: opts.mobileToDesktop, | ||
env: opts.env | ||
} | ||
@@ -430,0 +431,0 @@ |
16
node.js
@@ -159,8 +159,14 @@ var region = require('caniuse-lite/dist/unpacker/region').default | ||
var queries = require(require.resolve(name, { paths: ['.'] })) | ||
if (!Array.isArray(queries)) { | ||
throw new BrowserslistError( | ||
'`' + name + '` config exports not an array of queries' | ||
) | ||
if (queries) { | ||
if (Array.isArray(queries)) { | ||
return queries | ||
} else if (typeof queries === 'object') { | ||
if (!queries.defaults) queries.defaults = [] | ||
return pickEnv(queries, context, name) | ||
} | ||
} | ||
return queries | ||
throw new BrowserslistError( | ||
'`' + name + '` config exports not an array of queries' + | ||
' or an object of envs' | ||
) | ||
}, | ||
@@ -167,0 +173,0 @@ |
{ | ||
"name": "browserslist", | ||
"version": "4.11.1", | ||
"version": "4.12.0", | ||
"description": "Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-env-preset", | ||
@@ -18,4 +18,4 @@ "keywords": [ | ||
"dependencies": { | ||
"caniuse-lite": "^1.0.30001038", | ||
"electron-to-chromium": "^1.3.390", | ||
"caniuse-lite": "^1.0.30001043", | ||
"electron-to-chromium": "^1.3.413", | ||
"node-releases": "^1.1.53", | ||
@@ -28,6 +28,3 @@ "pkg-up": "^2.0.0" | ||
"path": false | ||
}, | ||
"eslintIgnore": [ | ||
"test/fixtures" | ||
] | ||
} | ||
} |
@@ -71,12 +71,20 @@ # Browserslist [![Cult Of Martians][cult-img]][cult] | ||
1. [Tools](#tools) | ||
2. [Best Practices](#best-practices) | ||
3. [Queries](#queries) | ||
4. [Config File](#config-file) | ||
5. [Shareable Configs](#shareable-configs) | ||
6. [Configuring for Different Environments](#configuring-for-different-environments) | ||
7. [Custom Usage Data](#custom-usage-data) | ||
8. [JS API](#js-api) | ||
9. [Environment Variables](#environment-variables) | ||
10. [Cache](#cache) | ||
* [Tools](#tools) | ||
* [Best Practices](#best-practices) | ||
* [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) | ||
@@ -166,4 +174,7 @@ ## Tools | ||
Obviously you can *not* start with a `not` combiner, since there is no left-hand | ||
side query to combine it with. | ||
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). | ||
`and` combiner has precedence over `or` combiner. | ||
| Query combiner type | Illustration | Example | | ||
@@ -173,3 +184,3 @@ | ------------------- | :----------: | ------- | | ||
| `and` combiner <br> (intersection) | ![intersection of queries](img/intersection.svg) | `> .5% and last 2 versions` | | ||
| `not` combiner <br> (relative complement) | ![Relative complement of queries](img/complement.svg) | `> .5% and not last 2 versions` <br> `> .5% or not last 2 versions` <br> `> .5%, not last 2 versions` | | ||
| `not` combiner <br> (relative complement) | ![Relative complement of queries](img/complement.svg) | 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` | | ||
@@ -218,3 +229,3 @@ _A quick way to test your query is to do `npx browserslist '> 0.5%, not IE 11'` | ||
* `dead`: browsers without official support or updates for 24 months. | ||
Right now it is `IE 10`, `IE_Mob 10`, `BlackBerry 10`, `BlackBerry 7`, | ||
Right now it is `IE 10`, `IE_Mob 11`, `BlackBerry 10`, `BlackBerry 7`, | ||
`Samsung 4` and `OperaMobile 12.1`. | ||
@@ -310,3 +321,4 @@ * `last 2 versions`: the last 2 versions for *each* browser. | ||
Separated Browserslist config should be named `.browserslistrc` | ||
and have browsers queries split by a new line. Comments starts with `#` symbol: | ||
and have browsers queries split by a new line. | ||
Each line is combined with the `or` combiner. Comments starts with `#` symbol: | ||
@@ -373,6 +385,23 @@ ```yaml | ||
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. | ||
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 | ||
@@ -607,1 +636,12 @@ | ||
[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) |
85531
1706
641
Updatedcaniuse-lite@^1.0.30001043