mattinsler/longjohn

Interoperability with Traceur call stacks

Opened this issue · 1 comments

Example: https://gist.github.com/OliverJAsh/fd98c53b62eaa32f5e56

Without longjohn:

❯ node traceur-runner.js main.js

/Users/Oliver/Development/tmp/traceur-longjohn/<compileSource>:5
var bar = () => { throw new Error('foo'); };
                        ^
Error: foo
    at bar (/Users/Oliver/Development/tmp/traceur-longjohn/<compileSource>:5:25)
    at [object Object].foo [as _onTimeout] (/Users/Oliver/Development/tmp/traceur-longjohn/<compileSource>:7:67)
    at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)

With longjohn:

❯ node traceur-runner.js main.js
Error: foo
    at bar (/Users/Oliver/Development/tmp/traceur-longjohn/main.js:5:9)
    at foo (/Users/Oliver/Development/tmp/traceur-longjohn/main.js:10:22)
    at listOnTimeout (timers.js:112:15)
---------------------------------------------
    at foo (/Users/Oliver/Development/tmp/traceur-longjohn/main.js:9:12)
    at new Promise (eval at eval at <anonymous> (/Users/Oliver/Development/tmp/traceur-longjohn/node_modules/traceur/src/node/traceur.js:24:17))
    at foo (/Users/Oliver/Development/tmp/traceur-longjohn/main.js:8:10)
    at Object.<anonymous> (/Users/Oliver/Development/tmp/traceur-longjohn/main.js:14:1)
    at Module._compile (module.js:456:26)
    at Module._extensions..js (/Users/Oliver/Development/tmp/traceur-longjohn/node_modules/traceur/src/node/require.js:65:21)
    at Module.load (module.js:356:32)
    at Module._load (module.js:312:12)

When longjohn is enabled, the generated call stack does not respect Traceur’s call stack, which is resolved against the source maps using by traceur-source-maps. Notice how the first few lines of the longjohn call stack do not match the mappings of the original.

What is the happy path to using longjohn with Traceur? Is this something we can fix?

I've also opened an issue on Traceur itself to discuss long stack traces: google/traceur-compiler#1481