After more than a year of work, the team is thrilled to release the first version of Yarn 4.x. The major changes include a switch to Node.js 18+, the use of Corepack instead of yarnPath for new projects created with yarn init, inclusion of all official plugins by default, and a slightly altered syntax for the yarn workspaces foreach command. The team also introduced Hardened Mode, which provides additional validation to protect against attacks. Yarn is the only package manager with a constraints engine, and starting from Yarn 4, Prolog constraints have been replaced with a new JavaScript-based engine. The user interface has been improved, and Yarn 4.0 is significantly faster than its predecessor. The website has also been revamped. The team plans to continue making improvements and is considering native Yarn builds in the future.
https://yarnpkg.com/blog/release/4.0