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 13121312 (apply str
13131313 (map #(str " ['" % " ']" ) xs)))))
13141314
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\" );" ))
13171328 (emitln
13181329 (munge ns-name) " ."
13191330 (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
13281333 (sublib-select sublib)
13291334 " ;" )))
13301335
14091414 ; ; Global Exports
14101415 (doseq [lib global-exports-libs]
14111416 (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 )))
14131418 (when (-> libs meta :reload-all )
14141419 (emitln " if(!COMPILED) " loaded-libs " = cljs.core.into(" loaded-libs-temp " , " loaded-libs " );" ))))
14151420
You can’t perform that action at this time.
0 commit comments