jaredwray / cacheable

a robust, scalable, and maintained set of caching packages
https://cacheable.org
MIT License
1.64k stars 166 forks source link

File-entry-cache does not recognize file changes when loading cache from a file #886

Closed lkinasiewicz closed 3 weeks ago

lkinasiewicz commented 3 weeks ago

Describe the bug When file-entry-cache creates a new instance from a file, and a "cached" file had changed before cache instance was created, it reports that the "cached" file did not change.

  1. There is a cache file containing metadata of file X
  2. File X changes
  3. file-entry-cache creates a new cache instance from the cache file
  4. file-entry-cache analyzeFiles and getUpdatedFiles do not report file X as changed

This is a regression in version 10.0.0 - according to npm's versioning. I don't know how cacheable date based versioning relates to npm's semver.

How To Reproduce Codesandbox example: https://codesandbox.io/p/devbox/c3rx6r From the terminal you can run:

I will also provide unit tests in a pull request.