If so, how can gradle be instructed to use these, since they aren’t compiled?
They should be compiled unless you have a compilation error.
It should be as usual Kotlin/JS library, so see how to create Kotlin/JS library from command line here. To achieve the same thing in the gradle use metaInfo option (all options)
To distribute using maven-central (or jcenter) you should pack all files from output directory to a jar, but on npm you can distribute them as is.