-
Notifications
You must be signed in to change notification settings - Fork 718
support pnp resolver #1876
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
base: main
Are you sure you want to change the base?
support pnp resolver #1876
Conversation
logger.Log(fmt.Sprintf("ATA:: Installed typings %v", packageNames)) | ||
var installedTypingFiles []string | ||
resolver := module.NewResolver(ti.host, &core.CompilerOptions{ModuleResolution: core.ModuleResolutionKindNodeNext}, "", "") | ||
resolver := module.NewResolver(ti.host, &core.CompilerOptions{ModuleResolution: core.ModuleResolutionKindNodeNext}, "", "", nil) |
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.
todo: add pnp support later
packageName, rest := ParsePackageName(moduleName) | ||
packageDirectory := tspath.CombinePaths(nodeModulesDirectory, packageName) | ||
|
||
func (r *resolutionState) loadModuleFromSpecificNodeModulesDirectory(ext extensions, candidate string, packageDirectory string, rest string, nodeModulesDirectoryExists bool) *resolved { |
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 change this function's interface
} | ||
|
||
// need fixtures to be yarn install and make global cache | ||
func TestGlobalCache(t *testing.T) { |
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.
These test cases were taken from pnp-rs, but since they are relatively complex to run and maintain.
I think it would be fine to remove them if they’re not considered necessary.
Please let me know your thoughts!
@microsoft-github-policy-service agree |
pnpResolutionConfig := TryGetPnpResolutionConfig(currentDirectory) | ||
|
||
if pnpResolutionConfig != nil { | ||
fs = pnpvfs.From(fs) |
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.
On second thought, this way I wouldn’t be able to take advantage of the cached VFS, so I’m thinking of moving its location instead.
This PR adds support for PnP resolution.
#1875 in the previous discussion, I have internalized pnp-go into the repository.
Please note that the PR has become quite large due to the inclusion of the PnP source and test code. I apologize for the length and appreciate your understanding.
what is pnp
Yarn Plug’n’Play (PnP) is a dependency resolution system that removes the need for a traditional node_modules folder.
describe at #460
how to support
add pnp resolution config in host
add pnp branch in resolver.go