Fixes virtual resolution#325
Merged
Merged
Conversation
Commit generated via `yarn stage`
Member
Author
|
I removed the resolutions passes; commands will instead rely on the automatic virtual resolution as much as possible (it implies that they will not automatically find newly added binaries). The reason for this change is that Yarn 1 already required |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This diff fixes a problem where the virtual packages aren't generated until after a full resolution pass got triggered. This was causing issue with for example
yarn pack, which doesn't initiate any resolution pass.To fix that, multiple actions have been taken:
First, the
Project.findmethod will automatically resolve the virtual packages. This ensures that at the very least, the information obtained from the lockfile are in a usable state even without new resolution pass.Second, a bug got fixed so that we properly reset the virtual packages before starting a new resolution pass (otherwise we'd end up virtualizing them multiple times).
Third, the
packcommand now triggers a resolution pass when initializing.This last point may look curious given I just said that the
Project.findmethod will automatically resolve the virtual packages. This is because there's a subtle difference depending on whether or not you trigger a full resolution pass:If you don't trigger a resolution pass, and only rely on the virtual package resolution, the dependency tree will get its information from the exact state of the lockfile, without looking at the filesystem at all (not even for workspaces).
If you trigger a resolution pass, the dependency tree will update its information based on the updated filesystem.
So for example, let's say you add a new binary to one of your packages, you'd need to run
yarn installin order to update the lockfile metadata before this binary is made available (this only affect binaries; scripts are always detected at runtime).That being said, I'm not entirely sure which of the two behaviors is the most consistent: full resolution pass for every command that may happen to run scripts, or not? ...