-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
--experimental-transform-types leads to wrong lineNumbers in util.getCallSite for files with empty lines #55211
Comments
If this even a bug, Duplicate of #55109 Transforming types modifies where each price of code is, so this is, IMO, expected. |
@RedYetiDev I don't think it's a duplicate of #55109, since I'm not using any third party lib like Additionally https://nodejs.org/api/cli.html#--experimental-transform-types states that |
IMHO the issues spawn from the same problem: source maps not being respected by getCallSite, so only one issue is needed to track it |
If the other issue is tracking that, and not only 3rd party libs, that's fine. The other question I would have is, why does |
--experimental-transform-types does transform the code no matter what, while strip only strips. |
@legendecas do you think its possible to reconstruct the callsite with sourcemaps? |
That should be possible but will require a bit of work, for example currently the uncaught exception printing calls back to JS land to map the source locations for the exception source line: Line 73 in 5a19a9b
Which goes here
and to here
Something similar can be done for util.getCallsite() when the StackFrame::GetScriptSourceMappingURL() or StackFrame::GetScriptNameOrSourceURL() is returning something non-empty, just operating on the call site objects instead.
|
It is doable, and it is how internal stack trace translation works. I think for this issue and #55109, the question is whether |
Yeah I imagine something like |
In case it helps anyone, here is where the test runner does this sort of thing with source maps. |
Do I understand correctly, that there might be a way to get it working with |
here is how the internal call site serialization does. |
Version
v22.9.0
Platform
Subsystem
No response
What steps will reproduce the bug?
For the given file, the output is different for two different commands:
How often does it reproduce? Is there a required condition?
It only happens when using
--experimental-transform-types
What is the expected behavior? Why is that the expected behavior?
The lineNumbers should be correctly regardless if
--experimental-transform-types
is used or notWhat do you see instead?
I'm seeing the wrong line numbers based on the sum of all empty lines.
Additional information
No response
The text was updated successfully, but these errors were encountered: