-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow custom loader to be provided #161
Comments
I guess it's time I get this supported: whitlockjc/path-loader#1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My use-case is that I have an object of objects, for which there are no real correspending files (let's say they come from a database), let's say:
and my refs are like:
When
json-refs
is used with it like this, there's no real way to fetch such references with aprocessContent
function becausePathLoader
will try to resolve toprocess.cwd()
and of course won't find such files.What I suggest is providing an option for a simple function that gets an unmangled uri and then either returns an object (or error) as-is (synchronous), or returns a promise (asynchronous). You could name it
customLoader
or somesuch.It could even have some matcher function to provide a way to validate whether to use the
customLoader
or fall back toPathLoader
ending up with a simplest use-case (using theoaData
from above) such as:or let's say from an async database loader such as:
The text was updated successfully, but these errors were encountered: