browserify / browser-resolve

resolve function which support the browser field in package.json
MIT License
102 stars 70 forks source link

Feature request: option to intercept all disk I/O #66

Closed callumlocke closed 9 years ago

callumlocke commented 9 years ago

I want browser-resolve to always go through my provided functions rather than touching the disk directly. This is because I have an in-memory asset pipeline and I want to be able to expose files to browser-resolve that it wouldn't be able to find on disk (because they don't actually exist on disk, they exist only in my in-memory cache, having being transformed from other filetypes on disk).

Would it be possible to accept an optional callback, readFile (for example) which, if provided, would be used by browser-resolve instead of fs.readFile? And also maybe a custom isFile option, or whatever else it needs? Obviously these functions would be required to implement a standard node async signature.

I need to be able to intercept and carry out all disk accesses that browser-resolve does when resolving something, including all stat calls and file reads, for all package.jsons etc.

callumlocke commented 9 years ago

I've just found enhanced-resolve and it looks like what I'm asking for, so I'll close this