Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@babel/plugin-transform-regenerator
Advanced tools
Explode async and generator functions into a state machine.
The @babel/plugin-transform-regenerator package is a Babel plugin that enables the transformation of generator functions and async functions into ES5-compatible JavaScript code using the regenerator runtime. It allows developers to use these modern features in environments that do not natively support them.
Transformation of generator functions
This plugin transforms generator functions into ES5 code by converting the generator syntax into a state machine that is compatible with older JavaScript engines.
function* gen() { yield 1; yield 2; yield 3; }
Transformation of async functions
It also transforms async functions into generator functions and then applies the generator function transformation to ensure compatibility with environments that do not support async/await syntax.
async function foo() { await someAsyncFunction(); }
The regenerator-runtime package provides the runtime needed to support the generator functions in environments that do not natively support them. It is often used in conjunction with @babel/plugin-transform-regenerator, which handles the syntax transformation.
This package is similar to @babel/plugin-transform-regenerator in that it transforms async functions into generator functions. However, it focuses solely on async functions and does not handle generator functions.
fast-async is a Babel plugin that transforms async/await functions into ES5-compatible code using Promises instead of generators. It provides an alternative approach to handling async functions and can be faster than regenerator-based transformations.
Explode async and generator functions into a state machine.
See our website @babel/plugin-transform-regenerator for more information.
Using npm:
npm install --save-dev @babel/plugin-transform-regenerator
or using yarn:
yarn add @babel/plugin-transform-regenerator --dev
v7.25.9 (2024-10-22)
babel-parser
, babel-template
, babel-types
syntacticPlaceholders
mode (@liuxingbaoyu)babel-helper-compilation-targets
, babel-preset-env
ClassAccessorProperty
to prevent the no-undef
rule (@victorenator)babel-parser
, babel-types
VISITOR_KEYS
etc. faster to access (@liuxingbaoyu)FAQs
Explode async and generator functions into a state machine.
The npm package @babel/plugin-transform-regenerator receives a total of 18,401,003 weekly downloads. As such, @babel/plugin-transform-regenerator popularity was classified as popular.
We found that @babel/plugin-transform-regenerator 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.