flatten a resolved component tree