This repository was archived by the owner on Aug 15, 2024. It is now read-only.
Use memfs under the hood #66
Open
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.
Related: webpack/webpack-dev-middleware#366
This PR is an attempt to re-imagine
memory-fsas a bridge tomemfs. I have simply extendedVolumeand added compatibility methods likenormalizethat the legacymemory-fshad. This should serve as a drop-in replacement for the oldmemory-fswith no interruptions. As far as I can tell this works just like the oldmemory-fsbut with fullfsapi support.All of the tests pass except the ones related to win32 paths. It appears that
memfshas support for win32 paths but I don't yet know how to write tests against it.streamich/memfs#327 (comment)
Why?
There are a number of issues here and around the web where people are trying to do novel things with
memory-fsbut it doesn't support their use-case. I personally ran into an issue when trying to usefs-monkeytorequiremodules directly from amemory-fsvolume. Sadly,memory-fsdoesn't support the fullfsapi so some things aren't possible.I'm not the only one. There are a number of people who have tried to make
memory-fsdo things it wasn't designed for. Many of those people end up findingmemfs(streamich/memfs#323).memfshas fullfsAPI support and it is actively maintained. It is compatible with two very interesting packages:unionfsandfs-monkey.Switching the guts of
memory-fstomemfswhile maintaining full API compliance with the oldmemory-fsseems like the best way to bridge the gap. The aim is to allow people to keep using webpack as they always did while enabling fullfsapi compatibility.Does it work?
It should. We need to figure out how to test the windows paths and determine if people are doing weird things like trying to jam windows paths in
memory-fswhile on a posix machine (memfstries to "do whatfswould do" and that means following the path-type of the underlying system).