Uh oh!
There was an error while loading. Please reload this page.
Compare package.json paths with correct sensitivity in getLocalModuleSpecifier - #57973
Conversation
Jake Bailey (jakebailey)
commented
Mar 27, 2024
TypeScript Bot (@typescript-bot) pack this |
| nearestTargetPackageJson &&= toPath(nearestTargetPackageJson, projectDirectory, getCanonicalFileName); | ||
| nearestSourcePackageJson &&= toPath(nearestSourcePackageJson, projectDirectory, getCanonicalFileName); |
There was a problem hiding this comment.
Not clear if getNearestAncestorDirectoryWithPackageJson should just always return Path.
There was a problem hiding this comment.
Or if i should just comparePaths?
There was a problem hiding this comment.
This is used elsewhere and a toPath might have other negative affects at those use sites.
There was a problem hiding this comment.
If you mean my Path comment, it's only used when reading a file so shouldn't actually affect anything, but it sounds like the comparison one may just be better.
There was a problem hiding this comment.
I'd say just use comparePaths. We use it throughout tryGetModuleNameFromExportsOrImports against a path that comes from getNearestAncestorDirectoryWithPackageJson as well, so it would be consistent.
There was a problem hiding this comment.
Updated to use a helper; slightly different than the one you suggested but I was having trouble understanding what I was reading...
Hey Jake Bailey (@jakebailey), I've packed this into an installable tgz. You can install it for testing by referencing it in your and then running There is also a playground for this build and an npm module you can use via |
Jake Bailey (jakebailey)
commented
Mar 27, 2024
TypeScript Bot (@typescript-bot) test it |
TypeScript Bot (typescript-bot)
commented
Mar 27, 2024
Jake Bailey (@jakebailey) Here they are:tscComparison Report - baseline..pr
System info unknown Hosts
Scenarios
Developer Information: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
TypeScript Bot (typescript-bot)
commented
Mar 27, 2024
Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready. Everything looks the same! |
Jake Bailey (jakebailey)
commented
Mar 27, 2024
TypeScript Bot (@typescript-bot) cherry-pick this to release-5.4 |
TypeScript Bot (typescript-bot)
commented
Mar 27, 2024
Hey, Jake Bailey (@jakebailey)! I've created #57976 for you. |
TypeScript Bot (typescript-bot)
commented
Mar 27, 2024
Jake Bailey (@jakebailey) Here are the results of running the user tests comparing Everything looks good! |
| function packageJsonPathsAreEqual(a: string | undefined, b: string | undefined, ignoreCase?: boolean) { | ||
| if (a === b) return true; | ||
| if (a === undefined || b === undefined) return false; | ||
| return comparePaths(a, b, ignoreCase) === Comparison.EqualTo; |
There was a problem hiding this comment.
dont you need to pass current directory for this to work correctly
There was a problem hiding this comment.
These paths are already absolute, it seems, so nothing broke...
There was a problem hiding this comment.
Checked the other use in this file and they don't pass in the working dir either (also for paths from this host method)
TypeScript Bot (typescript-bot)
commented
Mar 28, 2024
Jake Bailey (@jakebailey) Here are the results of running the top 400 repos comparing Everything looks good! |
Andrew Branch (andrewbranch)
commented
Mar 28, 2024
Fixes #57802 |
…e-5.4 (#57976) Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
Fixes#57956
Fixes#57926
Fixes#57802
Closes#57961
Thanks Hang Liang (@xlianghang) for the test.
See the second commit for the change.