browserslist 4.3.1 → 4.3.5

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,6 +1,18 @@
1
1
  # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
+ ## 4.3.5
5
+ * Fix `not` query for wrong Can I Use data.
6
+
7
+ ## 4.3.4
8
+ * Allow to update `node-releases` without new Browserslist releases.
9
+
10
+ ## 4.3.3
11
+ * Fix Node.js 11 support.
12
+
13
+ ## 4.3.2
14
+ * Fix `Unknown version 11 of Node.js` error (by Dan Onoshko).
15
+
4
16
  ## 4.3.1
5
17
  * Fix conflict between `caniuse-lite` and custom browsers statistics.
6
18
 
package/README.md CHANGED
@@ -111,9 +111,10 @@ from one of this sources:
111
111
  * If you want to change the default set of browsers we recommend to combine
112
112
  `last 1 version`, `not dead` with `> 0.2%` (or `> 1% in US`,
113
113
  `> 1% in my stats`). `last n versions` adds too many dead browsers
114
- and does not add popular old versions. `> 0.2%` make popular browsers
115
- even more popular, so we will have a monopoly and stagnation,
116
- as we had with Internet Explorer 6.
114
+ and does not add popular old versions. Choosing a percentage above `0.2%`
115
+ will in the long run make popular browsers even more popular. We might run
116
+ into a monopoly and stagnation situation, as we had with Internet Explorer 6.
117
+ Please use this setting with caution.
117
118
  * Don’t remove browsers just because you don’t know them. Opera Mini has
118
119
  100 million users in Africa and it is more popular in the global market
119
120
  than Microsoft Edge. Chinese QQ Browsers has more market share than Firefox
package/index.js CHANGED
@@ -9,6 +9,17 @@ var env = require('./node') // Will load browser.js in webpack
9
9
 
10
10
  var FLOAT_RANGE = /^\d+(\.\d+)?(-\d+(\.\d+)?)*$/
11
11
 
12
+ function isVersionsMatch (versionA, versionB) {
13
+ return (versionA + '.').indexOf(versionB + '.') === 0
14
+ }
15
+
16
+ function isEolReleased (name) {
17
+ var version = name.slice(1)
18
+ return jsReleases.some(function (i) {
19
+ return isVersionsMatch(i.version, version)
20
+ })
21
+ }
22
+
12
23
  function normalize (versions) {
13
24
  return versions.filter(function (version) {
14
25
  return typeof version === 'string'
@@ -143,11 +154,30 @@ function resolve (queries, context) {
143
154
  var args = [context].concat(match.slice(1))
144
155
  var array = type.select.apply(browserslist, args)
145
156
  if (isExclude) {
146
- array = array.concat(array.map(function (j) {
147
- return j.replace(/\s\S+/, ' 0')
148
- }))
157
+ var filter = { }
158
+ var browsers = { }
159
+ var versionLess = { }
160
+ array.forEach(function (j) {
161
+ filter[j] = true
162
+ var browser = j.replace(/\s\S+$/, '')
163
+ browsers[browser] = true
164
+ if (/\s0$/.test(j)) {
165
+ versionLess[browser] = true
166
+ }
167
+ })
149
168
  return result.filter(function (j) {
150
- return array.indexOf(j) === -1
169
+ if (filter[j]) {
170
+ return false
171
+ } else {
172
+ var browser = j.replace(/\s\S+$/, '')
173
+ if (versionLess[browser]) {
174
+ return false
175
+ } else if (/\s0$/.test(j) && browsers[browser]) {
176
+ return false
177
+ } else {
178
+ return true
179
+ }
180
+ }
151
181
  })
152
182
  }
153
183
  return result.concat(array)
@@ -680,7 +710,7 @@ var QUERIES = [
680
710
  return i.name === 'nodejs'
681
711
  })
682
712
  var matched = nodeReleases.filter(function (i) {
683
- return (i.version + '.').indexOf(version + '.') === 0
713
+ return isVersionsMatch(i.version, version)
684
714
  })
685
715
  if (matched.length === 0) {
686
716
  if (context.ignoreUnknownVersions) {
@@ -705,7 +735,8 @@ var QUERIES = [
705
735
  var now = Date.now()
706
736
  var queries = Object.keys(jsEOL).filter(function (key) {
707
737
  return now < Date.parse(jsEOL[key].end) &&
708
- now > Date.parse(jsEOL[key].start)
738
+ now > Date.parse(jsEOL[key].start) &&
739
+ isEolReleased(key)
709
740
  }).map(function (key) {
710
741
  return 'node ' + key.slice(1)
711
742
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browserslist",
3
- "version": "4.3.1",
3
+ "version": "4.3.5",
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,20 @@
11
11
  "license": "MIT",
12
12
  "repository": "browserslist/browserslist",
13
13
  "dependencies": {
14
- "caniuse-lite": "^1.0.30000893",
15
- "electron-to-chromium": "^1.3.80",
16
- "node-releases": "^1.0.0-alpha.14"
14
+ "caniuse-lite": "^1.0.30000912",
15
+ "electron-to-chromium": "^1.3.86",
16
+ "node-releases": "^1.0.5"
17
17
  },
18
18
  "bin": "./cli.js",
19
19
  "browser": {
20
20
  "./node.js": "./browser.js",
21
21
  "path": false
22
+ },
23
+ "husky": {
24
+ "hooks": {
25
+ "pre-commit": [
26
+ "lint-staged"
27
+ ]
28
+ }
22
29
  }
23
30
  }