jk
jk copied to clipboard
Add source map support
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.
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
Made std.js readable, so exceptions in the standard library are now readable! that alleviates the immediate need for sourcemaps. See PR #84.