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

Use node's shorter filenames in REPL, eval, and stdin stack traces #1360

Open
cspotcode opened this issue Jun 3, 2021 · 0 comments
Open

Comments

@cspotcode
Copy link
Collaborator

cspotcode commented Jun 3, 2021

Related to #1282
Tracking as a separate issue because I don't think this is worth fixing, but I want to document my research.

In node's <repl>, [eval], and [stdin] there are 2x filenames used depending on the situation: the short [eval] and a longer absolute path /this/is/the/cwd/[eval] (ts-node also adds the .ts extension to the absolute path)

In vanilla node, stack traces use the shorter name. In ts-node they use the absolute path.

This is controlled by the filename option to new Script(). However, I think changing the filename will break stack traces. To preserve stack trace functionality, we must add a mapping from the short names to the full, absolute path. When source-map-support tries to look up the sourcemap for [eval] it should get the sourcemap for /this/is/the/cwd/[eval].ts

The short names in vanilla node appear to be [eval], [stdin], and REPL1

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

No branches or pull requests

1 participant