1. babel-plugin-transform-async-super
Transform super calls inside async class methods for Node 6
babel-plugin-transform-async-super
Package: babel-plugin-transform-async-super
Created by: devongovett
Last modified: Mon, 13 Jun 2022 04:04:01 GMT
Version: 1.0.0
License: MIT
Downloads: 407
Repository: https://github.com/devongovett/babel-plugin-transform-async-super

Install

npm install babel-plugin-transform-async-super
yarn add babel-plugin-transform-async-super

babel-plugin-transform-async-super

This is a Babel plugin that transforms super calls inside async functions in order to work around a
Babel bug when compiling async functions to generators,
but not ES6 classes. This is an issue when compiling for Node 6, for example, which supports classes
but not async functions. This plugin only compiles super calls inside async functions, and not elsewhere.

The Babel bug mentioned above is fixed in Babel 7 which is in beta. This plugin is therefore only
useful when you need to use Babel 6.

Along side babel-plugin-transform-async-to-generator, it transforms this:

 class Test extends Foo {
  async test(arg) {
    return await super.test(arg) + 2;
  }
}

into this:

 class Test extends Foo {
  test(arg) {
    var _this = this;

    return _asyncToGenerator(function* () {
      return (yield Foo.prototype.test.call(_this, arg)) + 2;
    })();
  }
}

License

MIT

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code