|
642 | 642 | [ns] |
643 | 643 | (if (= "cljs.core$macros" (str ns)) |
644 | 644 | (let [relpath "cljs/core.cljc"] |
645 | | - {:relative-path relpath :uri (io/resource relpath)}) |
| 645 | + {:relative-path relpath :uri (io/resource relpath) :ext :cljc}) |
646 | 646 | (let [path (-> (munge ns) (string/replace \. \/)) |
647 | 647 | relpath (str path ".cljs")] |
648 | 648 | (if-let [res (io/resource relpath)] |
649 | | - {:relative-path relpath :uri res} |
| 649 | + {:relative-path relpath :uri res :ext :cljs} |
650 | 650 | (let [relpath (str path ".cljc")] |
651 | 651 | (if-let [res (io/resource relpath)] |
652 | | - {:relative-path relpath :uri res})))))) |
| 652 | + {:relative-path relpath :uri res :ext :cljc})))))) |
653 | 653 |
|
654 | 654 | (defn source-for-namespace |
655 | 655 | "Given a namespace and compilation environment return the relative path and |
|
660 | 660 | path (string/replace ns-str \. \/) |
661 | 661 | relpath (str path ".cljs")] |
662 | 662 | (if-let [cljs-res (io/resource relpath)] |
663 | | - {:relative-path relpath :uri cljs-res} |
| 663 | + {:relative-path relpath :uri cljs-res :ext :cljs} |
664 | 664 | (let [relpath (str path ".cljc")] |
665 | 665 | (if-let [cljc-res (io/resource relpath)] |
666 | | - {:relative-path relpath :uri cljc-res} |
| 666 | + {:relative-path relpath :uri cljc-res :ext :cljc} |
667 | 667 | (let [relpath (str path ".js")] |
668 | 668 | (if-let [js-res (io/resource relpath)] |
669 | | - {:relative-path relpath :uri js-res} |
| 669 | + {:relative-path relpath :uri js-res :ext :js} |
670 | 670 | (let [ijs (get-in @compiler-env [:js-dependency-index (str ns)]) |
671 | 671 | relpath (or (:file ijs) (:url ijs))] |
672 | 672 | (if-let [js-res (and relpath |
|
675 | 675 | (or (and (util/url? relpath) relpath) |
676 | 676 | (try (URL. relpath) (catch Throwable t)) |
677 | 677 | (io/resource relpath)))] |
678 | | - {:relative-path relpath :uri js-res} |
| 678 | + {:relative-path relpath :uri js-res :ext :js} |
679 | 679 | (throw |
680 | 680 | (IllegalArgumentException. |
681 | 681 | (str "Namespace " ns " does not exist")))))))))))) |
|
0 commit comments