MCPcopy Create free account
hub / github.com/ampproject/amphtml / checkSourcemapUrl

Function checkSourcemapUrl

build-system/tasks/check-sourcemaps.js:51–61  ·  view source on GitHub ↗

* Verifies that a correctly formatted sourcemap URL is present in v0.js.map. * * @param {!Object} sourcemapJson * @param {string} map The map filepath to check

(sourcemapJson, map)

Source from the content-addressed store, hash-verified

49 * @param {string} map The map filepath to check
50 */
51function checkSourcemapUrl(sourcemapJson, map) {
52 log('Inspecting', cyan('sourceRoot'), 'in', cyan(map) + '...');
53 if (!sourcemapJson.sourceRoot) {
54 log(red('ERROR:'), 'Could not find', cyan('sourceRoot'));
55 throw new Error('Could not find sourcemap URL');
56 }
57 if (!sourcemapJson.sourceRoot.match(sourcemapUrlMatcher)) {
58 log(red('ERROR:'), cyan(sourcemapJson.sourceRoot), 'is badly formatted');
59 throw new Error('Badly formatted sourcemap URL');
60 }
61}
62
63/**
64 * Verifies all the paths in the sources field are as expected.

Callers 1

checkSourceMapFunction · 0.85

Calls 3

cyanFunction · 0.85
redFunction · 0.85
logFunction · 0.50

Tested by

no test coverage detected