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

Function getSourceRoot

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

* Computes the base url for sourcemaps. Custom sourcemap URLs have placeholder * {version} that should be replaced with the actual version. Also, ensures * that a trailing slash exists. * @param {object} options * @return {string}

(options)

Source from the content-addressed store, hash-verified

50 * @return {string}
51 */
52function getSourceRoot(options) {
53 if (argv.sourcemap_url) {
54 return String(argv.sourcemap_url)
55 .replace(/\{version\}/g, internalRuntimeVersion)
56 .replace(/([^/])$/, '$1/');
57 }
58 if (options.fortesting || !argv._.includes('dist')) {
59 return 'http://localhost:8000/';
60 }
61 return `https://raw.githubusercontent.com/ampproject/amphtml/${internalRuntimeVersion}/`;
62}
63
64module.exports = {
65 massageSourcemaps,

Callers 1

massageSourcemapsFunction · 0.70

Calls 2

StringFunction · 0.50
replaceMethod · 0.45

Tested by

no test coverage detected