-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
No documentation around custom resolvers #7014
Comments
The custom resolver option takes the path to a long-running binary that Flow starts and communicates with using a line-by-line stdin/stdout formatted with JSON. An implementation can be found in the PnP resolver used by Yarn: https://github.com/yarnpkg/yarn/blob/master/src/util/generate-pnp-map-api.tpl.js#L832-L849 |
@arcanis Wow this is pretty cool! Does it mean that we could validate e.g css modules with custom resolver? Or at least that the css class names are present? |
No, it's just a resolver (it just tells Flow which file to load when file |
Oh ok, thanks! Do you think that it would be difficult to implement? I see that this could have huge potential to build full blown plugin system to flow! |
It'll doable but difficult. The main issue tho it's that it'll likely involve some architectural changes in the way Flow loads its files, which means that we first have to reach a consensus on what's the best way to do it (and if we want to do it!). |
@arcanis thanks, that should work for our use case. As far as actually passing something like https://github.com/yarnpkg/yarn/blob/master/src/util/generate-pnp-map-api.tpl.js#L832-L849 to flow, how is that done would that use the flow config? Yeah, I think that @villesau is right here- this is a prerequisite to a system that can process files like css modules and definitely a good idea. |
@jakesyl I played around a bit with the solution, this is the minimum setup to get started:
And here is my hacky test.js which didn't do anything meaningful but managed to return message
Important part is This is what flow gives you in stdin: |
Thanks! Going to play around with this a little bit. |
@jakesyl here is even better example: https://github.com/facebook/flow/pull/6132/files#diff-146f2d34133e80d0efbc6c7b6e6e7bcf |
Unfortunately 87820b8 (part of 0.110) deleted |
Since the feature was deleted due to a security issue that was reported to us, as mentioned above, we can close this issue. |
tracking: adonisjs/discussion/issues/65
Aside from the description on #6132 (which doesn't give many usage details), there's also no documentation on the .flowconfig webpage. I do see in the changelog it says:
But I'd at least like to see an implementation example in the PR. I know there have been a few variants of "custom resolver" requests including #2939, #293.
So I'm using a framework adonisjs/adonis-framework . The framework operates similarly to @laravel/@symfony in that you have an IoC container and allows for dependency injection. The IoC is a package called
adonis-fold
. Real world use looks something like this:use()
is a global that hits theIoC container
which binds the namespace'Redis'
to something like this:The
use()
keyword can be used to load any of the providers in adonis which are loaded as an array when the application boots. Essentially, we want a way to create a custom resolver as is described here but for flow. The project is also trying to get setup on typescript so the issues do overlap quite a bit.For reference this is the code for the use method:
How can I resolve this?
The text was updated successfully, but these errors were encountered: