a wrapper around the `node` executable for better stacktraces with sourcemaps, sourcecode excerpts
npm install nodexh
Table of Contents generated with DocToc
- What It Is
- How to Install
- How to Use
- What to Expect
- Related
- To Do
NodeXH is a drop-in wrapper for the NodeJS executable hat provides better stacktraces.
npm install -g nodexh
Use nodexh path/to/file.js instead of node path/to/file.js, and you're good to go.
Stack trace items will be reversed, so most recent calls will be shown last*, i.e. also closest to where
the cursor of your terminal is.
* Stack traces will show source contexts (3 lines by default) except where files can not be opened or are
NodeJS internals.
* Source code shown will honor sourcemaps, which is great when you're using the likes of CoffeeScript or
TypeScript.
* The error message will be repeated to avoid having to scroll up when stack traces get longer.
* Colors!
* https://github.com/mozilla/source-map/
* https://sokra.github.io/source-map-visualization/
* https://medium.com/@nodejs/source-maps-in-node-js-482872b56116:
* "In v13.7.0 a public API was introduced for interacting with source
maps."—link
* "You can start using Node.js’ source map functionality today: make sure you have an up-to-date version
of Node.js installed, and run your programs with the flag --enable-source-maps."
* [ ] Add error.name, error.code; where node reports TypeError: TEMPLATES.main_2 is not a function,
nodexh only reports EXCEPTION: TEMPLATES.main_2 is not a function
* [ ] visually indicate spot of error (e.g. by reversing)
* [ ] fix async stacktraces (probably not yet handled correctly; might be issue with stackman?)
* [ ] consider utf8ize-sourcemaps in case there should be
problems w/ 32bit characters
* [ ] truncate long lines in context
* [ ] offer capabilities of NodeXH as API so applications (such as test libraries) can easily retrieve
source code, display source lines with contexts