-
Notifications
You must be signed in to change notification settings - Fork 12.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Take into account peerDependency versions when calculating packageId #57029
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f5d0ef0
Baseline
sheetalkamat 98e72b0
Handle peer dependencies in pnpm layout
sheetalkamat 3c7612e
Update Baselines and/or Applied Lint Fixes
typescript-bot 3d33069
oops
sheetalkamat 9b1d076
Merge branch 'main' into pnpmFileVersioning
sheetalkamat 9497cf8
Always read peer dependencies
sheetalkamat dfefb0e
Merge branch 'main' into pnpmFileVersioning
sheetalkamat 6de58fc
Merge branch 'main' into pnpmFileVersioning
sheetalkamat 620bb48
Make API internal
sheetalkamat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: I could theoretically name a package on disk
typescript@5.4.1+
and munge this cache key up pretty badly (all these separators are valid filepath characters after all). Shouldn't this use, eg,?
and|
instead of+
and@
, since, at least on windows, those aren't valid path characters? Believe it or not, arequire("typescript@5.4.1+")
will work and resolve on disk, even ifnpm
won't let you publish a package with those characters!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that shouldnt matter right becaus this is just distinguisher and gets added as
packageName@version+peerPackage@peerPackageversion...
as the package ID for distinguishing.. Actually was wondering if peerPackageDependency should be array of { packageName, version} instead so that in future we can use it say in module specifier etc .There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrewbranch do you think we would be able to use peer dependency to determine the "moduleSpecifier" name for transitive dependencies? If yes i will make change to make this object with packageName and version instead of a string of all peer dependencies together?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where would we use that exactly? Usually when we’re trying to compute a module specifier, we’re starting from a source file or module symbol. So I’m not sure where this would come in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eg. if your file has import whose peer dependency is the source File for the package then short cut to directly use package name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then while going through all imports in the file: if you find say "foo" import whose peer dependency is "Bar@Bar.version" use that package name ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe that could be leveraged somehow, but getting just the package name is usually fairly easy compared to figuring out what subpath can be used to get to the export we need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@weswigham @andrewbranch do we still have concern about the string for peer dependency calculations.
Do we want this as array of package name and versions for future use or just some string is ok. Should i make this internal for now so we have option to change this later? Would like to get this in sooner than later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should probably be internal if it’s a formatted string that only gets used as a lookup id. But if you want to go ahead and change it to be an object with name/version, that works too.