  We study constraints coming from the modular invariance of the partition
function of two-dimensional conformal field theories. We constrain the spectrum
of CFTs in the presence of holomorphic and anti-holomorphic currents using the
semi-definite programming. In particular, we find the bounds on the twist gap
for the non-current primaries depend dramatically on the presence of
holomorphic currents, showing numerous kinks and peaks. Various rational CFTs
are realized at the numerical boundary of the twist gap, saturating the upper
limits on the degeneracies. Such theories include Wess-Zumino-Witten models for
the Deligne's exceptional series, the Monster CFT and the Baby Monster CFT. We
also study modular constraints imposed by $\mathcal{W}$-algebras of various
type and observe that the bounds on the gap depend on the choice of
$\mathcal{W}$-algebra in the small central charge region.
