Is there already pre-existing code for supporting Dojo AMD, NodeJS require and Browser window.[something] for a Javascript micro library

I have some code which supports writing a micro-library and having it loaded in Dojo AMD, NodeJS require() and the browsers normal window.[something]... But I was wondering if there are already established means of doing this and I just re-invented the wheel or if the code is worth while. I did do a good search around the internet.

The code I created is at https://gist.github.com/forbesmyester/5293746, if people have comments, great, but I am much more interested in finding out if there is a proper method of doing this.

I followed the link psema4 added and with some reading around found this github project which attempts to collate all the different approaches people have used to solve this problem into a set of boilerplate files.

I'm sure that Forbesmyester has already found this solution, but I thought it ought to be put up on SO for anyone who finds this question in future.