browserslist 4.7.1 → 4.7.2
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 +4 -0
- package/index.js +11 -4
- package/node.js +18 -12
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
package/index.js
CHANGED
|
@@ -289,6 +289,8 @@ function resolve (queries, context) {
|
|
|
289
289
|
}, [])
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
+
var cache = { }
|
|
293
|
+
|
|
292
294
|
/**
|
|
293
295
|
* Return array of browsers by selection queries.
|
|
294
296
|
*
|
|
@@ -350,7 +352,10 @@ function browserslist (queries, opts) {
|
|
|
350
352
|
}
|
|
351
353
|
}
|
|
352
354
|
|
|
353
|
-
var
|
|
355
|
+
var cacheKey = JSON.stringify([queries, context])
|
|
356
|
+
if (cache[cacheKey]) return cache[cacheKey]
|
|
357
|
+
|
|
358
|
+
var result = uniq(resolve(queries, context)).sort(function (name1, name2) {
|
|
354
359
|
name1 = name1.split(' ')
|
|
355
360
|
name2 = name2.split(' ')
|
|
356
361
|
if (name1[0] === name2[0]) {
|
|
@@ -363,8 +368,10 @@ function browserslist (queries, opts) {
|
|
|
363
368
|
return compare(name1[0], name2[0])
|
|
364
369
|
}
|
|
365
370
|
})
|
|
366
|
-
|
|
367
|
-
|
|
371
|
+
if (!process.env.BROWSERSLIST_DISABLE_CACHE) {
|
|
372
|
+
cache[cacheKey] = result
|
|
373
|
+
}
|
|
374
|
+
return result
|
|
368
375
|
}
|
|
369
376
|
|
|
370
377
|
function parse (queries) {
|
|
@@ -828,7 +835,7 @@ var QUERIES = [
|
|
|
828
835
|
{
|
|
829
836
|
regexp: /^(firefox|ff|fx)\s+esr$/i,
|
|
830
837
|
select: function () {
|
|
831
|
-
return ['firefox 68'
|
|
838
|
+
return ['firefox 68']
|
|
832
839
|
}
|
|
833
840
|
},
|
|
834
841
|
{
|
package/node.js
CHANGED
|
@@ -84,7 +84,8 @@ function parsePackage (file) {
|
|
|
84
84
|
var config = JSON.parse(fs.readFileSync(file))
|
|
85
85
|
if (config.browserlist && !config.browserslist) {
|
|
86
86
|
throw new BrowserslistError(
|
|
87
|
-
'`browserlist` key instead of `browserslist` in ' + file
|
|
87
|
+
'`browserlist` key instead of `browserslist` in ' + file
|
|
88
|
+
)
|
|
88
89
|
}
|
|
89
90
|
var list = config.browserslist
|
|
90
91
|
if (Array.isArray(list) || typeof list === 'string') {
|
|
@@ -117,7 +118,8 @@ module.exports = {
|
|
|
117
118
|
var queries = require(require.resolve(name, { paths: ['.'] }))
|
|
118
119
|
if (!Array.isArray(queries)) {
|
|
119
120
|
throw new BrowserslistError(
|
|
120
|
-
'`' + name + '` config exports not an array of queries'
|
|
121
|
+
'`' + name + '` config exports not an array of queries'
|
|
122
|
+
)
|
|
121
123
|
}
|
|
122
124
|
return queries
|
|
123
125
|
},
|
|
@@ -215,7 +217,8 @@ module.exports = {
|
|
|
215
217
|
sections.forEach(function (section) {
|
|
216
218
|
if (result[section]) {
|
|
217
219
|
throw new BrowserslistError(
|
|
218
|
-
'Duplicate section ' + section + ' in Browserslist config'
|
|
220
|
+
'Duplicate section ' + section + ' in Browserslist config'
|
|
221
|
+
)
|
|
219
222
|
}
|
|
220
223
|
result[section] = []
|
|
221
224
|
})
|
|
@@ -239,13 +242,12 @@ module.exports = {
|
|
|
239
242
|
findConfig: function findConfig (from) {
|
|
240
243
|
from = path.resolve(from)
|
|
241
244
|
|
|
242
|
-
var cacheKey = isFile(from) ? path.dirname(from) : from
|
|
243
|
-
if (cacheKey in configCache) {
|
|
244
|
-
return configCache[cacheKey]
|
|
245
|
-
}
|
|
246
|
-
|
|
247
245
|
var passed = []
|
|
248
246
|
var resolved = eachParent(from, function (dir) {
|
|
247
|
+
if (dir in configCache) {
|
|
248
|
+
return configCache[dir]
|
|
249
|
+
}
|
|
250
|
+
|
|
249
251
|
passed.push(dir)
|
|
250
252
|
|
|
251
253
|
var config = path.join(dir, 'browserslist')
|
|
@@ -259,19 +261,23 @@ module.exports = {
|
|
|
259
261
|
} catch (e) {
|
|
260
262
|
if (e.name === 'BrowserslistError') throw e
|
|
261
263
|
console.warn(
|
|
262
|
-
'[Browserslist] Could not parse ' + pkg + '. Ignoring it.'
|
|
264
|
+
'[Browserslist] Could not parse ' + pkg + '. Ignoring it.'
|
|
265
|
+
)
|
|
263
266
|
}
|
|
264
267
|
}
|
|
265
268
|
|
|
266
269
|
if (isFile(config) && pkgBrowserslist) {
|
|
267
270
|
throw new BrowserslistError(
|
|
268
|
-
dir + ' contains both browserslist and package.json with browsers'
|
|
271
|
+
dir + ' contains both browserslist and package.json with browsers'
|
|
272
|
+
)
|
|
269
273
|
} else if (isFile(rc) && pkgBrowserslist) {
|
|
270
274
|
throw new BrowserslistError(
|
|
271
|
-
dir + ' contains both .browserslistrc and package.json with browsers'
|
|
275
|
+
dir + ' contains both .browserslistrc and package.json with browsers'
|
|
276
|
+
)
|
|
272
277
|
} else if (isFile(config) && isFile(rc)) {
|
|
273
278
|
throw new BrowserslistError(
|
|
274
|
-
dir + ' contains both .browserslistrc and browserslist'
|
|
279
|
+
dir + ' contains both .browserslistrc and browserslist'
|
|
280
|
+
)
|
|
275
281
|
} else if (isFile(config)) {
|
|
276
282
|
return module.exports.readConfig(config)
|
|
277
283
|
} else if (isFile(rc)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browserslist",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.2",
|
|
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,9 +11,9 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"repository": "browserslist/browserslist",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"caniuse-lite": "^1.0.
|
|
15
|
-
"electron-to-chromium": "^1.3.
|
|
16
|
-
"node-releases": "^1.1.
|
|
14
|
+
"caniuse-lite": "^1.0.30001004",
|
|
15
|
+
"electron-to-chromium": "^1.3.295",
|
|
16
|
+
"node-releases": "^1.1.38"
|
|
17
17
|
},
|
|
18
18
|
"bin": "./cli.js",
|
|
19
19
|
"browser": {
|