Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
@babel/runtime-corejs3
Advanced tools
The @babel/runtime-corejs3 package is a runtime library for Babel that includes polyfills for ECMAScript features using core-js version 3. It is used alongside Babel to enable the use of new JavaScript features in environments that do not natively support them. This package helps to avoid polluting the global scope and reduces the size of the compiled code by deduplicating helper functions.
Polyfilling ECMAScript features
This code imports polyfills for stable ECMAScript features and the regenerator runtime needed to use generators and async functions.
import 'core-js/stable';
import 'regenerator-runtime/runtime';
Usage of built-in methods
This code demonstrates how to use the map method from core-js through the runtime without polluting the global Array prototype.
import { map } from '@babel/runtime-corejs3/core-js-stable/instance/map';
let arr = [1, 2, 3];
let mapped = map.call(arr, x => x * x);
Usage of new syntax features
This code shows how to use the helpers provided by @babel/runtime-corejs3 to work with new syntax features like async functions and generators.
import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
const asyncFunc = _asyncToGenerator(function* () {
yield Promise.resolve('Hello World');
});
core-js is a modular standard library for JavaScript, including polyfills for ECMAScript up to 2021. It's similar to @babel/runtime-corejs3 but does not require Babel to work and can be included directly in any JavaScript project.
regenerator-runtime is a standalone runtime for Regenerator-compiled generator and async functions. It is similar to the regenerator part of @babel/runtime-corejs3 but does not include other polyfills or helpers.
Deprecated in favor of separate core-js and regenerator-runtime packages, @babel/polyfill was a package that included Babel's polyfills for ECMAScript features. It was similar to @babel/runtime-corejs3 but was designed to be included globally rather than modularly.
babel's modular runtime helpers with core-js@3 polyfilling
Using npm:
npm install --save-dev @babel/runtime-corejs3
or using yarn:
yarn add @babel/runtime-corejs3 --dev
FAQs
babel's modular runtime helpers with core-js@3 polyfilling
The npm package @babel/runtime-corejs3 receives a total of 5,410,793 weekly downloads. As such, @babel/runtime-corejs3 popularity was classified as popular.
We found that @babel/runtime-corejs3 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
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.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.