Skip to content

Use the full local file path as the id for a submodule#21471

Merged
weswigham merged 2 commits into
microsoft:masterfrom
weswigham:us-full-path-to-file-for-submodule
Jan 30, 2018
Merged

Use the full local file path as the id for a submodule#21471
weswigham merged 2 commits into
microsoft:masterfrom
weswigham:us-full-path-to-file-for-submodule

Conversation

@weswigham
Copy link
Copy Markdown
Member

@weswigham weswigham commented Jan 30, 2018

Fixes #21446

The issue was essentialy that the package id name generation logic assumed that foo/bar was always the same as foo/bar/index.d.ts, which isn't true if you also have a foo/bar.d.ts (which takes priority over the other when referenced shorthand).

@weswigham weswigham requested review from a user and mhegazy January 30, 2018 02:06
Comment thread src/compiler/moduleNameResolver.ts Outdated
}
const packageDirectory = path.slice(0, indexAfterPackageName);
const subModuleName = removeExtensionAndIndex(path.slice(indexAfterPackageName + 1));
const subModuleName = addExtensionAndIndex(path.slice(indexAfterPackageName + 1));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this here even?

}
else {
const jsPath = tryReadPackageJsonFields(/*readTypes*/ false, packageJsonContent, nodeModuleDirectory, state);
if (typeof jsPath === "string") {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about .jsx?

Copy link
Copy Markdown
Contributor

@mhegazy mhegazy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to port this to release-2.7 as well.

@weswigham weswigham merged commit b0ea899 into microsoft:master Jan 30, 2018
@weswigham weswigham deleted the us-full-path-to-file-for-submodule branch January 30, 2018 19:09
weswigham added a commit to weswigham/TypeScript that referenced this pull request Jan 30, 2018
* Use the full file path as the id for a submodule

* Informal code review feedback
mhegazy pushed a commit that referenced this pull request Jan 30, 2018
* Use the full file path as the id for a submodule

* Informal code review feedback
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants