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.
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 offs.readFile
? And also maybe a customisFile
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.