Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework debug id injection #1670

Closed
4 tasks done
Tracked by #71
loewenheim opened this issue Jul 7, 2023 · 0 comments
Closed
4 tasks done
Tracked by #71

Rework debug id injection #1670

loewenheim opened this issue Jul 7, 2023 · 0 comments
Assignees

Comments

@loewenheim
Copy link
Contributor

loewenheim commented Jul 7, 2023

Injection is incredibly buggy, mostly because we only inject at a line boundary, even though sometimes the correct place is in the middle of a line. This creates frustration for users and hurts debug id adoption. Splitting lines apart would mean we would need to edit the sourcemap in a nontrivial way, however.

A possible way forward—my preferred option, if it works out the way I imagine it—is as follows.

  1. Use the Rust port of magic-string to inject in exactly the right place and generate a sourcemap from the injected file to the pre-injected one. In my preliminary tests this works nicely.
  2. Add a composition operation to rust-sourcemap. Given a sourcemap ab.map from file a to file b and a sourcemap bc.map from file b to files c₁, …, cₙ, this would produce a sourcemap ac.map from a to c₁, …, cₙ by composing the mappings from ab.map and bc.map.
  3. Compose the sourcemap obtained in (1) with the one we already have to obtain a correct sourcemap from the injected file to the unminified files.

Tasks

  1. accepted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant