* 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)
| 50 | * @return {string} |
| 51 | */ |
| 52 | function 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 | |
| 64 | module.exports = { |
| 65 | massageSourcemaps, |
no test coverage detected