Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(core): never mark resolution dependencies as optional
  • Loading branch information
paul-soporan committed Oct 16, 2021
commit 8d641e75b09f77313cd554da275888c85b6e48b9
13 changes: 12 additions & 1 deletion packages/yarnpkg-core/sources/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@ export class Project {
const descriptorResolutionPromises = new Map<DescriptorHash, Promise<Package>>();

const dependencyResolutionLocator = this.topLevelWorkspace.anchoredLocator;
const allResolutionDependencyPackages = new Set<LocatorHash>();

const resolutionQueue: Array<Promise<unknown>> = [];

Expand Down Expand Up @@ -762,7 +763,11 @@ export class Project {
const resolutionDependencies = resolver.getResolutionDependencies(descriptor, resolveOptions);
const resolvedDependencies = new Map(await Promise.all(resolutionDependencies.map(async dependency => {
const bound = resolver.bindDescriptor(dependency, dependencyResolutionLocator, resolveOptions);
return [dependency.descriptorHash, await scheduleDescriptorResolution(bound)] as const;

const resolvedPackage = await scheduleDescriptorResolution(bound);
allResolutionDependencyPackages.add(resolvedPackage.locatorHash);

return [dependency.descriptorHash, resolvedPackage] as const;
})));

const candidateResolutions = await miscUtils.prettifyAsyncErrors(async () => {
Expand Down Expand Up @@ -828,6 +833,12 @@ export class Project {
allPackages,
});

for (const locatorHash of optionalBuilds) {
if (allResolutionDependencyPackages.has(locatorHash)) {
optionalBuilds.delete(locatorHash);
}
}

// All descriptors still referenced within the volatileDescriptors set are
// descriptors that aren't depended upon by anything in the dependency tree.

Expand Down