Skip to content

Commit 95386f5

Browse files
committed
mark transpiled files so we can switch between :none & :advanced w/o issue.
looking at the bigger picture we should look at what it would take to repurpose the :aot-cache logic for a local cache
1 parent 66f6bc5 commit 95386f5

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/main/clojure/cljs/closure.clj

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,8 +2065,13 @@
20652065
result (.compile cc (url->nio-path rsc) source)]
20662066
(.source result))
20672067
source)]
2068-
(cond-> source'
2069-
(= :goog module) add-goog-load)))
2068+
(str "/*TRANSPILED*/"
2069+
(cond-> source'
2070+
(= :goog module) add-goog-load))))
2071+
2072+
(defn requires-transpile? [out-file]
2073+
(let [line (first (line-seq (io/reader out-file)))]
2074+
(not (string/starts-with? line "/*TRANSPILED*/"))))
20702075

20712076
(comment
20722077
(println (slurp (io/resource "goog/math/long.js")))
@@ -2107,7 +2112,9 @@
21072112
(and res (util/changed? out-file res))
21082113
;; always re-emit GCL libs under optimizations higher than :none
21092114
;; :none will just use the cached transpiled result
2110-
(and transpile? (not= :none optimizations))))
2115+
(and transpile?
2116+
(or (not= :none optimizations)
2117+
(requires-transpile? out-file)))))
21112118
(when (and res (or ana/*verbose* (:verbose opts)))
21122119
(util/debug-prn "Copying" (str res) "to" (str out-file)))
21132120
(util/mkdirs out-file)

0 commit comments

Comments
 (0)