Is there a way to generate bindings for a list of JS files?

interop

#1

Suppose I would like to generate bindings for, say, all the highlight.js languages.

Manually, I could go:

  [@bs.module]
  external langJs: langPlugin = "highlight.js/lib/languages/javascript";
  [@bs.module]
  external langOcaml: langPlugin = "highlight.js/lib/languages/ocaml";
  [@bs.module]
  external langReasonml: langPlugin = "highlight.js/lib/languages/reasonml";
  [@bs.module]
  external langTs: langPlugin = "highlight.js/lib/languages/typescript";
  
  let langAll = [langJs, langOcaml, langReasonml, langTs];

Sure enough, I could use ls and suchlike, so it’s not prohibitively tedious, but the list is still rather tedious and error-ptone to update. Does a better way exist?