|
1399 | 1399 | (map (fn [[k v]]
|
1400 | 1400 | [(if (symbol? k) (str (comp/munge k)) k) v])
|
1401 | 1401 | (:closure-defines opts)))))
|
1402 |
| - {:keys [libs foreign-libs externs]} (get-upstream-deps)] |
| 1402 | + {:keys [libs foreign-libs externs]} (get-upstream-deps) |
| 1403 | + emit-constants (or (and (= optimizations :advanced) |
| 1404 | + (not (false? (:optimize-constants opts)))) |
| 1405 | + (:optimize-constants opts))] |
1403 | 1406 | (cond->
|
1404 | 1407 | (-> opts
|
1405 | 1408 | (assoc
|
1406 | 1409 | :optimizations optimizations
|
1407 | 1410 | :output-dir output-dir
|
1408 | 1411 | :ups-libs libs
|
1409 | 1412 | :ups-foreign-libs foreign-libs
|
1410 |
| - :ups-externs externs) |
| 1413 | + :ups-externs externs |
| 1414 | + :emit-constants emit-constants) |
1411 | 1415 | (update-in [:preamble] #(into (or % []) ["cljs/imul.js"])))
|
1412 | 1416 |
|
1413 | 1417 | (:target opts)
|
|
1434 | 1438 | ([source opts compiler-env]
|
1435 | 1439 | (env/with-compiler-env compiler-env
|
1436 | 1440 | (let [compiler-stats (:compiler-stats opts)
|
1437 |
| - all-opts (add-implicit-options opts) |
1438 |
| - emit-constants (or (and (= (:optimizations opts) :advanced) |
1439 |
| - (not (false? (:optimize-constants opts)))) |
1440 |
| - (:optimize-constants opts))] |
| 1441 | + all-opts (add-implicit-options opts)] |
1441 | 1442 | (check-output-to opts)
|
1442 | 1443 | (check-output-dir opts)
|
1443 | 1444 | (check-source-map opts)
|
|
1446 | 1447 | (check-node-target opts)
|
1447 | 1448 | (swap! compiler-env
|
1448 | 1449 | #(-> %
|
1449 |
| - (assoc-in [:options :emit-constants] emit-constants) |
| 1450 | + (update-in [:options] merge all-opts) |
1450 | 1451 | (assoc :target (:target opts))
|
1451 | 1452 | (assoc :js-dependency-index (deps/js-dependency-index all-opts))))
|
1452 | 1453 | (binding [comp/*dependents* (when-not (false? (:recompile-dependents opts))
|
|
1484 | 1485 | [(-compile (io/resource "cljs/nodejs.cljs") all-opts)])))
|
1485 | 1486 | (when (= :nodejs (:target all-opts))
|
1486 | 1487 | [(-compile (io/resource "cljs/nodejscli.cljs") all-opts)]))))
|
1487 |
| - _ (when emit-constants |
| 1488 | + _ (when (:emit-constants all-opts) |
1488 | 1489 | (comp/emit-constants-table-to-file
|
1489 | 1490 | (::ana/constant-table @env/*compiler*)
|
1490 | 1491 | (str (util/output-directory all-opts) "/constants_table.js")))
|
|
0 commit comments