fix: add a temporary property '_isRootFile_' for each promise result of cache to prevent i…#165
Conversation
|
great, will have a closer look soon. is it possible to hide the flag with a non enumerable ? |
0d1c791 to
df3ab99
Compare
Done. By the way, this flag is just bound to the "promise result" would not exist in the result returned to user, it's more like a temporary flag druing the parse process. |
|
Thanks! looks like you also have to run The reason for hiding is that the promise can be accessed from the cache. Yes its temporary and users shouldn't enumerate the promise, but better safe than sorry ;) see also #162 that would be a breaking change so it didn't move forward yet |
…nto deadlock with cache
df3ab99 to
28352e2
Compare
|
CI passed now. |
|
added a changeset and made the flag readonly, planning to release a patch with it soon. |
I've just came across the issue of vitest-dev/vitest#5182. Then found out the RC is #154. So I spent some times to read relevant codes and put my correction out to try to push this issue forward. The tests based on #157.
My considerations about this fix: this fix is based on the current design and as few changes as possible to just add a patch to prevent into the deadlock situation you've described in aleclarson/vite-tsconfig-paths#132 (comment).
In the correction, I add an internal property
_isRootFile_for each cached file and this new property means if the file is invoked by the public apiparese()which used to distingust another type of cache which created byparseFile(). Then using_isRootFile_prevent into the deadlock inparseFile().@dominikg let me know if you have some comments.