-
-
Notifications
You must be signed in to change notification settings - Fork 17.4k
prettier: Use wrapProgram for plugins
#442463
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
Conversation
These changes _should_ be backwards compatible while allowing users to opt-in to declaring list of Prettier `plugins` via `.override` High-level summary; - Add `plugins` package level argument - Add `exportRelativePathOf` and `nodeEntryPointOf` internal functions - Inject `wrapProgram` into `installPhase` Attributions; - `l0b0` much thanks for code and doc review
9882f8f to
6236e8b
Compare
|
Thanks for the rapid review @l0b0! I've applied the corrections, and tested things still build (and work) on my device, as well as squashed things down to a single commit 🎉 Please do let me know if there be anything else that'll prevent proposed changes from being acceptable :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! You'll want to add other reviewers too, because I don't have merge rights.
You can also ask on Matrix after a week.
|
Ah that, "after a week", tip be super helpful for me not violating social norms around these parts x-) I'll set a reminder for myself to check-in later as |
Main intent is to provide Prettier plugins for PR NixOS#442463 to consume. Prettier provides, at time of this commit, four [official](https://prettier.io/docs/plugins/#official-plugins) plugins. And there are about two dozen [community](https://prettier.io/docs/plugins/#community-plugins) plugins available too. So it seems wise to leverage existing code, where possible, and follow examples provided by similar NPM projects that have been packaged with plugins. Much of these changes are based on examples found from; - `./pkgs/by-name/le/lessc/plugins/` - `./pkgs/development/node-packages/` ... as well as documentation provided in; - `./doc/languages-frameworks/javascript.section.md`
These changes should be backwards compatible while allowing users to opt-in to declaring list of Prettier
pluginsvia.overrideDoc-comments hopefully'll provide sufficient details about what the added features/functions are intended to do.
High-level summary;
pluginspackage level argumentexportRelativePathOfandnodeEntryPointOfinternal functionswrapProgramintoinstallPhaseLimitations;
<plugin>imported fromnoop.jsshows though we can add--plugin=<path>to CLI viawrapProgramthere are upstream limitations due to how they doimport/requirepath discoverynodeExportAttrAddresses... also that list's order is kinda brittle--plugin=<path>that can be injected, while still allowing users to define other parameters, but unlikely it is that limit will be reachedThings done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.