Asynchronous module loader

This is work on an AMD compatible module loader.

https://github.com/amdjs/amdjs-api/wiki/AMD

This allows async module loading, and dependency resolution. See terminal.html in the diff.
That won't happen. In addition we need to do this check in the function below on the canonicalized id as well.