jiti icon indicating copy to clipboard operation
jiti copied to clipboard

[Feature] Add `JITI_FORCE` to ignore and rebuild the cache

Open kricsleo opened this issue 7 months ago • 5 comments

Describe the feature

Currently, we have two options:

  • Reuse cache with fsCache enabled (default)
  • Disable cache with fsCache disabled

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?

kricsleo avatar May 06 '25 09:05 kricsleo

What about JITI_CACHE: rebuild

pi0 avatar May 06 '25 09:05 pi0

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.)

kricsleo avatar May 06 '25 09:05 kricsleo

Yes it is primary fs cache. We could also have dedicate flag JITI_REBUILD_FS_CACHE / rebuildFsCache (or invalidate*)

pi0 avatar May 07 '25 11:05 pi0

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. ⚙️

kricsleo avatar May 08 '25 09:05 kricsleo

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.

pi0 avatar May 08 '25 11:05 pi0