|
52 | 52 | ('example.core 'example.util)"
|
53 | 53 | ([namespaces]
|
54 | 54 | (closure/cljs-dependents-for-macro-namespaces
|
55 |
| - (ana-api/empty-state) namespaces)) |
| 55 | + (or (ana-api/current-state) (ana-api/empty-state)) namespaces)) |
56 | 56 | ([state namespaces]
|
57 | 57 | (closure/cljs-dependents-for-macro-namespaces state namespaces)))
|
58 | 58 |
|
|
68 | 68 | provide build options with :output-dir specified."
|
69 | 69 | ([src] (src-file->target-file src nil))
|
70 | 70 | ([src opts]
|
71 |
| - (src-file->target-file (ana-api/empty-state opts) src opts)) |
| 71 | + (src-file->target-file |
| 72 | + (or (ana-api/current-state) (ana-api/empty-state opts)) src opts)) |
72 | 73 | ([state src opts]
|
73 | 74 | (ana-api/with-state state
|
74 | 75 | (binding [ana/*cljs-warning-handlers* (:warning-handlers opts ana/*cljs-warning-handlers*)]
|
|
79 | 80 | the goog.require statement for it."
|
80 | 81 | ([src] (src-file->goog-require src nil))
|
81 | 82 | ([src opts]
|
82 |
| - (src-file->goog-require (ana-api/empty-state opts) src opts)) |
| 83 | + (src-file->goog-require |
| 84 | + (or (ana-api/current-state) (ana-api/empty-state opts)) src opts)) |
83 | 85 | ([state src opts]
|
84 | 86 | (ana-api/with-state state
|
85 | 87 | (binding [ana/*cljs-warning-handlers* (:warning-handlers opts ana/*cljs-warning-handlers*)]
|
|
121 | 123 | .cljs, .cljc, .js. Returns a map containing :relative-path a string, and
|
122 | 124 | :uri a URL."
|
123 | 125 | ([ns]
|
124 |
| - (ns->location ns (ana-api/empty-state))) |
| 126 | + (ns->location ns (or (ana-api/current-state) (ana-api/empty-state)))) |
125 | 127 | ([ns compiler-env]
|
126 | 128 | (closure/source-for-namespace ns compiler-env)))
|
127 | 129 |
|
|
139 | 141 | ([xs]
|
140 | 142 | (add-dependency-sources xs {}))
|
141 | 143 | ([xs opts]
|
142 |
| - (add-dependency-sources (ana-api/empty-state opts) xs opts)) |
| 144 | + (add-dependency-sources (or (ana-api/current-state) (ana-api/empty-state opts)) xs opts)) |
143 | 145 | ([state xs opts]
|
144 | 146 | (ana-api/with-state state
|
145 | 147 | (closure/add-dependency-sources xs opts))))
|
|
192 | 194 | (defn compile
|
193 | 195 | "Given a Compilable, compile it and return an IJavaScript."
|
194 | 196 | ([opts compilable]
|
195 |
| - (compile (ana-api/empty-state opts) opts compilable)) |
| 197 | + (compile (or (ana-api/current-state) (ana-api/empty-state opts)) opts compilable)) |
196 | 198 | ([state opts compilable]
|
197 | 199 | (ana-api/with-state state
|
198 | 200 | (closure/compile compilable opts))))
|
|
214 | 216 | (build nil opts))
|
215 | 217 | ([source opts]
|
216 | 218 | (build source opts
|
217 |
| - (ana-api/empty-state |
218 |
| - ;; need to dissoc :foreign-libs since we won't know what overriding |
219 |
| - ;; foreign libspecs are referring to until after add-implicit-options |
220 |
| - ;; - David |
221 |
| - (closure/add-externs-sources (dissoc opts :foreign-libs))))) |
| 219 | + (or |
| 220 | + (ana-api/current-state) |
| 221 | + (ana-api/empty-state |
| 222 | + ;; need to dissoc :foreign-libs since we won't know what overriding |
| 223 | + ;; foreign libspecs are referring to until after add-implicit-options |
| 224 | + ;; - David |
| 225 | + (closure/add-externs-sources (dissoc opts :foreign-libs)))))) |
222 | 226 | ([source opts compiler-env]
|
223 | 227 | (doseq [[unknown-opt suggested-opt] (util/unknown-opts (set (keys opts)) closure/known-opts)]
|
224 | 228 | (when suggested-opt
|
|
230 | 234 | "Given a source which can be compiled, watch it for changes to produce."
|
231 | 235 | ([source opts]
|
232 | 236 | (watch source opts
|
233 |
| - (ana-api/empty-state |
234 |
| - (closure/add-externs-sources opts)))) |
| 237 | + (or (ana-api/current-state) |
| 238 | + (ana-api/empty-state |
| 239 | + (closure/add-externs-sources opts))))) |
235 | 240 | ([source opts compiler-env]
|
236 | 241 | (watch source opts compiler-env nil))
|
237 | 242 | ([source opts compiler-env stop]
|
|
291 | 296 | installed."
|
292 | 297 | ([entries]
|
293 | 298 | (node-inputs entries
|
294 |
| - (:options (ana-api/empty-state)))) |
| 299 | + (:options (or (ana-api/current-state) (ana-api/empty-state))))) |
295 | 300 | ([entries opts]
|
296 | 301 | (closure/node-inputs entries opts)))
|
297 | 302 |
|
298 | 303 | (defn node-modules
|
299 | 304 | "Return a sequence of requirable libraries found under node_modules."
|
| 305 | + ([] |
| 306 | + (node-modules {})) |
300 | 307 | ([opts]
|
301 |
| - (ana-api/with-state (ana-api/empty-state opts) |
| 308 | + (ana-api/with-state (or (ana-api/current-state) (ana-api/empty-state opts)) |
302 | 309 | (filter :provides (closure/index-node-modules-dir)))))
|
0 commit comments