next.js
c1f4e3e7 - Turbopack: fix sourcemaps of scopehoisted comments (#80987)

Commit
229 days ago
Turbopack: fix sourcemaps of scopehoisted comments (#80987) There was a bug in the source mappings for scope hoisted comments. They actually contained invalid mappings, which was only caught by the invalid mapping landing exactly on an invalid multibyte character boundary, which triggered a debug assertion: ![Bildschirmfoto 2025-06-27 um 10 01 15](https://github.com/user-attachments/assets/90cd7771-72c2-41ea-bc54-05b3be5f17f7) What's happening is: 1. You do `comments.add_leading` with a `Comment` containing the real span 2. Traverse the AST and encode all bytepos in the soans 3. codegen, the bytepos in the AST are encoded, but the ones in the comments (Comment.span) are not (i.e. via `comments.take_leading` Now, they are all consistently encoded and correctly mapped: ![Bildschirmfoto 2025-06-27 um 10 02 47](https://github.com/user-attachments/assets/90b4bb58-e946-4781-b498-d88668193107)
Author
Parents
Loading