browserslist 4.6.6 → 4.7.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.
Files changed (4) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +24 -19
  3. package/index.js +12 -29
  4. package/package.json +10 -4
package/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
+ ## 4.7
5
+ * Add PhantomJS queries.
6
+ * Improve docs (by Dorian Koehring).
7
+
4
8
  ## 4.6.6
5
9
  * Remove Safari from `dead` query.
6
10
 
package/README.md CHANGED
@@ -45,7 +45,6 @@ Browserslist will take queries from tool option,
45
45
  `browserslist` config, `.browserslistrc` config,
46
46
  `browserslist` section in `package.json` or environment variables.
47
47
 
48
- You can test Browserslist queries in [online demo].
49
48
  [Browserslist Example] shows how every tool uses Browserslist.
50
49
 
51
50
  [cult-img]: https://cultofmartians.com/assets/badges/badge.svg
@@ -62,7 +61,6 @@ You can test Browserslist queries in [online demo].
62
61
  [postcss-preset-env]: https://github.com/jonathantneal/postcss-preset-env
63
62
  [postcss-normalize]: https://github.com/jonathantneal/postcss-normalize
64
63
  [Autoprefixer]: https://github.com/postcss/autoprefixer
65
- [online demo]: https://browserl.ist/
66
64
  [Can I Use]: https://caniuse.com/
67
65
  [Babel]: https://github.com/babel/babel/tree/master/packages/babel-preset-env
68
66
  [obsolete-webpack-plugin]: https://github.com/ElemeFE/obsolete-webpack-plugin
@@ -73,16 +71,17 @@ You can test Browserslist queries in [online demo].
73
71
  2. [Best Practices](#best-practices)
74
72
  3. [Queries](#queries)
75
73
  4. [Config File](#config-file)
76
- 5. [Configuring for Different Environments](#configuring-for-different-environments)
77
- 6. [Custom Usage Data](#custom-usage-data)
78
- 7. [JS API](#js-api)
79
- 8. [Environment Variables](#environment-variables)
80
- 9. [Cache](#cache)
74
+ 5. [Shareable Configs](#shareable-configs)
75
+ 6. [Configuring for Different Environments](#configuring-for-different-environments)
76
+ 7. [Custom Usage Data](#custom-usage-data)
77
+ 8. [JS API](#js-api)
78
+ 9. [Environment Variables](#environment-variables)
79
+ 10. [Cache](#cache)
81
80
 
82
81
  ## Tools
83
82
 
84
- * [`browserslist-ga`] downloads your website browsers statistics
85
- to use it in `> 0.5% in my stats` query.
83
+ * [`browserslist-ga`] and [`browserslist-ga-export`] download your website
84
+ browsers statistics to use it in `> 0.5% in my stats` query.
86
85
  * [`browserslist-useragent-regexp`] compiles Browserslist query to a RegExp
87
86
  to test browser useragent.
88
87
  * [`browserslist-useragent-ruby`] is a Ruby library to checks browser
@@ -94,12 +93,13 @@ You can test Browserslist queries in [online demo].
94
93
  target browsers. This CLI tool is built-in and available in any project
95
94
  with Autoprefixer.
96
95
 
96
+ [`browserslist-useragent-regexp`]: https://github.com/browserslist/browserslist-useragent-regexp
97
97
  [`browserslist-useragent-ruby`]: https://github.com/browserslist/browserslist-useragent-ruby
98
+ [`browserslist-browserstack`]: https://github.com/xeroxinteractive/browserslist-browserstack
99
+ [`browserslist-ga-export`]: https://github.com/browserslist/browserslist-ga-export
98
100
  [`browserslist-useragent`]: https://github.com/pastelsky/browserslist-useragent
99
- [`browserslist-useragent-regexp`]: https://github.com/browserslist/browserslist-useragent-regexp
100
101
  [`browserslist-ga`]: https://github.com/browserslist/browserslist-ga
101
102
  [`caniuse-api`]: https://github.com/Nyalab/caniuse-api
102
- [`browserslist-browserstack`]: https://github.com/xeroxinteractive/browserslist-browserstack
103
103
 
104
104
 
105
105
  ## Best Practices
@@ -133,7 +133,7 @@ You can test Browserslist queries in [online demo].
133
133
  ## Queries
134
134
 
135
135
  Browserslist will use browsers and Node.js versions query
136
- from one of this sources:
136
+ from one of these sources:
137
137
 
138
138
  1. `browserslist` key in `package.json` file in current or parent directories.
139
139
  **We recommend this way.**
@@ -194,6 +194,8 @@ You can specify the browser and Node.js versions by queries (case insensitive):
194
194
  `>=`, `<` and `<=` work too. It also works with Node.js.
195
195
  * `iOS 7`: the iOS browser version 7 directly.
196
196
  * `Firefox ESR`: the latest [Firefox ESR] version.
197
+ * `PhantomJS 2.1` and `PhantomJS 1.9`: selects Safari versions similar
198
+ to PhantomJS runtime.
197
199
  * `unreleased versions` or `unreleased Chrome versions`:
198
200
  alpha and beta versions.
199
201
  * `last 2 major versions` or `last 2 iOS major versions`:
@@ -407,8 +409,10 @@ If you have a website, you can query against the usage statistics of your site.
407
409
  npx browserslist-ga
408
410
  ```
409
411
 
410
- Of course, you can generate usage statistics file by any other method.
411
- File format should be like:
412
+ Or you can use [`browserslist-ga-export`] to convert Google Analytics data without giving a password for Google account.
413
+
414
+ You can generate usage statistics file by any other method. File format should
415
+ be like:
412
416
 
413
417
  ```js
414
418
  {
@@ -424,12 +428,13 @@ File format should be like:
424
428
  }
425
429
  ```
426
430
 
427
- Note that you can query against your custom usage data
428
- while also querying against global or regional data.
429
- For example, the query `> 1% in my stats, > 5% in US, 10%` is permitted.
431
+ Note that you can query against your custom usage data while also querying
432
+ against global or regional data. For example, the query
433
+ `> 1% in my stats, > 5% in US, 10%` is permitted.
430
434
 
431
- [`browserslist-ga`]: https://github.com/browserslist/browserslist-ga
432
- [Can I Use]: https://caniuse.com/
435
+ [`browserslist-ga-export`]: https://github.com/browserslist/browserslist-ga-export
436
+ [`browserslist-ga`]: https://github.com/browserslist/browserslist-ga
437
+ [Can I Use]: https://caniuse.com/
433
438
 
434
439
 
435
440
  ## JS API
package/index.js CHANGED
@@ -10,10 +10,7 @@ var env = require('./node') // Will load browser.js in webpack
10
10
  var FLOAT_RANGE = /^\d+(\.\d+)?(-\d+(\.\d+)?)*$/
11
11
  var YEAR = 365.259641 * 24 * 60 * 60 * 1000
12
12
 
13
- // Enum values MUST be powers of 2, so combination are safe
14
- /** @constant {number} */
15
13
  var QUERY_OR = 1
16
- /** @constant {number} */
17
14
  var QUERY_AND = 2
18
15
 
19
16
  function isVersionsMatch (versionA, versionB) {
@@ -265,14 +262,10 @@ function resolve (queries, context) {
265
262
  case QUERY_AND:
266
263
  if (isExclude) {
267
264
  return result.filter(function (j) {
268
- // remove result items that are in array
269
- // (the relative complement of array in result)
270
265
  return array.indexOf(j) === -1
271
266
  })
272
267
  } else {
273
268
  return result.filter(function (j) {
274
- // remove result items not in array
275
- // (intersect of result and array)
276
269
  return array.indexOf(j) !== -1
277
270
  })
278
271
  }
@@ -287,7 +280,6 @@ function resolve (queries, context) {
287
280
  return !filter[j]
288
281
  })
289
282
  }
290
- // union of result and array
291
283
  return result.concat(array)
292
284
  }
293
285
  }
@@ -375,35 +367,14 @@ function browserslist (queries, opts) {
375
367
  return uniq(result)
376
368
  }
377
369
 
378
- /**
379
- * @typedef {object} BrowserslistQuery
380
- * @property {number} type A type constant like QUERY_OR @see QUERY_OR.
381
- * @property {string} queryString A query like "not ie < 11".
382
- */
383
-
384
- /**
385
- * Parse a browserslist string query
386
- * @param {string} queries One or more queries as a string
387
- * @returns {BrowserslistQuery[]} An array of BrowserslistQuery
388
- */
389
370
  function parse (queries) {
390
371
  var qs = []
391
-
392
372
  do {
393
373
  queries = doMatch(queries, qs)
394
374
  } while (queries)
395
-
396
375
  return qs
397
376
  }
398
377
 
399
- /**
400
- * Find query matches in a string. This function is meant to be called
401
- * repeatedly with the returned query string until there is no more matches.
402
- * @param {string} string A string with one or more queries.
403
- * @param {BrowserslistQuery[]} qs Out parameter,
404
- * will be filled with `BrowserslistQuery`.
405
- * @returns {string} The rest of the query string minus the matched part.
406
- */
407
378
  function doMatch (string, qs) {
408
379
  var or = /^(?:,\s*|\s+OR\s+)(.*)/i
409
380
  var and = /^\s+AND\s+(.*)/i
@@ -918,6 +889,18 @@ var QUERIES = [
918
889
  return resolve(queries, context)
919
890
  }
920
891
  },
892
+ {
893
+ regexp: /^phantomjs\s+1.9$/i,
894
+ select: function () {
895
+ return ['safari 5']
896
+ }
897
+ },
898
+ {
899
+ regexp: /^phantomjs\s+2.1$/i,
900
+ select: function () {
901
+ return ['safari 6']
902
+ }
903
+ },
921
904
  {
922
905
  regexp: /^(\w+)\s+(tp|[\d.]+)$/i,
923
906
  select: function (context, name, version) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browserslist",
3
- "version": "4.6.6",
3
+ "version": "4.7.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",
@@ -11,13 +11,19 @@
11
11
  "license": "MIT",
12
12
  "repository": "browserslist/browserslist",
13
13
  "dependencies": {
14
- "caniuse-lite": "^1.0.30000984",
15
- "electron-to-chromium": "^1.3.191",
16
- "node-releases": "^1.1.25"
14
+ "caniuse-lite": "^1.0.30000989",
15
+ "electron-to-chromium": "^1.3.247",
16
+ "node-releases": "^1.1.29"
17
17
  },
18
18
  "bin": "./cli.js",
19
19
  "browser": {
20
20
  "./node.js": "./browser.js",
21
21
  "path": false
22
+ },
23
+ "eslintIgnore": [
24
+ "test/fixtures"
25
+ ],
26
+ "sharec": {
27
+ "version": "0.4.2"
22
28
  }
23
29
  }