|
479 | 479 | (-compile uri (merge opts {:output-file js-file})))) |
480 | 480 |
|
481 | 481 | (defn cljs-source-for-namespace |
482 | | - "Given a namespace return the corresponding source with either a .cljc or |
483 | | - .cljs extension." |
| 482 | + "Given a namespace return the corresponding source with either a .cljs or |
| 483 | + .cljc extension." |
484 | 484 | [ns] |
485 | 485 | (let [path (-> (munge ns) (string/replace \. \/)) |
486 | | - relpath (str path ".cljc")] |
| 486 | + relpath (str path ".cljs")] |
487 | 487 | (if-let [res (io/resource relpath)] |
488 | 488 | {:relative-path relpath :uri res} |
489 | | - (let [relpath (str path ".cljs")] |
| 489 | + (let [relpath (str path ".cljc")] |
490 | 490 | (if-let [res (io/resource relpath)] |
491 | 491 | {:relative-path relpath :uri res}))))) |
492 | 492 |
|
493 | 493 | (defn source-for-namespace |
494 | 494 | "Given a namespace and compilation environment return the relative path and |
495 | 495 | uri of the corresponding source regardless of the source language extension: |
496 | | - .cljc, .cljs, .js" |
| 496 | + .cljs, .cljc, .js" |
497 | 497 | [ns compiler-env] |
498 | 498 | (let [ns-str (str (comp/munge ns {})) |
499 | 499 | path (string/replace ns-str \. \/) |
500 | | - relpath (str path ".cljc")] |
501 | | - (if-let [cljc-res (io/resource relpath)] |
502 | | - {:relative-path relpath :uri cljc-res} |
503 | | - (let [relpath (str path ".cljs")] |
504 | | - (if-let [cljs-res (io/resource relpath)] |
505 | | - {:relative-path relpath :uri cljs-res} |
| 500 | + relpath (str path ".cljs")] |
| 501 | + (if-let [cljs-res (io/resource relpath)] |
| 502 | + {:relative-path relpath :uri cljs-res} |
| 503 | + (let [relpath (str path ".cljc")] |
| 504 | + (if-let [cljc-res (io/resource relpath)] |
| 505 | + {:relative-path relpath :uri cljc-res} |
506 | 506 | (let [relpath (:file (get-in @compiler-env [:js-dependency-index ns-str]))] |
507 | 507 | (if-let [js-res (and relpath (io/resource relpath))] |
508 | 508 | {:relative-path relpath :uri js-res} |
|
1606 | 1606 | ([src {:keys [wrap all-provides] :as options}] |
1607 | 1607 | (let [goog-ns |
1608 | 1608 | (case (util/ext src) |
1609 | | - ("cljc" "cljs") (comp/munge (:ns (ana/parse-ns src))) |
| 1609 | + ("cljs" "cljc") (comp/munge (:ns (ana/parse-ns src))) |
1610 | 1610 | "js" (cond-> (:provides (parse-js-ns src)) |
1611 | 1611 | (not all-provides) first) |
1612 | 1612 | (throw |
|
0 commit comments