added better error checking around empty compiled content.  Also added some logic to select the correct compilation Unit for the given path.

Updated the README.md to describe an issue that came up where you have to include lib.d.ts in client side code for it to compile (since typescript.api doesn't include it by default).