Logic to resolve module dependency (used by the compiler, runtime etc).