Node: Future work for source-map functionality

Created on 7 Oct 2019  路  6Comments  路  Source: nodejs/node

This thread documents some of the known limitations of the recently released Source Map V3 support in Node.js.

I would greatly appreciate help testing and improving this feature, and this is a great opportunity to land some commits in Node.js.

_If you begin work on a specific task, create a corresponding issue and reference this thread._

Feature Work

  • [x] source-maps are not applied to GetErrorSource, this is the logic that Node.js uses to place a ^ pointing to the source location where an exception occurred. (@bcoe might be able to help).
  • [ ] source-maps are not applied when running in repl (talk to @devsnek and @bcoe about this work).
  • [x] develop public API for fetching and manipulating source-maps (it would be good to engage folks like @SimenB, and @boneskull, about the current needs of tools like Mocha and Jest).
  • [x] a source-map is not serialized to disk if an exception occurs while loading (this issue is deceptively difficult, and will require some refactoring related to how we serialize the cache, talk to @bcoe); see: https://github.com/nodejs/node/pull/35915 for solution.

Bug Fixes

  • [ ] partial source-map/coverage is written to disk when running Node's test suite (make -j4 coverage-run-js, results in warning SyntaxError: Unexpected end of JSON input) (potentially talk to @joyeecheung about this issue).
  • [x] missing branch coverage displayed for covered catch statements (the fix for this is most likely in v8, and similar to this, @schuay would be a good person to talk to about this).

    Screen Shot 2019-10-06 at 1 07 28 PM

Refactoring

  • [x] the caching of ESM and CJS is currently different code paths, it would be nice to figure out a way to consolidate them (can we find out a way to use a WeakMap for both, and still serialize to disk?).

CC: @iansu, @azasypkin
Related: related Node tooling conversation.

help wanted source maps

Most helpful comment

@Hamza-324 yes 馃憤 happy to help coordinate here.

All 6 comments

Thanks @bcoe! I鈥檓 excited to help out with some of this stuff.

Hello @bcoe I'm a first time contributor here and would love to help out with this, how can I begin ?

@Hamza-324 I would love for us to figure out a way for source maps to work when running in a repl, this might be the easiest place to start contributing on the feature.

@bcoe okay, I will start work on this.
Should I comment here if I don't understand something or need some help, regarding this issue?

@Hamza-324 yes 馃憤 happy to help coordinate here.

From this conversation we may want to reconsider our approach of showing both the original and transpiled call site, as it might not fit with the TC39 Error Stacks Proposal.

We should start a conversation about the future of Node.js' stack traces/source map support, on this proposal.

CC: @ljharb

Was this page helpful?
0 / 5 - 0 ratings

Related issues

srl295 picture srl295  路  3Comments

loretoparisi picture loretoparisi  路  3Comments

filipesilvaa picture filipesilvaa  路  3Comments

vsemozhetbyt picture vsemozhetbyt  路  3Comments

addaleax picture addaleax  路  3Comments