Actually, I think this is an exact copy from src/node/compiler.js. Can you move it to a shared file?