From b79e45a706201087f69df56647055c442dca7229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B3nio=20Nuno=20Monteiro?= Date: Fri, 14 Apr 2017 09:12:43 -0700 Subject: [PATCH] CLJS-2009: Remove unnecessary code introduced by CLJS-1973 --- src/main/clojure/cljs/closure.clj | 13 +++++-------- src/main/clojure/cljs/util.cljc | 14 -------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/src/main/clojure/cljs/closure.clj b/src/main/clojure/cljs/closure.clj index 5e427e369b..44e5116b54 100644 --- a/src/main/clojure/cljs/closure.clj +++ b/src/main/clojure/cljs/closure.clj @@ -1959,9 +1959,7 @@ :as opts}] (let [opts (cond-> (update opts :foreign-libs (fn [libs] - (into (into [] - (util/distinct-merge-by :file - (index-node-modules npm-deps opts))) + (into (index-node-modules npm-deps opts) (expand-libs libs)))) (:closure-defines opts) (assoc :closure-defines @@ -1981,9 +1979,7 @@ :optimizations optimizations :output-dir output-dir :ups-libs libs - :ups-foreign-libs (into (into [] - (util/distinct-merge-by :file - (index-node-modules (compute-upstream-npm-deps opts) opts))) + :ups-foreign-libs (into (index-node-modules (compute-upstream-npm-deps opts) opts) (expand-libs foreign-libs)) :ups-externs externs :emit-constants emit-constants @@ -2115,14 +2111,15 @@ (:options @env/*compiler*)))) ([npm-deps opts] (let [node-modules (io/file "node_modules")] - (when (and (not (empty? npm-deps)) (.exists node-modules) (.isDirectory node-modules)) + (if (and (not (empty? npm-deps)) (.exists node-modules) (.isDirectory node-modules)) (let [modules (map name (keys npm-deps)) deps-file (io/file (str (util/output-directory opts) File/separator "cljs$node_modules.js"))] (util/mkdirs deps-file) (with-open [w (io/writer deps-file)] (run! #(.write w (str "require('" % "');\n")) modules)) - (node-inputs [{:file (.getAbsolutePath deps-file)}] opts)))))) + (node-inputs [{:file (.getAbsolutePath deps-file)}] opts)) + [])))) (defn process-js-modules "Given the current compiler options, converts JavaScript modules to Google diff --git a/src/main/clojure/cljs/util.cljc b/src/main/clojure/cljs/util.cljc index 435b2ab045..c8de4750e4 100644 --- a/src/main/clojure/cljs/util.cljc +++ b/src/main/clojure/cljs/util.cljc @@ -279,20 +279,6 @@ xs seen)))] (step coll #{})))) -(defn distinct-merge-by - [f & xss] - (let [xf (map (fn [x] - [(f x) x]))] - (vals (apply merge-with - (fn [a b] - (merge-with - (fn [a b] - (cond-> a - (sequential? a) - (into b))) - a b)) - (map #(into {} xf %) xss))))) - (defn content-sha [^String s] (let [digest (MessageDigest/getInstance "SHA-1")] (.reset digest)