webpack / memory-fs

[DEPRECATED use memfs instead] A simple in-memory filesystem. Holds data in a javascript object.
MIT License
881 stars 88 forks source link

Enable overridable memory-fs errors. #48

Closed mjhenkes closed 7 years ago

mjhenkes commented 7 years ago

As discussed in issue #46 I've put together a PR to allow consumers to override the default error behavior of memory-fs.

My use case for this change is that if a file is not found in memory-fs, the error behavior can fall back to search for the file in the standard file system.

Now with update tests, and no rest operator.

codecov[bot] commented 7 years ago

Codecov Report

Merging #48 into master will increase coverage by 0.15%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #48      +/-   ##
=========================================
+ Coverage   96.24%   96.4%   +0.15%     
=========================================
  Files           4       4              
  Lines         293     306      +13     
  Branches       67      73       +6     
=========================================
+ Hits          282     295      +13     
  Misses         11      11
Impacted Files Coverage Δ
lib/MemoryFileSystem.js 99.11% <100%> (+0.05%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 67cec91...b79f0cc. Read the comment docs.

mjhenkes commented 7 years ago

Alternatively I think this problem could be solved by creating a higher order file system that consumes memory fs and whatever other filesystem you want to fall back to and uses exists to decide when to fall back.

mjhenkes commented 7 years ago

To cap off this one man discussion, I think the alternate approach I mentioned above is probably the most appropriate solution. I'll close this guy out in favor of that.

sokra commented 6 years ago

Alternatively I think this problem could be solved by creating a higher order file system that consumes memory fs and whatever other filesystem you want to fall back to and uses exists to decide when to fall back.

Yes, I would also propose this as better solution.