How to use polyfill-service - 5 common examples

To help you get started, we’ve selected a few polyfill-service 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 kaliberjs / build / library / lib / withPolyfill.js View on Github external
async function polyfillResponse({uaString, minify, query = {} }) {
  const features = (query.features || '').split(',').filter(Boolean).reduce((res, x) => ({ ...res, [x]: { flags: ['gated'] }}), {})
  const cache = !!query.cache

  const polyfill = await getPolyfillString({ uaString, minify, features })
  const headers = {
    'Content-Type': 'application/javascript;charset=utf-8',
    ...cache && { 'Cache-Control': 'max-age=31536000' }, // 365 days
  }

  return {
    status: 200,
    headers,
    data: { polyfill, uaString }
  }
}
github wikipathways / pvjs / gulp / tasks / browserify.js View on Github external
gulp.task('browserify', function(gulpTaskCompleteCallback) {

  var isInitialized = false;

  var polyfillServiceList = polyfillService.getAllPolyfills();
  var packageJson = JSON.parse(fs.readFileSync('package.json'));
  var version = packageJson.version;
  var name = packageJson.name;
  var polyfillsCache = {};

  mkdirp.sync('./dist/' + version + '/');
  mkdirp.sync('./demo/lib/' + name + '/' + version + '/');
  mkdirp.sync('./test/lib/' + name + '/dev/');

//  function inspect() {
//    return highland.pipeline(function(stream) {
//      return stream.map(function(file) {
//        if (file.isNull()) {
//          return file;
//        }
//        return file;
github mozilla / donate.mozilla.org / server / base-routes.js View on Github external
if (!locale) {
        locale = getLocale(request.headers["accept-language"], locales);
      }

      var features = request.query.features + ',Intl.~locale.' + locale;
      var flags = request.query.flags ? request.query.flags.split(',') : [];

      var polyfills = PolyfillSet.fromQueryParam(features || 'default', flags);
      var params = {
        features: polyfills.get(),
        minify: true,
        unknown: 'polyfill'
      };
      params.uaString = request.plugins.scooter.source;
      polyfillio.getPolyfillString(params).then(function(bundleString) {
        reply(bundleString).type('application/javascript; charset=utf-8').vary('User-Agent');
      });
    },
    config: {
github mozilla / donate.mozilla.org / server / base-routes.js View on Github external
return new Promise((resolve) => {
        polyfillio.getPolyfillString(params).then(function(bundleString) {
          resolve(h.response(bundleString).type('application/javascript; charset=utf-8').vary('User-Agent'));
        });
      });
    },

polyfill-service

A polyfill combinator

MIT
Latest version published 6 years ago

Package Health Score

54 / 100
Full package analysis

Similar packages