fix(javascript): preserve namespace re-export relationships (#1833)

* fix(javascript): preserve namespace re-export relationships

* fix(javascript): exclude erased namespace type exports
This commit is contained in:
Yann Roberto
2026-10-11 22:51:00 +08:00
committed by GitHub
parent cf7477eb46
commit 37a9eb9d65
2 changed files with 179 additions and 3 deletions
@@ -304,14 +304,22 @@ const collectNamedExports = (
node,
);
for (const specifier of node.specifiers)
if (t.isExportSpecifier(specifier))
if (
t.isExportSpecifier(specifier) ||
(t.isExportNamespaceSpecifier(specifier) && node.exportKind !== "type")
)
addModuleLink(
state,
{
kind: node.source == null ? "export" : "re-export",
specifier: node.source?.value ?? null,
importedName: propertyName(specifier.local),
localName: node.source == null ? propertyName(specifier.local) : null,
importedName: t.isExportNamespaceSpecifier(specifier)
? "*"
: propertyName(specifier.local),
localName:
node.source == null && t.isExportSpecifier(specifier)
? propertyName(specifier.local)
: null,
exportedName: propertyName(specifier.exported),
location: range(specifier),
},