|
196 | 196 | (assoc :url (io/resource (:file ijs))))) |
197 | 197 |
|
198 | 198 | (defn ns->input [ns opts] |
199 | | - (if-let [input (some-> (util/ns->source ns) (ana/parse-ns opts))] |
200 | | - input |
201 | | - (if-let [input (some-> |
202 | | - (get-in @env/*compiler* |
203 | | - [:js-dependency-index (str ns)]) |
204 | | - add-url)] |
205 | | - input |
| 199 | + (or (some-> (util/ns->source ns) (ana/parse-ns opts)) |
| 200 | + (some-> (get-in @env/*compiler* [:js-dependency-index (str ns)]) add-url) |
206 | 201 | (throw |
207 | 202 | (ex-info (str ns " does not exist") |
208 | | - {::error :invalid-ns}))))) |
| 203 | + {::error :invalid-ns})))) |
209 | 204 |
|
210 | 205 | (defn compilable? [input] |
211 | 206 | (contains? input :source-file)) |
|
216 | 211 | only once." |
217 | 212 | ([repl-env ns] (load-namespace repl-env ns nil)) |
218 | 213 | ([repl-env ns opts] |
219 | | - (let [ns (if (and (seq? ns) (= (first ns) 'quote)) (second ns) ns) |
220 | | - input (ns->input ns opts) |
221 | | - sources (if (compilable? input) |
222 | | - (->> (cljsc/compile-inputs [input] |
223 | | - (merge (env->opts repl-env) opts)) |
224 | | - (remove (comp #{["goog"]} :provides))) |
225 | | - (map #(cljsc/source-on-disk opts %) |
226 | | - (cljsc/add-js-sources [input] opts)))] |
| 214 | + (let [ns (if (and (seq? ns) (= (first ns) 'quote)) (second ns) ns) |
| 215 | + sources (seq |
| 216 | + (when-not (ana/node-module-dep? ns) |
| 217 | + (let [input (ns->input ns opts)] |
| 218 | + (if (compilable? input) |
| 219 | + (->> (cljsc/compile-inputs [input] |
| 220 | + (merge (env->opts repl-env) opts)) |
| 221 | + (remove (comp #{["goog"]} :provides))) |
| 222 | + (map #(cljsc/source-on-disk opts %) |
| 223 | + (cljsc/add-js-sources [input] opts))))))] |
227 | 224 | (when (:repl-verbose opts) |
228 | 225 | (println (str "load-namespace " ns " , compiled:") (map :provides sources))) |
229 | 226 | (if (:output-dir opts) |
|
0 commit comments