Skip to content
This repository was archived by the owner on Jun 24, 2024. It is now read-only.

Commit 5508ea8

Browse files
concavelenzfitzgen
authored andcommitted
Source Map Revision 3 Proposal as of 2012-10-24
Co-authored-by: John Lenz <[email protected]> Co-authored-by: Nick Fitzgerald <[email protected]>
1 parent ee581fc commit 5508ea8

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

source-map-rev3.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ August 18, 2011 | John Lenz | Draft
1919
May 2, 2012 | John Lenz | HTTP header and CC-BY-SA license
2020
July 30, 2012 | John Lenz | Modified recommended HTTP header name.
2121
August 20, 2012 | John Lenz | Add CSS linkage recommendation
22+
October 24, 2012 | John Lenz | Add clarifying section on source locations.
2223

2324
## License
2425

2526
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License](http://creativecommons.org/licenses/by-sa/3.0/).
2627

28+
2729
## Background
2830

2931
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.
@@ -32,6 +34,7 @@ Related documents:
3234

3335
[Revision 2 proposal](https://docs.google.com/document/d/1xi12LrcqjqIHTtZzrzZKmQ3lbTv9mKrN076UB-j3UZQ/edit?hl=en_US)
3436

37+
3538
## Terminology
3639

3740
Term | Definition
@@ -41,7 +44,7 @@ Original Source | The source code which has not been passed through the compiler
4144
Base 64 VLQ | The <a href="http://en.wikipedia.org/wiki/Variable-length_quantity">VLQ</a> is a<a href="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.
4245
Source Mapping URL | The URL referencing the location of a source map from the generated code.
4346

44-
## Revision 3 format
47+
## Revision 3 Format
4548

4649

4750
### General Goals
@@ -53,7 +56,7 @@ Source Mapping URL | The URL referencing the location of a source map from the g
5356
* Support server side stack trace deobfuscation
5457

5558

56-
### Proposed format
59+
### Proposed Format
5760

5861

5962

@@ -76,11 +79,11 @@ Line 4: An optional source root, useful for relocating source files on a server
7679

7780
Line 5: A list of original sources used by the “mappings” entry.
7881

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.
8083

8184
Line 7: A string with the encoded mapping data.
8285

83-
The “mapping” data is broken down as follows:
86+
The “mappings” data is broken down as follows:
8487

8588

8689

@@ -101,6 +104,11 @@ The fields in each segment are:
101104
Note: This encoding reduces the source map size 50% relative to the V2 format in tests performed using Google Calendar.
102105

103106

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+
104112
#### Encoding
105113

106114
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
143151
9. ` file: "section.js",`
144152
10. ` sources: ["foo.js", "bar.js"],`
145153
11. ` names: ["src", "maps", "are", "fun"],`
146-
12. ` mappings: "AA,AB;;ABCDE;"`
154+
12. ` mappings: "AAAA,E;;ABCDE;"`
147155
13. ` }`
148156
14. ` }`
149157
15. `],`

0 commit comments

Comments
 (0)