getsentry / rust-sourcemap

A library for rust that implements basic sourcemap handling
Other
224 stars 28 forks source link

feat: Implement sourcemap composition #67

Closed loewenheim closed 1 year ago

loewenheim commented 1 year ago

only a partial review. this is very hard to digest.

I know. Thank you for your comments :)

how does it compare with other imlementations that exist in the JS ecosystem?

I'll do my best to understand at least remapping and compare them. So far I haven't found it easy to understand the code.

loewenheim commented 1 year ago

You're right that the use case is very narrow. I'll try to think of more descriptive names!

loewenheim commented 1 year ago

This PR now includes test cases for debug id injection (the intended use case) as well as a property-based test showing the following: If we edit a string s into t (with sourcemap m₁: t -> s) and then edit t into u (with sourcemap m₂: u -> t), then SourceMap::adjust_mappings(m₁, m₂) is the same sourcemap that we would get if we did the edits from s to u in one go, with the following restriction: The first edits (from s to t) must only happen within lines, and the second edits (from t to u) must only happen to whole lines.