Well, then it seems that it should be picked up by the Nix tooling and made available. But I’m no expert. If it’s anything similar to how Python dependencies are implemented, then your executable should be a script that defines some variables and runs Node.js. You may be able to inspect the values for those variables and see whether prettier is present.
As you previously pointed out, the peer dependencies are available in the lockfile. They’re a way to point a hard dependency between a host package and a precise version. More infos there: Node.js — Peer Dependencies
I’m not familiar with buildNpmPackage, but I can describe how we handle those in npmlock2nix: we plain remove them from the lockfile (test here). They should have been already set in stone by the npm resolver during the lockfile generation.