@babel/helper-split-export-declaration
Advanced tools
Comparing version 7.18.6 to 7.21.4-esm
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = splitExportDeclaration; | ||
var _t = require("@babel/types"); | ||
const { | ||
@@ -19,3 +17,2 @@ cloneNode, | ||
} = _t; | ||
function splitExportDeclaration(exportDeclaration) { | ||
@@ -25,3 +22,2 @@ if (!exportDeclaration.isExportDeclaration() || exportDeclaration.isExportAllDeclaration()) { | ||
} | ||
if (exportDeclaration.isExportDefaultDeclaration()) { | ||
@@ -33,7 +29,5 @@ const declaration = exportDeclaration.get("declaration"); | ||
let needBindingRegistration = false; | ||
if (!id) { | ||
needBindingRegistration = true; | ||
id = scope.generateUidIdentifier("default"); | ||
if (standaloneDeclaration || declaration.isFunctionExpression() || declaration.isClassExpression()) { | ||
@@ -43,3 +37,2 @@ declaration.node.id = cloneNode(id); | ||
} | ||
const updatedDeclaration = standaloneDeclaration ? declaration.node : variableDeclaration("var", [variableDeclarator(cloneNode(id), declaration.node)]); | ||
@@ -49,7 +42,5 @@ const updatedExportDeclaration = exportNamedDeclaration(null, [exportSpecifier(cloneNode(id), identifier("default"))]); | ||
exportDeclaration.replaceWith(updatedDeclaration); | ||
if (needBindingRegistration) { | ||
scope.registerDeclaration(exportDeclaration); | ||
} | ||
return exportDeclaration; | ||
@@ -59,3 +50,2 @@ } else if (exportDeclaration.get("specifiers").length > 0) { | ||
} | ||
const declaration = exportDeclaration.get("declaration"); | ||
@@ -70,2 +60,4 @@ const bindingIdentifiers = declaration.getOuterBindingIdentifiers(); | ||
return exportDeclaration; | ||
} | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@babel/helper-split-export-declaration", | ||
"version": "7.18.6", | ||
"version": "7.21.4-esm", | ||
"description": "", | ||
@@ -17,3 +17,3 @@ "repository": { | ||
"dependencies": { | ||
"@babel/types": "^7.18.6" | ||
"@babel/types": "^7.21.4-esm" | ||
}, | ||
@@ -20,0 +20,0 @@ "engines": { |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
10175
6
53
1
Updated@babel/types@^7.21.4-esm