-
Notifications
You must be signed in to change notification settings - Fork 146
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
Do not emit fs.realpath()
path of files
#20
Conversation
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.
In CommonJS resolution, whenever resolving relative to a path that is symlinked, the resolution must always happen relative to the realpath. To not apply this realpath is to break CJS semantics.
Yes now-node isn't doing the right thing without symlink support, but that means we must fix it there, not break the semantic here.
@@ -1,5 +1,4 @@ | |||
[ |
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.
By removing this test, you are effectively breaking yarn workspaces 🤔
I added this test in #15 specifically for yarn workspaces so I can't approve this PR if you are modifying this test.
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.
This doesn't seem correct because you changed the test I just added in #15
Got it @guybedford. Then I guess we need to always resolve the real paths, and add the location of the symlink to the file list. I still think it's wrong to have both the "virtual path" and the real path 🤔 Because the consumer won't now the "virtual path" is from a symlink and will create a real file (lstat on |
@lucleray my understanding is for example in a git repo if you add a file or folder that is a symlink, that it will embed that symlink into the file model. Or similarly for archiving with tar etc. And yes that involves statting again at the time of constructing the file system model. So we could in theory do that work here, and instead output |
Got it @guybedford. Thank you for explaining 🙂 |
Following-up #15.
This PRs removes the
fs.realpath()'d
path of a file infileList
.Example:
Here I would expect the trace to be
input.js
andsymlink/another.js
.Currently, it is
input.js
,folder/another.js
andsymlink/another.js
(folder/another.js
is not required anywhere!).Other example:
Here I would expect the trace to be
input.js
andsymlink
. It's up to the consumer of the trace to chose how it wants to copy thesymlink
file (either by creating a real file atsymlink
or by copying the symlink and its target).Currently it is
input.js
,symlink
andanother.js
.