moved reference, amdloader, html2ts, templatecache into their own files

This helps with maintainability. `ts.ts` is hereby a compilation (perhaps this should be moved out as well) + setting parsing only.