Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// of `defaults` in queries will be different since we don't want to break
// the behavior of "no targets is the same as preset-latest".
if (!hasTargets) {
browserslist.defaults = objectToBrowserslist(targets);
}
const browsers = browserslist(browsersquery, {
path: options.configPath,
mobileToDesktop: true,
});
const queryBrowsers = getLowestVersions(browsers);
targets = mergeBrowsers(queryBrowsers, targets);
// Reset browserslist defaults
browserslist.defaults = browserslistDefaults;
}
// Parse remaining targets
const parsed = Object.keys(targets)
.filter(value => value !== TargetNames.esmodules)
.sort()
.reduce(
(results: ParsedResult, target: string): ParsedResult => {
if (target !== TargetNames.browsers) {
const value = targets[target];
// Warn when specifying minor/patch as a decimal
if (typeof value === "number" && value % 1 !== 0) {
results.decimalWarnings.push({ target, value });
}
if (options.target.modern) {
const modern = query({ modern: true })
const modernBrowsers = browserslist(modern)
console.log(chalk.yellow('[modern query]'))
console.log((Array.isArray(modern) ? modern : modern.split(', ')).join('\n'))
console.log('')
console.log(chalk.yellow('[modern browsers]'))
console.log(modernBrowsers.join('\n'))
console.log('')
console.log(chalk.yellow(`[modern coverage ${options.coverage || 'globally'}]`))
console.log(browserslist.coverage(modernBrowsers, options.coverage || undefined).toFixed(2) + '%')
console.log('')
}
if (options.target.legacy) {
const legacy = query({ modern: false }) || browserslist.defaults
const legacyBrowsers = browserslist(legacy)
console.log(chalk.yellow('[legacy query]'))
console.log((Array.isArray(legacy) ? legacy : legacy.split(', ')).join('\n'))
console.log('')
console.log(chalk.yellow('[legacy browsers]'))
console.log(legacyBrowsers.join('\n'))
console.log('')
console.log(chalk.yellow(`[legacy coverage ${options.coverage || 'globally'}]`))
console.log(browserslist.coverage(legacyBrowsers, options.coverage || undefined).toFixed(2) + '%')
console.log('')
}
}
return plugin;
});
/**
* Autoprefixer data
*/
module.exports.data = {
browsers: agents,
prefixes: data
};
/**
* Autoprefixer default browsers
*/
module.exports.defaults = browserslist.defaults;
/**
* Inspect with default Autoprefixer
*/
module.exports.info = function () {
return module.exports().info();
};
return plugin;
});
/**
* Autoprefixer data
*/
module.exports.data = {
browsers: require('caniuse-lite').agents,
prefixes: require('../data/prefixes')
};
/**
* Autoprefixer default browsers
*/
module.exports.defaults = browserslist.defaults;
/**
* Inspect with default Autoprefixer
*/
module.exports.info = function () {
return module.exports().info();
};
return plugin;
});
/**
* Autoprefixer data
*/
module.exports.data = {
browsers: agents,
prefixes: data
};
/**
* Autoprefixer default browsers
*/
module.exports.defaults = browserslist.defaults;
/**
* Inspect with default Autoprefixer
*/
module.exports.info = function () {
return module.exports().info();
};
return plugin;
});
/**
* Autoprefixer data
*/
module.exports.data = {
browsers: require('caniuse-lite').agents,
prefixes: require('../data/prefixes')
};
/**
* Autoprefixer default browsers
*/
module.exports.defaults = browserslist.defaults;
/**
* Inspect with default Autoprefixer
*/
module.exports.info = function () {
return module.exports().info();
};
return plugin;
});
/**
* Autoprefixer data
*/
module.exports.data = {
browsers: require('caniuse-lite').agents,
prefixes: require('../data/prefixes')
};
/**
* Autoprefixer default browsers
*/
module.exports.defaults = browserslist.defaults;
/**
* Inspect with default Autoprefixer
*/
module.exports.info = function () {
return module.exports().info();
};
return info(loadPrefixes(opts))
}
return plugin
})
/**
* Autoprefixer data
*/
module.exports.data = { browsers: agents, prefixes: data }
/**
* Autoprefixer default browsers
*/
module.exports.defaults = browserslist.defaults
/**
* Inspect with default Autoprefixer
*/
module.exports.info = () => module.exports().info()
function Browsers (options) {
var browserslist = require('browserslist');
var cdbRem = require('caniuse-db/features-json/rem');
var cdbOpacity = require('caniuse-db/features-json/css-opacity');
var cdbPseudo = require('caniuse-db/features-json/css-gencontent');
options = options || {};
options.browsers = options.browsers || browserslist.defaults;
this.selected = browserslist(options.browsers);
this.browsers = browserslist.data;
var features = {};
this.getBrowsersByFeature(cdbRem, function(browsers) {
features.rem = browsers;
});
this.getBrowsersByFeature(cdbOpacity, /^(a|n)/, function(browsers) {
features.opacity = browsers;
});
this.getBrowsersByFeature(cdbPseudo, function(browsers) {
features.pseudoElements = browsers;
});
this.features = features;
return plugin;
});
/**
* Autoprefixer data
*/
module.exports.data = {
browsers: require('caniuse-lite').agents,
prefixes: require('../data/prefixes')
};
/**
* Autoprefixer default browsers
*/
module.exports.defaults = browserslist.defaults;
/**
* Inspect with default Autoprefixer
*/
module.exports.info = function () {
return module.exports().info();
};