-
Notifications
You must be signed in to change notification settings - Fork 49.3k
[DevTools] Fix symbolication with Index Source Maps #34300
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
[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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: