-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
realpath of entry-point script is not resolved #1004
Closed
cspotcode opened this issue
Apr 8, 2020
· 0 comments
· Fixed by #1009 or terrestris/gondolin#175 · May be fixed by AshleyWright/metalsmith-projects#36, 82ndAirborneDiv/Azure-Network-Security#4 or 82ndAirborneDiv/Azure-Sentinel#4
Closed
realpath of entry-point script is not resolved #1004
cspotcode opened this issue
Apr 8, 2020
· 0 comments
· Fixed by #1009 or terrestris/gondolin#175 · May be fixed by AshleyWright/metalsmith-projects#36, 82ndAirborneDiv/Azure-Network-Security#4 or 82ndAirborneDiv/Azure-Sentinel#4
Labels
Comments
1 task
cspotcode
added a commit
that referenced
this issue
Apr 20, 2020
This was referenced Apr 23, 2020
This was referenced Sep 16, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This issue is a messy brain-dump. I'll clean it up later and ping people for review so they can read the clean version instead of this mess :D
Investigate symlink resolution of the entry-point script and how it affects compilation and config file resolution. E.g. something like
ts-node-script ./node_modules/.bin/this-is-a-symlink
This is important if a script uses
ts-node-script
in the shebang and is symlinked to the path via something like npm's installation mechanism. In that case, the symlink is in a totally different directory than the target script. If we use therealpath
we will discover the correct tsconfig file. Otherwise we will search for tsconfig relative to the symlink's location.Matching node's behavior
We can use node's
package.json
resolution as a model to follow. If it is usingrealpath
then we should probably do the same. It has--preserve-symlinks
and--preserve-symlinks-main
flags.It sounds like node almost always
realpath
s the entry-point, so we can do the same, even before we've loaded the config file. From there, we can obey tsconfig'spreserveSymlinks
.Questions
preserveSymlinks
with node's--preserve-symlinks
? Is node's flag query-able at runtime?fs.realpath()
orrequire.resolve
to locate the entry-point? Latter is guaranteed to match node's behavior but requires us to register .ts and .tsx extensions before locating entry-point and config file. (complexity)TODO
realpath
realpath
-related tickets to make sure we don't break use-casesrealpath
orrequire.resolve
to entry-point codepath before config file resolution.The template below is incomplete; I'll fill in with reproductions when I'm able to come back to this.
Related discussion in #995
Expected Behavior
If entry-point script is
./foo/index.ts
, which symlinks to./bar/index.ts
, the latter path should be used for config file resolution, similar to how nodejs will locate the script'spackage.json
relative to the realpath instead of the symlink path.Actual Behavior
TODO
Steps to reproduce the problem
TODO
Minimal reproduction
TODO
Specifications
The text was updated successfully, but these errors were encountered: