source: imaps-frontend/node_modules/@babel/plugin-transform-export-namespace-from/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.7 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 _core = require("@babel/core");
9var _default = exports.default = (0, _helperPluginUtils.declare)(api => {
10 api.assertVersion(7);
11 return {
12 name: "transform-export-namespace-from",
13 manipulateOptions: (_, parser) => parser.plugins.push("exportNamespaceFrom"),
14 visitor: {
15 ExportNamedDeclaration(path) {
16 var _exported$name;
17 const {
18 node,
19 scope
20 } = path;
21 const {
22 specifiers
23 } = node;
24 const index = _core.types.isExportDefaultSpecifier(specifiers[0]) ? 1 : 0;
25 if (!_core.types.isExportNamespaceSpecifier(specifiers[index])) return;
26 const nodes = [];
27 if (index === 1) {
28 nodes.push(_core.types.exportNamedDeclaration(null, [specifiers.shift()], node.source));
29 }
30 const specifier = specifiers.shift();
31 const {
32 exported
33 } = specifier;
34 const uid = scope.generateUidIdentifier((_exported$name = exported.name) != null ? _exported$name : exported.value);
35 nodes.push(_core.types.importDeclaration([_core.types.importNamespaceSpecifier(uid)], _core.types.cloneNode(node.source)), _core.types.exportNamedDeclaration(null, [_core.types.exportSpecifier(_core.types.cloneNode(uid), exported)]));
36 if (node.specifiers.length >= 1) {
37 nodes.push(node);
38 }
39 const [importDeclaration] = path.replaceWithMultiple(nodes);
40 path.scope.registerDeclaration(importDeclaration);
41 }
42 }
43 };
44});
45
46//# sourceMappingURL=index.js.map
Note: See TracBrowser for help on using the repository browser.