Prevent JS source map builder from inserting overlapping mappings
Check if newly inserted mapping is in the same position within JS line and in this case omit the mapping
This commit is contained in:
@@ -127,14 +127,19 @@ public class SourceMap3Builder implements SourceMapBuilder {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addMapping(String source, int sourceLine, int sourceColumn) {
|
public void addMapping(String source, int sourceLine, int sourceColumn) {
|
||||||
if (previousGeneratedColumn == -1) {
|
boolean newGroupStarted = previousGeneratedColumn == -1;
|
||||||
|
if (newGroupStarted) {
|
||||||
previousGeneratedColumn = 0;
|
previousGeneratedColumn = 0;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
out.append(',');
|
|
||||||
}
|
|
||||||
|
|
||||||
int columnDiff = textOutput.getColumn() - previousGeneratedColumn;
|
int columnDiff = textOutput.getColumn() - previousGeneratedColumn;
|
||||||
|
if (!newGroupStarted && columnDiff == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!newGroupStarted) {
|
||||||
|
out.append(',');
|
||||||
|
}
|
||||||
|
|
||||||
// TODO fix sections overlapping
|
// TODO fix sections overlapping
|
||||||
// assert columnDiff != 0;
|
// assert columnDiff != 0;
|
||||||
Base64VLQ.encode(out, columnDiff);
|
Base64VLQ.encode(out, columnDiff);
|
||||||
|
|||||||
Reference in New Issue
Block a user