Section 2.6.5Source:
server/src/parser/extractors/SymbolExtractor.tsExport Mapping & Specifiers
Mapping exported symbol names to internal symbol IDs across named declarations, aliased specifiers, and default exports.
Source:
server/src/parser/extractors/SymbolExtractor.tsExport Extraction in AST Exit Passes
Export mapping runs during AST exit passes. This ensures that all symbols in the file have already been discovered and assigned IDs before export resolution attempts to bind them.
| Export Form | AST Node | Resolution Mechanism | Exported Name |
|---|---|---|---|
| Declared Named Export | ExportNamedDeclaration (declaration) | Finds declaration symbol in parsedFile.symbols by location. | symbol.name |
| Variable Declarator Export | ExportNamedDeclaration (VariableDeclaration) | Iterates declarators, finds symbol by init/declarator location. | declarator.name |
| Specifier Export | ExportNamedDeclaration (specifiers) | Resolves specifier.local.name via path.scope.getBinding(), maps to symbol. | specifier.exported.name |
| Declared Default Export | ExportDefaultDeclaration (declaration) | Finds declaration symbol by start location. | "default" |
| Identifier Default Export | ExportDefaultDeclaration (Identifier) | Resolves identifier binding, or falls back to name search for types. | "default" |
Specifier Renaming: `export { foo as bar }`
When a symbol is exported with an alias:
server/src/parser/extractors/SymbolExtractor.ts
1234567891011121314// export { internalService as publicApi } for (const specifier of path.node.specifiers) { if (specifier.type !== "ExportSpecifier") continue; // local.name = "internalService" const symbol = this.resolveExportSpecifierToSymbol(parsedFile, path, specifier.local.name); if (!symbol) continue; // exported.name = "publicApi" exportedSymbols.push({ exportedName: specifier.exported.name, // "publicApi" symbolId: symbol.id // Links to internalService symbol ID }); }