From 37b5d7d68a1cf928846c4f5777ed32e845ad11fe Mon Sep 17 00:00:00 2001
From: dnolen <dnolen@cognitect.com>
Date: Tue, 21 Jun 2016 15:09:46 -0400
Subject: [PATCH] include source extension info in map returned by
 cljs.closure/source-for-namespace and cljs.closure/cljs-source-for-namespace

---
 src/main/clojure/cljs/closure.clj | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/main/clojure/cljs/closure.clj b/src/main/clojure/cljs/closure.clj
index 4c8604f28d..13034824d0 100644
--- a/src/main/clojure/cljs/closure.clj
+++ b/src/main/clojure/cljs/closure.clj
@@ -642,14 +642,14 @@
   [ns]
   (if (= "cljs.core$macros" (str ns))
     (let [relpath "cljs/core.cljc"]
-      {:relative-path relpath :uri (io/resource relpath)})
+      {:relative-path relpath :uri (io/resource relpath) :ext :cljc})
     (let [path    (-> (munge ns) (string/replace \. \/))
           relpath (str path ".cljs")]
       (if-let [res (io/resource relpath)]
-        {:relative-path relpath :uri res}
+        {:relative-path relpath :uri res :ext :cljs}
         (let [relpath (str path ".cljc")]
           (if-let [res (io/resource relpath)]
-            {:relative-path relpath :uri res}))))))
+            {:relative-path relpath :uri res :ext :cljc}))))))
 
 (defn source-for-namespace
   "Given a namespace and compilation environment return the relative path and
@@ -660,13 +660,13 @@
         path    (string/replace ns-str \. \/)
         relpath (str path ".cljs")]
     (if-let [cljs-res (io/resource relpath)]
-      {:relative-path relpath :uri cljs-res}
+      {:relative-path relpath :uri cljs-res :ext :cljs}
       (let [relpath (str path ".cljc")]
         (if-let [cljc-res (io/resource relpath)]
-          {:relative-path relpath :uri cljc-res}
+          {:relative-path relpath :uri cljc-res :ext :cljc}
           (let [relpath (str path ".js")]
             (if-let [js-res (io/resource relpath)]
-              {:relative-path relpath :uri js-res}
+              {:relative-path relpath :uri js-res :ext :js}
               (let [ijs (get-in @compiler-env [:js-dependency-index (str ns)])
                    relpath (or (:file ijs) (:url ijs))]
                (if-let [js-res (and relpath
@@ -675,7 +675,7 @@
                                  (or (and (util/url? relpath) relpath)
                                    (try (URL. relpath) (catch Throwable t))
                                    (io/resource relpath)))]
-                 {:relative-path relpath :uri js-res}
+                 {:relative-path relpath :uri js-res :ext :js}
                  (throw
                    (IllegalArgumentException.
                      (str "Namespace " ns " does not exist"))))))))))))