Skip to content

Commit 87976ff

Browse files
authored
fix: support negated pnpm os|cpu constraints (#2696)
Fix #2694 PNPM os/cpu constraints can also be negated such as `!arm`, for example: ``` [email protected]: resolution: {integrity: sha512-...==} cpu: ['!arm', '!arm64', '!riscv64', '!x64'] ``` See: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#cpu https://nodejs.org/docs/latest-v24.x/api/process.html#processarch https://nodejs.org/docs/latest-v24.x/api/process.html#processplatform ### Changes are visible to end-users: no ### Test plan - New test cases added
1 parent d266e8a commit 87976ff

22 files changed

+2092
-364
lines changed

e2e/pnpm_lockfiles/MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ npm = use_extension(
9797

9898
# optional deps, os/cpu conditions
9999
"lock-%s__esbuild__0.27.0__links" % version,
100+
"lock-%s__sass-embedded__1.97.3__links" % version,
100101
)
101102
for version in PNPM_LOCK_VERSIONS
102103
]

e2e/pnpm_lockfiles/base/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
"@types/node": "22.18.13",
5050
"@types/archiver": "5.3.1",
5151
"alias-only-sizzle": "npm:@types/sizzle@~2.3.10",
52-
"alias-types-node": "npm:@types/node@~22.18.13"
52+
"alias-types-node": "npm:@types/node@~22.18.13",
53+
"sass-embedded": "1.97.3"
5354
},
5455
"optionalDependencies": {
5556
"@aspect-test/c": "2.0.0",

e2e/pnpm_lockfiles/lockfile-test.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ BZLMOD_FILES = {
3131

3232
# optional deps, os/cpu conditions
3333
"esbuild_links_defs.bzl": "@REPO_NAME__esbuild__0.27.0__links//:defs.bzl",
34+
"sass-embedded_links_defs.bzl": "@REPO_NAME__sass-embedded__1.97.3__links//:defs.bzl",
3435
}
3536

3637
def lockfile_test(npm_link_all_packages, name = None):
@@ -113,6 +114,9 @@ def lockfile_test(npm_link_all_packages, name = None):
113114
# rollup has a 'optionalDependency' (fsevents)
114115
":node_modules/rollup",
115116

117+
# sass-embedded has many optional deps with conditions
118+
":node_modules/sass-embedded",
119+
116120
# npm: alias to a package that has many peers
117121
":node_modules/rollup-plugin-with-peers",
118122
# underlying repo for the many-peers package

0 commit comments

Comments
 (0)