https://github.com/Deraen/clojurescript/commit/bb94e566a8827d0356740491e2506fba02faa109
- Load all
js_transform.cljfiles in classpath - Problems:
- files are not real namespaces (no
ns) load-readerwill eval the code in file each timeload-js-transforms!is called, which is each timecljs.closure/buildis called- a
js_transform.cljfile is loaded even ifjs-transformsmethod from it is not needed- for example, if any lib in classpath has dep on
cljsjs/babel-standalone
- for example, if any lib in classpath has dep on
- files are not real namespaces (no
https://github.com/Deraen/clojurescript/commit/9866a33c78ebf882e5e01d07316d00c7794e8edc
- If
js-transformsmethod is not found, but the value is namespaced keyword, try to load namespace pointed by the namespace part of the keyword and runjs-transformsagain in hopes that the namespace provided the method - If namespace doesn't provide the method, there will be a warning about unsupported preprocess value
- Benefits vs. Option 1:
- Real namespaces
- Works with current
cljsjs/babel-standalone - Minimal change
:preprocessvalue should be a symboljs-transformsmultimethod is removed- symbol will point directly at a function, the namespace is required if needed
- Benefits:
- Using a symbol to refer to a function is better than refering to a multimethod using namespaced keyword
:preprocessshould be allowed to be vector of transformations to run?- Would be handled at
process-js-modules, will work with options 2 and 3
- Would be handled at
Currently have a hard time coming up with use-cases for this since it may sometimes be required to process multiple files in one pass instead of one-by-one. If only for performance reasons ...
Besides that I would probably suggest using something
middleware-ishalthough I hate the term. Something along the lines of http://pedestal.io/reference/interceptors.:preprocess [{:enter some.ns/enter :leave some.ns/leave :other-opt "foo"}]Not sure
:enterand:leaveare required, could just make it:fnand take map itself as the opts.All "simpler" entries could just desugar into the above
:preprocess some.ns:preprocess some.ns/process-js-module:preprocess [{:fn some.ns/process-js-module}]