Even after reading the answers, explanations were still not so clear to me. Here is an explanation in plain english in case it helps someone:
something like ;;AAAA,IAAM,WAAW,SAAX;...
means <line0 info>;<line1 info>;...
so for ;;AAAA;IAAM,WAAW,SAAX;...
, line 0 and line 1 doesn't have any important info (empty spaces etc.)
then for line 2 we have AAAA,IAAM,WAAW,SAAX
we convert each of these groups to binary using the base64 character mapping:
BASE64_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
so we basically find the index in this BASE64_ALPHABET
above, and convert the index to 6-bit binary (6 bit because we use base64). eg. index of A is 0, so in 6 bit binary its 000000. so AAAA would be 000000 000000 000000 000000
then if we do this with IAAM
we get: 001000 000000 000000 001100
.
then this bit representation is the VLQ encoded version of 4 numbers. we start from the left block, remove the sign and continuation bit, keep the bits. and continue adding it bits while continuation bit is 1.
eg. 001000 is (cont)0100(sign)
so cont = 0 (no other block will be added to this number)
sign=0 (its positive)
bits = 0100 --> so it is 4 in decimal
-- note that we only remove sign bit for the first time. so if we had
101000 001000
we would say
0100 (cont=1, sign=0) 01000 (cont=0)
so we would have had +010001000 = 136
when we keep doing this, we will get these 4 numbers (continuation bit should be 0 exactly 4 times).
- AAAA would map to (0,0,0,0)
- IAAM would map to (4,0,0,6)
- WAAW would map to (11,0,0,11)
...
now, each of these mean relative numbers. so we correct those:
- AAAA actually points to: (0,0,0,0)
- IAAM actually points to: (0+4, 0+0, 0+0, 0+6) = (4,0,0,6)
- WAAW actually points to: (4+11, 0+0, 0+0, 6+11) = (15,0,0,17) // we added it where IAAAM was actually pointing to
...
so numbers (n1, n2, n3, n4) here stand for
- n1: column in generated code
- n2: corresponding source file index in "sources" array of sourceMapping output
- n3: line number in original code
- n4: column number in original code
we already knew which line this referred to from the beginning. so using the information we have above, we learned:
- AAAA: line 2, column 1 of generated code points to sources[0], line 0, column 0
- IAAM: line 2, column 4 of generated code points to sources[0], line 0, column 6
- WAAW: line 2, column 15 of generated code points to sources[0], line 0, column 17
...
two good sources about this: