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

Function dataFromUrl

lib/internal/source_map/source_map_cache.js:237–255  ·  view source on GitHub ↗

* Resolves source map payload data from the source url and source map url. * If the source map url is a data url, the data is returned. * Otherwise the source map url is resolved to a file path and the file is read. * @param {string} sourceURL - url of the source file * @param {string} sourceMap

(sourceURL, sourceMappingURL)

Source from the content-addressed store, hash-verified

235 * @returns {object} deserialized source map JSON object
236 */
237function dataFromUrl(sourceURL, sourceMappingURL) {
238 const url = URLParse(sourceMappingURL);
239
240 if (url != null) {
241 switch (url.protocol) {
242 case 'data:':
243 return sourceMapFromDataUrl(sourceURL, url.pathname);
244 default:
245 debug(`unknown protocol ${url.protocol}`);
246 return null;
247 }
248 }
249
250 const mapURL = URLParse(sourceMappingURL, sourceURL);
251 if (mapURL === null) {
252 return null;
253 }
254 return sourceMapFromFile(mapURL);
255}
256
257// Cache the length of each line in the file that a source map was extracted
258// from. This allows translation from byte offset V8 coverage reports,

Callers 1

maybeCacheSourceMapFunction · 0.85

Calls 3

sourceMapFromDataUrlFunction · 0.85
sourceMapFromFileFunction · 0.85
debugFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…