MCPcopy
hub / github.com/ampproject/amphtml / massageSourcemaps

Function massageSourcemaps

build-system/tasks/sourcemaps.js:31–43  ·  view source on GitHub ↗

* @param {Array } mapChain * @param {string} destFile * @param {*} options * @return {object}

(mapChain, destFile, options)

Source from the content-addressed store, hash-verified

29 * @return {object}
30 */
31function massageSourcemaps(mapChain, destFile, options) {
32 const map = remapping(mapChain, () => null, !includeSourcesContent());
33 map.file = path.basename(destFile);
34 map.sourceRoot = getSourceRoot(options);
35 map.sources = map.sources.map((s) => {
36 // By default, sources are relative to the map. But we just added an
37 // absolute sourceRoot, and we do not want the file to be relative to that
38 // root.
39 return resolveUri(s || '', destFile);
40 });
41
42 return map;
43}
44
45/**
46 * Computes the base url for sourcemaps. Custom sourcemap URLs have placeholder

Callers 1

buildFunction · 0.85

Calls 2

includeSourcesContentFunction · 0.85
getSourceRootFunction · 0.70

Tested by

no test coverage detected