JS lib: introduced different output strategies, and chose them depending of environment.

 #KT-2994 Fixed
JS lib: export Kotlin object when it possible.

It allows use kotlin.js on node.js without modifications.