first
This commit is contained in:
48
node_modules/@babel/plugin-transform-export-namespace-from/lib/index.js
generated
vendored
Normal file
48
node_modules/@babel/plugin-transform-export-namespace-from/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _helperPluginUtils = require("@babel/helper-plugin-utils");
|
||||
var _pluginSyntaxExportNamespaceFrom = require("@babel/plugin-syntax-export-namespace-from");
|
||||
var _core = require("@babel/core");
|
||||
var _default = (0, _helperPluginUtils.declare)(api => {
|
||||
api.assertVersion(7);
|
||||
return {
|
||||
name: "transform-export-namespace-from",
|
||||
inherits: _pluginSyntaxExportNamespaceFrom.default,
|
||||
visitor: {
|
||||
ExportNamedDeclaration(path) {
|
||||
var _exported$name;
|
||||
const {
|
||||
node,
|
||||
scope
|
||||
} = path;
|
||||
const {
|
||||
specifiers
|
||||
} = node;
|
||||
const index = _core.types.isExportDefaultSpecifier(specifiers[0]) ? 1 : 0;
|
||||
if (!_core.types.isExportNamespaceSpecifier(specifiers[index])) return;
|
||||
const nodes = [];
|
||||
if (index === 1) {
|
||||
nodes.push(_core.types.exportNamedDeclaration(null, [specifiers.shift()], node.source));
|
||||
}
|
||||
const specifier = specifiers.shift();
|
||||
const {
|
||||
exported
|
||||
} = specifier;
|
||||
const uid = scope.generateUidIdentifier((_exported$name = exported.name) != null ? _exported$name : exported.value);
|
||||
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)]));
|
||||
if (node.specifiers.length >= 1) {
|
||||
nodes.push(node);
|
||||
}
|
||||
const [importDeclaration] = path.replaceWithMultiple(nodes);
|
||||
path.scope.registerDeclaration(importDeclaration);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@babel/plugin-transform-export-namespace-from/lib/index.js.map
generated
vendored
Normal file
1
node_modules/@babel/plugin-transform-export-namespace-from/lib/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"names":["_helperPluginUtils","require","_pluginSyntaxExportNamespaceFrom","_core","_default","declare","api","assertVersion","name","inherits","syntaxExportNamespaceFrom","default","visitor","ExportNamedDeclaration","path","_exported$name","node","scope","specifiers","index","t","isExportDefaultSpecifier","isExportNamespaceSpecifier","nodes","push","exportNamedDeclaration","shift","source","specifier","exported","uid","generateUidIdentifier","value","importDeclaration","importNamespaceSpecifier","cloneNode","exportSpecifier","length","replaceWithMultiple","registerDeclaration","exports"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport syntaxExportNamespaceFrom from \"@babel/plugin-syntax-export-namespace-from\";\nimport { types as t } from \"@babel/core\";\n\nexport default declare(api => {\n api.assertVersion(7);\n\n return {\n name: \"transform-export-namespace-from\",\n inherits: syntaxExportNamespaceFrom.default,\n\n visitor: {\n ExportNamedDeclaration(path) {\n const { node, scope } = path;\n const { specifiers } = node;\n\n const index = t.isExportDefaultSpecifier(specifiers[0]) ? 1 : 0;\n if (!t.isExportNamespaceSpecifier(specifiers[index])) return;\n\n const nodes = [];\n\n if (index === 1) {\n nodes.push(\n t.exportNamedDeclaration(null, [specifiers.shift()], node.source),\n );\n }\n\n const specifier = specifiers.shift();\n const { exported } = specifier;\n const uid = scope.generateUidIdentifier(\n // @ts-expect-error Identifier ?? StringLiteral\n exported.name ?? exported.value,\n );\n\n nodes.push(\n t.importDeclaration(\n [t.importNamespaceSpecifier(uid)],\n t.cloneNode(node.source),\n ),\n t.exportNamedDeclaration(null, [\n t.exportSpecifier(t.cloneNode(uid), exported),\n ]),\n );\n\n if (node.specifiers.length >= 1) {\n nodes.push(node);\n }\n\n const [importDeclaration] = path.replaceWithMultiple(nodes);\n path.scope.registerDeclaration(import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