Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
stream._transform = function (file, _filetype, callback) {
const oriContents = file.contents.toString()
const pattern = 'var __SUPPORTED_BROWSERS__ ='
if (oriContents.indexOf(pattern) < 0) {
return stream.emit('error', new Error(`Missing "${pattern}" pattern`))
}
const browserList = getUserAgentRegExp({ allowHigherVersions: true })
const regPattern = new RegExp(`${pattern} .+`)
const newContents = oriContents.replace(
regPattern,
`${pattern} ${browserList}`
)
file.contents = Buffer.from(newContents)
callback(null, file)
}
function regexp (options) {
return browserslistUseragentRegexp.getUserAgentRegExp({
browsers: query(options),
allowHigherVersions: true
})
}