Uploaded image for project: 'ClojureScript'
  1. CLJS-1407

Exposing output file dependency graph in API


    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects versions: None
    • Fix versions: None
    • Labels:


      Use case for boot-cljs and boot-reload:

      After compilation boot-reload reloads the changed JS files. So that the files can be reloaded in correct order, boot-cljs uses dependency graph to sort the files. Currently boot-cljs accesses compiler state directly and uses data from :js-dependency-index to build the graph: https://github.com/adzerk-oss/boot-cljs/blob/0.0-3308/src/adzerk/boot_cljs/impl.clj#L17-L36

      Simple solution:

      If dependencies (requires) of namespace are exposed through API it is easy to build graph of cljs namespace dependencies: https://github.com/adzerk-oss/boot-cljs/blob/d479f10935be321232e2363e2ae3e9cc515a81af/src/adzerk/boot_cljs/impl.clj#L12-L32

      Problem with this solution is that all-ns, ns-dependencies or target-file-for-cljs-ns do not work with foreign-deps. While foreign-dep files don't usually change and thus aren't reloaded, it's possible that user has local JS files in the project using foreign-deps and those can change.

      Questions, notes and issues

      • Should cljs-dependency-graph be exposed in the API or is it enough to provide ns-dependencies and such which user can use to create dependency graph?
      • cljs.build.api/parse-js-ns can also be used to read provides and requires from compiled JS files, but this doesn't work with foreign-deps either
      • Perhaps there is some way in Closure library to reload files in correct order?
      • Supporting foreign-deps is not perhaps necessary, but if there is good way it would be nice to have.




            • Assignee:
              deraen Juho Teperi
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: