-
-
Couldn't load subscription status.
- Fork 0
Open
Labels
priority: mediumMedium priority performance optimizationMedium priority performance optimization
Description
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
- Create an
IndexExportscache keyed by normalized index file paths - Populate the cache via existing AST/content helpers on first access
- Update export-checking utilities to consult the cache before re-reading
Definition of Done
- Existing benchmark and stress test suites are run before and after the change; share the comparison in the PR description. This step cannot be skipped.
- Unit/e2e tests must still pass.
- Add inline docs describing the cache lifecycle if helpful.
Metadata
Metadata
Assignees
Labels
priority: mediumMedium priority performance optimizationMedium priority performance optimization