src/FileUpdater.js
function mergePathMaps(sourceMaps, targetMap, targetDir) {
    // Merge multiple source maps together, along with target path info.
    // Entries in later source maps override those in earlier source maps.
    // Target stats will be filled in below for targets that exist.
    var pathMap = {};
    sourceMaps.forEach(function (sourceMap) {
        Object.keys(sourceMap).forEach(function(sourceSubPath){
            var sourceEntry = sourceMap[sourceSubPath];
            pathMap[sourceSubPath] = {
                targetPath: path.join(targetDir, sourceSubPath),
                targetStats: null,
                sourcePath: path.join(sourceEntry.subDir, sourceSubPath),
                sourceStats: sourceEntry.stats
            };
        });
    });

    // Fill in target stats for targets that exist, and create entries
    // for targets that don't have any corresponding sources.
    Object.keys(targetMap).forEach(function(subPath){
        var entry = pathMap[subPath];
        if (entry) {
            entry.targetStats = targetMap[subPath].stats;
        } else {
            pathMap[subPath] = {
                targetPath: path.join(targetDir, subPath),
                targetStats: targetMap[subPath].stats,
                sourcePath: null,
                sourceStats: null
            };
        }
    });

    return pathMap;
}
function mergePathMaps(sourceMaps, targetMap, targetDir) {
    // Merge multiple source maps together, along with target path info.
    // Entries in later source maps override those in earlier source maps.
    // Target stats will be filled in below for targets that exist.
    var pathMap = {};
    sourceMaps.forEach(function (sourceMap) {
        Object.keys(sourceMap).forEach(function(sourceSubPath){
            var sourceEntry = sourceMap[sourceSubPath];
            pathMap[sourceSubPath] = {
                targetPath: path.join(targetDir, sourceSubPath),
                targetStats: null,
                sourcePath: path.join(sourceEntry.subDir, sourceSubPath),
                sourceStats: sourceEntry.stats
            };
        });
    });

    // Fill in target stats for targets that exist, and create entries
    // for targets that don't have any corresponding sources.
    Object.keys(targetMap).forEach(function(subPath){
        var entry = pathMap[subPath];
        if (entry) {
            entry.targetStats = targetMap[subPath].stats;
        } else {
            pathMap[subPath] = {
                targetPath: path.join(targetDir, subPath),
                targetStats: targetMap[subPath].stats,
                sourcePath: null,
                sourceStats: null
            };
        }
    });

    return pathMap;
}
function mergePathMaps ( sourceMaps , targetMap , targetDir ) { // Merge multiple source maps together, along with target path info. // Entries in later source maps override those in earlier source maps. // Target stats will be filled in below for targets that exist. var pathMap = { } ; sourceMaps . forEach ( function ( sourceMap ) { Object . keys ( sourceMap ) . forEach ( function ( sourceSubPath ) { var sourceEntry = sourceMap [ sourceSubPath ] ; pathMap [ sourceSubPath ] = { targetPath : path . join ( targetDir , sourceSubPath ) , targetStats : null , sourcePath : path . join ( sourceEntry . subDir , sourceSubPath ) , sourceStats : sourceEntry . stats } ; } ) ; } ) ; // Fill in target stats for targets that exist, and create entries // for targets that don't have any corresponding sources. Object . keys ( targetMap ) . forEach ( function ( subPath ) { var entry = pathMap [ subPath ] ; if ( entry ) { entry . targetStats = targetMap [ subPath ] . stats ; } else { pathMap [ subPath ] = { targetPath : path . join ( targetDir , subPath ) , targetStats : targetMap [ subPath ] . stats , sourcePath : null , sourceStats : null } ; } } ) ; return pathMap ; }
Merges together multiple source maps and a target map into a single mapping from
relative paths to objects with target and source paths and stats.
Merges together multiple source maps and a target map into a single mapping from relative paths to objects with target and source paths and stats .