changed module wrapping to include dependencies

Works with RequireJS and should continue to work from <script> tag