Sha256: 0e1be02570aeb30f635d488f17d4c949ede5281029321bd2d1986ec041df2440

Contents?: true

Size: 1.52 KB

Versions: 13

Compression:

Stored size: 1.52 KB

Contents

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _helperPluginUtils = require("@babel/helper-plugin-utils");

var _helperRemapAsyncToGenerator = _interopRequireDefault(require("@babel/helper-remap-async-to-generator"));

var _helperModuleImports = require("@babel/helper-module-imports");

var _core = require("@babel/core");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = (0, _helperPluginUtils.declare)((api, options) => {
  api.assertVersion(7);
  const {
    method,
    module
  } = options;

  if (method && module) {
    return {
      name: "transform-async-to-generator",
      visitor: {
        Function(path, state) {
          if (!path.node.async || path.node.generator) return;
          let wrapAsync = state.methodWrapper;

          if (wrapAsync) {
            wrapAsync = _core.types.cloneNode(wrapAsync);
          } else {
            wrapAsync = state.methodWrapper = (0, _helperModuleImports.addNamed)(path, method, module);
          }

          (0, _helperRemapAsyncToGenerator.default)(path, {
            wrapAsync
          });
        }

      }
    };
  }

  return {
    name: "transform-async-to-generator",
    visitor: {
      Function(path, state) {
        if (!path.node.async || path.node.generator) return;
        (0, _helperRemapAsyncToGenerator.default)(path, {
          wrapAsync: state.addHelper("asyncToGenerator")
        });
      }

    }
  };
});

exports.default = _default;

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/@babel/plugin-transform-async-to-generator/lib/index.js
tang-0.2.1 spec/tang_app/node_modules/@babel/plugin-transform-async-to-generator/lib/index.js
tang-0.2.0 spec/tang_app/node_modules/@babel/plugin-transform-async-to-generator/lib/index.js
tang-0.1.0 spec/tang_app/node_modules/@babel/plugin-transform-async-to-generator/lib/index.js
tang-0.0.9 spec/tang_app/node_modules/@babel/plugin-transform-async-to-generator/lib/index.js
enju_library-0.3.8 spec/dummy/node_modules/@babel/plugin-transform-async-to-generator/lib/index.js
condenser-0.3 lib/condenser/processors/node_modules/@babel/plugin-transform-async-to-generator/lib/index.js
condenser-0.2 lib/condenser/processors/node_modules/@babel/plugin-transform-async-to-generator/lib/index.js
condenser-0.1 lib/condenser/processors/node_modules/@babel/plugin-transform-async-to-generator/lib/index.js
condenser-0.0.12 lib/condenser/processors/node_modules/@babel/plugin-transform-async-to-generator/lib/index.js
condenser-0.0.11 lib/condenser/processors/node_modules/@babel/plugin-transform-async-to-generator/lib/index.js
condenser-0.0.10 lib/condenser/processors/node_modules/@babel/plugin-transform-async-to-generator/lib/index.js
condenser-0.0.9 lib/condenser/processors/node_modules/@babel/plugin-transform-async-to-generator/lib/index.js