~NOTE: this is built on top of #414 as it uses the buildStart changes made there. As such, I've marked this PR as "Draft" until #414 is merged.~
Rebased on top and marked as ready for review.
Summary
Use the buildStart hook added in #414 to simplify cache() to cache
Details
as everything is created in the buildStart hook now (which has RollupContext), we can create the cache there too
no need for slightly hacky, lazy creation during transform anymore
simplifies it and also standardizes it so it's created the same way as all the other instance vars
fix: reset cache after each watch cycle
previously the cache was never reset, meaning that if anything became dirty in a watch cycle, it would never get reset back
I noticed this in the processing of writing watch mode tests in #386
in some cases, this would mean that the cache was effectively always dirty during an entire watch mode run, and therefore never used
this would be quite inefficient as the FS usage for the cache would just go to waste
see that test coverage has now increased as a result!
~NOTE: this is built on top of #414 as it uses the
buildStart
changes made there. As such, I've marked this PR as "Draft" until #414 is merged.~ Rebased on top and marked as ready for review.Summary
Use the
buildStart
hook added in #414 to simplifycache()
tocache
Details
as everything is created in the
buildStart
hook now (which hasRollupContext
), we can create thecache
there tootransform
anymorefix: reset
cache
after each watch cycle