Support variable and property maps

Description

If the ClojureScript compiler has support for --variable_map_input_file, --variable_map_output_file, --property_map_input_file, and --property_map_output_file then it will be possible to enable vendorization by code splitting dependencies into a separate bundle from app code.

More details at http://closuretools.blogspot.co.nz/2011/01/property-by-any-other-name-part-3.html, https://groups.google.com/forum/#!topic/clojurescript/nsq9r1SOLTI

Shadow-cljs implementation: https://github.com/thheller/shadow-cljs/blob/7795161297c6d7d2eae990446aed18a28e03a6f8/src/main/shadow/build/closure.clj#L456-L498

Environment

None

Activity

Show:
David Nolen
December 13, 2017, 10:11 PM

I think we can hide all those options behind a simpler flag, `:stable-names` and pick default filenames for those files for the user. We can of course also supply `:closure-variable-map-input-file` etc. for people who want maximum control.

Thomas Heller
December 14, 2017, 10:45 AM

In shadow-cljs I have a default "cache" directory for each build where files such as these are written. Currently you can't even configure variable maps otherwise since I see no reason to ever disable it (or write it elsewhere).

Maybe it would be easier if CLJS introduced the concept of a :cache-dir or so where it can write cache to (including the variable maps). The analyzer cache is currently also written to :output-dir I believe. I use the :cache-dir quite a lot for various things.

Maximum control is nice but starting with simpler defaults would be way easier on the users. lein-cljsbuild and others could set a :cache-dir automatically as well, setting each individual setting automatically is much harder.

David Nolen
December 22, 2017, 9:57 PM

Assignee

David Nolen

Reporter

Daniel Compton

Labels

Approval

Accepted

Patch

None

Priority

Minor
Configure