A Compactification Theory with Potential-theoretic Applications