Skip to content

Commit e5af27e

Browse files
Fixed specifier name resolution
1 parent 4b393e8 commit e5af27e

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

typescript/src/core/processors/export-declaration.processor.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,18 @@ export class ExportDeclarationProcessor extends Processor {
5858
// may also contain a default export using the "default" specifier
5959
// may also be a re-export
6060
for (const specifier of node.specifiers) {
61-
const globalDeclFqn = DependencyResolutionProcessor.constructFQNPrefix(localContexts).globalFqn + specifier.local.name;
61+
const localName = specifier.local.type === AST_NODE_TYPES.Identifier ? specifier.local.name : specifier.local.raw;
62+
const exportedName = specifier.exported.type === AST_NODE_TYPES.Identifier ? specifier.exported.name : specifier.exported.raw;
63+
const globalDeclFqn = DependencyResolutionProcessor.constructFQNPrefix(localContexts).globalFqn + localName;
6264
concepts.push(
6365
singleEntryConceptMap(
6466
LCEExportDeclaration.conceptId,
6567
new LCEExportDeclaration(
66-
specifier.local.name,
67-
specifier.exported.name === "default" || specifier.exported.name === specifier.local.name
68-
? undefined
69-
: specifier.exported.name,
68+
localName,
69+
exportedName === "default" || exportedName === localName ? undefined : exportedName,
7070
globalDeclFqn,
7171
source,
72-
specifier.exported.name === "default",
72+
exportedName === "default",
7373
node.exportKind,
7474
globalContext.sourceFilePathAbsolute,
7575
),

typescript/src/core/processors/import-declaration.processor.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ export class ImportDeclarationProcessor extends Processor {
2828
let isModule = false;
2929
if (specifier.type === AST_NODE_TYPES.ImportSpecifier) {
3030
const importSourceFqn = ModulePathUtils.toFQN(importSource);
31-
target = new FQN(
32-
importSourceFqn.globalFqn + "." + specifier.imported.name,
33-
importSourceFqn.localFqn + "." + specifier.imported.name,
34-
);
31+
const importedName = specifier.imported.type === AST_NODE_TYPES.Identifier ? specifier.imported.name : specifier.imported.raw;
32+
target = new FQN(importSourceFqn.globalFqn + "." + importedName, importSourceFqn.localFqn + "." + importedName);
3533
} else if (specifier.type === AST_NODE_TYPES.ImportDefaultSpecifier) {
3634
const importSourceFqn = ModulePathUtils.toFQN(importSource);
3735
target = new FQN(importSourceFqn.globalFqn + ".default", importSourceFqn.localFqn + ".default");

0 commit comments

Comments
 (0)