(defn goog-dependencies*
"Create an index of Google dependencies by namespace and file name."
[]
(letfn [(parse-list [s] (when (> (count s) 0)
(-> (.substring ^String s 1 (dec (count s)))
(string/split #"'\s*,\s*'"))))]
(with-open [reader (io/reader (io/resource "goog/deps.js"))]
(->> (line-seq reader)
(map #(re-matches #"^goog\.addDependency\(['\"](.*)['\"],\s*\[(.*)\],\s*\[(.*)\],.*\);.*" %))
(remove nil?)
(map #(drop 1 %))
(remove #(.startsWith ^String (first %) "../../third_party"))
(map #(hash-map :file (str "goog/" (nth % 0))
:provides (parse-list (nth % 1))
:requires (parse-list (nth % 2))
:group :goog))
(doall)))))