Avoid generating images when the input code has not changed

Provide the initial metadata cache infrastructure requested in #5 to avoid redundant work.