Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vrbo/nimbuild-corejs

Package Overview
Dependencies
Maintainers
9
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vrbo/nimbuild-corejs

Performant generation of coreJS polyfill bundles optimized for target browsers at runtime

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
increased by75%
Maintainers
9
Weekly downloads
 
Created
Source

@vrbo/nimbuild-corejs

NPM Version Build Status

Performant generation of coreJS polyfill bundles optimized for target browsers at runtime

Why

Read: https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#better-optimization-of-polyfill-loading

A service like this one integrated with a good polyfills source like core-js, which only loads the needed polyfills by statically analyzing the source like Babel's useBuiltIns: usage option does could cause a revolution in the way we think about polyfills.

This module is the core of what is needed to fulfill the next generation approach to loading polyfills.

Installation

npm install --save @vrbo/nimbuild-corejs

Usage

Import module, configure, and prime cache

const {
    addSupported,
    clearSupported,
    initializeSupported,
    primeCache,
    serializeCache,
    deserializeCache
} = require('@vrbo/nimbuild-corejs');

// Initialize supported corejs modules
initializeSupported(); // use `nimbuild-corejs` defaults
// or customize supported corejs modules
initializeSupported({
    'my-default': {
        include: [
            /* custom core-js modules */
        ],
        exclude: [
            /* custom core-js modules */
        ]
    }
});

// Runs webpacknimbuild.run() on every browser platform
await primeCache();

// Get serialized cache
const serializedData = serializeCache();

// Set cache from serialized data
deserializeCache(serializedData);

When processing an HTTP request, generate coreJS polyfill string with this usage:

const {getPolyfillString} = require('@vrbo/nimbuild-corejs');
const coreJSData = await getPolyfillString({
    include: ['es.*'],
    exclude: [],
    logger: {log: console.log},
    minify: true,
    uaString: http.headers['user-agent']
});
return coreJSData.script; // polyfill string

Development

Starting development harness

npm start

Prettier

This projects supports auto-formatting of source code! Simply find your favorite IDE from the list in the following list: https://prettier.io/docs/en/editors.html

For VSCode support, perform the following steps:

  • Launch VS Code Quick Open (Ctrl+P)
  • Paste the following command, and press enter:
ext install esbenp.prettier-vscode

Keywords

FAQs

Package last updated on 28 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc