@babel/plugin-proposal-export-default-from
Advanced tools
Comparing version 7.18.9 to 7.18.10
@@ -21,19 +21,21 @@ "use strict"; | ||
ExportNamedDeclaration(path) { | ||
var _exported$name; | ||
const { | ||
node, | ||
scope | ||
node | ||
} = path; | ||
const { | ||
specifiers | ||
specifiers, | ||
source | ||
} = node; | ||
if (!_core.types.isExportDefaultSpecifier(specifiers[0])) return; | ||
const specifier = specifiers.shift(); | ||
const { | ||
exported | ||
} = specifier; | ||
const uid = scope.generateUidIdentifier((_exported$name = exported.name) != null ? _exported$name : exported.value); | ||
const nodes = [_core.types.importDeclaration([_core.types.importDefaultSpecifier(uid)], _core.types.cloneNode(node.source)), _core.types.exportNamedDeclaration(null, [_core.types.exportSpecifier(_core.types.cloneNode(uid), exported)])]; | ||
} = specifiers.shift(); | ||
if (specifiers.every(s => _core.types.isExportSpecifier(s))) { | ||
specifiers.unshift(_core.types.exportSpecifier(_core.types.identifier("default"), exported)); | ||
return; | ||
} | ||
const nodes = [_core.types.exportNamedDeclaration(null, [_core.types.exportSpecifier(_core.types.identifier("default"), exported)], _core.types.cloneNode(source))]; | ||
if (specifiers.length >= 1) { | ||
@@ -43,4 +45,3 @@ nodes.push(node); | ||
const [importDeclaration] = path.replaceWithMultiple(nodes); | ||
path.scope.registerDeclaration(importDeclaration); | ||
path.replaceWithMultiple(nodes); | ||
} | ||
@@ -47,0 +48,0 @@ |
{ | ||
"name": "@babel/plugin-proposal-export-default-from", | ||
"version": "7.18.9", | ||
"version": "7.18.10", | ||
"description": "Compile export default to ES2015", | ||
@@ -27,3 +27,3 @@ "repository": { | ||
"devDependencies": { | ||
"@babel/core": "^7.18.9", | ||
"@babel/core": "^7.18.10", | ||
"@babel/helper-plugin-test-runner": "^7.18.6" | ||
@@ -30,0 +30,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3816