Implement full path expansion for sources.

Remove require as it can be implemented in js. Implement some
platform abstraction stuff (hopefully this can be kept minimal).

Next steps are implementation of relative path searching for includes.