Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
babel-runtime
Advanced tools
The babel-runtime npm package is a part of Babel, a JavaScript compiler that allows developers to use next-generation JavaScript, today. It provides runtime support for features that are not supported in older browsers or environments. This includes things like new syntax features and built-in functions. The babel-runtime package helps in avoiding polluting the global scope and reduces the code size by deduplicating helper functions that Babel uses to transpile the code.
Polyfill for ECMAScript features
This code sample demonstrates how babel-runtime can be used to polyfill newer ECMAScript features such as Promises for environments that do not support them natively.
import 'babel-runtime/core-js/promise';
const p = new Promise((resolve, reject) => {
setTimeout(resolve, 1000, 'foo');
});
Transforming syntax
This code sample shows how babel-runtime provides helper functions to transform syntax like classes into a format that can be understood by environments that do not support such syntax natively.
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
class Example {
constructor() {
_classCallCheck(this, Example);
}
}
Regenerator for generators and async functions
This code sample illustrates the use of babel-runtime to enable the use of async functions and generators in environments that do not have native support for these features.
import 'babel-runtime/regenerator';
async function asyncCall() {
console.log('calling');
const result = await resolveAfter2Seconds();
console.log(result);
}
Core-js is a modular standard library for JavaScript, which includes polyfills for ECMAScript features. It is similar to babel-runtime in that it provides polyfills, but it is more comprehensive and can be used without Babel.
Regenerator-runtime is a standalone runtime for Regenerator-compiled generator and async functions. It is similar to the regenerator part of babel-runtime but does not include other babel helpers or polyfills.
Tslib is a runtime library for TypeScript that includes helper functions similar to those in babel-runtime. It is used to support features from TypeScript when compiling to JavaScript, similar to how babel-runtime supports Babel.
FAQs
babel selfContained runtime
The npm package babel-runtime receives a total of 3,186,276 weekly downloads. As such, babel-runtime popularity was classified as popular.
We found that babel-runtime demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.