How to use the @babel/plugin-transform-async-to-generator.default function in @babel/plugin-transform-async-to-generator

To help you get started, we’ve selected a few @babel/plugin-transform-async-to-generator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebook / metro / packages / metro-babel-register / src / babel-register.js View on Github external
require('./node-polyfills');

var _only = [];

const PLUGINS = [
  [require('@babel/plugin-transform-flow-strip-types').default],
  [require('@babel/plugin-proposal-object-rest-spread').default],
  [require('@babel/plugin-proposal-class-properties').default],
  [require('@babel/plugin-transform-modules-commonjs').default],
  [require('@babel/plugin-proposal-nullish-coalescing-operator').default],
  [require('@babel/plugin-proposal-optional-catch-binding').default],
  [require('@babel/plugin-proposal-optional-chaining').default],
];

if (/^v[0-7]\./.test(process.version)) {
  PLUGINS.push([require('@babel/plugin-transform-async-to-generator').default]);
}

function registerOnly(onlyList) {
  // This prevents `babel-register` from transforming the code of the
  // plugins/presets that we are require-ing themselves before setting up the
  // actual config.
  require('@babel/register')({only: [], babelrc: false, configFile: false});
  require('@babel/register')(config(onlyList));
}

function config(onlyList) {
  _only = _only.concat(onlyList);
  return {
    babelrc: false,
    configFile: false,
    ignore: null,
github facebook / metro / packages / metro-babel-register / src / babel-register.js View on Github external
require('./node-polyfills');

var _only = [];

const PLUGINS = [
  [require('@babel/plugin-transform-flow-strip-types').default],
  [require('@babel/plugin-proposal-object-rest-spread').default],
  [require('@babel/plugin-proposal-class-properties').default],
  [require('@babel/plugin-transform-modules-commonjs').default],
  [require('@babel/plugin-proposal-nullish-coalescing-operator').default],
  [require('@babel/plugin-proposal-optional-catch-binding').default],
  [require('@babel/plugin-proposal-optional-chaining').default],
];

if (/^v[0-7]\./.test(process.version)) {
  PLUGINS.push([require('@babel/plugin-transform-async-to-generator').default]);
}

function registerOnly(onlyList) {
  // This prevents `babel-register` from transforming the code of the
  // plugins/presets that we are require-ing themselves before setting up the
  // actual config.
  require('@babel/register')({only: [], babelrc: false});
  require('@babel/register')(config(onlyList));
}

function config(onlyList) {
  _only = _only.concat(onlyList);
  return {
    babelrc: false,
    ignore: null,
    only: _only,

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

Turn async functions into ES2015 generators

MIT
Latest version published 2 months ago

Package Health Score

95 / 100
Full package analysis

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