Yield unicode text lines from the js.map or css.map file at `location`. Spec is at: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit The format is: { "version" : 3, "file": "out.js", "sourceRoot": "",
(location)
| 221 | |
| 222 | |
| 223 | def js_map_sources_lines(location): |
| 224 | """ |
| 225 | Yield unicode text lines from the js.map or css.map file at `location`. |
| 226 | Spec is at: |
| 227 | https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit |
| 228 | The format is: |
| 229 | { |
| 230 | "version" : 3, |
| 231 | "file": "out.js", |
| 232 | "sourceRoot": "", |
| 233 | "sources": ["foo.js", "bar.js"], |
| 234 | "sourcesContent": [null, null], |
| 235 | "names": ["src", "maps", "are", "fun"], |
| 236 | "mappings": "A,AAAB;;ABCDE;" |
| 237 | } |
| 238 | We care only about the presence of these tags for detection: version, sources, sourcesContent. |
| 239 | """ |
| 240 | with io.open(location, encoding='utf-8') as jsm: |
| 241 | content = json.load(jsm) |
| 242 | sources = content.get('sourcesContent', []) |
| 243 | for entry in sources: |
| 244 | entry = replace_verbatim_cr_lf_chars(entry) |
| 245 | for line in entry.splitlines(): |
| 246 | l = remove_verbatim_cr_lf_tab_chars(line) |
| 247 | yield l |
| 248 | |
| 249 | |
| 250 | def as_unicode(line): |
no test coverage detected