Improve the AMD support for just-in-time loading of mime modules.
- use local async `require` instead of inline named `define`
- keep the timeout for AMD environs that don't support `require`'s error callback
- fix AMD environment sniffing