browserslist 3.2.2 → 3.2.6
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 +14 -0
- package/README.md +40 -21
- package/cli.js +11 -12
- package/index.js +3 -3
- package/node.js +10 -9
- package/package.json +9 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
3
3
|
|
|
4
|
+
## 3.2.6
|
|
5
|
+
* Add Opera Mini 12 to dead browsers.
|
|
6
|
+
* Update docs (by Jamie Kyle).
|
|
7
|
+
|
|
8
|
+
## 3.2.5
|
|
9
|
+
* Fix excluding Opera Mini and other browsers with `all` version.
|
|
10
|
+
|
|
11
|
+
## 3.2.4
|
|
12
|
+
* Resolve shareable config from current working directory.
|
|
13
|
+
|
|
14
|
+
## 3.2.3
|
|
15
|
+
* Fix `package.json` config validation for single string case.
|
|
16
|
+
* Fix CLI error reporting.
|
|
17
|
+
|
|
4
18
|
## 3.2.2
|
|
5
19
|
* Add `package.json` config validation.
|
|
6
20
|
* Move project to `browserlist` GitHub organization.
|
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ when you add the following to `package.json`:
|
|
|
22
22
|
{
|
|
23
23
|
"browserslist": [
|
|
24
24
|
"> 1%",
|
|
25
|
-
"
|
|
25
|
+
"IE 10"
|
|
26
26
|
]
|
|
27
27
|
}
|
|
28
28
|
```
|
|
@@ -33,7 +33,6 @@ Or in `.browserslistrc` config:
|
|
|
33
33
|
# Browsers that we support
|
|
34
34
|
|
|
35
35
|
> 1%
|
|
36
|
-
Last 2 versions
|
|
37
36
|
IE 10 # sorry
|
|
38
37
|
```
|
|
39
38
|
|
|
@@ -77,7 +76,7 @@ You can test Browserslist queries in [online demo].
|
|
|
77
76
|
with Autoprefixer.
|
|
78
77
|
|
|
79
78
|
[`browserslist-useragent`]: https://github.com/pastelsky/browserslist-useragent
|
|
80
|
-
[`browserslist-ga`]: https://github.com/
|
|
79
|
+
[`browserslist-ga`]: https://github.com/browserslist/browserslist-ga
|
|
81
80
|
[`caniuse-api`]: https://github.com/Nyalab/caniuse-api
|
|
82
81
|
|
|
83
82
|
|
|
@@ -95,10 +94,27 @@ Browserslist will use browsers query from one of this sources:
|
|
|
95
94
|
Browserslist will use defaults:
|
|
96
95
|
`> 0.5%, last 2 versions, Firefox ESR, not dead`.
|
|
97
96
|
|
|
97
|
+
|
|
98
|
+
### Best Practices
|
|
99
|
+
|
|
100
|
+
* We do not recommend to changing the default set of browsers unless you
|
|
101
|
+
know what are you doing. Browserslist’s default browsers selection is a
|
|
102
|
+
result of many long discussions. It is easy to make mistake selecting own
|
|
103
|
+
browsers without understanding what are you doing (like accidentally making
|
|
104
|
+
your website inaccessible for Chinese users).
|
|
105
|
+
* Select browsers directly (`last 2 Chrome versions`) only if you are making
|
|
106
|
+
web app for kiosk with one browser. There are a lot browsers on the market.
|
|
107
|
+
If you are making general web app you should respect browsers diversity.
|
|
108
|
+
* If you want to change the default set of browsers we recommend `> 0.2%`,
|
|
109
|
+
`> 1% in US` or `> 1% in my stats`. `last 2 versions` will add too many
|
|
110
|
+
dead browsers and will not add many popular versions. If you require last
|
|
111
|
+
2 versions support, set `last 2 versions, > 1% in my stats, not dead`.
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
### Full List
|
|
115
|
+
|
|
98
116
|
You can specify the versions by queries (case insensitive):
|
|
99
117
|
|
|
100
|
-
* `last 2 versions`: the last 2 versions for each browser.
|
|
101
|
-
* `last 2 Chrome versions`: the last 2 versions of Chrome browser.
|
|
102
118
|
* `> 5%`: versions selected by global usage statistics.
|
|
103
119
|
`>=`, `<` and `<=` work too.
|
|
104
120
|
* `> 5% in US`: uses USA usage statistics. It accepts [two-letter country code].
|
|
@@ -124,7 +140,9 @@ You can specify the versions by queries (case insensitive):
|
|
|
124
140
|
* `dead`: browsers from `last 2 version` query, but with less than 0.5%
|
|
125
141
|
in global usage statistics and without official support or updates
|
|
126
142
|
for 24 months. Right now it is `IE 10`, `IE_Mob 10`, `BlackBerry 10`,
|
|
127
|
-
and `
|
|
143
|
+
`BlackBerry 7`, and `OperaMobile 12.1`.
|
|
144
|
+
* `last 2 versions`: the last 2 versions for *each* browser.
|
|
145
|
+
* `last 2 Chrome versions`: the last 2 versions of Chrome browser.
|
|
128
146
|
* `defaults`: Browserslist’s default browsers
|
|
129
147
|
(`> 0.5%, last 2 versions, Firefox ESR, not dead`).
|
|
130
148
|
* `not ie <= 8`: exclude browsers selected by previous queries.
|
|
@@ -212,7 +230,7 @@ browsers in `package.json` with `browserslist` key:
|
|
|
212
230
|
},
|
|
213
231
|
"browserslist": [
|
|
214
232
|
"> 1%",
|
|
215
|
-
"
|
|
233
|
+
"IE 10"
|
|
216
234
|
]
|
|
217
235
|
}
|
|
218
236
|
```
|
|
@@ -227,8 +245,7 @@ and have browsers queries split by a new line. Comments starts with `#` symb
|
|
|
227
245
|
# Browsers that we support
|
|
228
246
|
|
|
229
247
|
> 1%
|
|
230
|
-
|
|
231
|
-
IE 8 # sorry
|
|
248
|
+
IE 10 # sorry
|
|
232
249
|
```
|
|
233
250
|
|
|
234
251
|
Browserslist will check config in every directory in `path`.
|
|
@@ -276,8 +293,8 @@ When writing a shared Browserslist package, just export an array.
|
|
|
276
293
|
|
|
277
294
|
```js
|
|
278
295
|
module.exports = [
|
|
279
|
-
'
|
|
280
|
-
'ie
|
|
296
|
+
'> 1%',
|
|
297
|
+
'ie 10'
|
|
281
298
|
]
|
|
282
299
|
```
|
|
283
300
|
|
|
@@ -333,11 +350,12 @@ In `package.json`:
|
|
|
333
350
|
```js
|
|
334
351
|
"browserslist": {
|
|
335
352
|
"production": [
|
|
336
|
-
"
|
|
337
|
-
"ie
|
|
353
|
+
"> 1%",
|
|
354
|
+
"ie 10"
|
|
338
355
|
],
|
|
339
356
|
"development": [
|
|
340
|
-
"last 1 version"
|
|
357
|
+
"last 1 chrome version",
|
|
358
|
+
"last 1 firefox version"
|
|
341
359
|
]
|
|
342
360
|
}
|
|
343
361
|
```
|
|
@@ -346,11 +364,12 @@ In `.browserslistrc` config:
|
|
|
346
364
|
|
|
347
365
|
```ini
|
|
348
366
|
[production staging]
|
|
349
|
-
|
|
350
|
-
ie
|
|
367
|
+
> 1%
|
|
368
|
+
ie 10
|
|
351
369
|
|
|
352
370
|
[development]
|
|
353
|
-
last 1 version
|
|
371
|
+
last 1 chrome version
|
|
372
|
+
last 1 firefox version
|
|
354
373
|
```
|
|
355
374
|
|
|
356
375
|
|
|
@@ -385,7 +404,7 @@ Note that you can query against your custom usage data
|
|
|
385
404
|
while also querying against global or regional data.
|
|
386
405
|
For example, the query `> 1% in my stats, > 5% in US, 10%` is permitted.
|
|
387
406
|
|
|
388
|
-
[`browserslist-ga`]: https://github.com/
|
|
407
|
+
[`browserslist-ga`]: https://github.com/browserslist/browserslist-ga
|
|
389
408
|
[Can I Use]: http://caniuse.com/
|
|
390
409
|
|
|
391
410
|
|
|
@@ -405,8 +424,8 @@ var process = function (source, opts) {
|
|
|
405
424
|
}
|
|
406
425
|
```
|
|
407
426
|
|
|
408
|
-
Queries can be a string `">
|
|
409
|
-
or an array `['>
|
|
427
|
+
Queries can be a string `"> 1%, IE 10"`
|
|
428
|
+
or an array `['> 1%', 'IE 10']`.
|
|
410
429
|
|
|
411
430
|
If a query is missing, Browserslist will look for a config file.
|
|
412
431
|
You can provide a `path` option (that can be a file) to find the config file
|
|
@@ -426,7 +445,7 @@ Options:
|
|
|
426
445
|
For non-JS environment and debug purpose you can use CLI tool:
|
|
427
446
|
|
|
428
447
|
```sh
|
|
429
|
-
browserslist "> 1%,
|
|
448
|
+
browserslist "> 1%, IE 10"
|
|
430
449
|
```
|
|
431
450
|
|
|
432
451
|
|
package/cli.js
CHANGED
|
@@ -62,20 +62,19 @@ if (isArg('--help') || isArg('-h')) {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
if (!queries && !opts.config) {
|
|
66
|
-
if (browserslist.findConfig(process.cwd())) {
|
|
67
|
-
opts.path = process.cwd()
|
|
68
|
-
} else {
|
|
69
|
-
error(
|
|
70
|
-
'Browserslist config was not found. ' +
|
|
71
|
-
'Define queries or config path.' +
|
|
72
|
-
'\n\n' + USAGE
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
65
|
var browsers
|
|
78
66
|
try {
|
|
67
|
+
if (!queries && !opts.config) {
|
|
68
|
+
if (browserslist.findConfig(process.cwd())) {
|
|
69
|
+
opts.path = process.cwd()
|
|
70
|
+
} else {
|
|
71
|
+
error(
|
|
72
|
+
'Browserslist config was not found. ' +
|
|
73
|
+
'Define queries or config path.' +
|
|
74
|
+
'\n\n' + USAGE
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
79
78
|
browsers = browserslist(queries, opts)
|
|
80
79
|
} catch (e) {
|
|
81
80
|
if (e.name === 'BrowserslistError') {
|
package/index.js
CHANGED
|
@@ -140,7 +140,7 @@ function resolve (queries, context) {
|
|
|
140
140
|
var array = type.select.apply(browserslist, args)
|
|
141
141
|
if (isExclude) {
|
|
142
142
|
array = array.concat(array.map(function (j) {
|
|
143
|
-
return j.replace(/\s
|
|
143
|
+
return j.replace(/\s[^\s]+/, ' 0')
|
|
144
144
|
}))
|
|
145
145
|
return result.filter(function (j) {
|
|
146
146
|
return array.indexOf(j) === -1
|
|
@@ -332,7 +332,7 @@ browserslist.coverage = function (browsers, stats) {
|
|
|
332
332
|
return browsers.reduce(function (all, i) {
|
|
333
333
|
var usage = data[i]
|
|
334
334
|
if (usage === undefined) {
|
|
335
|
-
usage = data[i.replace(/ [
|
|
335
|
+
usage = data[i.replace(/ [^\s]+$/, ' 0')]
|
|
336
336
|
}
|
|
337
337
|
return all + (usage || 0)
|
|
338
338
|
}, 0)
|
|
@@ -710,7 +710,7 @@ var QUERIES = [
|
|
|
710
710
|
{
|
|
711
711
|
regexp: /^dead$/i,
|
|
712
712
|
select: function () {
|
|
713
|
-
return ['ie 10', 'ie_mob 10', 'bb 10', 'bb 7']
|
|
713
|
+
return ['ie 10', 'ie_mob 10', 'bb 10', 'bb 7', 'op_mob 12.1']
|
|
714
714
|
}
|
|
715
715
|
},
|
|
716
716
|
{
|
package/node.js
CHANGED
|
@@ -7,8 +7,8 @@ var BrowserslistError = require('./error')
|
|
|
7
7
|
var IS_SECTION = /^\s*\[(.+)\]\s*$/
|
|
8
8
|
var CONFIG_PATTERN = /^browserslist-config-/
|
|
9
9
|
var SCOPED_CONFIG__PATTERN = /@[^./]+\/browserslist-config(-|$)/
|
|
10
|
-
var FORMAT = 'Browserslist config should
|
|
11
|
-
'
|
|
10
|
+
var FORMAT = 'Browserslist config should be a string or an array ' +
|
|
11
|
+
'of strings with browser queries'
|
|
12
12
|
|
|
13
13
|
var filenessCache = { }
|
|
14
14
|
var configCache = { }
|
|
@@ -50,13 +50,14 @@ function eachParent (file, callback) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
function check (section) {
|
|
53
|
-
if (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
throw new BrowserslistError(FORMAT)
|
|
53
|
+
if (Array.isArray(section)) {
|
|
54
|
+
for (var i = 0; i < section.length; i++) {
|
|
55
|
+
if (typeof section[i] !== 'string') {
|
|
56
|
+
throw new BrowserslistError(FORMAT)
|
|
57
|
+
}
|
|
59
58
|
}
|
|
59
|
+
} else if (typeof section !== 'string') {
|
|
60
|
+
throw new BrowserslistError(FORMAT)
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -99,7 +100,7 @@ module.exports = {
|
|
|
99
100
|
loadQueries: function loadQueries (context, name) {
|
|
100
101
|
if (!context.dangerousExtend) checkExtend(name)
|
|
101
102
|
// eslint-disable-next-line security/detect-non-literal-require
|
|
102
|
-
var queries = require(name)
|
|
103
|
+
var queries = require(require.resolve(name, { paths: ['.'] }))
|
|
103
104
|
if (!Array.isArray(queries)) {
|
|
104
105
|
throw new BrowserslistError(
|
|
105
106
|
'`' + name + '` config exports not an array of queries')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browserslist",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.6",
|
|
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,8 +11,8 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"repository": "browserslist/browserslist",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"caniuse-lite": "^1.0.
|
|
15
|
-
"electron-to-chromium": "^1.3.
|
|
14
|
+
"caniuse-lite": "^1.0.30000830",
|
|
15
|
+
"electron-to-chromium": "^1.3.42"
|
|
16
16
|
},
|
|
17
17
|
"bin": "./cli.js",
|
|
18
18
|
"devDependencies": {
|
|
@@ -21,15 +21,16 @@
|
|
|
21
21
|
"eslint-ci": "^0.1.1",
|
|
22
22
|
"eslint-config-logux": "^21.0.0",
|
|
23
23
|
"eslint-config-standard": "^11.0.0",
|
|
24
|
-
"eslint-plugin-es5": "^1.
|
|
25
|
-
"eslint-plugin-import": "^2.
|
|
26
|
-
"eslint-plugin-jest": "^21.15.
|
|
24
|
+
"eslint-plugin-es5": "^1.3.1",
|
|
25
|
+
"eslint-plugin-import": "^2.11.0",
|
|
26
|
+
"eslint-plugin-jest": "^21.15.1",
|
|
27
27
|
"eslint-plugin-node": "^6.0.1",
|
|
28
28
|
"eslint-plugin-promise": "^3.7.0",
|
|
29
29
|
"eslint-plugin-security": "^1.4.0",
|
|
30
|
-
"eslint-plugin-standard": "^3.0
|
|
30
|
+
"eslint-plugin-standard": "^3.1.0",
|
|
31
|
+
"fs-extra": "^5.0.0",
|
|
31
32
|
"jest": "^22.4.3",
|
|
32
|
-
"lint-staged": "^7.0.
|
|
33
|
+
"lint-staged": "^7.0.4",
|
|
33
34
|
"pre-commit": "^1.1.3",
|
|
34
35
|
"size-limit": "^0.17.0",
|
|
35
36
|
"yaspeller-ci": "^1.0.0"
|