|
1496 | 1496 | (CompilerInput.))]
|
1497 | 1497 | (.getAstRoot input closure-compiler)))
|
1498 | 1498 |
|
1499 |
| -(defn get-source-files [module-type opts] |
| 1499 | +(defn get-source-files [opts] |
1500 | 1500 | (->> (:foreign-libs opts)
|
1501 |
| - (filter #(= (:module-type %) module-type)) |
| 1501 | + (filter #(let [module-type (:module-type %)] |
| 1502 | + (or (= module-type :amd) |
| 1503 | + (= module-type :commonjs) |
| 1504 | + (= module-type :es6)))) |
1502 | 1505 | (map (fn [lib]
|
1503 | 1506 | (let [lib (deps/load-foreign-library lib)]
|
1504 | 1507 | (js-source-file (:file lib) (deps/-source lib)))))))
|
|
1524 | 1527 | (defmethod convert-js-module :commonjs [ijs opts]
|
1525 | 1528 | (let [{:keys [file module-type]} ijs
|
1526 | 1529 | ^List externs '()
|
1527 |
| - ^List source-files (get-source-files module-type opts) |
| 1530 | + ^List source-files (get-source-files opts) |
1528 | 1531 | ^CompilerOptions options (make-convert-js-module-options opts)
|
1529 | 1532 | closure-compiler (doto (make-closure-compiler)
|
1530 | 1533 | (.init externs source-files options))
|
|
1542 | 1545 |
|
1543 | 1546 | (util/compile-if can-convert-es6?
|
1544 | 1547 | (defmethod convert-js-module :es6 [ijs opts]
|
1545 |
| - (let [{:keys [file module-type]} ijs |
| 1548 | + (let [{:keys [file]} ijs |
1546 | 1549 | ^List externs '()
|
1547 |
| - ^List source-files (get-source-files module-type opts) |
| 1550 | + ^List source-files (get-source-files opts) |
1548 | 1551 | ^CompilerOptions options (doto (make-convert-js-module-options opts)
|
1549 | 1552 | (.setLanguageIn CompilerOptions$LanguageMode/ECMASCRIPT6)
|
1550 | 1553 | (.setLanguageOut CompilerOptions$LanguageMode/ECMASCRIPT5))
|
|
0 commit comments