https://github.com/Deraen/clojurescript/commit/bb94e566a8827d0356740491e2506fba02faa109
- Load all
js_transform.clj
files in classpath - Problems:
- files are not real namespaces (no
ns
) load-reader
will eval the code in file each timeload-js-transforms!
is called, which is each timecljs.closure/build
is called- a
js_transform.clj
file is loaded even ifjs-transforms
method 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-transforms
method is not found, but the value is namespaced keyword, try to load namespace pointed by the namespace part of the keyword and runjs-transforms
again 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
:preprocess
value should be a symboljs-transforms
multimethod 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
:preprocess
should 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-ish
although I hate the term. Something along the lines of http://pedestal.io/reference/interceptors.Not sure
:enter
and:leave
are required, could just make it:fn
and 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}]