Skip to content
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

Adds support for the libc field in package.json #3981

Merged
merged 10 commits into from
Jan 20, 2022
Merged

Conversation

arcanis
Copy link
Member

@arcanis arcanis commented Jan 14, 2022

What's the problem this PR addresses?

Some packages (SWC, sharp) publish native packages for both glibc and musl. At the moment users need to install both versions, as there is no conditional differentiator as for os and cpu.

How did you fix it?

This PR adds support for a new libc field in the package.json file, which will be taken into account when filtering conditional packages. We currently support two values, glibc and musl, which are both obtained from looking at the Node report (Node 14+ only).

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@arcanis arcanis merged commit e64af83 into master Jan 20, 2022
@arcanis arcanis deleted the mael/libc-field branch January 20, 2022 16:08
styfle pushed a commit to vercel/next.js that referenced this pull request Mar 16, 2022
Related: yarnpkg/berry#3981

With `yarn 3.2` +, developers will install one less package on the Linux platform
@fengmk2
Copy link

fengmk2 commented Mar 19, 2022

npm registry won't return the libc field on the accept: application/vnd.npm.install-v1+json request.

yisibl added a commit to yisibl/resvg-js that referenced this pull request Mar 20, 2022
Currently only [yarn 3.2+](yarnpkg/berry#3981) and [cnpm](cnpm/npminstall#387) are supported.
yisibl added a commit to yisibl/resvg-js that referenced this pull request Mar 20, 2022
On Linux, it is not possible to tell exactly what kind of C library a native modules depends on just by os/cpu, so yarn 3.2 and cnpm added libc fields to further distinguish this case. This avoids downloading both `gnu` and `musl` packages at the same time.

Currently only [yarn 3.2+](yarnpkg/berry#3981) and [cnpm](cnpm/npminstall#387) are supported, the npm implementation is [still under discussion](npm/rfcs#519).
yisibl added a commit to yisibl/resvg-js that referenced this pull request Mar 20, 2022
On Linux, it is not possible to tell exactly what kind of C library a native modules depends on just by os/cpu, so yarn 3.2 and cnpm added libc fields to further distinguish this case. This avoids downloading both `gnu` and `musl` packages at the same time.

Currently only [yarn 3.2+](yarnpkg/berry#3981) and [cnpm](cnpm/npminstall#387) are supported, the npm implementation is [still under discussion](npm/rfcs#519).
@merceyz
Copy link
Member

merceyz commented Mar 23, 2022

@fengmk2 Yarn doesn't use that header since it slows down requests due to the lack of compression so it doesn't affect us, you can open an issue with npm and ask them to include it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants