source: imaps-frontend/node_modules/@babel/plugin-transform-async-to-generator/lib/index.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

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