in tsc/src/lsif.ts [3839:3886]
private endVisitExportDeclaration(node: ts.ExportDeclaration): void {
// `export { foo }` ==> ExportDeclaration
// `export { _foo as foo }` ==> ExportDeclaration
if (node.exportClause !== undefined && ts.isNamedExports(node.exportClause)) {
for (const element of node.exportClause.elements) {
const symbol = this.tsProject.getSymbolAtLocation(element.name);
if (symbol === undefined) {
continue;
}
const monikerPath = this.currentDocumentData.monikerPath;
if (monikerPath === undefined) {
return;
}
// Make sure we have a symbol data;
this.dataManager.getOrCreateSymbolData(symbol);
const aliasedSymbol = Symbols.isAliasSymbol(symbol)
? this.tsProject.getAliasedSymbol(symbol)
: element.propertyName !== undefined
? this.tsProject.getSymbolAtLocation(element.propertyName)
: undefined;
if (aliasedSymbol === undefined) {
continue;
}
const aliasedSymbolData = this.dataManager.getOrCreateSymbolData(aliasedSymbol);
if (aliasedSymbolData === undefined) {
return;
}
aliasedSymbolData.changeVisibility(SymbolDataVisibility.indirectExported);
this.tsProject.exportSymbol(aliasedSymbol, monikerPath, this.tsProject.getExportSymbolName(symbol), this.currentSourceFile);
}
} else if (node.moduleSpecifier !== undefined) {
const symbol = this.tsProject.getSymbolAtLocation(node);
if (symbol === undefined || !Symbols.isExportStar(symbol)) {
return;
}
const monikerPath = this.currentDocumentData.monikerPath;
if (monikerPath === undefined) {
return;
}
this.dataManager.getOrCreateSymbolData(symbol);
const aliasedSymbol = this.tsProject.getSymbolAtLocation(node.moduleSpecifier);
if (aliasedSymbol === undefined || !Symbols.isSourceFile(aliasedSymbol)) {
return;
}
this.dataManager.getOrCreateSymbolData(aliasedSymbol);
this.tsProject.exportSymbol(aliasedSymbol, monikerPath, '', this.currentSourceFile);
}
}