Move compile from src/node/api.js into src/Compiler

Fixes #1002