Ed Yong in Not Exactly Rocket Science:
The transformation from caterpillar to butterfly is one of the most exquisite in the natural world. Within the chrysalis, an inching, cylindrical eating machine remakes itself into a beautiful flying creature that drinks through a straw.
This strategy—known as holometaboly, or complete metamorphosis—partitions youngsters and adults into completely different worlds, so that neither competes with the other. It’s such a successful way of life that it’s used by the majority of insects (and therefore, the majority of all animals). Butterflies, ants, beetles and flies all radically remodel their bodies within a pupa as they develop from larvae to adults.
But what goes on inside a pupa? We know that a larva releases enzymes that break down many of its tissues into their constituent proteins. Textbooks will commonly talk about the insect dissolving into a kind of “soup”, but that’s not entirely accurate. Some organs stay intact. Others, like muscles, break down into clumps of cells that can be re-used, like a Lego sculpture decomposing into bricks. And some cells create imaginal discs—structures that produce adult body parts. There’s a pair for the antennae, a pair for the eyes, one for each leg and wing, and so on. So if the pupa contains a soup, it’s an organised broth full of chunky bits.
More here.