@babel/plugin-transform-typescript
Advanced tools
Comparing version 7.25.9 to 7.26.3
@@ -22,5 +22,7 @@ "use strict"; | ||
case "TSQualifiedName": | ||
return path.parentPath.findParent(path => path.type !== "TSQualifiedName").type !== "TSImportEqualsDeclaration"; | ||
return (path.parentPath.findParent(path => path.type !== "TSQualifiedName").type !== "TSImportEqualsDeclaration" | ||
); | ||
case "ExportSpecifier": | ||
return path.parent.exportKind === "type" || path.parentPath.parent.exportKind === "type"; | ||
return (path.parent.exportKind === "type" || path.parentPath.parent.exportKind === "type" | ||
); | ||
default: | ||
@@ -286,6 +288,4 @@ return false; | ||
const namespace = path.node.declaration; | ||
const { | ||
id | ||
} = namespace; | ||
if (t.isIdentifier(id)) { | ||
if (!t.isStringLiteral(namespace.id)) { | ||
const id = (0, _namespace.getFirstIdentifier)(namespace.id); | ||
if (path.scope.hasOwnBinding(id.name)) { | ||
@@ -292,0 +292,0 @@ path.replaceWith(namespace); |
@@ -7,4 +7,11 @@ "use strict"; | ||
exports.default = transpileNamespace; | ||
exports.getFirstIdentifier = getFirstIdentifier; | ||
var _core = require("@babel/core"); | ||
var _globalTypes = require("./global-types.js"); | ||
function getFirstIdentifier(node) { | ||
if (_core.types.isIdentifier(node)) { | ||
return node; | ||
} | ||
return getFirstIdentifier(node.left); | ||
} | ||
function transpileNamespace(path, allowNamespaces) { | ||
@@ -18,3 +25,3 @@ if (path.node.declare || path.node.id.type === "StringLiteral") { | ||
} | ||
const name = path.node.id.name; | ||
const name = getFirstIdentifier(path.node.id).name; | ||
const value = handleNested(path, path.node); | ||
@@ -63,5 +70,9 @@ if (value === null) { | ||
const realName = node.id; | ||
_core.types.assertIdentifier(realName); | ||
const name = path.scope.generateUid(realName.name); | ||
const namespaceTopLevel = _core.types.isTSModuleBlock(node.body) ? node.body.body : [_core.types.exportNamedDeclaration(node.body)]; | ||
const body = node.body; | ||
let id = node.id; | ||
let namespaceTopLevel; | ||
{ | ||
namespaceTopLevel = _core.types.isTSModuleBlock(body) ? body.body : [_core.types.exportNamedDeclaration(body)]; | ||
} | ||
let isEmpty = true; | ||
@@ -68,0 +79,0 @@ for (let i = 0; i < namespaceTopLevel.length; i++) { |
{ | ||
"name": "@babel/plugin-transform-typescript", | ||
"version": "7.25.9", | ||
"version": "7.26.3", | ||
"description": "Transform TypeScript into ES.next", | ||
@@ -30,6 +30,6 @@ "repository": { | ||
"devDependencies": { | ||
"@babel/core": "^7.25.9", | ||
"@babel/core": "^7.26.0", | ||
"@babel/helper-plugin-test-runner": "^7.25.9", | ||
"@babel/traverse": "^7.25.9", | ||
"@babel/types": "^7.25.9" | ||
"@babel/traverse": "^7.26.3", | ||
"@babel/types": "^7.26.3" | ||
}, | ||
@@ -36,0 +36,0 @@ "homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-typescript", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
136629
1053
2