 (ns jsx-fun.core
   (:require [clojure.java.io :as io]
             [cljs.closure :as cl])
-  (:import [javax.script ScriptEngineManager]
-           [java.util List]
-           [java.util.logging Level]
+  (:import [com.google.common.base Predicates]
+           [javax.script ScriptEngineManager]
            [com.google.javascript.jscomp
             ES6ModuleLoader ProcessCommonJSModules CompilerOptions SourceFile
-            Result JSModule JSError CompilerOptions$LanguageMode
-            AbstractCompiler]
-           [com.google.javascript.jscomp.Compiler]))
+            CompilerOptions$LanguageMode NodeUtil NodeUtil$Visitor]
+           [com.google.javascript.jscomp.parsing
+            Config Config$LanguageMode ParserRunner]
+           [com.google.javascript.rhino
+            Node Token ErrorReporter SimpleErrorReporter]))
 
 (defn set-options [opts ^CompilerOptions compiler-options]
   (doseq [[k v] opts]

      nil root)
    (.toSource comp root)))

;(defn transform-commonjs
;  [filename src]
;  (let [^List externs '()

    (io/file "resources/ScrollResponder.out.js")
    (transform-jsx (slurp (io/file "resources/ScrollResponder.js"))))

  ;; the file name is used as the module name
  ;; we will have to extract this from @providesModule
  (println
    (transform-commonjs
      "ScrollResponder.js"
      (transform-jsx (slurp (io/file "resources/ScrollResponder.js")))))

  (let [config       (ParserRunner/createConfig
                       true Config$LanguageMode/ECMASCRIPT5 true nil)
        err-reporter (SimpleErrorReporter.)
        source-file  (SourceFile/fromFile
                       (io/file "resources/ScrollResponder.js"))
        parse-result (ParserRunner/parse
                       source-file (.getCode source-file)
                       config err-reporter)
        visitor      (node-visitor)]
    (println
      (.comments parse-result))
    (NodeUtil/visitPreOrder
      (.ast parse-result) visitor (Predicates/alwaysTrue)))
  )