Adds support for running native binaries without JS intermediaries#5508
Adds support for running native binaries without JS intermediaries#5508
Conversation
merceyz
left a comment
There was a problem hiding this comment.
Presumably we'll need to do this for the following locations as well:
berry/packages/yarnpkg-core/sources/scriptUtils.ts
Lines 491 to 495 in ca47575
berry/packages/yarnpkg-core/sources/scriptUtils.ts
Lines 544 to 548 in ca47575
berry/packages/yarnpkg-core/sources/scriptUtils.ts
Lines 741 to 745 in ca47575
|
There are some issues that this probably fixes (for example #882), could you check and link to them so they're closed? |
Not sure about this PR, but from the title it might fix some turborepo hacks: https://github.com/vercel/turbo/blob/main/packages/turbo/install.js#L190 So it might also relate to |
|
I've tried |
|
This fix is only about native binaries. From your logs, expo is a shellscripts, which aren't allowed in |
|
Will the changes be also added to yarn 3? |
…5508) **What's the problem this PR addresses?** Yarn currently cannot run native binaries without going through a JS jumper script. Other package managers don't have this restriction, and it makes the `yarn run` overhead worse on some scripts for little reasons - or doesn't work at all when packages don't use jumper scripts. **How did you fix it?** Two mechanisms are used: - First we check for the binary extension - Then we check its magic number If one of the two match a predetermined list, the binary is spawned without going through Node. This ensures that this logic is called only when the binary is truly a native binary, and will not affect the behaviour of other existing scripts. **Checklist** <!--- Don't worry if you miss something, chores are automatically tested. --> <!--- This checklist exists to help you remember doing the chores when you submit a PR. --> <!--- Put an `x` in all the boxes that apply. --> - [x] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). <!-- See https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released for more details. --> <!-- Check with `yarn version check` and fix with `yarn version check -i` --> - [x] I have set the packages that need to be released for my changes to be effective. <!-- The "Testing chores" workflow validates that your PR follows our guidelines. --> <!-- If it doesn't pass, click on it to see details as to what your PR might be missing. --> - [x] I will check that all automated PR checks pass before the PR gets reviewed.
|
Yes, I've backported it now so it will be in the next release. |
What's the problem this PR addresses?
Yarn currently cannot run native binaries without going through a JS jumper script. Other package managers don't have this restriction, and it makes the
yarn runoverhead worse on some scripts for little reasons - or doesn't work at all when packages don't use jumper scripts.Fixes #882
How did you fix it?
Two mechanisms are used:
If one of the two match a predetermined list, the binary is spawned without going through Node. This ensures that this logic is called only when the binary is truly a native binary, and will not affect the behaviour of other existing scripts.
Checklist