You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 24, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: source-map-rev3.md
+13-5Lines changed: 13 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,11 +19,13 @@ August 18, 2011 | John Lenz | Draft
19
19
May 2, 2012 | John Lenz | HTTP header and CC-BY-SA license
20
20
July 30, 2012 | John Lenz | Modified recommended HTTP header name.
21
21
August 20, 2012 | John Lenz | Add CSS linkage recommendation
22
+
October 24, 2012 | John Lenz | Add clarifying section on source locations.
22
23
23
24
## License
24
25
25
26
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License](http://creativecommons.org/licenses/by-sa/3.0/).
26
27
28
+
27
29
## Background
28
30
29
31
The original source map format (v1) was created by Joseph Schorr for use by Closure Inspector to enable source level debugging of optimized JavaScript code (although the format itself is language agnostic). However, as the size of the projects using the source maps expanded the verbosity of the format started to be become a problem. The v2 was created trading some simplicity and flexibility to reduce to overall size of the source map. Even with the changes made with the v2 version of the format, the source map file size was limiting its usefulness. The v3 format is based on suggestions made by podivilov.
@@ -41,7 +44,7 @@ Original Source | The source code which has not been passed through the compiler
41
44
Base 64 VLQ | The <ahref="http://en.wikipedia.org/wiki/Variable-length_quantity">VLQ</a> is a<ahref="http://en.wikipedia.org/wiki/Base64"> Base64</a> value, where the most significant bit (the 6th bit) is used as the continuation bit, and the “digits” are encoded into the string least significant first, and where the least significant bit of the first digit is used as the sign bit.<p>Note: The values that can be represent by the VLQ Base64 encoded are limited to 32 bit quantities until some use case for larger values is presented.
42
45
Source Mapping URL | The URL referencing the location of a source map from the generated code.
43
46
44
-
## Revision 3 format
47
+
## Revision 3 Format
45
48
46
49
47
50
### General Goals
@@ -53,7 +56,7 @@ Source Mapping URL | The URL referencing the location of a source map from the g
53
56
* Support server side stack trace deobfuscation
54
57
55
58
56
-
### Proposed format
59
+
### Proposed Format
57
60
58
61
59
62
@@ -76,11 +79,11 @@ Line 4: An optional source root, useful for relocating source files on a server
76
79
77
80
Line 5: A list of original sources used by the “mappings” entry.
78
81
79
-
Line 6: A list of symbol names used by the “mapping” entry.
82
+
Line 6: A list of symbol names used by the “mappings” entry.
80
83
81
84
Line 7: A string with the encoded mapping data.
82
85
83
-
The “mapping” data is broken down as follows:
86
+
The “mappings” data is broken down as follows:
84
87
85
88
86
89
@@ -101,6 +104,11 @@ The fields in each segment are:
101
104
Note: This encoding reduces the source map size 50% relative to the V2 format in tests performed using Google Calendar.
102
105
103
106
107
+
#### Resolving Sources
108
+
109
+
If the sources are not absolute URLs after prepending of the “sourceRoot”, the sources are resolved relative to the SourceMap (like resolving script src in a html document).
110
+
111
+
104
112
#### Encoding
105
113
106
114
For simplicity, the character set encoding is always UTF-8.
@@ -143,7 +151,7 @@ To support concatenating generated code and other common post processing, an alt
0 commit comments