Summary
Cache export information for index files so isFileExported() and related checks avoid reparsing the same files during a batch move.
Proposed Solution
interface IndexExports {
exports: Set<string>;
reexports: Set<string>;
}
const indexExportsCache = new Map<string, IndexExports>();
function getIndexExports(tree: Tree, indexPath: string): IndexExports {
const cached = indexExportsCache.get(indexPath);
if (cached !== undefined) {
return cached;
}
const exports = new Set<string>();
const reexports = new Set<string>();
const ast = astCache.getAST(tree, indexPath);
if (ast) {
// Parse and extract all exports
// ... parsing logic ...
}
const result = { exports, reexports };
indexExportsCache.set(indexPath, result);
return result;
}
- Cache parsed export lists for index/barrel files.
- Consult the cache before re-parsing index files.
Tasks
Definition of Done
Summary
Cache export information for index files so
isFileExported()and related checks avoid reparsing the same files during a batch move.Proposed Solution
Tasks
IndexExportscache keyed by normalized index file pathsDefinition of Done