function generateBugs() {
const random = Math.random();
if (random < 0.3) {
undefined.someMethod();
} else if (random < 0.6) {
throw "this is an error";
} else {
console.log(sdffsf + fsdfssdfsf);
}
}
function generateBugs(){const s=Math.random();if(s<.3)(void 0).someMethod();else{if(s<.6)throw"this is an error";console.log(sdffsf+fsdfssdfsf)}}
From Source Map Revision 3 Proposal
Each segment is made up of 1,4 or 5 variable length fields.
So it seems like these are the valid formats:
The first format seems to be used to indicate that a segment was not present in the original file.
The zero-based starting column of the line in the generated code that the segment represents. If this is the first field of the first segment, or the first segment following a new generated line (“;”), then this field holds the whole base 64 VLQ. Otherwise, this field contains a base 64 VLQ that is relative to the previous occurrence of this field. Note that this is different than the fields below because the previous value is reset after every generated line.
So basically this is the number of characters between this and the last segement. The segement at the start of a line is relative to the start of the line.
If present, an zero-based index into the “sources” list. This field is a base 64 VLQ relative to the previous occurrence of this field, unless this is the first occurrence of this field, in which case the whole value is represented.
Not needed if the sourcemap is for a single source
If present, the zero-based starting line in the original source represented. This field is a base 64 VLQ relative to the previous occurrence of this field, unless this is the first occurrence of this field, in which case the whole value is represented. Always present if there is a source field.
If present, the zero-based starting column of the line in the source represented. This field is a base 64 VLQ relative to the previous occurrence of this field, unless this is the first occurrence of this field, in which case the whole value is represented. Always present if there is a source field.
If present, the zero-based index into the “names” list associated with this segment. This field is a base 64 VLQ relative to the previous occurrence of this field, unless this is the first occurrence of this field, in which case the whole value is represented.
You need this if you want to deobfuscate stack traces