Skip to content

Commit

Permalink
CLJS-2450: Allow configuring ingnored JS module extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
Deraen authored and swannodette committed Dec 23, 2017
1 parent 8baeacd commit f7d611d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/main/clojure/cljs/closure.clj
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
:fn-invoke-direct :checked-arrays :closure-module-roots :rewrite-polyfills :use-only-custom-externs
:watch :watch-error-fn :watch-fn :install-deps :process-shim :rename-prefix :rename-prefix-namespace
:closure-variable-map-in :closure-property-map-in :closure-variable-map-out :closure-property-map-out
:stable-names})
:stable-names :ignore-js-module-exts})

(def string->charset
{"iso-8859-1" StandardCharsets/ISO_8859_1
Expand Down Expand Up @@ -2183,7 +2183,10 @@
{:closure-variable-map-in (io/file output-dir "closure_var.map")
:closure-variable-map-out (io/file output-dir "closure_var.map")
:closure-property-map-in (io/file output-dir "closure_prop.map")
:closure-property-map-out (io/file output-dir "closure_prop.map")})))))
:closure-property-map-out (io/file output-dir "closure_prop.map")}))

(nil? (:ignore-js-module-exts opts))
(assoc :ignore-js-module-exts [".css"]))))

(defn- alive? [proc]
(try (.exitValue proc) false (catch IllegalThreadStateException _ true)))
Expand Down Expand Up @@ -2442,8 +2445,13 @@
(map (fn [lib]
(let [js (deps/load-foreign-library lib)
url (str (deps/-url js opts))]
(if (and url (not (or (.endsWith url ".js") (.endsWith url ".json"))))
(assoc js :source "")
(if (and url (some (fn [ext]

This comment has been minimized.

Copy link
@rauhs

rauhs Dec 25, 2017

Contributor

I think url will always be truthy, no?

This comment has been minimized.

Copy link
@Deraen

Deraen Dec 25, 2017

Author Contributor

Not necessarily, foreign lib map can be map just :source, without :url or :file. Those are used internally for few cases, probably very rare that those would be used here, but wanted to be sure.

(.endsWith url ext))
(:ignore-js-module-exts opts)))
(do
(when (or ana/*verbose* (:verbose opts))
(util/debug-prn "Ignoring JS module" url "based on the file extension"))
(assoc js :source ""))
(assoc js :source (deps/-source js opts))))))
(map (fn [js]
(if (:preprocess js)
Expand Down

0 comments on commit f7d611d

Please sign in to comment.