Closed dominikg closed 1 year ago
Improved code to eagerly add Promises to cache instead of only setting results. This ensures that fs calls are minimized even with parallel async calls to find and parse. This can occur in vite when many files are passing through transformWithESbuild eg during devserver start.
used in findNative/parseNative as well.
Main motivation behind this is that the previous way to use findAll + tsconfigPaths could create a lot of extra work in huge projects, where ts files were contained in a small subtree.
Without having to traverse all of root and lazily caching all directories that have been traversed, this costs a little bit more memory, but less up front work.
Example for tsconfig in /a/b/c/tsconfig.json
(findNative caching is a little bit less effective as cache hits during traversal are impossible)
In a very large project with deep code trees and many directories, this can consume extra memory because all intermediate directories are added to the cache separately.