update, text, response

This commit is contained in:
2025-11-02 11:09:14 +01:00
parent 14776c86b0
commit eed8a4ddcf
2794 changed files with 156786 additions and 129204 deletions

16
node_modules/browserslist/README.md generated vendored
View File

@@ -1,4 +1,4 @@
# Browserslist [![Cult Of Martians][cult-img]][cult]
# Browserslist
<img width="120" height="120" alt="Browserslist logo by Anton Popov"
src="https://browsersl.ist/logo.svg" align="right">
@@ -19,7 +19,7 @@ when you add the following to `package.json`:
```json
"browserslist": [
"defaults and supports es6-module",
"defaults and fully supports es6-module",
"maintained node versions"
]
```
@@ -29,7 +29,7 @@ Or in `.browserslistrc` config:
```yaml
# Browsers that we support
defaults and supports es6-module
defaults and fully supports es6-module
maintained node versions
```
@@ -46,13 +46,7 @@ You can check how config works at our playground: [`browsersl.ist`](https://brow
<br>
<br>
<div align="center">
<a href="https://evilmartians.com/?utm_source=browserslist">
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
alt="Sponsored by Evil Martians" width="236" height="54">
</a>  <a href="https://cube.dev/?ref=eco-browserslist-github">
<img src="https://user-images.githubusercontent.com/986756/154330861-d79ab8ec-aacb-4af8-9e17-1b28f1eccb01.svg"
alt="Supported by Cube" width="227" height="46">
</a>
<a href="https://evilmartians.com/?utm_source=browserslist"><img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"></a>  <a href="https://cube.dev/?ref=eco-browserslist-github"><img src="https://user-images.githubusercontent.com/986756/154330861-d79ab8ec-aacb-4af8-9e17-1b28f1eccb01.svg" alt="Supported by Cube" width="227" height="46"></a>
</div>
[stylelint-no-unsupported-browser-features]: https://github.com/ismay/stylelint-no-unsupported-browser-features
@@ -66,8 +60,6 @@ You can check how config works at our playground: [`browsersl.ist`](https://brow
[Autoprefixer]: https://github.com/postcss/autoprefixer
[Can I Use]: https://caniuse.com/
[Babel]: https://github.com/babel/babel/tree/master/packages/babel-preset-env
[cult-img]: https://cultofmartians.com/assets/badges/badge.svg
[cult]: https://cultofmartians.com/done.html
## Docs
Read full docs **[here](https://github.com/browserslist/browserslist#readme)**.

View File

@@ -44,6 +44,8 @@ module.exports = {
findConfig: noop,
findConfigFile: noop,
clearCaches: noop,
oldDataWarning: noop,

9
node_modules/browserslist/cli.js generated vendored
View File

@@ -1,7 +1,7 @@
#!/usr/bin/env node
var updateDb = require('update-browserslist-db')
var fs = require('fs')
var updateDb = require('update-browserslist-db')
var browserslist = require('./')
var pkg = require('./package.json')
@@ -38,7 +38,12 @@ if (isArg('--help') || isArg('-h')) {
} else if (isArg('--version') || isArg('-v')) {
process.stdout.write('browserslist ' + pkg.version + '\n')
} else if (isArg('--update-db')) {
/* c8 ignore next 3 */
/* c8 ignore next 8 */
process.stdout.write(
'The --update-db command is deprecated.\n' +
'Please use npx update-browserslist-db@latest instead.\n'
)
process.stdout.write('Browserslist DB update will still be made.\n')
updateDb(function (str) {
process.stdout.write(str)
})

28
node_modules/browserslist/index.d.ts generated vendored
View File

@@ -166,6 +166,17 @@ declare namespace browserslist {
opts?: browserslist.Options
): Query[]
/**
* Return queries for specific file inside the project.
*
* ```js
* browserslist.loadConfig({
* file: process.cwd()
* }) ?? browserslist.defaults
* ```
*/
function loadConfig(options: LoadConfigOptions): string[] | undefined
function clearCaches(): void
function parseConfig(string: string): Config
@@ -174,13 +185,25 @@ declare namespace browserslist {
function findConfig(...pathSegments: string[]): Config | undefined
function findConfigFile(...pathSegments: string[]): string | undefined
interface LoadConfigOptions {
/**
* Path to config file
* */
config?: string
/**
* Path to file inside the project to find Browserslist config
* in closest folder
*/
path?: string
/**
* Environment to choose part of config.
*/
env?: string
}
function loadConfig(options: LoadConfigOptions): string[] | undefined
}
declare global {
@@ -193,6 +216,7 @@ declare global {
BROWSERSLIST_ENV?: string
BROWSERSLIST_IGNORE_OLD_DATA?: string
BROWSERSLIST_STATS?: string
BROWSERSLIST_ROOT_PATH?: string
}
}
}

187
node_modules/browserslist/index.js generated vendored
View File

@@ -1,12 +1,13 @@
var bbm = require('baseline-browser-mapping')
var jsReleases = require('node-releases/data/processed/envs.json')
var agents = require('caniuse-lite/dist/unpacker/agents').agents
var e2c = require('electron-to-chromium/versions')
var jsEOL = require('node-releases/data/release-schedule/release-schedule.json')
var path = require('path')
var e2c = require('electron-to-chromium/versions')
var BrowserslistError = require('./error')
var parse = require('./parse')
var env = require('./node') // Will load browser.js in webpack
var env = require('./node')
var parseWithoutCache = require('./parse') // Will load browser.js in webpack
var YEAR = 365.259641 * 24 * 60 * 60 * 1000
var ANDROID_EVERGREEN_FIRST = '37'
@@ -82,11 +83,11 @@ function generateFilter(sign, version) {
version = parseFloat(version)
if (sign === '>') {
return function (v) {
return parseFloat(v) > version
return parseLatestFloat(v) > version
}
} else if (sign === '>=') {
return function (v) {
return parseFloat(v) >= version
return parseLatestFloat(v) >= version
}
} else if (sign === '<') {
return function (v) {
@@ -97,6 +98,10 @@ function generateFilter(sign, version) {
return parseFloat(v) <= version
}
}
function parseLatestFloat(v) {
return parseFloat(v.split('-')[1] || v)
}
}
function generateSemverFilter(sign, version) {
@@ -249,9 +254,18 @@ function normalizeAndroidVersions(androidVersions, chromeVersions) {
.concat(chromeVersions.slice(iFirstEvergreen))
}
function copyObject(obj) {
var copy = {}
for (var key in obj) {
copy[key] = obj[key]
}
return copy
}
function normalizeAndroidData(android, chrome) {
android.released = normalizeAndroidVersions(android.released, chrome.released)
android.versions = normalizeAndroidVersions(android.versions, chrome.versions)
android.releaseDate = copyObject(android.releaseDate)
android.released.forEach(function (v) {
if (android.releaseDate[v] === undefined) {
android.releaseDate[v] = chrome.releaseDate[v]
@@ -298,15 +312,15 @@ function filterJumps(list, name, nVersions, context) {
return list.slice(jump - 1 - nVersions)
}
function isSupported(flags) {
function isSupported(flags, withPartial) {
return (
typeof flags === 'string' &&
(flags.indexOf('y') >= 0 || flags.indexOf('a') >= 0)
(flags.indexOf('y') >= 0 || (withPartial && flags.indexOf('a') >= 0))
)
}
function resolve(queries, context) {
return parse(QUERIES, queries).reduce(function (result, node, index) {
return parseQueries(queries).reduce(function (result, node, index) {
if (node.not && index === 0) {
throw new BrowserslistError(
'Write any browsers query (for instance, `defaults`) ' +
@@ -382,19 +396,27 @@ function checkQueries(queries) {
}
var cache = {}
var parseCache = {}
function browserslist(queries, opts) {
opts = prepareOpts(opts)
queries = prepareQueries(queries, opts)
checkQueries(queries)
var needsPath = parseQueries(queries).some(function (node) {
return QUERIES[node.type].needsPath
})
var context = {
ignoreUnknownVersions: opts.ignoreUnknownVersions,
dangerousExtend: opts.dangerousExtend,
throwOnMissing: opts.throwOnMissing,
mobileToDesktop: opts.mobileToDesktop,
path: opts.path,
env: opts.env
}
// Removing to avoid using context.path without marking query as needsPath
if (needsPath) {
context.path = opts.path
}
env.oldDataWarning(browserslist.data)
var stats = env.getStat(opts, browserslist.data)
@@ -428,11 +450,35 @@ function browserslist(queries, opts) {
return result
}
function parseQueries(queries) {
var cacheKey = JSON.stringify(queries)
if (cacheKey in parseCache) return parseCache[cacheKey]
var result = parseWithoutCache(QUERIES, queries)
if (!env.env.BROWSERSLIST_DISABLE_CACHE) {
parseCache[cacheKey] = result
}
return result
}
function loadCustomUsage(context, config) {
var stats = env.loadStat(context, config, browserslist.data)
if (stats) {
context.customUsage = {}
for (var browser in stats) {
fillUsage(context.customUsage, browser, stats[browser])
}
}
if (!context.customUsage) {
throw new BrowserslistError('Custom usage statistics was not provided')
}
return context.customUsage
}
browserslist.parse = function (queries, opts) {
opts = prepareOpts(opts)
queries = prepareQueries(queries, opts)
checkQueries(queries)
return parse(QUERIES, queries)
return parseQueries(queries)
}
// Will be filled by Can I Use data below
@@ -478,6 +524,7 @@ browserslist.versionAliases = {}
browserslist.clearCaches = env.clearCaches
browserslist.parseConfig = env.parseConfig
browserslist.readConfig = env.readConfig
browserslist.findConfigFile = env.findConfigFile
browserslist.findConfig = env.findConfig
browserslist.loadConfig = env.loadConfig
@@ -548,6 +595,33 @@ function sinceQuery(context, node) {
return filterByYear(Date.UTC(year, month, day, 0, 0, 0), context)
}
function bbmTransform(bbmVersions) {
var browsers = {
chrome: 'chrome',
chrome_android: 'and_chr',
edge: 'edge',
firefox: 'firefox',
firefox_android: 'and_ff',
safari: 'safari',
safari_ios: 'ios_saf',
webview_android: 'android',
samsunginternet_android: 'samsung',
opera_android: 'op_mob',
opera: 'opera',
qq_android: 'and_qq',
uc_android: 'and_uc',
kai_os: 'kaios'
}
return bbmVersions
.filter(function (version) {
return Object.keys(browsers).indexOf(version.browser) !== -1
})
.map(function (version) {
return browsers[version.browser] + ' >= ' + version.version
})
}
function coverQuery(context, node) {
var coverage = parseFloat(node.coverage)
var usage = browserslist.usage.global
@@ -567,19 +641,21 @@ function coverQuery(context, node) {
env.loadCountry(browserslist.usage, place, browserslist.data)
usage = browserslist.usage[place]
}
} else if (node.config) {
usage = loadCustomUsage(context, node.config)
}
var versions = Object.keys(usage).sort(function (a, b) {
return usage[b] - usage[a]
})
var coveraged = 0
var covered = 0
var result = []
var version
for (var i = 0; i < versions.length; i++) {
version = versions[i]
if (usage[version] === 0) break
coveraged += usage[version]
covered += usage[version]
result.push(version)
if (coveraged >= coverage) break
if (covered >= coverage) break
}
return result
}
@@ -713,7 +789,7 @@ var QUERIES = {
},
last_years: {
matches: ['years'],
regexp: /^last\s+(\d*.?\d+)\s+years?$/i,
regexp: /^last\s+((\d+\.)?\d+)\s+years?$/i,
select: function (context, node) {
return filterByYear(Date.now() - YEAR * node.years, context)
}
@@ -733,6 +809,54 @@ var QUERIES = {
regexp: /^since (\d+)-(\d+)-(\d+)$/i,
select: sinceQuery
},
baseline: {
matches: ['year', 'availability', 'date', 'downstream', 'kaios'],
// Matches:
// baseline 2024
// baseline newly available
// baseline widely available
// baseline widely available on 2024-06-01
// ...with downstream
// ...including kaios
regexp:
/^baseline\s+(?:(\d+)|(newly|widely)\s+available(?:\s+on\s+(\d{4}-\d{2}-\d{2}))?)?(\s+with\s+downstream)?(\s+including\s+kaios)?$/i,
select: function (context, node) {
var baselineVersions
var includeDownstream = !!node.downstream
var includeKaiOS = !!node.kaios
if (node.availability === 'newly' && node.date) {
throw new BrowserslistError(
'Using newly available with a date is not supported, please use "widely available on YYYY-MM-DD" and add 30 months to the date you specified.'
)
}
if (node.year) {
baselineVersions = bbm.getCompatibleVersions({
targetYear: node.year,
includeDownstreamBrowsers: includeDownstream,
includeKaiOS: includeKaiOS
})
} else if (node.date) {
baselineVersions = bbm.getCompatibleVersions({
widelyAvailableOnDate: node.date,
includeDownstreamBrowsers: includeDownstream,
includeKaiOS: includeKaiOS
})
} else if (node.availability === 'newly') {
var future30months = new Date().setMonth(new Date().getMonth() + 30)
baselineVersions = bbm.getCompatibleVersions({
widelyAvailableOnDate: future30months,
includeDownstreamBrowsers: includeDownstream,
includeKaiOS: includeKaiOS
})
} else {
baselineVersions = bbm.getCompatibleVersions({
includeDownstreamBrowsers: includeDownstream,
includeKaiOS: includeKaiOS
})
}
return resolve(bbmTransform(baselineVersions), context)
}
},
popularity: {
matches: ['sign', 'popularity'],
regexp: /^(>=?|<=?)\s*(\d+|\d+\.\d+|\.\d+)%$/,
@@ -798,17 +922,7 @@ var QUERIES = {
regexp: /^(>=?|<=?)\s*(\d+|\d+\.\d+|\.\d+)%\s+in\s+(\S+)\s+stats$/,
select: function (context, node) {
var popularity = parseFloat(node.popularity)
var stats = env.loadStat(context, node.config, browserslist.data)
if (stats) {
context.customUsage = {}
for (var browser in stats) {
fillUsage(context.customUsage, browser, stats[browser])
}
}
if (!context.customUsage) {
throw new BrowserslistError('Custom usage statistics was not provided')
}
var usage = context.customUsage
var usage = loadCustomUsage(context, node.config)
return Object.keys(usage).reduce(function (result, version) {
var percentage = usage[version]
if (percentage == null) {
@@ -882,26 +996,37 @@ var QUERIES = {
regexp: /^cover\s+(\d+|\d+\.\d+|\.\d+)%\s+in\s+(my\s+stats|(alt-)?\w\w)$/i,
select: coverQuery
},
cover_config: {
matches: ['coverage', 'config'],
regexp: /^cover\s+(\d+|\d+\.\d+|\.\d+)%\s+in\s+(\S+)\s+stats$/i,
select: coverQuery
},
supports: {
matches: ['feature'],
regexp: /^supports\s+([\w-]+)$/,
matches: ['supportType', 'feature'],
regexp: /^(?:(fully|partially)\s+)?supports\s+([\w-]+)$/,
select: function (context, node) {
env.loadFeature(browserslist.cache, node.feature)
var withPartial = node.supportType !== 'fully'
var features = browserslist.cache[node.feature]
var result = []
for (var name in features) {
var data = byName(name, context)
// Only check desktop when latest released mobile has support
var iMax = data.released.length - 1
while (iMax >= 0) {
if (data.released[iMax] in features[name]) break
iMax--
}
var checkDesktop =
context.mobileToDesktop &&
name in browserslist.desktopNames &&
isSupported(features[name][data.released.slice(-1)[0]])
isSupported(features[name][data.released[iMax]], withPartial)
data.versions.forEach(function (version) {
var flags = features[name][version]
if (flags === undefined && checkDesktop) {
flags = features[browserslist.desktopNames[name]][version]
}
if (isSupported(flags)) {
if (isSupported(flags, withPartial)) {
result.push(name + ' ' + version)
}
})
@@ -1001,7 +1126,7 @@ var QUERIES = {
matches: [],
regexp: /^(firefox|ff|fx)\s+esr$/i,
select: function () {
return ['firefox 102', 'firefox 115']
return ['firefox 140']
}
},
opera_mini_all: {
@@ -1113,6 +1238,7 @@ var QUERIES = {
browserslist_config: {
matches: [],
regexp: /^browserslist config$/i,
needsPath: true,
select: function (context) {
return browserslist(undefined, context)
}
@@ -1120,6 +1246,7 @@ var QUERIES = {
extends: {
matches: ['config'],
regexp: /^extends (.+)$/i,
needsPath: true,
select: function (context, node) {
return resolve(env.loadQueries(context, node.config), context)
}

285
node_modules/browserslist/node.js generated vendored
View File

@@ -1,21 +1,25 @@
var feature = require('caniuse-lite/dist/unpacker/feature').default
var region = require('caniuse-lite/dist/unpacker/region').default
var path = require('path')
var fs = require('fs')
var path = require('path')
var BrowserslistError = require('./error')
var IS_SECTION = /^\s*\[(.+)]\s*$/
var CONFIG_PATTERN = /^browserslist-config-/
var SCOPED_CONFIG__PATTERN = /@[^/]+\/browserslist-config(-|$|\/)/
var TIME_TO_UPDATE_CANIUSE = 6 * 30 * 24 * 60 * 60 * 1000
var SCOPED_CONFIG__PATTERN = /@[^/]+(?:\/[^/]+)?\/browserslist-config(?:-|$|\/)/
var FORMAT =
'Browserslist config should be a string or an array ' +
'of strings with browser queries'
var PATHTYPE_UNKNOWN = 'unknown'
var PATHTYPE_DIR = 'directory'
var PATHTYPE_FILE = 'file'
var dataTimeChecked = false
var filenessCache = {}
var configCache = {}
var statCache = {}
var configPathCache = {}
var parseConfigCache = {}
function checkExtend(name) {
var use = ' Use `dangerousExtend` option to disable.'
if (!CONFIG_PATTERN.test(name) && !SCOPED_CONFIG__PATTERN.test(name)) {
@@ -35,25 +39,76 @@ function checkExtend(name) {
}
}
function isFile(file) {
if (file in filenessCache) {
return filenessCache[file]
function getPathType(filepath) {
var stats
try {
stats = fs.existsSync(filepath) && fs.statSync(filepath)
} catch (err) {
/* c8 ignore start */
if (
err.code !== 'ENOENT' &&
err.code !== 'EACCES' &&
err.code !== 'ERR_ACCESS_DENIED'
) {
throw err
}
/* c8 ignore end */
}
var result = fs.existsSync(file) && fs.statSync(file).isFile()
if (!process.env.BROWSERSLIST_DISABLE_CACHE) {
filenessCache[file] = result
if (stats && stats.isDirectory()) return PATHTYPE_DIR
if (stats && stats.isFile()) return PATHTYPE_FILE
return PATHTYPE_UNKNOWN
}
function isFile(file) {
return getPathType(file) === PATHTYPE_FILE
}
function isDirectory(dir) {
return getPathType(dir) === PATHTYPE_DIR
}
function eachParent(file, callback, cache) {
var loc = path.resolve(file)
var pathsForCacheResult = []
var result
do {
if (!pathInRoot(loc)) {
break
}
if (cache && loc in cache) {
result = cache[loc]
break
}
pathsForCacheResult.push(loc)
if (!isDirectory(loc)) {
continue
}
var locResult = callback(loc)
if (typeof locResult !== 'undefined') {
result = locResult
break
}
} while (loc !== (loc = path.dirname(loc)))
if (cache && !process.env.BROWSERSLIST_DISABLE_CACHE) {
pathsForCacheResult.forEach(function (cachePath) {
cache[cachePath] = result
})
}
return result
}
function eachParent(file, callback) {
var dir = isFile(file) ? path.dirname(file) : file
var loc = path.resolve(dir)
do {
var result = callback(loc)
if (typeof result !== 'undefined') return result
} while (loc !== (loc = path.dirname(loc)))
return undefined
function pathInRoot(p) {
if (!process.env.BROWSERSLIST_ROOT_PATH) return true
var rootPath = path.resolve(process.env.BROWSERSLIST_ROOT_PATH)
if (path.relative(rootPath, p).substring(0, 2) === '..') {
return false
}
return true
}
function check(section) {
@@ -94,18 +149,21 @@ function pickEnv(config, opts) {
}
function parsePackage(file) {
var config = JSON.parse(
fs
.readFileSync(file)
.toString()
.replace(/^\uFEFF/m, '')
)
if (config.browserlist && !config.browserslist) {
throw new BrowserslistError(
'`browserlist` key instead of `browserslist` in ' + file
)
var text = fs
.readFileSync(file)
.toString()
.replace(/^\uFEFF/m, '')
var list
if (text.indexOf('"browserslist"') >= 0) {
list = JSON.parse(text).browserslist
} else if (text.indexOf('"browserlist"') >= 0) {
var config = JSON.parse(text)
if (config.browserlist && !config.browserslist) {
throw new BrowserslistError(
'`browserlist` key instead of `browserslist` in ' + file
)
}
}
var list = config.browserslist
if (Array.isArray(list) || typeof list === 'string') {
list = { defaults: list }
}
@@ -116,6 +174,20 @@ function parsePackage(file) {
return list
}
function parsePackageOrReadConfig(file) {
if (file in parseConfigCache) {
return parseConfigCache[file]
}
var isPackage = path.basename(file) === 'package.json'
var result = isPackage ? parsePackage(file) : module.exports.readConfig(file)
if (!process.env.BROWSERSLIST_DISABLE_CACHE) {
parseConfigCache[file] = result
}
return result
}
function latestReleaseTime(agents) {
var latest = 0
for (var name in agents) {
@@ -129,6 +201,16 @@ function latestReleaseTime(agents) {
return latest * 1000
}
function getMonthsPassed(date) {
var now = new Date()
var past = new Date(date)
var years = now.getFullYear() - past.getFullYear()
var months = now.getMonth() - past.getMonth()
return years * 12 + months
}
function normalizeStats(data, stats) {
if (!data) {
data = {}
@@ -157,7 +239,6 @@ function normalizeStats(data, stats) {
function normalizeUsageData(usageData, data) {
for (var browser in usageData) {
var browserUsage = usageData[browser]
// eslint-disable-next-line max-len
// https://github.com/browserslist/browserslist/issues/431#issuecomment-565230615
// caniuse-db returns { 0: "percentage" } for `and_*` regional stats
if ('0' in browserUsage) {
@@ -174,6 +255,9 @@ module.exports = {
checkExtend(name)
}
var queries = require(require.resolve(name, { paths: ['.', ctx.path] }))
if (typeof queries === 'object' && queries !== null && queries.__esModule) {
queries = queries.default
}
if (queries) {
if (Array.isArray(queries)) {
return queries
@@ -194,10 +278,12 @@ module.exports = {
if (!ctx.dangerousExtend && !process.env.BROWSERSLIST_DANGEROUS_EXTEND) {
checkExtend(name)
}
var stats = require(require.resolve(
path.join(name, 'browserslist-stats.json'),
{ paths: ['.'] }
))
var stats = require(
// Use forward slashes for module paths, also on Windows.
require.resolve(path.posix.join(name, 'browserslist-stats.json'), {
paths: ['.']
})
)
return normalizeStats(data, stats)
},
@@ -208,10 +294,14 @@ module.exports = {
} else if (process.env.BROWSERSLIST_STATS) {
stats = process.env.BROWSERSLIST_STATS
} else if (opts.path && path.resolve && fs.existsSync) {
stats = eachParent(opts.path, function (dir) {
var file = path.join(dir, 'browserslist-stats.json')
return isFile(file) ? file : undefined
})
stats = eachParent(
opts.path,
function (dir) {
var file = path.join(dir, 'browserslist-stats.json')
return isFile(file) ? file : undefined
},
statCache
)
}
if (typeof stats === 'string') {
try {
@@ -228,11 +318,7 @@ module.exports = {
return process.env.BROWSERSLIST
} else if (opts.config || process.env.BROWSERSLIST_CONFIG) {
var file = opts.config || process.env.BROWSERSLIST_CONFIG
if (path.basename(file) === 'package.json') {
return pickEnv(parsePackage(file), opts)
} else {
return pickEnv(module.exports.readConfig(file), opts)
}
return pickEnv(parsePackageOrReadConfig(file), opts)
} else if (opts.path) {
return pickEnv(module.exports.findConfig(opts.path), opts)
} else {
@@ -318,68 +404,66 @@ module.exports = {
if (!isFile(file)) {
throw new BrowserslistError("Can't read " + file + ' config')
}
return module.exports.parseConfig(fs.readFileSync(file))
},
findConfig: function findConfig(from) {
from = path.resolve(from)
findConfigFile: function findConfigFile(from) {
return eachParent(
from,
function (dir) {
var config = path.join(dir, 'browserslist')
var pkg = path.join(dir, 'package.json')
var rc = path.join(dir, '.browserslistrc')
var passed = []
var resolved = eachParent(from, function (dir) {
if (dir in configCache) {
return configCache[dir]
}
passed.push(dir)
var config = path.join(dir, 'browserslist')
var pkg = path.join(dir, 'package.json')
var rc = path.join(dir, '.browserslistrc')
var pkgBrowserslist
if (isFile(pkg)) {
try {
pkgBrowserslist = parsePackage(pkg)
} catch (e) {
if (e.name === 'BrowserslistError') throw e
console.warn(
'[Browserslist] Could not parse ' + pkg + '. Ignoring it.'
)
var pkgBrowserslist
if (isFile(pkg)) {
try {
pkgBrowserslist = parsePackage(pkg)
} catch (e) {
if (e.name === 'BrowserslistError') throw e
console.warn(
'[Browserslist] Could not parse ' + pkg + '. Ignoring it.'
)
}
}
}
if (isFile(config) && pkgBrowserslist) {
throw new BrowserslistError(
dir + ' contains both browserslist and package.json with browsers'
)
} else if (isFile(rc) && pkgBrowserslist) {
throw new BrowserslistError(
dir + ' contains both .browserslistrc and package.json with browsers'
)
} else if (isFile(config) && isFile(rc)) {
throw new BrowserslistError(
dir + ' contains both .browserslistrc and browserslist'
)
} else if (isFile(config)) {
return module.exports.readConfig(config)
} else if (isFile(rc)) {
return module.exports.readConfig(rc)
} else {
return pkgBrowserslist
}
})
if (!process.env.BROWSERSLIST_DISABLE_CACHE) {
passed.forEach(function (dir) {
configCache[dir] = resolved
})
}
return resolved
if (isFile(config) && pkgBrowserslist) {
throw new BrowserslistError(
dir + ' contains both browserslist and package.json with browsers'
)
} else if (isFile(rc) && pkgBrowserslist) {
throw new BrowserslistError(
dir +
' contains both .browserslistrc and package.json with browsers'
)
} else if (isFile(config) && isFile(rc)) {
throw new BrowserslistError(
dir + ' contains both .browserslistrc and browserslist'
)
} else if (isFile(config)) {
return config
} else if (isFile(rc)) {
return rc
} else if (pkgBrowserslist) {
return pkg
}
},
configPathCache
)
},
findConfig: function findConfig(from) {
var configFile = this.findConfigFile(from)
return configFile ? parsePackageOrReadConfig(configFile) : undefined
},
clearCaches: function clearCaches() {
dataTimeChecked = false
filenessCache = {}
configCache = {}
statCache = {}
configPathCache = {}
parseConfigCache = {}
this.cache = {}
},
@@ -390,11 +474,14 @@ module.exports = {
if (process.env.BROWSERSLIST_IGNORE_OLD_DATA) return
var latest = latestReleaseTime(agentsObj)
var halfYearAgo = Date.now() - TIME_TO_UPDATE_CANIUSE
var monthsPassed = getMonthsPassed(latest)
if (latest !== 0 && latest < halfYearAgo) {
if (latest !== 0 && monthsPassed >= 6) {
var months = monthsPassed + ' ' + (monthsPassed > 1 ? 'months' : 'month')
console.warn(
'Browserslist: caniuse-lite is outdated. Please run:\n' +
'Browserslist: browsers data (caniuse-lite) is ' +
months +
' old. Please run:\n' +
' npx update-browserslist-db@latest\n' +
' Why you should do it regularly: ' +
'https://github.com/browserslist/update-db#readme'

View File

@@ -1,6 +1,6 @@
{
"name": "browserslist",
"version": "4.21.10",
"version": "4.26.3",
"description": "Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-env-preset",
"keywords": [
"caniuse",
@@ -25,10 +25,11 @@
"license": "MIT",
"repository": "browserslist/browserslist",
"dependencies": {
"caniuse-lite": "^1.0.30001517",
"electron-to-chromium": "^1.4.477",
"node-releases": "^2.0.13",
"update-browserslist-db": "^1.0.11"
"baseline-browser-mapping": "^2.8.9",
"caniuse-lite": "^1.0.30001746",
"electron-to-chromium": "^1.5.227",
"node-releases": "^2.0.21",
"update-browserslist-db": "^1.1.3"
},
"engines": {
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"

2
node_modules/browserslist/parse.js generated vendored
View File

@@ -9,7 +9,7 @@ function flatten(array) {
}
function find(string, predicate) {
for (var n = 1, max = string.length; n <= max; n++) {
for (var max = string.length, n = 1; n <= max; n++) {
var parsed = string.substr(-n, n)
if (predicate(parsed, n, max)) {
return string.slice(0, -n)