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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugins and dependency injection #5438
Comments
As long as you use |
Yeah, I thought about it before (recursive dependency). But since nobody raised this kind of issues, I didn't investigate it further. We should change it to not directly depend on prettier, though it'll make the development inconvenient (we cannot do top-level require to get doc-related method, we need to pass it to every function that needs this functionality). |
How about creating a |
That would be much better and I will apply it, but it only solves the problem for minor versions not major versions.
This seems like a better way, but if the internal structure of the Doc changes it would be a breaking change. For example: if pluginX uses doc-builders@1.2.0 and prettier uses doc-builders@2.1.0 and those two versions produce a different Doc object than we will have a problem. On the other hand if the interface for building a Doc object:
It would mean that plugins could even be re-used across major versions of prettier. |
to reduce cases of duplicate prettier versions. See: prettier/prettier#5438
Hello.
I am trying to give a boost to the prettier-java plugin which was moved to the Jhipster
organization.
I am new to prettier internals so please bear with me 馃槃
I am trying to understand the relationship between a plugin and prettier itself.
I see that most of the plugins listed in: https://github.com/prettier/prettier/blob/master/docs/plugins.md
specify a direct dependency to prettier in their package.json.
I also see that the plugin development guide:
Provides a code snippet that creates a direct dependency:
Does it make sense that a plugin depends on the core platform directly?
Won't that cause multiple versions of prettier to exist at the same time?
Should not the core platform load the plugin and provide the APIs in some kind of DI injection style?
e.g:
Thanks.
Shahar.
The text was updated successfully, but these errors were encountered: