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

Function getSourceRoot

build-system/compile/helpers.js:13–23  ·  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

11 * @return {string}
12 */
13function getSourceRoot(options) {
14 if (argv.sourcemap_url) {
15 return String(argv.sourcemap_url)
16 .replace(/\{version\}/g, internalRuntimeVersion)
17 .replace(/([^/])$/, '$1/');
18 }
19 if (options.fortesting || !argv._.includes('dist')) {
20 return 'http://localhost:8000/';
21 }
22 return `https://raw.githubusercontent.com/ampproject/amphtml/${internalRuntimeVersion}/`;
23}
24
25module.exports = {getSourceRoot};

Callers

nothing calls this directly

Calls 2

StringFunction · 0.50
replaceMethod · 0.45

Tested by

no test coverage detected