source: trip-planner-front/node_modules/@babel/plugin-transform-async-to-generator/lib/index.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.5 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = void 0;
7
8var _helperPluginUtils = require("@babel/helper-plugin-utils");
9
10var _helperRemapAsyncToGenerator = require("@babel/helper-remap-async-to-generator");
11
12var _helperModuleImports = require("@babel/helper-module-imports");
13
14var _core = require("@babel/core");
15
16var _default = (0, _helperPluginUtils.declare)((api, options) => {
17 api.assertVersion(7);
18 const {
19 method,
20 module
21 } = options;
22 const noNewArrows = api.assumption("noNewArrows");
23
24 if (method && module) {
25 return {
26 name: "transform-async-to-generator",
27 visitor: {
28 Function(path, state) {
29 if (!path.node.async || path.node.generator) return;
30 let wrapAsync = state.methodWrapper;
31
32 if (wrapAsync) {
33 wrapAsync = _core.types.cloneNode(wrapAsync);
34 } else {
35 wrapAsync = state.methodWrapper = (0, _helperModuleImports.addNamed)(path, method, module);
36 }
37
38 (0, _helperRemapAsyncToGenerator.default)(path, {
39 wrapAsync
40 }, noNewArrows);
41 }
42
43 }
44 };
45 }
46
47 return {
48 name: "transform-async-to-generator",
49 visitor: {
50 Function(path, state) {
51 if (!path.node.async || path.node.generator) return;
52 (0, _helperRemapAsyncToGenerator.default)(path, {
53 wrapAsync: state.addHelper("asyncToGenerator")
54 }, noNewArrows);
55 }
56
57 }
58 };
59});
60
61exports.default = _default;
Note: See TracBrowser for help on using the repository browser.