* Extracts the source url from the content if present. For example * //# sourceURL=file:///path/to/file * * Read more at: https://tc39.es/source-map-spec/#linking-evald-code-to-named-generated-code * @param {string} content - source content * @returns {string | null} source url or null if not p
(content)
| 103 | * @returns {string | null} source url or null if not present |
| 104 | */ |
| 105 | function extractSourceURLMagicComment(content) { |
| 106 | let match; |
| 107 | let matchSourceURL; |
| 108 | // A while loop is used here to get the last occurrence of sourceURL. |
| 109 | // This is needed so that we don't match sourceURL in string literals. |
| 110 | while ((match = RegExpPrototypeExec(kSourceURLMagicComment, content))) { |
| 111 | matchSourceURL = match; |
| 112 | } |
| 113 | if (matchSourceURL == null) { |
| 114 | return null; |
| 115 | } |
| 116 | let sourceURL = matchSourceURL.groups.sourceURL; |
| 117 | if (sourceURL != null && RegExpPrototypeExec(kLeadingProtocol, sourceURL) === null) { |
| 118 | sourceURL = pathToFileURL(sourceURL).href; |
| 119 | } |
| 120 | return sourceURL; |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * Extracts the source map url from the content if present. For example |
no test coverage detected
searching dependent graphs…