Skip to content
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

Resolve realpath #5183

Closed
wants to merge 18 commits into from
Closed

Conversation

dishuostec
Copy link
Contributor

Origin pull request #4939

I fixed all test #4939 (comment)

@height
Copy link

height bot commented Sep 25, 2020

Link Height tasks by mentioning a task ID in the pull request title or description, commit messages, or comments.

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

@dishuostec dishuostec mentioned this pull request Sep 25, 2020
1 task
@aminya
Copy link
Contributor

aminya commented Sep 25, 2020

Wow! This is awesome. Excited to see this in action. Should we revive the pnpm PR as well after this is merged?

@jasonswearingen
Copy link

Should we revive the pnpm PR as well after this is merged?

Please do, I have been tracking this issue for that very reason.

@dishuostec
Copy link
Contributor Author

Wow! This is awesome. Excited to see this in action. Should we revive the pnpm PR as well after this is merged?

I have tested pnpm with this pr, it works fine and no more duplicate depenndency.

@aminya
Copy link
Contributor

aminya commented Sep 27, 2020

I want to request the maintainers to review this if they can and let us know if there is anything we can do to get this through. I'm afraid that other pull requests introduce conflicts with this, like how it happened for the old PR. 😄

cc: @mischnic @DeMoorJasper @devongovett etc

@aminya
Copy link
Contributor

aminya commented Oct 26, 2020

Anything else remaining here? What's the procedure for merging something into Parcel? It's a little unclear how the PRs work in Parcel considering that this (or its related PR) has been open for a couple of months now.

@jasonswearingen
Copy link

@devongovett please consider accepting this PR. It or it's predecessor have been around for 5 months and dishuostec got it mergeable twice.

@aminya
Copy link
Contributor

aminya commented Nov 25, 2020

I have made a fork of Parcel that includes this PR and #4920. However, I am not familiar with the registration procedure for this repository because it uses Lerna, Yarn, Gulp, etc. If anyone is familiar with the process, let me know in this issue:
aminya#4

@aminya
Copy link
Contributor

aminya commented Dec 16, 2020

I merged V2 into this branch and ran the tests. Everything works without any issues.

I only had to increase this time out to 30000 on my machine for this flaky test.

// This depends on spinning up a WorkerFarm, which can take some time.
this.timeout(20000);

CC: @wbinnssmith @mischnic

@aminya
Copy link
Contributor

aminya commented Dec 18, 2020

@devongovett devongovett mentioned this pull request Dec 20, 2020
2 tasks
Copy link
Member

@devongovett devongovett left a comment

Choose a reason for hiding this comment

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

I apologize for the slow response to this PR. I am also making some changes to the resolver in #5481, so I will update this and make a new PR with those changes merged in. Thanks again for your contribution!

filePath: realModuleDir
? path.join(realModuleDir, subPath || '')
: path.join(dir, 'node_modules', filename),
isSymlink: realModuleDir ? realModuleDir !== moduleDir : false,
Copy link
Member

Choose a reason for hiding this comment

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

Pretty sure this will always be true. The FS module returns the original path if there is no realpath https://github.com/parcel-bundler/parcel/blob/v2/packages/core/fs/src/NodeFS.js#L82

@@ -429,11 +430,16 @@ export default class NodeResolver {
let moduleDir = path.join(dir, 'node_modules', moduleName);
let stats = await this.fs.stat(moduleDir);
if (stats.isDirectory()) {
const realModuleDir = await this.fs.realpath(moduleDir);
Copy link
Member

@devongovett devongovett Dec 20, 2020

Choose a reason for hiding this comment

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

I believe this is slightly different from what Node does. This only considers symlinked directories whereas node also supports symlinked files. I believe Node basically just takes the realpath at the end after everything has been resolved. This would also avoid the need for the isSymlink flag because the symlink path would be used until the very end of the algorithm.

@devongovett
Copy link
Member

See #5508

@devongovett devongovett closed this Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants