browserslist 4.12.2 → 4.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,19 +1,23 @@
1
1
  # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
+ ## 4.13
5
+ * Added `supports` query to select browsers (by Jesús Leganés-Combarro).
6
+
4
7
  ## 4.12.2
5
8
  * Update Firefox ESR.
6
9
 
7
10
  ## 4.12.1
8
11
  * Update `package.json` scanning tool for `--update-db` (by Luke Edwards).
9
12
  * Improve docs (by Mukundan Senthil).
13
+ * Drop Node.js 13.0-13.6 support because of ES modules bug in that versions.
10
14
 
11
15
  ## 4.12
12
16
  * Add environments to shared configs (by Yevgeny Petukhov).
13
17
  * Fix docs (by Dmitry Statsenko and Thomas Pozzo di Borgo).
14
18
 
15
19
  ## 4.11.1
16
- * FIx Node.js 6 support.
20
+ * Fix Node.js 6 support.
17
21
 
18
22
  ## 4.11
19
23
  * Add `npx browserslist --mobile-to-desktop` (by James Ross).
package/README.md CHANGED
@@ -184,7 +184,6 @@ combiner even if `or` is used (this is an API implementation specificity).
184
184
  _A quick way to test your query is to do `npx browserslist '> 0.5%, not IE 11'`
185
185
  in your terminal._
186
186
 
187
-
188
187
  ### Full List
189
188
 
190
189
  You can specify the browser and Node.js versions by queries (case insensitive):
@@ -193,45 +192,51 @@ You can specify the browser and Node.js versions by queries (case insensitive):
193
192
  (`> 0.5%, last 2 versions, Firefox ESR, not dead`).
194
193
  * `> 5%`: browsers versions selected by global usage statistics.
195
194
  `>=`, `<` and `<=` work too.
196
- * `> 5% in US`: uses USA usage statistics. It accepts [two-letter country code].
197
- * `> 5% in alt-AS`: uses Asia region usage statistics. List of all region codes
198
- can be found at [`caniuse-lite/data/regions`].
199
- * `> 5% in my stats`: uses [custom usage data].
200
- * `> 5% in browserslist-config-mycompany stats`: uses [custom usage data]
201
- from `browserslist-config-mycompany/browserslist-stats.json`.
202
- * `cover 99.5%`: most popular browsers that provide coverage.
203
- * `cover 99.5% in US`: same as above, with [two-letter country code].
204
- * `cover 99.5% in my stats`: uses [custom usage data].
205
- * `maintained node versions`: all Node.js versions, which are [still maintained]
206
- by Node.js Foundation.
195
+ * `> 5% in US`: uses USA usage statistics.
196
+ It accepts [two-letter country code].
197
+ * `> 5% in alt-AS`: uses Asia region usage statistics.
198
+ List of all region codes can be found at [`caniuse-lite/data/regions`].
199
+ * `> 5% in my stats`: uses [custom usage data].
200
+ * `> 5% in browserslist-config-mycompany stats`: uses [custom usage data]
201
+ from `browserslist-config-mycompany/browserslist-stats.json`.
202
+ * `cover 99.5%`: most popular browsers that provide coverage.
203
+ * `cover 99.5% in US`: same as above, with [two-letter country code].
204
+ * `cover 99.5% in my stats`: uses [custom usage data].
205
+ * `dead`: browsers without official support or updates for 24 months.
206
+ Right now it is `IE 10`, `IE_Mob 11`, `BlackBerry 10`, `BlackBerry 7`,
207
+ `Samsung 4` and `OperaMobile 12.1`.
208
+ * `last 2 versions`: the last 2 versions for *each* browser.
209
+ * `last 2 Chrome versions`: the last 2 versions of Chrome browser.
210
+ * `last 2 major versions` or `last 2 iOS major versions`:
211
+ all minor/patch releases of last 2 major versions.
207
212
  * `node 10` and `node 10.4`: selects latest Node.js `10.x.x`
208
213
  or `10.4.x` release.
209
- * `current node`: Node.js version used by Browserslist right now.
214
+ * `current node`: Node.js version used by Browserslist right now.
215
+ * `maintained node versions`: all Node.js versions, which are [still maintained]
216
+ by Node.js Foundation.
217
+ * `iOS 7`: the iOS browser version 7 directly.
218
+ * `Firefox > 20`: versions of Firefox newer than 20.
219
+ `>=`, `<` and `<=` work too. It also works with Node.js.
220
+ * `ie 6-8`: selects an inclusive range of versions.
221
+ * `Firefox ESR`: the latest [Firefox ESR] version.
222
+ * `PhantomJS 2.1` and `PhantomJS 1.9`: selects Safari versions similar
223
+ to PhantomJS runtime.
210
224
  * `extends browserslist-config-mycompany`: take queries from
211
225
  `browserslist-config-mycompany` npm package.
212
- * `ie 6-8`: selects an inclusive range of versions.
213
- * `Firefox > 20`: versions of Firefox newer than 20.
214
- `>=`, `<` and `<=` work too. It also works with Node.js.
215
- * `iOS 7`: the iOS browser version 7 directly.
216
- * `Firefox ESR`: the latest [Firefox ESR] version.
217
- * `PhantomJS 2.1` and `PhantomJS 1.9`: selects Safari versions similar
218
- to PhantomJS runtime.
219
- * `unreleased versions` or `unreleased Chrome versions`:
220
- alpha and beta versions.
221
- * `last 2 major versions` or `last 2 iOS major versions`:
222
- all minor/patch releases of last 2 major versions.
226
+ * `supports rtcpeerconnection`: browsers with support for specific features.
227
+ `rtcpeerconnection` here is the `feat` parameter at the URL of the [Can I Use]
228
+ page. A list of all available features can be found at
229
+ [`caniuse-lite/data/features`].
223
230
  * `since 2015` or `last 2 years`: all versions released since year 2015
224
231
  (also `since 2015-03` and `since 2015-03-10`).
225
- * `dead`: browsers without official support or updates for 24 months.
226
- Right now it is `IE 10`, `IE_Mob 11`, `BlackBerry 10`, `BlackBerry 7`,
227
- `Samsung 4` and `OperaMobile 12.1`.
228
- * `last 2 versions`: the last 2 versions for *each* browser.
229
- * `last 2 Chrome versions`: the last 2 versions of Chrome browser.
232
+ * `unreleased versions` or `unreleased Chrome versions`:
233
+ alpha and beta versions.
230
234
  * `not ie <= 8`: exclude browsers selected by previous queries.
231
235
 
232
236
  You can add `not ` to any query.
233
237
 
234
238
  [`caniuse-lite/data/regions`]: https://github.com/ben-eb/caniuse-lite/tree/master/data/regions
239
+ [`caniuse-lite/data/features`]: https://github.com/ben-eb/caniuse-lite/tree/master/data/features
235
240
  [two-letter country code]: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
236
241
  [custom usage data]: #custom-usage-data
237
242
  [still maintained]: https://github.com/nodejs/Release
package/browser.js CHANGED
@@ -21,10 +21,15 @@ module.exports = {
21
21
 
22
22
  loadCountry: function loadCountry () {
23
23
  throw new BrowserslistError(
24
- 'Country statistics is not supported ' +
24
+ 'Country statistics are not supported ' +
25
25
  'in client-side build of Browserslist')
26
26
  },
27
27
 
28
+ loadFeature: function loadFeature () {
29
+ throw new BrowserslistError(
30
+ 'Supports queries are not available in client-side build of Browserslist')
31
+ },
32
+
28
33
  currentNode: function currentNode (resolve, context) {
29
34
  return resolve(['maintained node versions'], context)[0]
30
35
  },
package/index.js CHANGED
@@ -505,6 +505,7 @@ function flatten (array) {
505
505
  }
506
506
 
507
507
  // Will be filled by Can I Use data below
508
+ browserslist.cache = { }
508
509
  browserslist.data = { }
509
510
  browserslist.usage = {
510
511
  global: { },
@@ -887,6 +888,20 @@ var QUERIES = [
887
888
  return result
888
889
  }
889
890
  },
891
+ {
892
+ regexp: /^supports\s+([\w-]+)$/,
893
+ select: function (context, feature) {
894
+ env.loadFeature(browserslist.cache, feature)
895
+ var features = browserslist.cache[feature]
896
+ return Object.keys(features).reduce(function (result, version) {
897
+ var flags = features[version]
898
+ if (flags.indexOf('y') >= 0 || flags.indexOf('a') >= 0) {
899
+ result.push(version)
900
+ }
901
+ return result
902
+ }, [])
903
+ }
904
+ },
890
905
  {
891
906
  regexp: /^electron\s+([\d.]+)\s*-\s*([\d.]+)$/i,
892
907
  select: function (context, from, to) {
package/node.js CHANGED
@@ -1,3 +1,4 @@
1
+ var feature = require('caniuse-lite/dist/unpacker/feature').default
1
2
  var region = require('caniuse-lite/dist/unpacker/region').default
2
3
  var path = require('path')
3
4
  var fs = require('fs')
@@ -237,6 +238,21 @@ module.exports = {
237
238
  }
238
239
  },
239
240
 
241
+ loadFeature: function loadFeature (features, name) {
242
+ name = name.replace(/[^\w-]/g, '')
243
+ if (features[name]) return
244
+
245
+ // eslint-disable-next-line security/detect-non-literal-require
246
+ var compressed = require('caniuse-lite/data/features/' + name + '.js')
247
+ var stats = feature(compressed).stats
248
+ features[name] = { }
249
+ for (var i in stats) {
250
+ for (var j in stats[i]) {
251
+ features[name][i + ' ' + j] = stats[i][j]
252
+ }
253
+ }
254
+ },
255
+
240
256
  parseConfig: function parseConfig (string) {
241
257
  var result = { defaults: [] }
242
258
  var sections = ['defaults']
@@ -337,6 +353,8 @@ module.exports = {
337
353
  dataTimeChecked = false
338
354
  filenessCache = { }
339
355
  configCache = { }
356
+
357
+ this.cache = { }
340
358
  },
341
359
 
342
360
  oldDataWarning: function oldDataWarning (agentsObj) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browserslist",
3
- "version": "4.12.2",
3
+ "version": "4.13.0",
4
4
  "description": "Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-env-preset",
5
5
  "keywords": [
6
6
  "caniuse",
@@ -15,8 +15,8 @@
15
15
  "license": "MIT",
16
16
  "repository": "browserslist/browserslist",
17
17
  "dependencies": {
18
- "caniuse-lite": "^1.0.30001088",
19
- "electron-to-chromium": "^1.3.483",
18
+ "caniuse-lite": "^1.0.30001093",
19
+ "electron-to-chromium": "^1.3.488",
20
20
  "escalade": "^3.0.1",
21
21
  "node-releases": "^1.1.58"
22
22
  },