-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Add additional diagnostic for packages that only resolve under non-exports
-respecting modes
#52173
Merged
andrewbranch
merged 7 commits into
microsoft:main
from
andrewbranch:module-resolution/esm-types-resolution-diagnostic
Jan 13, 2023
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1e24dcb
Add additional diagnostic for packages that only resolve under non-ex…
andrewbranch fd1ad49
Add test and fix implementation
andrewbranch 71d356c
Update baselines
andrewbranch 8eb5099
Merge branch 'main' into module-resolution/esm-types-resolution-diagn…
andrewbranch 816719d
Update type from merge
andrewbranch bc720e4
Merge branch 'main' into module-resolution/esm-types-resolution-diagn…
andrewbranch 8d8907f
Tweak text
andrewbranch 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,6 +99,16 @@ | |
"File name '/node_modules/exports-and-types-versions/dist/foo.js' has a '.js' extension - stripping it.", | ||
"File '/node_modules/exports-and-types-versions/dist/foo.js' exist - use it as a name resolution result.", | ||
"Resolving real path for '/node_modules/exports-and-types-versions/dist/foo.js', result '/node_modules/exports-and-types-versions/dist/foo.js'.", | ||
"Resolution of non-relative name failed; trying with modern Node resolution features disabled to see if npm library needs configuration update.", | ||
"File '/package.json' does not exist according to earlier cached lookups.", | ||
"Loading module 'exports-and-types-versions/foo' from 'node_modules' folder, target file types: TypeScript, Declaration.", | ||
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", | ||
"'package.json' has a 'typesVersions' field with version-specific path mappings.", | ||
"'package.json' has a 'typesVersions' entry '*' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'foo'.", | ||
"Module name 'foo', matched pattern 'foo'.", | ||
"Trying substitution './types/foo.d.ts', candidate module location: './types/foo.d.ts'.", | ||
"File '/node_modules/exports-and-types-versions/types/foo.d.ts' exist - use it as a name resolution result.", | ||
"Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'.", | ||
"======== Module name 'exports-and-types-versions/foo' was successfully resolved to '/node_modules/exports-and-types-versions/dist/foo.js' with Package ID 'exports-and-types-versions/dist/[email protected]'. ========", | ||
"======== Resolving module 'exports-and-types-versions/nope' from '/main.mts'. ========", | ||
"Module resolution kind is not specified, using 'Node16'.", | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,6 +99,16 @@ | |
"File name '/node_modules/exports-and-types-versions/dist/foo.js' has a '.js' extension - stripping it.", | ||
"File '/node_modules/exports-and-types-versions/dist/foo.js' exist - use it as a name resolution result.", | ||
"Resolving real path for '/node_modules/exports-and-types-versions/dist/foo.js', result '/node_modules/exports-and-types-versions/dist/foo.js'.", | ||
"Resolution of non-relative name failed; trying with modern Node resolution features disabled to see if npm library needs configuration update.", | ||
"File '/package.json' does not exist according to earlier cached lookups.", | ||
"Loading module 'exports-and-types-versions/foo' from 'node_modules' folder, target file types: TypeScript, Declaration.", | ||
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", | ||
"'package.json' has a 'typesVersions' field with version-specific path mappings.", | ||
"'package.json' has a 'typesVersions' entry '*' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'foo'.", | ||
"Module name 'foo', matched pattern 'foo'.", | ||
"Trying substitution './types/foo.d.ts', candidate module location: './types/foo.d.ts'.", | ||
"File '/node_modules/exports-and-types-versions/types/foo.d.ts' exist - use it as a name resolution result.", | ||
"Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'.", | ||
"======== Module name 'exports-and-types-versions/foo' was successfully resolved to '/node_modules/exports-and-types-versions/dist/foo.js' with Package ID 'exports-and-types-versions/dist/[email protected]'. ========", | ||
"======== Resolving module 'exports-and-types-versions/nope' from '/main.mts'. ========", | ||
"Module resolution kind is not specified, using 'NodeNext'.", | ||
|
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.
a non-relative name is one like "foo", not "./foo.js", right?
I guess this is output for traceResolution, so it's probably OK to be technical, but is 'non-relative' the friendliest term we have? I have to think about it a bit every time I see the term. Could be that I was ruined by reading an old, old "how Typescript implements Node resolution" document, though.
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've also found myself wondering if there's a good term for imports that are neither absolute nor relative to the containing file, but rather relative to some configured root or resolved via aliasing. Floating? Inferred? I guess "absolute" could be reused since giving full filesystem paths for imports should be vanishingly rare, but it doesn't feel accurate either.