Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return function autoprefixer_(assetGraph) {
const cssAssets = assetGraph.findAssets({ type: 'Css', isLoaded: true });
if (cssAssets.length > 0) {
let autoprefixerVersionStr;
try {
autoprefixerVersionStr = require('autoprefixer/package.json').version;
} catch (e) {
e.message =
`autoprefixer transform: Found ${cssAssets.length} css asset${
cssAssets.length === 1 ? '' : 's'
}, ` +
`but no autoprefixer module is available. Please use npm to install autoprefixer in your project so ` +
`the autoprefixer transform can require it.\n${e.message}`;
assetGraph.info(e);
return;
}
let autoprefixer;
if (semver.satisfies(autoprefixerVersionStr, '>= 9.6.0')) {
// https://github.com/postcss/autoprefixer/commit/6ed7c22bb6503968185935d807a61d6a593f352c
autoprefixer = require('autoprefixer')(
browsers ? { overrideBrowserslist: browsers } : {}
return browsersOrAutoprefixerInstance;
} else if (browsersOrAutoprefixerInstance && !Array.isArray(browsersOrAutoprefixerInstance)) {
browsersOrAutoprefixerInstance = String(browsersOrAutoprefixerInstance).split(/,\s*/);
}
var autoprefixer;
try {
autoprefixer = require('autoprefixer');
} catch (e) {
if (errorMessageIfUnavailable) {
e.message = errorMessageIfUnavailable + '\n' + e.message;
throw e;
}
}
if (semver.satisfies(require('autoprefixer/package.json').version, '>= 3.0.0')) {
autoprefixer = autoprefixer(browsersOrAutoprefixerInstance ? {browsers: browsersOrAutoprefixerInstance} : {});
} else {
autoprefixer = autoprefixer(browsersOrAutoprefixerInstance);
}
return autoprefixer;
};
return function autoprefixer_(assetGraph) {
var cssAssets = assetGraph.findAssets({type: 'Css'});
if (cssAssets.length > 0) {
var autoprefixerVersionStr;
try {
autoprefixerVersionStr = require('autoprefixer/package.json').version;
} catch (e) {
e.message = 'autoprefixer transform: Found ' + cssAssets.length + ' css asset(s) while --browsers option is active, ' +
'but no autoprefixer module is available. Please use npm to install autoprefixer in your project so ' +
'the autoprefixer transform can require it.\n' +
e.message;
throw e;
}
var autoprefixer;
if (semver.satisfies(autoprefixerVersionStr, '>= 3.0.0')) {
autoprefixer = require('autoprefixer')(browsers ? {browsers: browsers} : {});
} else {
autoprefixer = require('autoprefixer')(browsers);
}
var isAtLeastVersion5 = semver.satisfies(autoprefixerVersionStr, '>= 5.0.0');