Skip to content

Better detection that a value should be pushed#16

Merged
vmihailenco merged 1 commit intogo-sourcemap:masterfrom
mstoykov:fixMappingParsing
Nov 19, 2021
Merged

Better detection that a value should be pushed#16
vmihailenco merged 1 commit intogo-sourcemap:masterfrom
mstoykov:fixMappingParsing

Conversation

@mstoykov
Copy link
Contributor

This probably should get more tests, but I got this particular mapping while trying some things around grafana/k6#2082 and it turned out to totally not work because it was pointing to 1:0 in the original file.

The source map is generated from (a very old version of) babel so I think it's possible for something else to generate a similar source map and for it to not be parsed correctly.

{genLine: 7, genColumn: 30, sourceLine: 3, sourceColumn: 27, namesInd: -1},
{genLine: 7, genColumn: 31, sourceLine: 4, sourceColumn: 1, namesInd: -1},
{genLine: 7, genColumn: 32, sourceLine: 4, sourceColumn: 1, namesInd: -1},
{genLine: 9, genColumn: 0, sourceLine: 1, sourceColumn: 0, namesInd: -1},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line says that 9:0 should be mapped to 1:0 which does not make much sense...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's what babel generated and https://sokra.github.io/source-map-visualization/ works with it 🤷 it is actually pointing to the first line and the line is import .... so 🤷

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I guess generators are free to reorder the code...

@vmihailenco vmihailenco merged commit b07da1b into go-sourcemap:master Nov 19, 2021
@mstoykov mstoykov deleted the fixMappingParsing branch February 28, 2024 13:58
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

Successfully merging this pull request may close these issues.

2 participants