 (defn- cache-prefix-for-path [path]
   (str (:cache-path @app-env) "/" (munge path)))
 
+(defn- extract-cache-metadata [source]
+  (let [file-namespace (extract-namespace source)
+        relpath (if file-namespace
+                  (cljs/ns->relpath file-namespace)
+                  "cljs/user")]
+    [file-namespace relpath]))
+
+(def extract-cache-metadata-mem (memoize extract-cache-metadata))
+
 (defn caching-js-eval
   [{:keys [path name source cache]}]
   (when (and path source cache (:cache-path @app-env))

        (-> (r/read {:read-cond :allow :features #{:cljs}} rdr)
          meta :source)))))

(defn execute-source
  [[source-type source-value] {:keys [expression? print-nil-expression? in-exit-context? include-stacktrace?] :as opts}]
  (binding [ana/*cljs-ns* @current-ns

          (if source
            (case lang
              :clj (execute-source ["text" source] opts)
              :js (process-macros-deps cache
                    (fn [res]
                      (if-let [error (:error res)]
                        (handle-error (js/Error. error) false in-exit-context?)
                        (process-libs-deps cache
                          (fn [res]
                            (if-let [error (:error res)]
                              (handle-error (js/Error. error) false in-exit-context?)
                              (js/eval source))))))))
            (handle-error (js/Error. (str "Could not load file " source-value)) false in-exit-context?))))
      (let [source-text source-value
            expression-form (and expression? (repl-read-string source-text))]
