browserslist
Advanced tools
Comparing version 4.18.1 to 4.19.0
@@ -42,2 +42,3 @@ #!/usr/bin/env node | ||
} else if (isArg('--update-db')) { | ||
/* c8 ignore next 3 */ | ||
updateDb(function (str) { | ||
@@ -80,4 +81,6 @@ process.stdout.write(str) | ||
} else if (name === '--mobile-to-desktop') { | ||
/* c8 ignore next */ | ||
opts.mobileToDesktop = true | ||
} else if (name === '--ignore-unknown-versions') { | ||
/* c8 ignore next */ | ||
opts.ignoreUnknownVersions = true | ||
@@ -95,5 +98,5 @@ } else { | ||
error(e.message) | ||
} else { | ||
} else /* c8 ignore start */ { | ||
throw e | ||
} | ||
} /* c8 ignore end */ | ||
} | ||
@@ -100,0 +103,0 @@ |
42
index.js
@@ -400,2 +400,3 @@ var jsReleases = require('node-releases/data/processed/envs.json') | ||
* for extend query. | ||
* @param {boolean} [opts.throwOnMissing] Throw error on missing env. | ||
* @param {boolean} [opts.mobileToDesktop] Alias mobile browsers to the desktop | ||
@@ -669,3 +670,3 @@ * version when Can I Use doesn't have | ||
var version | ||
for (var i = 0; i <= versions.length; i++) { | ||
for (var i = 0; i < versions.length; i++) { | ||
version = versions[i] | ||
@@ -836,15 +837,20 @@ if (usage[version] === 0) break | ||
return Object.keys(usage).reduce(function (result, version) { | ||
var percentage = usage[version] | ||
if (percentage == null) { | ||
return result | ||
} | ||
if (sign === '>') { | ||
if (usage[version] > popularity) { | ||
if (percentage > popularity) { | ||
result.push(version) | ||
} | ||
} else if (sign === '<') { | ||
if (usage[version] < popularity) { | ||
if (percentage < popularity) { | ||
result.push(version) | ||
} | ||
} else if (sign === '<=') { | ||
if (usage[version] <= popularity) { | ||
if (percentage <= popularity) { | ||
result.push(version) | ||
} | ||
} else if (usage[version] >= popularity) { | ||
} else if (percentage >= popularity) { | ||
result.push(version) | ||
@@ -872,15 +878,20 @@ } | ||
return Object.keys(usage).reduce(function (result, version) { | ||
var percentage = usage[version] | ||
if (percentage == null) { | ||
return result | ||
} | ||
if (sign === '>') { | ||
if (usage[version] > popularity) { | ||
if (percentage > popularity) { | ||
result.push(version) | ||
} | ||
} else if (sign === '<') { | ||
if (usage[version] < popularity) { | ||
if (percentage < popularity) { | ||
result.push(version) | ||
} | ||
} else if (sign === '<=') { | ||
if (usage[version] <= popularity) { | ||
if (percentage <= popularity) { | ||
result.push(version) | ||
} | ||
} else if (usage[version] >= popularity) { | ||
} else if (percentage >= popularity) { | ||
result.push(version) | ||
@@ -904,15 +915,20 @@ } | ||
return Object.keys(usage).reduce(function (result, version) { | ||
var percentage = usage[version] | ||
if (percentage == null) { | ||
return result | ||
} | ||
if (sign === '>') { | ||
if (usage[version] > popularity) { | ||
if (percentage > popularity) { | ||
result.push(version) | ||
} | ||
} else if (sign === '<') { | ||
if (usage[version] < popularity) { | ||
if (percentage < popularity) { | ||
result.push(version) | ||
} | ||
} else if (sign === '<=') { | ||
if (usage[version] <= popularity) { | ||
if (percentage <= popularity) { | ||
result.push(version) | ||
} | ||
} else if (usage[version] >= popularity) { | ||
} else if (percentage >= popularity) { | ||
result.push(version) | ||
@@ -919,0 +935,0 @@ } |
@@ -85,2 +85,10 @@ var feature = require('caniuse-lite/dist/unpacker/feature').default | ||
if (opts.throwOnMissing) { | ||
if (name && name !== 'defaults' && !config[name]) { | ||
throw new BrowserslistError( | ||
'Missing config for Browserslist environment `' + name + '`' | ||
) | ||
} | ||
} | ||
return config[name] || config.defaults | ||
@@ -87,0 +95,0 @@ } |
{ | ||
"name": "browserslist", | ||
"version": "4.18.1", | ||
"version": "4.19.0", | ||
"description": "Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-env-preset", | ||
@@ -18,4 +18,4 @@ "keywords": [ | ||
"dependencies": { | ||
"caniuse-lite": "^1.0.30001280", | ||
"electron-to-chromium": "^1.3.896", | ||
"caniuse-lite": "^1.0.30001286", | ||
"electron-to-chromium": "^1.4.17", | ||
"escalade": "^3.1.1", | ||
@@ -28,2 +28,3 @@ "node-releases": "^2.0.1", | ||
}, | ||
"packageManager": "pnpm@6.23.6", | ||
"bin": { | ||
@@ -30,0 +31,0 @@ "browserslist": "cli.js" |
@@ -154,8 +154,10 @@ var childProcess = require('child_process') | ||
) | ||
lines[3] = latest.dist.integrity | ||
? lines[3].replace( | ||
/integrity .+/, | ||
'integrity ' + latest.dist.integrity | ||
) | ||
: '' | ||
if (lines.length === 4) { | ||
lines[3] = latest.dist.integrity | ||
? lines[3].replace( | ||
/integrity .+/, | ||
'integrity ' + latest.dist.integrity | ||
) | ||
: '' | ||
} | ||
} | ||
@@ -183,2 +185,3 @@ } | ||
if (lineParts[1].indexOf('/') >= 0) { | ||
/* c8 ignore start */ | ||
var sublineParts = lineParts[1].split(/([/:])/) | ||
@@ -193,2 +196,3 @@ for (j = 0; j < sublineParts.length; j++) { | ||
lineParts[1] = sublineParts.join('') | ||
/* c8 ignore stop */ | ||
} else { | ||
@@ -226,8 +230,9 @@ versions[lineParts[1]] = true | ||
if (lock.mode === 'npm') { | ||
if (lock.mode === 'yarn') { | ||
return updateYarnLockfile(lock, latest) | ||
} else if (lock.mode === 'pnpm') { | ||
return updatePnpmLockfile(lock, latest) | ||
} else { | ||
return updateNpmLockfile(lock, latest) | ||
} else if (lock.mode === 'yarn') { | ||
return updateYarnLockfile(lock, latest) | ||
} | ||
return updatePnpmLockfile(lock, latest) | ||
} | ||
@@ -269,3 +274,3 @@ | ||
childProcess.execSync(install + ' caniuse-lite') | ||
} catch (e) /* istanbul ignore next */ { | ||
} catch (e) /* c8 ignore start */ { | ||
print( | ||
@@ -283,3 +288,3 @@ pico.red( | ||
process.exit(1) | ||
} | ||
} /* c8 ignore end */ | ||
@@ -295,2 +300,23 @@ var del = lock.mode === 'yarn' ? 'yarn remove -W' : lock.mode + ' uninstall' | ||
function updateWith(print, cmd) { | ||
print('Updating caniuse-lite version\n' + pico.yellow('$ ' + cmd) + '\n') | ||
try { | ||
childProcess.execSync(cmd) | ||
} catch (e) /* c8 ignore start */ { | ||
print(pico.red(e.stdout.toString())) | ||
print( | ||
pico.red( | ||
'\n' + | ||
e.stack + | ||
'\n\n' + | ||
'Problem with `' + | ||
cmd + | ||
'` call. ' + | ||
'Run it manually.\n' | ||
) | ||
) | ||
process.exit(1) | ||
} /* c8 ignore end */ | ||
} | ||
module.exports = function updateDB(print) { | ||
@@ -311,24 +337,3 @@ var lock = detectLockfile() | ||
if (lock.mode === 'yarn' && lock.version !== 1) { | ||
var update = 'yarn up -R' | ||
print( | ||
'Updating caniuse-lite version\n' + | ||
pico.yellow('$ ' + update + ' caniuse-lite') + | ||
'\n' | ||
) | ||
try { | ||
childProcess.execSync(update + ' caniuse-lite') | ||
} catch (e) /* istanbul ignore next */ { | ||
print( | ||
pico.red( | ||
'\n' + | ||
e.stack + | ||
'\n\n' + | ||
'Problem with `' + | ||
update + | ||
' caniuse-lite` call. ' + | ||
'Run it manually.\n' | ||
) | ||
) | ||
process.exit(1) | ||
} | ||
updateWith(print, 'yarn up -R caniuse-lite') | ||
} else { | ||
@@ -344,5 +349,5 @@ updatePackageManually(print, lock, latest) | ||
currentBrowsersList = getBrowsersList() | ||
} catch (e) /* istanbul ignore next */ { | ||
} catch (e) /* c8 ignore start */ { | ||
browsersListRetrievalError = e | ||
} | ||
} /* c8 ignore end */ | ||
} | ||
@@ -349,0 +354,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69715
2189
Updatedcaniuse-lite@^1.0.30001286
Updatedelectron-to-chromium@^1.4.17