jk icon indicating copy to clipboard operation
jk copied to clipboard

Add source map support

Open dlespiau opened this issue 5 years ago • 2 comments

When an exception is being raised from the js part of the std library, it references the one line of the bundled & minimised bit of code our sdt lib is compiled down to.

More generally, we should support source maps, whether it's to decode std library exceptions or external libraries that have been minified.

dlespiau avatar Nov 12 '18 18:11 dlespiau

Implementation notes:

  • it's easy to get terser to generate a source map for you, and it'll be included in the baked-in assets
  • but: V8 won't use it by default -- to actually get it into stack traces, you have to use something that uses https://v8.dev/docs/stack-trace-api
    • https://github.com/evanw/node-source-map-support
    • https://github.com/gajus/get-stack-trace
    • (just for interpreting the format) https://github.com/mozilla/source-map
  • ideally it'd only consult the source map (which needs parsing, etc.) when necessary

squaremo avatar Dec 12 '18 15:12 squaremo

Made std.js readable, so exceptions in the standard library are now readable! that alleviates the immediate need for sourcemaps. See PR #84.

dlespiau avatar Jan 07 '19 17:01 dlespiau