JsSourceMap Class
A source map (https://tc39.es/ecma426/, version 3): the positions of the original sources of a generated script, such as a bundle or the output of a compiler. Use it with a JsSourceMapper to show the errors of the script at their original positions.
public sealed class JsSourceMapProperties
| Name | Description |
|---|---|
| File | Gets the name of the generated file (the file field), or null. |
| Sources | Gets the URLs of the original sources: the sources field, prefixed by sourceRoot and resolved against the URL of the source map when they are relative. |
File
JsSourceMap.csSources
JsSourceMap.csGets the URLs of the original sources: the sources field, prefixed by sourceRoot and resolved against the URL of the source map when they are relative.
public IReadOnlyList<string> Sources { get; }Property value
Methods
| Name | Description |
|---|---|
| Parse(string, string?) | Parses a source map. |
| TryGetOriginalLocation(int, int, JsSourceLocation) | Gets the original position of a position of the generated code. |
| TryParse(string, string?, JsSourceMap?) | Parses a source map; returns false when the text is not a valid source map of version 3. |
Parse(string, string?)
JsSourceMap.csParses a source map.
public static JsSourceMap Parse(string json, string? url = null)Parameters
jsonstring- The JSON text of the source map.
urlstring?- The URL (or the path) of the source map, against which the relative URLs of the sources are resolved, or null.
Returns
Exceptions
FormatException- The text is not a valid source map of version 3.
TryGetOriginalLocation(int, int, JsSourceLocation)
JsSourceMap.csGets the original position of a position of the generated code.
public bool TryGetOriginalLocation(int line, int column, out JsSourceLocation location)Parameters
lineint- The 1-based line in the generated code.
columnint- The 1-based column (in UTF-16 code units) in the generated code.
locationJsSourceLocation- The original position: the URL of the original source, and the 1-based line and column of the mapping that contains the position.
Returns
bool false when no mapping contains the position, or when its mapping has no original source.
TryParse(string, string?, JsSourceMap?)
JsSourceMap.csParses a source map; returns false when the text is not a valid source map of version 3.
public static bool TryParse(string json, string? url, out JsSourceMap? sourceMap)Parameters
jsonstring- The JSON text of the source map.
urlstring?- The URL (or the path) of the source map, against which the relative URLs of the sources are resolved, or null.
sourceMapJsSourceMap?- The source map.