Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function normalizeProduction()
{
// FIXME: Testing the file path is kind of expensive. This should be
// cached, and files in js/packages shouldn't be tested
return System.normalize.apply(this, arguments).then(function (result)
{
var resultPath = getAbsolutePathFromFileURL(result);
if (resultPath === null)
return result;
var basename = path.basename(resultPath);
var productionized = basename.replace(/^(.*)(\.[^.]+)$/, '$1.production$2');
// Bail if deriving the production name failed
if (productionized === basename)
return result;
var productionPath = path.join(path.dirname(resultPath), productionized);
// Test the path and return resolve with the productionized version if it