How to use the browserslist.defaults function in browserslist

To help you get started, we’ve selected a few browserslist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github babel / babel / packages / babel-preset-env / src / targets-parser.js View on Github external
// 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 });
          }
github KidkArolis / jetpack / lib / browsers.js View on Github external
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('')
  }
}
github makuga01 / dnsFookup / FE / node_modules / autoprefixer / lib / autoprefixer.js View on Github external
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();
};
github jake-101 / bael-template / node_modules / autoprefixer / lib / autoprefixer.js View on Github external
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();
};
github polakowo / datadocs / website / node_modules / autoprefixer / lib / autoprefixer.js View on Github external
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();
};
github aermin / ghChat / node_modules / autoprefixer / lib / autoprefixer.js View on Github external
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();
};
github cytle / wechat_web_devtools / package.nw / node_modules / autoprefixer / lib / autoprefixer.js View on Github external
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();
};
github postcss / autoprefixer / lib / autoprefixer.js View on Github external
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()
github iamvdo / pleeease / lib / browsers.js View on Github external
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;
github zubairghori / Ultimate_todo_list / node_modules / autoprefixer / lib / autoprefixer.js View on Github external
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();
};