![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
babel-plugin-polyfill-regenerator
Advanced tools
Package description
The babel-plugin-polyfill-regenerator package is designed to automatically replace `regeneratorRuntime` references with the corresponding polyfill from the `regenerator-runtime` package. This is particularly useful when using async/await or generator functions in environments that do not natively support these features. By including this plugin in your Babel configuration, you can ensure that your code will run correctly in older browsers or environments without needing to manually import or include the regenerator runtime in your source code.
Automatic Polyfill Injection for Async/Await
This feature automatically detects usage of async/await syntax in your JavaScript code and injects the necessary regenerator runtime polyfill to ensure compatibility with environments that do not natively support async/await. This is done without any manual imports or code modifications.
"use strict";\n\nasync function foo() {\n await bar();\n}\n
Automatic Polyfill Injection for Generator Functions
Similar to the async/await feature, this functionality automatically detects the use of generator functions in your code. It then ensures that the necessary regenerator runtime polyfill is included, allowing these functions to work in environments that do not support generators natively.
"use strict";\n\nfunction* myGenerator() {\n yield 1;\n yield 2;\n}\n
This package is part of the Babel ecosystem and offers broader functionality than just regenerator polyfilling. It can transform Babel helpers and regenerator runtime into references from the `@babel/runtime` package, thus reducing code duplication across your output files. It's more comprehensive but also more complex to configure compared to babel-plugin-polyfill-regenerator.
While not a direct alternative as a Babel plugin, `core-js` is a library that includes polyfills for ECMAScript up to the latest version. It can be used in conjunction with Babel to polyfill features like async/await, Promise, Symbol, and more, including generator functions. It offers a wider range of polyfills compared to babel-plugin-polyfill-regenerator but requires manual configuration and inclusion in your project.
Readme
Using npm:
npm install --save-dev babel-plugin-polyfill-regenerator
or using yarn:
yarn add babel-plugin-polyfill-regenerator --dev
Add this plugin to your Babel configuration:
{
"plugins": [["polyfill-regenerator", { "method": "usage-global" }]]
}
This package supports the usage-pure
, usage-global
, and entry-global
methods.
When entry-global
is used, it replaces imports to regenerator-runtime
.
FAQs
A Babel plugin to inject imports to regenerator-runtime
The npm package babel-plugin-polyfill-regenerator receives a total of 14,838,646 weekly downloads. As such, babel-plugin-polyfill-regenerator popularity was classified as popular.
We found that babel-plugin-polyfill-regenerator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.