Skip to content

Conversation

@S0AndS0
Copy link
Member

@S0AndS0 S0AndS0 commented Sep 12, 2025

These changes should be backwards compatible while allowing users to opt-in to declaring list of Prettier plugins via .override

Doc-comments hopefully'll provide sufficient details about what the added features/functions are intended to do.

High-level summary;

  • Add plugins package level argument
  • Add exportRelativePathOf and nodeEntryPointOf internal functions
  • Inject wrapProgram into installPhase
  • Majority of plugins tested work well with Vim

Limitations;

  • Cannot find <plugin> imported from noop.js shows though we can add --plugin=<path> to CLI via wrapProgram there are upstream limitations due to how they do import/require path discovery
  • Likely there are other, imaginative, ways for plugin authors to declare the main export/entry-point that is not currently covered by nodeExportAttrAddresses... also that list's order is kinda brittle
  • There likely is a limit to the number of --plugin=<path> that can be injected, while still allowing users to define other parameters, but unlikely it is that limit will be reached

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. labels Sep 12, 2025
@nix-owners nix-owners bot requested a review from l0b0 September 12, 2025 20:05
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
@S0AndS0 S0AndS0 force-pushed the prettier-with-plugins branch from 9882f8f to 6236e8b Compare September 13, 2025 16:49
@S0AndS0
Copy link
Member Author

S0AndS0 commented Sep 13, 2025

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 :-)

Copy link
Contributor

@l0b0 l0b0 left a 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.

@nixpkgs-ci nixpkgs-ci bot added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Sep 13, 2025
@S0AndS0
Copy link
Member Author

S0AndS0 commented Sep 13, 2025

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 pkgs/README.md, nor pkgs/by-name/README.md, supplies any names I should ping, and there ain't a big hurry/worry on my end.

@pyrox0 pyrox0 added this pull request to the merge queue Sep 14, 2025
Merged via the queue into NixOS:master with commit bde37a6 Sep 14, 2025
31 of 33 checks passed
S0AndS0 added a commit to S0AndS0/nixpkgs that referenced this pull request Sep 14, 2025
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`
@S0AndS0 S0AndS0 mentioned this pull request Sep 14, 2025
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants