browserslist 4.24.4 → 4.24.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.
Files changed (2) hide show
  1. package/node.js +57 -45
  2. package/package.json +4 -4
package/node.js CHANGED
@@ -51,23 +51,23 @@ function eachParent(file, callback, cache) {
51
51
  if (!pathInRoot(loc)) {
52
52
  break
53
53
  }
54
- if (cache && (loc in cache)) {
54
+ if (cache && loc in cache) {
55
55
  result = cache[loc]
56
56
  break
57
57
  }
58
58
  pathsForCacheResult.push(loc)
59
-
59
+
60
60
  if (!isDirectory(loc)) {
61
61
  continue
62
62
  }
63
-
63
+
64
64
  var locResult = callback(loc)
65
65
  if (typeof locResult !== 'undefined') {
66
66
  result = locResult
67
67
  break
68
68
  }
69
69
  } while (loc !== (loc = path.dirname(loc)))
70
-
70
+
71
71
  if (cache && !process.env.BROWSERSLIST_DISABLE_CACHE) {
72
72
  pathsForCacheResult.forEach(function (cachePath) {
73
73
  cache[cachePath] = result
@@ -152,10 +152,10 @@ function parsePackageOrReadConfig(file) {
152
152
  if (file in parseConfigCache) {
153
153
  return parseConfigCache[file]
154
154
  }
155
-
155
+
156
156
  var isPackage = path.basename(file) === 'package.json'
157
157
  var result = isPackage ? parsePackage(file) : module.exports.readConfig(file)
158
-
158
+
159
159
  if (!process.env.BROWSERSLIST_DISABLE_CACHE) {
160
160
  parseConfigCache[file] = result
161
161
  }
@@ -229,6 +229,9 @@ module.exports = {
229
229
  checkExtend(name)
230
230
  }
231
231
  var queries = require(require.resolve(name, { paths: ['.', ctx.path] }))
232
+ if (typeof queries === 'object' && queries !== null && queries.__esModule) {
233
+ queries = queries.default
234
+ }
232
235
  if (queries) {
233
236
  if (Array.isArray(queries)) {
234
237
  return queries
@@ -263,10 +266,14 @@ module.exports = {
263
266
  } else if (process.env.BROWSERSLIST_STATS) {
264
267
  stats = process.env.BROWSERSLIST_STATS
265
268
  } else if (opts.path && path.resolve && fs.existsSync) {
266
- stats = eachParent(opts.path, function (dir) {
267
- var file = path.join(dir, 'browserslist-stats.json')
268
- return isFile(file) ? file : undefined
269
- }, statCache)
269
+ stats = eachParent(
270
+ opts.path,
271
+ function (dir) {
272
+ var file = path.join(dir, 'browserslist-stats.json')
273
+ return isFile(file) ? file : undefined
274
+ },
275
+ statCache
276
+ )
270
277
  }
271
278
  if (typeof stats === 'string') {
272
279
  try {
@@ -374,43 +381,48 @@ module.exports = {
374
381
  },
375
382
 
376
383
  findConfigFile: function findConfigFile(from) {
377
- return eachParent(from, function (dir) {
378
- var config = path.join(dir, 'browserslist')
379
- var pkg = path.join(dir, 'package.json')
380
- var rc = path.join(dir, '.browserslistrc')
381
-
382
- var pkgBrowserslist
383
- if (isFile(pkg)) {
384
- try {
385
- pkgBrowserslist = parsePackage(pkg)
386
- } catch (e) {
387
- if (e.name === 'BrowserslistError') throw e
388
- console.warn(
389
- '[Browserslist] Could not parse ' + pkg + '. Ignoring it.'
390
- )
384
+ return eachParent(
385
+ from,
386
+ function (dir) {
387
+ var config = path.join(dir, 'browserslist')
388
+ var pkg = path.join(dir, 'package.json')
389
+ var rc = path.join(dir, '.browserslistrc')
390
+
391
+ var pkgBrowserslist
392
+ if (isFile(pkg)) {
393
+ try {
394
+ pkgBrowserslist = parsePackage(pkg)
395
+ } catch (e) {
396
+ if (e.name === 'BrowserslistError') throw e
397
+ console.warn(
398
+ '[Browserslist] Could not parse ' + pkg + '. Ignoring it.'
399
+ )
400
+ }
391
401
  }
392
- }
393
402
 
394
- if (isFile(config) && pkgBrowserslist) {
395
- throw new BrowserslistError(
396
- dir + ' contains both browserslist and package.json with browsers'
397
- )
398
- } else if (isFile(rc) && pkgBrowserslist) {
399
- throw new BrowserslistError(
400
- dir + ' contains both .browserslistrc and package.json with browsers'
401
- )
402
- } else if (isFile(config) && isFile(rc)) {
403
- throw new BrowserslistError(
404
- dir + ' contains both .browserslistrc and browserslist'
405
- )
406
- } else if (isFile(config)) {
407
- return config
408
- } else if (isFile(rc)) {
409
- return rc
410
- } else if (pkgBrowserslist) {
411
- return pkg
412
- }
413
- }, configPathCache)
403
+ if (isFile(config) && pkgBrowserslist) {
404
+ throw new BrowserslistError(
405
+ dir + ' contains both browserslist and package.json with browsers'
406
+ )
407
+ } else if (isFile(rc) && pkgBrowserslist) {
408
+ throw new BrowserslistError(
409
+ dir +
410
+ ' contains both .browserslistrc and package.json with browsers'
411
+ )
412
+ } else if (isFile(config) && isFile(rc)) {
413
+ throw new BrowserslistError(
414
+ dir + ' contains both .browserslistrc and browserslist'
415
+ )
416
+ } else if (isFile(config)) {
417
+ return config
418
+ } else if (isFile(rc)) {
419
+ return rc
420
+ } else if (pkgBrowserslist) {
421
+ return pkg
422
+ }
423
+ },
424
+ configPathCache
425
+ )
414
426
  },
415
427
 
416
428
  findConfig: function findConfig(from) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browserslist",
3
- "version": "4.24.4",
3
+ "version": "4.24.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",
@@ -25,10 +25,10 @@
25
25
  "license": "MIT",
26
26
  "repository": "browserslist/browserslist",
27
27
  "dependencies": {
28
- "caniuse-lite": "^1.0.30001688",
29
- "electron-to-chromium": "^1.5.73",
28
+ "caniuse-lite": "^1.0.30001716",
29
+ "electron-to-chromium": "^1.5.149",
30
30
  "node-releases": "^2.0.19",
31
- "update-browserslist-db": "^1.1.1"
31
+ "update-browserslist-db": "^1.1.3"
32
32
  },
33
33
  "engines": {
34
34
  "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"