Skip to content

Commit 02b8d6e

Browse files
committed
wip
1 parent 250a9fa commit 02b8d6e

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

src/main/clojure/cljs/build/api.clj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,10 @@
193193
(if-not (nil? env/*compiler*)
194194
env/*compiler*
195195
(env/default-compiler-env
196-
(closure/add-externs-sources opts)))))
196+
;; need to dissoc :foreign-libs since we won't know what overriding
197+
;; foreign libspecs are referring to until after add-implicit-options
198+
;; - David
199+
(closure/add-externs-sources (dissoc opts :foreign-libs))))))
197200
([source opts compiler-env]
198201
(doseq [[unknown-opt suggested-opt] (util/unknown-opts (set (keys opts)) closure/known-opts)]
199202
(when suggested-opt

src/main/clojure/cljs/closure.clj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2432,7 +2432,10 @@
24322432
(if-not (nil? env/*compiler*)
24332433
env/*compiler*
24342434
(env/default-compiler-env
2435-
(add-externs-sources opts)))))
2435+
;; need to dissoc :foreign-libs since we won't know what overriding
2436+
;; foreign libspecs are referring to until after add-implicit-options
2437+
;; - David
2438+
(add-externs-sources (dissoc opts :foreign-libs))))))
24362439
([source opts compiler-env]
24372440
(env/with-compiler-env compiler-env
24382441
;; we want to warn about NPM dep conflicts before installing the modules

src/main/clojure/cljs/js_deps.cljc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ case."
130130
(-requires [this] "A list of namespaces that this JavaScript requires.")
131131
(-source [this] [this opts] "The JavaScript source string."))
132132

133+
(defn get-file [libspec index]
134+
(or (:file libspec)
135+
(some (fn [provide] (get-in index [provide :file]))
136+
(:provides libspec))))
137+
133138
(defn build-index
134139
"Index a list of dependencies by namespace and file name. There can
135140
be zero or more namespaces provided per file. Upstream foreign libraies
@@ -159,7 +164,11 @@ case."
159164
index provides)
160165
index)]
161166
(if (:foreign dep)
162-
(update-in index' [(:file dep)] merge dep)
167+
(if-let [file (get-file dep index)]
168+
(update-in index' [file] merge dep)
169+
(throw
170+
(Exception.
171+
(str "No :file provided for foreign libspec " (pr-str dep)))))
163172
(assoc index' (:file dep) dep))))
164173
{} deps))
165174

0 commit comments

Comments
 (0)