import { BundleData } from '../../types/BundleData' ; import { DiffResults } from '../../types/DiffResults' ; export default function diffChunkGroups ( baseline , comparison ) { const results = { } ; const allChunkGroups = new Set ( [ ... Object . keys ( baseline . chunkGroups ) , ... Object . keys ( comparison . chunkGroups ) , ] ) ; for ( let chunkGroupName of allChunkGroups ) { const baselineChunkGroup = baseline . chunkGroups [ chunkGroupName ] ; const comparisonChunkGroup = comparison . chunkGroups [ chunkGroupName ] ; let delta ; if ( ! baselineChunkGroup ) { delta = comparisonChunkGroup . size ; } else if ( ! comparisonChunkGroup ) { delta = - baselineChunkGroup . size ; } else { delta = comparisonChunkGroup . size - baselineChunkGroup . size ; } results [ chunkGroupName ] = { delta , added : [ ] , removed : [ ] , changed : [ ] } ; } return results ; }