              (let [js-source (.toString sb)]
                (when (:verbose opts)
                  (debug-prn js-source))
-               (cb (*eval-fn* js-source))))))))))
+               (cb (*eval-fn* {:lang   :clj
+                               :name   name
+                               :path   (ns->relpath name)
+                               :source js-source}))))))))))
 
 (defn eval-str
   ([state source cb]
    (eval-str state source nil cb))
-  ([state source opts cb]
+  ([state source name cb]
+   (eval-str state source name nil cb))
+  ([state source opts name cb]
    (eval-str*
      {:*compiler*     state
       :*cljs-ns*      'cljs.user

     (reset! *loaded* #{}))
   (when-not (contains? @*loaded* name)
     (let [env (:*env* bound-vars)]
       ((:*load-fn* bound-vars) (ns->relpath name)
         (fn [resolved]
           (assert (or (map? resolved) (nil? resolved))
             "*load-fn* may only return a map or nil")
           (if resolved
             (let [{:keys [lang source]} resolved]
               (condp = lang
                 :clj (eval-str* bound-vars source opts
                        (fn [ret] (cb true)))
                 :js  (do
                        ((:*eval-fn* bound-vars) source)
                        (cb true))
                 (throw
                   (js/Error.

  (string/replace (ana/munge-path ns-sym) \. \/))

(defonce
  ^{:doc "Each runtime environment provides a different way to load a library.
  Whatever function *load-fn* is bound to will be passed two arguments - a
  map and a callback function: The map should have the following keys:

  :name   - the name of the library (a symbol)
  :path   - munged relative library path (a string)

  It is up to the implementor to correctly resolve the corresponding .cljs,
  .cljc, or .js resource (the order must be respected). Upon resolution the
  callback should be invoked with a map containing the following keys:

  :lang   - the language, :clj or :js
  :source - the source of the library (a string)
  :name   - optional, used to uniquely identify the script
  :path   - optional, relative URL style path representing location

  If the resource could not be resolved, the callback should be invoked with
  nil."
    :dynamic true}
  *load-fn*
