Skip to content

Commit 07c3421

Browse files
authored
fix(plugin-nm): handle supportedArchitectures (#4343)
1 parent c1744ef commit 07c3421

File tree

4 files changed

+52
-1
lines changed

4 files changed

+52
-1
lines changed

.yarn/versions/cb320125.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
releases:
2+
"@yarnpkg/cli": patch
3+
"@yarnpkg/plugin-nm": patch
4+
5+
declined:
6+
- "@yarnpkg/plugin-compat"
7+
- "@yarnpkg/plugin-constraints"
8+
- "@yarnpkg/plugin-dlx"
9+
- "@yarnpkg/plugin-essentials"
10+
- "@yarnpkg/plugin-init"
11+
- "@yarnpkg/plugin-interactive-tools"
12+
- "@yarnpkg/plugin-npm-cli"
13+
- "@yarnpkg/plugin-pack"
14+
- "@yarnpkg/plugin-patch"
15+
- "@yarnpkg/plugin-pnp"
16+
- "@yarnpkg/plugin-pnpm"
17+
- "@yarnpkg/plugin-stage"
18+
- "@yarnpkg/plugin-typescript"
19+
- "@yarnpkg/plugin-version"
20+
- "@yarnpkg/plugin-workspace-tools"
21+
- "@yarnpkg/builder"
22+
- "@yarnpkg/core"
23+
- "@yarnpkg/doctor"

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ The following changes only affect people writing Yarn plugins:
3939
- applies hoisting algorithm on aliased dependencies
4040
- reinstalls modules that have their directories removed from node_modules by the user
4141
- improves portal hoisting
42+
- supports `supportedArchitectures`
4243

4344
### Bugfixes
4445

packages/acceptance-tests/pkg-tests-specs/sources/node-modules.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,4 +1722,31 @@ describe(`Node_Modules`, () => {
17221722
});
17231723
}),
17241724
);
1725+
1726+
it(`should support supportedArchitectures`,
1727+
makeTemporaryEnv(
1728+
{
1729+
dependencies: {
1730+
native: `1.0.0`,
1731+
},
1732+
},
1733+
async ({path, run}) => {
1734+
await xfs.writeJsonPromise(ppath.join(path, Filename.rc), {
1735+
nodeLinker: `node-modules`,
1736+
supportedArchitectures: {
1737+
os: [`foo`],
1738+
cpu: [`x64`, `x86`],
1739+
},
1740+
});
1741+
1742+
await expect(run(`install`)).resolves.toMatchObject({code: 0});
1743+
1744+
await expect(xfs.readdirPromise(ppath.join(path, Filename.nodeModules))).resolves.toEqual([
1745+
`.yarn-state.yml`,
1746+
`native`,
1747+
`native-foo-x64`,
1748+
`native-foo-x86`,
1749+
]);
1750+
}),
1751+
);
17251752
});

packages/plugin-nm/sources/NodeModulesLinker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class NodeModulesInstaller implements Installer {
148148
}
149149

150150
// We don't link the package at all if it's for an unsupported platform
151-
if (!jsInstallUtils.checkManifestCompatibility(pkg))
151+
if (!structUtils.isPackageCompatible(pkg, this.opts.project.configuration.getSupportedArchitectures()))
152152
return {packageLocation: null, buildDirective: null};
153153

154154
const packageDependencies = new Map<string, string | [string, string] | null>();

0 commit comments

Comments
 (0)