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

Commit

Permalink
Source Map Revision 3 Proposal as of 2021-09-09
Browse files Browse the repository at this point in the history
Co-authored-by: John Lenz <johnlenz@google.com>
  • Loading branch information
concavelenz authored and jkrems committed Jan 25, 2022
1 parent c75342c commit 8b3e5f0
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions source-map-rev3.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ To discuss or propose changes to this specification, please use the dev-js-sourc

## Background

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

Related documents:

Expand All @@ -45,6 +45,7 @@ Related documents:

## Terminology


Term | Definition
--- | ---
Generated Code | The code which is generated by the compiler.
Expand Down Expand Up @@ -137,7 +138,7 @@ Additional fields may be added to the top level source map provided the fields b

##### Known Extensions

“x_google_linecount” - the number of line represented by this source map.
“x_google_linecount” - the number of lines represented by this source map.


#### Notes
Expand All @@ -152,17 +153,17 @@ To support concatenating generated code and other common post processing, an alt


1. `{`
2. `version : 3,`
3. `file: "app.js",`
4. `sections: [`
5. ` { offset: {line:0, column:0}, url: "url_for_part1.map" }`
6. ` { offset: {line:100, column:10}, map: `
2. `"version" : 3,`
3. `"file": "app.js",`
4. `"sections": [`
5. ` { "offset": {"line":0, "column":0}, "url": "url_for_part1.map" }`
6. ` { "offset": {"line":100, "column":10}, "map": `
7. ` {`
8. ` version : 3,`
9. ` file: "section.js",`
10. ` sources: ["foo.js", "bar.js"],`
11. ` names: ["src", "maps", "are", "fun"],`
12. ` mappings: "AAAA,E;;ABCDE;"`
8. ` "version" : 3,`
9. ` "file": "section.js",`
10. ` "sources": ["foo.js", "bar.js"],`
11. ` "names": ["src", "maps", "are", "fun"],`
12. ` "mappings": "AAAA,E;;ABCDE;"`
13. ` }`
14. ` }`
15. `],`
Expand Down Expand Up @@ -256,13 +257,13 @@ There is an existing convention that should be supported for the use of source m


```
//@ sourceURL=foo.js
//# sourceURL=foo.js
```


It is described here:

[http://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/](http://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/)
[https://web.archive.org/web/20120814122523/http://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/](https://web.archive.org/web/20120814122523/http://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/)


### Language Neutral Stack Mapping Notes
Expand Down

0 comments on commit 8b3e5f0

Please sign in to comment.