You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

browserslist-to-esbuild

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserslist-to-esbuild - npm Package Compare versions

Comparing version

to
1.1.0

2

package.json
{
"name": "browserslist-to-esbuild",
"version": "1.0.1",
"version": "1.1.0",
"description": "Use browserslist with esbuild",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -15,7 +15,43 @@ const browserslist = require('browserslist')

const SUPPORTED_ESBUILD_TARGETS = ['es', 'chrome', 'edge', 'firefox', 'ios', 'node', 'safari']
// https://github.com/eBay/browserslist-config/issues/16#issuecomment-863870093
const UNSUPPORTED = ['android 4']
const replaces = {
ios_saf: 'ios',
android: 'chrome',
}
const separator = ' '
return (
browserslist(browserslistConfig)
// filter out the unsupported ones
.filter((b) => !UNSUPPORTED.some((u) => b.startsWith(u)))
// transform into ['chrome', '88']
.map((b) => b.split(separator))
// replace the similar browser
.map((b) => {
if (replaces[b[0]]) {
b[0] = replaces[b[0]]
}
return b
})
// 11.0-12.0 --> 11.0
.map((b) => {
if (b[1].includes('-')) {
b[1] = b[1].slice(0, b[1].indexOf('-'))
}
return b
})
// 11.0 --> 11
.map((b) => {
if (b[1].endsWith('.0')) {
b[1] = b[1].slice(0, -2)
}
return b
})
// only get the ones supported by esbuild

@@ -22,0 +58,0 @@ .filter((b) => SUPPORTED_ESBUILD_TARGETS.includes(b[0]))