Skip to content

Commit

Permalink
CLJS-2009: Remove unnecessary code introduced by CLJS-1973
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro authored and dnolen committed Apr 14, 2017
1 parent 3d2dcaf commit b79e45a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
13 changes: 5 additions & 8 deletions src/main/clojure/cljs/closure.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 0 additions & 14 deletions src/main/clojure/cljs/util.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b79e45a

Please sign in to comment.