import { BundleData } from '../../types/BundleData' ; import { Stats } from '../../types/Stats' ; import { deriveBundleData } from '../deriveBundleData/deriveBundleData' ; import diffGraph from './diffGraph' ; import { EnhancedModuleGraph } from './EnhancedModuleGraph' ; import diffChunkGroups from './diffChunkGroups' ; import { DataOptions } from '../../types/DataOptions' ; export function diff ( baseline , comparison , options ? ) { baseline = getBundleData ( baseline , options ) ; comparison = getBundleData ( comparison , options ) ; const results = diffChunkGroups ( baseline , comparison ) ; diffGraph ( new EnhancedModuleGraph ( baseline . graph ) , new EnhancedModuleGraph ( comparison . graph ) , results ) ; return results ; } function getBundleData ( data , options ) { return ( < BundleData > data ) . graph ? < BundleData > data : deriveBundleData ( < Stats > data , options ) ; }