MCPcopy Index your code
hub / github.com/nodejs/node / extractSourceMapURLMagicComment

Function extractSourceMapURLMagicComment

lib/internal/source_map/source_map_cache.js:131–143  ·  view source on GitHub ↗

* Extracts the source map url from the content if present. For example * //# sourceMappingURL=file:///path/to/file * * Read more at: https://tc39.es/source-map-spec/#linking-generated-code * @param {string} content - source content * @returns {string | null} source map url or null if not presen

(content)

Source from the content-addressed store, hash-verified

129 * @returns {string | null} source map url or null if not present
130 */
131function extractSourceMapURLMagicComment(content) {
132 let match;
133 let lastMatch;
134 // A while loop is used here to get the last occurrence of sourceMappingURL.
135 // This is needed so that we don't match sourceMappingURL in string literals.
136 while ((match = RegExpPrototypeExec(kSourceMappingURLMagicComment, content))) {
137 lastMatch = match;
138 }
139 if (lastMatch == null) {
140 return null;
141 }
142 return lastMatch.groups.sourceMappingURL;
143}
144
145/**
146 * Caches the source map, with the given filename, moduleInstance, sourceURL and sourceMapURL.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…