Skip to content

Commit d5ecf36

Browse files
trivikrmerceyz
authored andcommitted
refactor(core): use const for descriptor in LegacyMigrationResolver (#4292)
1 parent e44e42d commit d5ecf36

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

.yarn/versions/0856ca1a.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
releases:
2+
"@yarnpkg/core": patch
3+
4+
declined:
5+
- "@yarnpkg/plugin-compat"
6+
- "@yarnpkg/plugin-constraints"
7+
- "@yarnpkg/plugin-dlx"
8+
- "@yarnpkg/plugin-essentials"
9+
- "@yarnpkg/plugin-exec"
10+
- "@yarnpkg/plugin-file"
11+
- "@yarnpkg/plugin-git"
12+
- "@yarnpkg/plugin-github"
13+
- "@yarnpkg/plugin-http"
14+
- "@yarnpkg/plugin-init"
15+
- "@yarnpkg/plugin-interactive-tools"
16+
- "@yarnpkg/plugin-link"
17+
- "@yarnpkg/plugin-nm"
18+
- "@yarnpkg/plugin-npm"
19+
- "@yarnpkg/plugin-npm-cli"
20+
- "@yarnpkg/plugin-pack"
21+
- "@yarnpkg/plugin-patch"
22+
- "@yarnpkg/plugin-pnp"
23+
- "@yarnpkg/plugin-pnpm"
24+
- "@yarnpkg/plugin-stage"
25+
- "@yarnpkg/plugin-typescript"
26+
- "@yarnpkg/plugin-version"
27+
- "@yarnpkg/plugin-workspace-tools"
28+
- "@yarnpkg/builder"
29+
- "@yarnpkg/cli"
30+
- "@yarnpkg/doctor"
31+
- "@yarnpkg/extensions"
32+
- "@yarnpkg/nm"
33+
- "@yarnpkg/pnpify"
34+
- "@yarnpkg/sdks"

packages/yarnpkg-core/sources/LegacyMigrationResolver.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,16 @@ export class LegacyMigrationResolver implements Resolver {
5353
const resolutions = this.resolutions = new Map();
5454

5555
for (const key of Object.keys(parsed)) {
56-
let descriptor = structUtils.tryParseDescriptor(key);
56+
const parsedDescriptor = structUtils.tryParseDescriptor(key);
5757

58-
if (!descriptor) {
58+
if (!parsedDescriptor) {
5959
report.reportWarning(MessageName.YARN_IMPORT_FAILED, `Failed to parse the string "${key}" into a proper descriptor`);
6060
continue;
6161
}
6262

63-
if (semverUtils.validRange(descriptor.range))
64-
descriptor = structUtils.makeDescriptor(descriptor, `npm:${descriptor.range}`);
63+
const descriptor = semverUtils.validRange(parsedDescriptor.range)
64+
? structUtils.makeDescriptor(parsedDescriptor, `npm:${parsedDescriptor.range}`)
65+
: parsedDescriptor;
6566

6667
const {version, resolved} = (parsed as any)[key];
6768

0 commit comments

Comments
 (0)