Automatically scan the classpath for non-goog JavaScript libraries


  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Declined
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:


Right now, adding JavaScript dependencies to a ClojureScript project is doable, but more difficult than it should be. Even assuming the use of lein-cljsbuild, one must always add appropriate :libs and/or :foreign-libs and/or :externs options to each build invocation...not just once (e.g. when packaging a JavaScript library as part of a ClojureScript library), but in every situation where such dependencies are used.

Addressing this for foreign libs is probably not practical, but we should be able to extend the treatment of goog.* dependencies (embodied in cljs.closure/goog-dependencies*) to any Google Closure-ready JavaScript library/module. In short, this would look like:

1. At load-time in cljs.closure, scan the classpath for all .js files
2. Use parse-js-ns to obtain each JavaScript file's provides and requires.
3. Include the resulting maps in js-dependency-index.

The end result should be that, if a JavaScript file is on your classpath that contains e.g. goog.provide('');, you can use it simply by adding (:require []) to an ns declaration, without touching any build configuration.

Sound sane? Not sure if it'll work or not, but if it does, it'd make packaging and use of JavaScript libraries from ClojureScript much easier IMO.


Chas Emerick made changes -
Field Original Value New Value
Priority Major [ 3 ] Trivial [ 5 ]
Chas Emerick made changes -
Status Open [ 1 ] Closed [ 6 ]
Resolution Declined [ 2 ]


Vote (0)
Watch (1)


  • Created: