|
901 | 901 | files needing copying or compilation will be compiled and/or copied to the
|
902 | 902 | appropiate location."
|
903 | 903 | [inputs opts]
|
904 |
| - (let [pred (fn [x] |
905 |
| - (if (:emit-constants opts) |
906 |
| - (not= ["constants-table"] (:provides x)) |
907 |
| - (not= ["cljs.core"] (:provides x)))) |
908 |
| - pre (take-while pred inputs) |
909 |
| - post (drop-while pred inputs) |
910 |
| - preloads (remove nil? |
911 |
| - (map |
912 |
| - (fn [preload] |
913 |
| - (try |
914 |
| - (comp/find-source preload) |
915 |
| - (catch Throwable t |
916 |
| - (util/debug-prn "WARNING: preload namespace" preload "does not exist")))) |
917 |
| - (:preloads opts)))] |
918 |
| - (distinct-by :provides |
919 |
| - (concat pre [(first post)] |
920 |
| - (-> (add-dependency-sources preloads opts) |
921 |
| - deps/dependency-order |
922 |
| - (compile-sources opts) |
923 |
| - (add-js-sources opts)) |
924 |
| - (next post))))) |
| 904 | + (if-not (:preloads opts) |
| 905 | + inputs |
| 906 | + (let [pred (fn [x] |
| 907 | + (if (:emit-constants opts) |
| 908 | + (not= ["constants-table"] (:provides x)) |
| 909 | + (not= ["cljs.core"] (:provides x)))) |
| 910 | + pre (take-while pred inputs) |
| 911 | + post (drop-while pred inputs) |
| 912 | + preloads (remove nil? |
| 913 | + (map |
| 914 | + (fn [preload] |
| 915 | + (try |
| 916 | + (comp/find-source preload) |
| 917 | + (catch Throwable t |
| 918 | + (util/debug-prn "WARNING: preload namespace" preload "does not exist")))) |
| 919 | + (:preloads opts)))] |
| 920 | + (distinct-by :provides |
| 921 | + (concat pre [(first post)] |
| 922 | + (-> (add-dependency-sources preloads opts) |
| 923 | + deps/dependency-order |
| 924 | + (compile-sources opts) |
| 925 | + (add-js-sources opts)) |
| 926 | + (next post)))))) |
925 | 927 |
|
926 | 928 | (comment
|
927 | 929 | (comp/find-sources-root "samples/hello/src")
|
|
1854 | 1856 | (assert (not (and (= target :nodejs) (= optimizations :whitespace)))
|
1855 | 1857 | (format ":nodejs target not compatible with :whitespace optimizations")))
|
1856 | 1858 |
|
| 1859 | +(defn check-preloads [{:keys [preloads optimizations] :as opts}] |
| 1860 | + (when (and (some? preloads) (not= optimizations :none)) |
| 1861 | + (binding [*out* *err*] |
| 1862 | + (println "WARNING: :preloads should only be specified with :none optimizations")))) |
| 1863 | + |
1857 | 1864 | (defn foreign-source? [js]
|
1858 | 1865 | (and (satisfies? deps/IJavaScript js)
|
1859 | 1866 | (deps/-foreign? js)))
|
|
1949 | 1956 | (check-source-map-path opts)
|
1950 | 1957 | (check-output-wrapper opts)
|
1951 | 1958 | (check-node-target opts)
|
| 1959 | + (check-preloads opts) |
1952 | 1960 | (swap! compiler-env
|
1953 | 1961 | #(-> %
|
1954 | 1962 | (update-in [:options] merge all-opts)
|
|
0 commit comments