Skip to content

Commit 2bc5173

Browse files
authored
feat!: generic fs cache type Resolver = ResolverGeneric<FsCache<FileSystemOs>> (#358)
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 :)
1 parent 29807ba commit 2bc5173

File tree

16 files changed

+762
-629
lines changed

16 files changed

+762
-629
lines changed

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ rayon = { version = "1.10.0" }
8686
vfs = "0.12.0" # for testing with in memory file system
8787

8888
[features]
89-
default = []
89+
default = ["fs_cache"]
90+
## Provides the `FsCache` implementation.
91+
fs_cache = []
9092
## Enables the [PackageJson::raw_json] API,
9193
## which returns the `package.json` with `serde_json::Value`.
9294
package_json_raw_json_api = []

0 commit comments

Comments
 (0)