Better UMD and bug fixes for nested define checks.

Now internally repurposes the known safe identifier `require` to track
the use of `define`.  This allows us to safely inject into the global
scope allowing nested modules to detect for AMD correctly.  We then
restore the identifier in the end fragment.