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
+12-11Lines changed: 12 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,7 @@ August 20, 2012 | John Lenz | Add CSS linkage recommendation
22
22
October 24, 2012 | John Lenz | Add clarifying section on source locations.
23
23
February 19, 2013 | John Lenz | Add “sourcesContent” line to support self contained source maps.<p>Added note regarding using data uri to load source maps.
24
24
May 16, 2013 | John Lenz | Updated linking convention to use # instead of @. @ conflicts with internet explorer’s conditional code
25
+
November 18, 2013 | John Lenz | Noted that “file” is an optional field.<p>Minor typographical corrections
25
26
26
27
## License
27
28
@@ -68,26 +69,26 @@ Source Mapping URL | The URL referencing the location of a source map from the g
68
69
69
70
70
71
1.`{`
71
-
2.`version : 3,`
72
-
3.`file: "out.js",`
73
-
4.`sourceRoot: "",`
74
-
5.`sources: ["foo.js", "bar.js"],`
75
-
6.`sourcesContent: [null, null],`
76
-
7.`names: ["src", "maps", "are", "fun"],`
77
-
8.`mappings: "AA,AB;;ABCDE;"`
72
+
2.`"version" : 3,`
73
+
3.`"file": "out.js",`
74
+
4.`"sourceRoot": "",`
75
+
5.`"sources": ["foo.js", "bar.js"],`
76
+
6.`"sourcesContent": [null, null],`
77
+
7.`"names": ["src", "maps", "are", "fun"],`
78
+
8.`"mappings": "A,AAAB;;ABCDE;"`
78
79
9.`}`
79
80
80
81
Line 1: The entire file is a single JSON object
81
82
82
83
Line 2: File version (always the first entry in the object) and must be a positive integer.
83
84
84
-
Line 3: The name of the generated code that this source map is associated with.
85
+
Line 3: An optional name of the generated code that this source map is associated with.
85
86
86
87
Line 4: An optional source root, useful for relocating source files on a server or removing repeated values in the “sources” entry. This value is prepended to the individual entries in the “source” field.
87
88
88
89
Line 5: A list of original sources used by the “mappings” entry.
89
90
90
-
Line 6: An optional list of source content, useful when the “source” can’t be hosted. The contents are listed in the same order as the sources in line 5. “null” may be used of some original sources should be retrieved by name.
91
+
Line 6: An optional list of source content, useful when the “source” can’t be hosted. The contents are listed in the same order as the sources in line 5. “null” may be used if some original sources should be retrieved by name.
91
92
92
93
Line 7: A list of symbol names used by the “mappings” entry.
93
94
@@ -218,7 +219,7 @@ The generated code may include a line at the end of the source, with the followi
218
219
```
219
220
220
221
221
-
Note: The prefix for this annotation was initially “//@” however this conflicts with Internet Explorer’s conditional comments and was changed to “//#”. It is reasonable for tools to also accept “//@” but “//#” is preferred.
222
+
Note: The prefix for this annotation was initially “//@” however this conflicts with Internet Explorer’s Conditional Compilation and was changed to “//#”. It is reasonable for tools to also accept “//@” but “//#” is preferred.
222
223
223
224
This recommendation works well for JavaScript, it is expected that other source files will have other conventions:
224
225
@@ -243,7 +244,7 @@ Regardless of the method used to retrieve the source mapping URL the same proces
243
244
244
245
245
246
246
-
* If the generated source is not associated with a script element that has a “src” attribute and there exists a `//@sourceURL` comment in the generated code, that comment should be used to determine the source origin.
247
+
* If the generated source is not associated with a script element that has a “src” attribute and there exists a `//# sourceURL` comment in the generated code, that comment should be used to determine the source origin. Note: Previously, this was “//@ sourceURL”, as with “//@ sourceMappingURL”, it is reasonable to accept both but //# is preferred.
247
248
* If the generated code is associated with a script element and the script element has a “src” attribute, the “src” attribute of the script element will be the source origin.
248
249
* If the generated code is associated with a script element and the script element does not have a “src” attribute, then the source origin will be the page’s origin.
249
250
* If the generated code is being evaluated as a string with the `eval()` function or via `new Function()`, then the source origin will be the page’s origin.
0 commit comments