Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-async-to-generator

Package Overview
Dependencies
57
Maintainers
4
Versions
71
Alerts
File Explorer

Advanced tools

Install Socket

Protect your apps from supply chain attacks

Install

@babel/plugin-transform-async-to-generator

Turn async functions into ES2015 generators

    7.23.3latest
    GitHub
    npm

Version published
Maintainers
4
Weekly downloads
22,203,129
increased by3.75%

Weekly downloads

Package description

What is @babel/plugin-transform-async-to-generator?

The @babel/plugin-transform-async-to-generator package is a Babel plugin that transforms async functions into generator functions using the regenerator runtime, which is a part of the Facebook Regenerator project. This transformation allows async functions to be used in environments that do not natively support async/await syntax by converting them into ES2015/ES6 compatible code.

What are @babel/plugin-transform-async-to-generator's main functionalities?

Transform async functions to generators

This feature allows developers to write asynchronous code using the modern async/await syntax and have it transformed into generator functions that are compatible with older JavaScript engines.

async function foo() {
  await bar();
}
// Transforms to:
function foo() {
  return regeneratorRuntime.async(function foo$(_context) {
    while (1) {
      switch (_context.prev = _context.next) {
        case 0:
          _context.next = 2;
          return regeneratorRuntime.awrap(bar());
        case 2:
        case "end":
          return _context.stop();
      }
    }
  }, null, this);
}

Other packages similar to @babel/plugin-transform-async-to-generator

Changelog

Source

v7.23.3 (2023-11-09)

:bug: Bug Fix
  • babel-plugin-transform-typescript
    • #16071 Strip type-only TS namespaces (@colinaaa)
  • babel-generator
  • babel-compat-data, babel-plugin-bugfix-v8-static-class-fields-redefine-readonly, babel-preset-env
  • babel-plugin-transform-object-super
  • babel-helper-module-transforms, babel-plugin-transform-modules-amd, babel-plugin-transform-modules-commonjs, babel-plugin-transform-modules-umd
:memo: Documentation
  • #16044 docs: Update links in @babel/eslint-parser README (@aryehb)
:house: Internal
  • babel-core, babel-preset-env
:running_woman: Performance
:microscope: Output optimization
  • babel-plugin-transform-computed-properties

Readme

Source

@babel/plugin-transform-async-to-generator

Turn async functions into ES2015 generators

See our website @babel/plugin-transform-async-to-generator for more information.

Install

Using npm:

npm install --save-dev @babel/plugin-transform-async-to-generator

or using yarn:

yarn add @babel/plugin-transform-async-to-generator --dev

Keywords

FAQs

Last updated on 09 Nov 2023

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc