Description
Is your feature request related to a problem? Please describe.
The output of Function.prototype.toString()
can be useful for showing the source code for a function, such as in output for a test framework, to show the test code for a test.
If the original code was transformed/transpiled/etc, the output will be the post-processed source code, which is less useful.
Describe the solution you'd like
When using --enable-source-maps
, show the original source code for the function, rather than the post-processed source code.
This is non-trivial from user-land since Function.prototype.toString()
has no metadata about the source file or source lines. Maybe Node can get access to that information through V8? If source file and line numbers were available then it should be a fairly straight forward look up in the source map to get back to the original code.
Describe alternatives you've considered
None.