|
1538 | 1538 | (.getAstRoot input closure-compiler)))
|
1539 | 1539 |
|
1540 | 1540 | (defn get-source-files [opts]
|
1541 |
| - (->> (:foreign-libs opts) |
| 1541 | + (->> (concat (:foreign-libs opts) |
| 1542 | + (:ups-foreign-libs opts)) |
1542 | 1543 | (filter #(let [module-type (:module-type %)]
|
1543 | 1544 | (or (= module-type :amd)
|
1544 | 1545 | (= module-type :commonjs)
|
|
1735 | 1736 | )
|
1736 | 1737 |
|
1737 | 1738 |
|
1738 |
| -(defn get-upstream-deps* |
| 1739 | +(defn get-upstream-deps* |
1739 | 1740 | "returns a merged map containing all upstream dependencies defined
|
1740 | 1741 | by libraries on the classpath."
|
1741 | 1742 | ([]
|
|
1903 | 1904 | (not (false? (:static-fns opts))) (assoc :static-fns true)
|
1904 | 1905 | (not (false? (:optimize-constants opts))) (assoc :optimize-constants true)))))
|
1905 | 1906 |
|
1906 |
| -(defn process-js-modules |
1907 |
| - "Given the current compiler options, converts JavaScript modules to Google |
1908 |
| - Closure modules and writes them to disk. Adds mapping from original module |
1909 |
| - namespace to new module namespace to compiler env. Returns modified compiler |
1910 |
| - options where new modules are passed with :libs option." |
1911 |
| - [opts] |
1912 |
| - (let [js-modules (filter :module-type (:foreign-libs opts))] |
| 1907 | +(defn- process-js-modules* |
| 1908 | + [opts k] |
| 1909 | + (let [js-modules (filter :module-type (k opts))] |
1913 | 1910 | (reduce (fn [new-opts {:keys [file module-type] :as lib}]
|
1914 | 1911 | (if (or (and (= module-type :commonjs) can-convert-commonjs?)
|
1915 | 1912 | (and (= module-type :amd) can-convert-amd?)
|
|
1921 | 1918 | #(update-in % [:js-module-index] assoc provide module-name)))
|
1922 | 1919 | (-> new-opts
|
1923 | 1920 | (update-in [:libs] (comp vec conj) (:out-file ijs))
|
1924 |
| - (update-in [:foreign-libs] |
| 1921 | + (update-in [k] |
1925 | 1922 | (comp vec (fn [libs] (remove #(= (:file %) file) libs))))))
|
1926 | 1923 | new-opts))
|
1927 | 1924 | opts js-modules)))
|
1928 | 1925 |
|
| 1926 | +(defn process-js-modules |
| 1927 | + "Given the current compiler options, converts JavaScript modules to Google |
| 1928 | + Closure modules and writes them to disk. Adds mapping from original module |
| 1929 | + namespace to new module namespace to compiler env. Returns modified compiler |
| 1930 | + options where new modules are passed with :libs option." |
| 1931 | + [opts] |
| 1932 | + (-> opts |
| 1933 | + (process-js-modules* :foreign-libs) |
| 1934 | + (process-js-modules* :ups-foreign-libs))) |
| 1935 | + |
1929 | 1936 | (defn build
|
1930 | 1937 | "Given a source which can be compiled, produce runnable JavaScript."
|
1931 | 1938 | ([source opts]
|
|
0 commit comments