From 452b7e9d8e5658ac6612aa363a0d43d0ceb7772c Mon Sep 17 00:00:00 2001 From: WooWan Date: Sat, 27 Sep 2025 02:03:49 -0700 Subject: [PATCH 1/4] support catalogs for peer depedencies --- packages/yarnpkg-core/sources/Manifest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yarnpkg-core/sources/Manifest.ts b/packages/yarnpkg-core/sources/Manifest.ts index 4123399053ed..6f2061b2fae9 100644 --- a/packages/yarnpkg-core/sources/Manifest.ts +++ b/packages/yarnpkg-core/sources/Manifest.ts @@ -377,7 +377,7 @@ export class Manifest { continue; } - if (typeof range !== `string` || (!range.startsWith(WorkspaceResolver.protocol) && !semverUtils.validRange(range))) { + if (typeof range !== `string` || (!range.startsWith(WorkspaceResolver.protocol) && !semverUtils.validRange(range)) && !range.startsWith(`catalog:`)) { errors.push(new Error(`Invalid dependency range for '${name}'`)); range = `*`; } From 506ccb7f48073cf842f91ed1a9efaaf87f6626bc Mon Sep 17 00:00:00 2001 From: WooWan Date: Sat, 27 Sep 2025 02:03:57 -0700 Subject: [PATCH 2/4] test: catalog peer deps --- .../sources/features/catalogs.test.ts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packages/acceptance-tests/pkg-tests-specs/sources/features/catalogs.test.ts b/packages/acceptance-tests/pkg-tests-specs/sources/features/catalogs.test.ts index 1fd90e92c549..5174d6f60b14 100644 --- a/packages/acceptance-tests/pkg-tests-specs/sources/features/catalogs.test.ts +++ b/packages/acceptance-tests/pkg-tests-specs/sources/features/catalogs.test.ts @@ -125,6 +125,9 @@ describe(`Features`, () => { devDependencies: { [`no-deps`]: `catalog:`, }, + peerDependencies: { + [`no-deps`]: `catalog:`, + }, }, async ({path, run}) => { await yarn.writeConfiguration(path, { @@ -336,5 +339,28 @@ describe(`Features`, () => { }, ), ); + + test( + `it should work with catalog references in peer dependencies`, + makeTemporaryEnv( + { + peerDependencies: { + [`no-deps`]: `catalog:`, + }, + }, + async ({path, run}) => { + await yarn.writeConfiguration(path, { + catalog: { + [`no-deps`]: `2.0.0`, + }, + }); + + await run(`install`); + + const manifest = await xfs.readJsonPromise(`${path}/package.json` as PortablePath); + expect(manifest.peerDependencies[`no-deps`]).toBe(`catalog:`); + }, + ), + ); }); }); From 953588a9c0573ac987ff2bb94fcc233cab73e2cb Mon Sep 17 00:00:00 2001 From: WooWan Date: Sat, 27 Sep 2025 03:04:46 -0700 Subject: [PATCH 3/4] version bumps --- .yarn/versions/a4a640ca.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .yarn/versions/a4a640ca.yml diff --git a/.yarn/versions/a4a640ca.yml b/.yarn/versions/a4a640ca.yml new file mode 100644 index 000000000000..85799e025ea0 --- /dev/null +++ b/.yarn/versions/a4a640ca.yml @@ -0,0 +1,3 @@ +releases: + "@yarnpkg/core": patch + "@yarnpkg/plugin-catalog": patch From 551a29f293d3700433052da609908c13fc87bac3 Mon Sep 17 00:00:00 2001 From: WooWan Date: Sat, 27 Sep 2025 03:57:37 -0700 Subject: [PATCH 4/4] update versions --- .yarn/versions/a4a640ca.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.yarn/versions/a4a640ca.yml b/.yarn/versions/a4a640ca.yml index 85799e025ea0..db19e4d46ba9 100644 --- a/.yarn/versions/a4a640ca.yml +++ b/.yarn/versions/a4a640ca.yml @@ -1,3 +1,36 @@ releases: "@yarnpkg/core": patch "@yarnpkg/plugin-catalog": patch + +declined: + - "@yarnpkg/plugin-compat" + - "@yarnpkg/plugin-constraints" + - "@yarnpkg/plugin-dlx" + - "@yarnpkg/plugin-essentials" + - "@yarnpkg/plugin-exec" + - "@yarnpkg/plugin-file" + - "@yarnpkg/plugin-git" + - "@yarnpkg/plugin-github" + - "@yarnpkg/plugin-http" + - "@yarnpkg/plugin-init" + - "@yarnpkg/plugin-interactive-tools" + - "@yarnpkg/plugin-jsr" + - "@yarnpkg/plugin-link" + - "@yarnpkg/plugin-nm" + - "@yarnpkg/plugin-npm" + - "@yarnpkg/plugin-npm-cli" + - "@yarnpkg/plugin-pack" + - "@yarnpkg/plugin-patch" + - "@yarnpkg/plugin-pnp" + - "@yarnpkg/plugin-pnpm" + - "@yarnpkg/plugin-stage" + - "@yarnpkg/plugin-typescript" + - "@yarnpkg/plugin-version" + - "@yarnpkg/plugin-workspace-tools" + - "@yarnpkg/builder" + - "@yarnpkg/cli" + - "@yarnpkg/doctor" + - "@yarnpkg/extensions" + - "@yarnpkg/nm" + - "@yarnpkg/pnpify" + - "@yarnpkg/sdks"