You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thought about this some more. Might make sense to expose an API for setting cache entries. Every time we need to invalidate a cache entry, it is because we have a new value for it. Maybe just set that new value into the cache.
This mimics the functionality of hookRequire without necessitating a hook.
On the other hand, hookRequire saves fs calls by storing every loaded module into the cache.
If a consumer uses emptyCacheBetweenOperations then they should still take care to implement retrieveSourceMap. Even then, new SourceMapConsumer() is called every time, and I'm not sure of the performance implications.
This is why I'm averse to emptyCacheBetweenOperations.
Activity
[-]Add cache invalidation API[/-][+]Add cache invalidation or cache setting API[/+]cspotcode commentedon Oct 17, 2021
Thought about this some more. Might make sense to expose an API for setting cache entries. Every time we need to invalidate a cache entry, it is because we have a new value for it. Maybe just set that new value into the cache.
This mimics the functionality of
hookRequirewithout necessitating a hook.On the other hand,
hookRequiresaves fs calls by storing every loaded module into the cache.cspotcode commentedon Oct 17, 2021
If a consumer uses
emptyCacheBetweenOperationsthen they should still take care to implementretrieveSourceMap. Even then,new SourceMapConsumer()is called every time, and I'm not sure of the performance implications.This is why I'm averse to
emptyCacheBetweenOperations.