[DevTools] Fix symbolication with Index Source Maps#34300
Conversation
| // The mappings in a Source Map section are relative to the section offset. | ||
| columnNumber: columnNumber - section.offsetColumn0, | ||
| lineNumber: lineNumber - section.offsetLine0, |
There was a problem hiding this comment.
This is the essence of the fix. The rest is just me being extra cautious with off-by-one errors. The implementation to find the relevant section is the same we're using in Next.js: https://github.com/vercel/next.js/blob/62f9611facd13ca7720b8fcfbc609c948a0563ba/packages/next/src/server/lib/source-maps.ts#L75-L97
There was a problem hiding this comment.
The rest is just me being extra cautious with off-by-one errors.
Absolutely the correct approach when dealing with source maps; thank you for that!
| +map: MixedSourceMap, | ||
| +offsetColumn0: number, | ||
| +offsetLine0: number, | ||
| +map: BasicSourceMap, |
There was a problem hiding this comment.
drive-by fix. Index Source Maps can't be nested: https://tc39.es/ecma426/#json-sections-map
| // The mappings in a Source Map section are relative to the section offset. | ||
| columnNumber: columnNumber - section.offsetColumn0, | ||
| lineNumber: lineNumber - section.offsetLine0, |
There was a problem hiding this comment.
The rest is just me being extra cautious with off-by-one errors.
Absolutely the correct approach when dealing with source maps; thank you for that!
Symbolicating with Index Source Maps needs to consider that the mappings in a section are relative to its offset.
Before:

After: