Simplify compiler code path and add support for sourceRoot.

The sourcemap sourceRoot is a common prefix like a baseURL for the
the filenames in a sourcemap. It allows the map to be more compact by
reducing the number of repeated strings.

Sorting out how to set this was hampered by the compile chain complexity
at the "write" end of the chain. Reducing functions and callbacks makes
things clearer.

Fixes #1324 and fixes #1310 
weird indentation