This repository was archived by the owner on Feb 26, 2024. It is now read-only.
patch fs methods as macrotask, add test cases of fs watcher #572
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
patch fs async methods (open, exists, write...) as macrotask, in previous patch, we use wrap,
in my understanding, patch with wrap vs as macro task, we can both intercept schedule and invoke,
but patch with macroTask can also have the ability to intercept cancelTask and hasTask.
add test cases of fs watcher related methods. Because we already patched EventEmitter, so fs.watch, fs.watchFile, fs.unwatchFile don't need additional patch.
add a generic patch macro task method in util.ts
And in original patch, we patched the fs function with wrap, now we treat them as macrotask, so fs method will make additional callback (invokeTask/scheduleTask etc..) call, it may have some performance impact, I will make some other performance demo to check it.