Commit 2bc5173
authored
feat!: generic fs cache
This PR makes the cache fully generic by introducing a `Cache` trait,
and renaming the existing `Cache` to `FsCache`.
The `FileSystem` trait still exists, but is only relevant still for
users of `FsCache`. By keeping the trait, I hope to minimize the amount
of breaking changes, even though some still remain.
The most notable breaking change is that
`ResolverGeneric::new_with_file_system(fs, ...)` has become
`ResolverGeneric::new_with_cache(Arc::new(FsCache::new(fs)), ...)`.
Both `FsCache` and `FileSystem` are now behind a `fs_cache` feature
flag, which is enabled by default.
I am actually considering to make both the `PackageJson` and `TsConfig`
types generic as well (Biome already has its own, which ideally we would
use directly for our custom `Cache` implementation). This should be
achievable by introducing traits for them and adding them as associated
types to the `Cache` trait. But before going too deep, I was hoping to
first get feedback on the work so far :)type Resolver = ResolverGeneric<FsCache<FileSystemOs>> (#358)1 parent 29807ba commit 2bc5173
File tree
16 files changed
+762
-629
lines changed- src
- tests
16 files changed
+762
-629
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
| |||
0 commit comments