Factor fragments.js out of compiler.js