File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change 1312
1312
(apply str
1313
1313
(map #(str " ['" % " ']" ) xs)))))
1314
1314
1315
- (defn emit-global-export [ns-name global-exports lib]
1316
- (let [[lib' sublib] (ana/lib&sublib lib)]
1315
+ (defn emit-global-export [ns-name global-exports lib opts]
1316
+ (let [[lib' sublib] (ana/lib&sublib lib)
1317
+ ref (str " goog.global"
1318
+ ; ; Convert object dot access to bracket access
1319
+ (->> (string/split (name (or (get global-exports (symbol lib'))
1320
+ (get global-exports (name lib'))))
1321
+ #"\. " )
1322
+ (map (fn [prop] (str " [\" " prop " \" ]" )))
1323
+ (apply str)))]
1324
+ (when (and (ana/external-dep? lib')
1325
+ (= :none (:optimizations opts)))
1326
+ (emitln
1327
+ " if(!" ref " ) throw new Error(\" External library, " lib' " , never provided\" );" ))
1317
1328
(emitln
1318
1329
(munge ns-name) " ."
1319
1330
(ana/munge-global-export lib)
1320
- " = goog.global"
1321
- ; ; Convert object dot access to bracket access
1322
- (->> (string/split (name (or (get global-exports (symbol lib'))
1323
- (get global-exports (name lib'))))
1324
- #"\. " )
1325
- (map (fn [prop]
1326
- (str " [\" " prop " \" ]" )))
1327
- (apply str))
1331
+ " = "
1332
+ ref
1328
1333
(sublib-select sublib)
1329
1334
" ;" )))
1330
1335
1409
1414
; ; Global Exports
1410
1415
(doseq [lib global-exports-libs]
1411
1416
(let [{:keys [global-exports]} (get js-dependency-index (name (-> lib ana/lib&sublib first)))]
1412
- (emit-global-export ns-name global-exports lib)))
1417
+ (emit-global-export ns-name global-exports lib options )))
1413
1418
(when (-> libs meta :reload-all )
1414
1419
(emitln " if(!COMPILED) " loaded-libs " = cljs.core.into(" loaded-libs-temp " , " loaded-libs " );" ))))
1415
1420
You can’t perform that action at this time.
0 commit comments