From fe12d3f9bbfd99a901c9ca1fd9881125a39e8dc2 Mon Sep 17 00:00:00 2001 From: Vadym Date: Sat, 10 Jun 2023 18:19:32 +0300 Subject: [PATCH 1/3] fix npm tag resolver when dedupe --- .yarn/versions/8bff1509.yml | 2 ++ packages/plugin-npm/sources/NpmTagResolver.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .yarn/versions/8bff1509.yml diff --git a/.yarn/versions/8bff1509.yml b/.yarn/versions/8bff1509.yml new file mode 100644 index 000000000000..1546c0b82c7a --- /dev/null +++ b/.yarn/versions/8bff1509.yml @@ -0,0 +1,2 @@ +releases: + "@yarnpkg/plugin-npm": patch diff --git a/packages/plugin-npm/sources/NpmTagResolver.ts b/packages/plugin-npm/sources/NpmTagResolver.ts index 718be626ed2f..bc7d32007bbf 100644 --- a/packages/plugin-npm/sources/NpmTagResolver.ts +++ b/packages/plugin-npm/sources/NpmTagResolver.ts @@ -78,7 +78,7 @@ export class NpmTagResolver implements Resolver { if (parsedRange.params?.__archiveUrl) { const newRange = structUtils.makeRange({protocol: PROTOCOL, selector: parsedRange.selector, source: null, params: null}); - const [resolvedLocator] = await this.getCandidates(structUtils.makeDescriptor(descriptor, newRange), dependencies, opts); + const [resolvedLocator] = await opts.resolver.getCandidates(structUtils.makeDescriptor(descriptor, newRange), dependencies, opts); if (locator.reference !== resolvedLocator.reference) { continue; } From f7b84e3383341c3435dc085100bec34397aeabe5 Mon Sep 17 00:00:00 2001 From: Vadym Date: Sat, 10 Jun 2023 19:55:59 +0300 Subject: [PATCH 2/3] test --- .../sources/commands/dedupe.test.ts | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/acceptance-tests/pkg-tests-specs/sources/commands/dedupe.test.ts b/packages/acceptance-tests/pkg-tests-specs/sources/commands/dedupe.test.ts index d555fa31cd1e..e04da34a3582 100644 --- a/packages/acceptance-tests/pkg-tests-specs/sources/commands/dedupe.test.ts +++ b/packages/acceptance-tests/pkg-tests-specs/sources/commands/dedupe.test.ts @@ -1,4 +1,5 @@ -import {tests} from 'pkg-tests-core'; +import {ppath, xfs, Filename} from '@yarnpkg/fslib'; +import {tests} from 'pkg-tests-core'; const {setPackageWhitelist} = tests; @@ -83,6 +84,26 @@ describe(`Commands`, () => { }), ); + it( + `should not throw on resolutions by npm-tag-resolver with __archiveUrl`, + makeTemporaryEnv({ + dependencies: {[`no-deps`]: `latest`}, + }, async ({path, run, source}) => { + await run(`install`); + await run(`add`, `one-range-dep`); + + const lockFilePath = ppath.join(path, Filename.lockfile); + let lockContent = await xfs.readFilePromise(lockFilePath, `utf8`); + + lockContent = lockContent.replace(`"no-deps@npm:2.0.0"`, `"no-deps@npm:2.0.0::__archiveUrl=https%3A%2F%2Fregistry.com%2Fno-deps-2.0.0.tgz"`); + await xfs.writeFilePromise(lockFilePath, lockContent); + + await expect(run(`dedupe`, `--check`)).resolves.toMatchObject({ + code: 0, + }); + }), + ); + it( `should handle aliased packages`, makeTemporaryEnv({ From 662c4fc7831f3ed71f2ec1f1638c889b708f7d5c Mon Sep 17 00:00:00 2001 From: merceyz Date: Tue, 13 Jun 2023 17:34:59 +0200 Subject: [PATCH 3/3] chore: versions --- .yarn/versions/8bff1509.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.yarn/versions/8bff1509.yml b/.yarn/versions/8bff1509.yml index 1546c0b82c7a..f198b962fb44 100644 --- a/.yarn/versions/8bff1509.yml +++ b/.yarn/versions/8bff1509.yml @@ -1,2 +1,24 @@ releases: + "@yarnpkg/cli": patch "@yarnpkg/plugin-npm": patch + +declined: + - "@yarnpkg/plugin-compat" + - "@yarnpkg/plugin-constraints" + - "@yarnpkg/plugin-dlx" + - "@yarnpkg/plugin-essentials" + - "@yarnpkg/plugin-init" + - "@yarnpkg/plugin-interactive-tools" + - "@yarnpkg/plugin-nm" + - "@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/core" + - "@yarnpkg/doctor"