import Fs from 'fs' ; import LodashMerge from 'lodash.merge' ; import MetroConfig from 'metro-config/src/defaults' ; import BootstrapService from './services/bootstrap.service' ; import { EvaConfig } from './services/eva-config.service' ; import ProjectService from './services/project.service' ; type MetroConfigType = any ; const defaultMetroConfig = MetroConfig . getDefaultValues ( ) ; const customMappingWatchOptions = { interval : 100 , } ; param { EvaConfig } evaConfig see { EvaConfig } param metroConfig link returns example export const create = ( evaConfig , metroConfig ? ) : MetroConfigType => { const handleMetroEvent = ( event ) : void => { const reporter = metroConfig && metroConfig . reporter || defaultMetroConfig . reporter ; if ( reporter && reporter . update ) { reporter . update ( event ) ; } if ( event . type === 'initialize_started' ) { BootstrapService . run ( evaConfig ) ; const customMappingPath = ProjectService . resolvePath ( evaConfig . customMappingPath ) ; const customMappingExists = Fs . existsSync ( customMappingPath ) ; if ( customMappingExists && ( evaConfig . watch || evaConfig . watch === undefined ) ) { Fs . watchFile ( customMappingPath , customMappingWatchOptions , ( ) => { BootstrapService . run ( evaConfig ) ; } ) ; } } } ; const libConfig = { reporter : { update : handleMetroEvent , } , } ; return LodashMerge ( { } , libConfig , metroConfig ) ; } ;