[Feature] Add `JITI_FORCE` to ignore and rebuild the cache
Describe the feature
Currently, we have two options:
- Reuse cache with
fsCacheenabled (default) - Disable cache with
fsCachedisabled
But in some scenarios (especially debugging, e.g., debugging output with different configs), we might want to clean the previous cache and rebuild it (if fsCache is enabled). It's pretty much like the vite --force.
Since adding jiti clean to just delete all the caches wouldn't be that necessary (mostly referenced: https://github.com/vitejs/vite/issues/10986), I think adding JITI_FORCE would be a lightweight solution.
Additional information
- [x] Would you be willing to help implement this feature?
What about JITI_CACHE: rebuild
Isn't JITI_CACHE considered deprecated (as it's no longer mentioned in the docs) or replaced by JITI_FS_CACHE?
(This issue primarily concerns fsCache, given that we also have JITI_MODULE_CACHE.)
Yes it is primary fs cache. We could also have dedicate flag JITI_REBUILD_FS_CACHE / rebuildFsCache (or invalidate*)
I agree with your suggestion to support three modes on the same config: fsCache: true | false | 'rebuild'. 👍
Regarding JITI_REBUILD_FS_CACHE, since it mainly influences JITI_FS_CACHE, if they're used together as JITI_REBUILD_FS_CACHE=true JITI_FS_CACHE=false, the behavior would be somewhat odd... If this isn't a concern, I'm okay with adding this extra config. ⚙️
Adding another option might make better sense since it is a new functionality. First I was thinking of new cache building mode but it is more of a one-off mode.