DelSkayn / rquickjs

High level bindings to the quickjs javascript engine
MIT License
435 stars 59 forks source link

Source map for eval #219

Open stevefan1999-personal opened 9 months ago

stevefan1999-personal commented 9 months ago

Given that I embedded Typescript in my project (just like Deno and Bun), I noticed the line mappings are often wrong if there is any error printed to the console. While swc does support source map, it seems like there is currently no way to supply that information. Maybe we need to find ways to fix that.

richarddd commented 9 months ago

There is this project which are pretty lightweight and in rust: https://github.com/parcel-bundler/source-map/tree/master/parcel_sourcemap

Maybe something that could be added behind a feature flag? Problem tho is that how would we find the source map? Since you have to implement a loader for loading the js we have to have a similar mechanism to locate/load the sourcemap

richarddd commented 9 months ago

@stevefan1999-personal the biggest blocker for this right now is that there is no column number support for quickjs. I'm currently working on a PR to apply that patch so we can get column numbers from exceptions.

ahaoboy commented 4 months ago

@richarddd quickjs-ng supports this feature., compared to implementing this functionality using patches, supporting the switching of different engines may be more reliable and versatile. The engines mentioned in these two issues (https://github.com/DelSkayn/rquickjs/issues/271 https://github.com/DelSkayn/rquickjs/issues/126) maintain a high level of compatibility with QuickJS, so successful compilation should only require minor modifications to the build.rs file.