awslabs / llrt

LLRT (Low Latency Runtime) is an experimental, lightweight JavaScript runtime designed to address the growing demand for fast and efficient Serverless applications.
Apache License 2.0
7.98k stars 351 forks source link

SourceMap Support #43

Open m-rph opened 9 months ago

m-rph commented 9 months ago

Sourcemaps are currently not supported meaning that stack traces will be from transpiled JS sources. This is not ideal for debugging purposes.

The parcel bundler has implemented support for source maps in a rust package. Its not available on crates.io but the logic of deserializing a sourcemap is not very complicated.

https://github.com/parcel-bundler/source-map/tree/master/parcel_sourcemap

Here is explanation of sourcemaps: https://www.bugsnag.com/blog/source-maps/

If this could be implemented without pulling in serde json dependency it would be ideal since the QuickJS engine already has a build in json parser

MisterJimson commented 7 months ago

Can't sourcemaps be handled at the bundler level? What does llrt need to do?

richarddavison commented 7 months ago

Can't sourcemaps be handled at the bundler level? What does llrt need to do?

It can! It would just be convenient. But ideally, source maps should stay of the deployment artifacts in Lambda as they add size that needs to pulled in to the execution environment, which adds time. Users can get the original source by using offline approach instead like https://www.npmjs.com/package/source-map-cli