/* 1.*/ {
/* 2.*/ "version": 3,
/* 3.*/ "file": "out.js",
/* 4.*/ "sourceRoot": "",
/* 5.*/ "sources": ["foo.js", "bar.ts"],
/* 6.*/ "sourcesContent": [null, null],
/* 7.*/ "names": ["src", "maps", "are", "fun"],
/* 8.*/ "mappings": "A,AAAB;;ABCDE;",
/* 9.*/ "mediaTypes": ["application/javascript", "application/x.typescript;version=1.0.1.0"],
/*10.*/ "sourcesMediaTypes": [0, 1]
/*11.*/ }
Line 9: An optional array containing the set of each media type M such that there is a source whose associated media media type is M in the "sources" property. Media types must conform to https://www.rfc-editor.org/rfc/rfc6838.txt.
Line 10: An optional array whose elements correspond to a value in the "sources" property with the same ordinal index, and whose values are integers greater than or equal to 0 and represent an index of a media type in the "mediaTypes" property. The number of integers in the array must not exceed the length of the "sources" property. If there are fewer elements in the "sourceMediaTypes" property than the number of elements in the "sources" property, the last media type index should be used for the remaining sources. If all sources share the same media type, this property may be elided and the default value 0 should be used for all remaining sources.
To find a source S's associated media type:
- If the "mediaTypes" property does not exist, or is null or undefined,
- Return undefined.
- Let mediaTypeIndex be 0.
- If the "sourcesMediaTypes" property exists and is an array,
- Let sourceMediaTypeIndex be the index of S in the "sources" property.
- Let sourcesMediaTypesLength be the length of the "sourcesMediaTypes" property.
- If sourceMediaTypeIndex >= sourcesMediaTypesLength,
- Let sourceMediaTypeIndex be sourcesMediaTypesLength - 1.
- Let mediaTypeIndex be the integer at sourceMediaTypeIndex of the "sourcesMediaTypes" property.
- Let mediaTypesLength be the length of the "mediaTypes" property.
- If mediaTypeIndex >= mediaTypesLength,
- Let mediaTypeIndex = mediaTypesLength - 1.
- Return the media type at mediaTypeIndex of the "mediaTypes" property.
Note that in the above algorithm, lists of size N are indexed from 0 to N-1.