MCPcopy Create free account
hub / github.com/SAP/ui5-builder / extractAndRemoveSourceMappingUrl

Function extractAndRemoveSourceMappingUrl

lib/processors/minifier.js:67–84  ·  view source on GitHub ↗
(resource)

Source from the content-addressed store, hash-verified

65}
66
67async function extractAndRemoveSourceMappingUrl(resource) {
68 const resourceContent = await resource.getString();
69 const resourcePath = resource.getPath();
70 const sourceMappingUrlMatch = resourceContent.match(sourceMappingUrlPattern);
71 if (sourceMappingUrlMatch) {
72 const sourceMappingUrl = sourceMappingUrlMatch[1];
73 if (log.isLevelEnabled("silly")) {
74 log.silly(`Found source map reference in content of resource ${resourcePath}: ${sourceMappingUrl}`);
75 }
76
77 // Strip sourceMappingURL from the resource to be minified
78 // It is not required anymore and will be replaced for in the minified resource
79 // and its debug variant anyways
80 resource.setString(resourceContent.replace(sourceMappingUrlPattern, ""));
81 return sourceMappingUrl;
82 }
83 return null;
84}
85
86async function getSourceMapFromUrl({sourceMappingUrl, resourcePath, readFile}) {
87 // =======================================================================

Callers 1

minifier.jsFile · 0.85

Calls 1

getPathMethod · 0.80

Tested by

no test coverage detected