This repository has been archived by the owner on Aug 15, 2024. It is now read-only.
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-fs
as a bridge tomemfs
. I have simply extendedVolume
and added compatibility methods likenormalize
that the legacymemory-fs
had. This should serve as a drop-in replacement for the oldmemory-fs
with no interruptions. As far as I can tell this works just like the oldmemory-fs
but with fullfs
api support.All of the tests pass except the ones related to win32 paths. It appears that
memfs
has 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-fs
but it doesn't support their use-case. I personally ran into an issue when trying to usefs-monkey
torequire
modules directly from amemory-fs
volume. Sadly,memory-fs
doesn't support the fullfs
api so some things aren't possible.I'm not the only one. There are a number of people who have tried to make
memory-fs
do things it wasn't designed for. Many of those people end up findingmemfs
(streamich/memfs#323).memfs
has fullfs
API support and it is actively maintained. It is compatible with two very interesting packages:unionfs
andfs-monkey
.Switching the guts of
memory-fs
tomemfs
while maintaining full API compliance with the oldmemory-fs
seems like the best way to bridge the gap. The aim is to allow people to keep using webpack as they always did while enabling fullfs
api 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-fs
while on a posix machine (memfs
tries to "do whatfs
would do" and that means following the path-type of the underlying system).