Skip to content

Commit c28859a

Browse files
authored
Cleanup (#819)
* Remove unused imports * Remove duplicate requires
1 parent d863c50 commit c28859a

File tree

23 files changed

+35
-56
lines changed

23 files changed

+35
-56
lines changed

src/main/shadow/build/api.clj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
[shadow.build.resource :as rc]
1616
[shadow.jvm-log :as log]
1717
[clojure.set :as set]
18-
[shadow.build.resolve :as resolve]
1918
[shadow.build.babel :as babel])
20-
(:import (java.io File)
21-
(java.util.concurrent ExecutorService)))
19+
(:import (java.util.concurrent ExecutorService)))
2220

2321
(defn build-state? [build]
2422
(data/build-state? build))

src/main/shadow/build/classpath.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
[shadow.build.cljs-bridge :as cljs-bridge]
2020
[shadow.build.npm :as npm]
2121
[shadow.build.data :as data])
22-
(:import (java.io File StringReader)
22+
(:import (java.io File)
2323
(java.util.jar JarFile JarEntry Attributes$Name)
2424
(java.net URL URLDecoder)
2525
(java.util.zip ZipException)
@@ -28,7 +28,7 @@
2828
[com.google.javascript.jscomp CompilerOptions$LanguageMode CompilerOptions SourceFile]
2929
[com.google.javascript.jscomp.deps ModuleNames]
3030
[javax.xml.parsers DocumentBuilderFactory]
31-
[org.w3c.dom Node Element]))
31+
[org.w3c.dom Element]))
3232

3333
(set! *warn-on-reflection* true)
3434

src/main/shadow/build/cljs_bridge.clj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
[shadow.build.ns-form :as ns-form]
1717
[shadow.build.cljs-hacks]
1818
[shadow.build.data :as data])
19-
(:import (java.io PushbackReader StringReader)
20-
(java.util.concurrent Executors ExecutorService)))
19+
(:import (java.io PushbackReader StringReader)))
2120

2221

2322
(defn get-resource-info [resource-name content reader-features]

src/main/shadow/build/closure.clj

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
[cljs.analyzer :as ana]
77
[cljs.compiler :as comp]
88
[cljs.env :as env]
9-
[cljs.compiler :as cljs-comp]
109
[shadow.cljs.util :as util]
1110
[shadow.build.output :as output]
1211
[shadow.build.warnings :as warnings]
@@ -17,15 +16,14 @@
1716
[shadow.core-ext :as core-ext]
1817
[shadow.build.resource :as rc]
1918
[shadow.debug :refer (?> ?-> ?->>)]
20-
[clojure.data.json :as json]
21-
[shadow.debug :as dbg])
22-
(:import (java.io StringWriter ByteArrayInputStream FileOutputStream File StringReader)
19+
[clojure.data.json :as json])
20+
(:import (java.io StringWriter ByteArrayInputStream FileOutputStream)
2321
(com.google.javascript.jscomp JSError SourceFile CompilerOptions CustomPassExecutionTime
2422
CommandLineRunner VariableMap SourceMapInput DiagnosticGroups
2523
CheckLevel JSModule CompilerOptions$LanguageMode
2624
Result ShadowAccess
27-
SourceMap$DetailLevel SourceMap$Format ClosureCodingConvention CompilationLevel AnonymousFunctionNamingPolicy DiagnosticGroup NodeTraversal StrictModeCheck VariableRenamingPolicy PropertyRenamingPolicy PhaseOptimizer)
28-
(shadow.build.closure ReplaceCLJSConstants NodeEnvInlinePass ReplaceRequirePass PropertyCollector NodeStuffInlinePass FindSurvivingRequireCalls ClearUnassignedJsRequires)
25+
SourceMap$DetailLevel SourceMap$Format ClosureCodingConvention CompilationLevel AnonymousFunctionNamingPolicy DiagnosticGroup VariableRenamingPolicy PropertyRenamingPolicy PhaseOptimizer)
26+
(shadow.build.closure ReplaceCLJSConstants NodeEnvInlinePass ReplaceRequirePass PropertyCollector NodeStuffInlinePass FindSurvivingRequireCalls)
2927
(com.google.javascript.jscomp.deps ModuleLoader$ResolutionMode)
3028
(java.nio.charset Charset)
3129
[java.util.logging Logger Level]
@@ -329,14 +327,14 @@
329327

330328
content
331329
(str (->> file-globals
332-
(map #(cljs-comp/munge % #{}))
330+
(map #(comp/munge % #{}))
333331
(sort)
334332
(map #(str "/** @const {ShadowJS} */ var " % ";"))
335333
(str/join "\n"))
336334
"\n"
337335
(->> file-props
338336
(sort)
339-
(map #(cljs-comp/munge % #{}))
337+
(map #(comp/munge % #{}))
340338
(map #(str "ShadowJS.prototype." % ";"))
341339
(str/join "\n")))]
342340

@@ -360,14 +358,14 @@
360358
content
361359
(str (->> js-globals
362360
(remove known-js-globals)
363-
(map #(cljs-comp/munge % #{}))
361+
(map #(comp/munge % #{}))
364362
(sort)
365363
(map #(str "/** @const {ShadowJS} */ var " % ";"))
366364
(str/join "\n"))
367365
"\n"
368366
(->> js-props
369367
(sort)
370-
(map #(cljs-comp/munge % #{}))
368+
(map #(comp/munge % #{}))
371369
(map #(str "ShadowJS.prototype." % ";"))
372370
(str/join "\n")))]
373371

@@ -1302,7 +1300,7 @@
13021300
(if (and (:import require-loc) (or (= :goog type) (= :shadow-js type)))
13031301
;; goog supports import ... from "goog:cljs.core" in ES6 files
13041302
;; but not for commonjs require
1305-
(str "goog:" (cljs-comp/munge ns))
1303+
(str "goog:" (comp/munge ns))
13061304
(str "/" resource-name))]
13071305

13081306
(str (subs source 0 (inc offset))
@@ -1419,7 +1417,7 @@
14191417
(case type
14201418
;; just in case we add the goog.provide for cljs/closure namespaces
14211419
(:cljs :goog :shadow-js)
1422-
(str "goog.provide(\"" (cljs-comp/munge ns) "\");")
1420+
(str "goog.provide(\"" (comp/munge ns) "\");")
14231421
(throw (ex-info (format "whats this? %s type: %s" resource-name type) {}))))))
14241422
(into []))
14251423

src/main/shadow/build/compiler.clj

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
[clojure.java.io :as io]
66
[clojure.tools.reader.reader-types :as readers]
77
[clojure.tools.reader :as reader]
8-
[cljs.analyzer :as cljs-ana]
98
[cljs.analyzer :as ana]
109
[cljs.compiler :as comp]
1110
[cljs.spec.alpha :as cljs-spec]
@@ -27,8 +26,7 @@
2726
[shadow.build.closure :as closure]
2827
[shadow.build.npm :as npm]
2928
[shadow.jvm-log :as log]
30-
[shadow.build.async :as async]
31-
[shadow.debug :as dbg])
29+
[shadow.build.async :as async])
3230
(:import (java.util.concurrent ExecutorService)
3331
(java.io File StringReader PushbackReader StringWriter)
3432
[java.util.concurrent.atomic AtomicLong]))
@@ -139,7 +137,7 @@
139137
pprefix (protocol-prefix protocol)]
140138

141139
;; assoc into ns so cache can restore it
142-
(swap! env/*compiler* update-in [::cljs-ana/namespaces protocol-ns :shadow/protocol-prefixes] util/set-conj pprefix)
140+
(swap! env/*compiler* update-in [::ana/namespaces protocol-ns :shadow/protocol-prefixes] util/set-conj pprefix)
143141
;; used by externs inference since it otherwise can't identify protocol properties
144142
(swap! env/*compiler* update :shadow/protocol-prefixes util/set-conj pprefix)
145143
))))
@@ -156,7 +154,7 @@
156154
(let [require (second form)
157155
ns (-> env :ns :name)]
158156
(when (string? require)
159-
(swap! env/*compiler* update-in [::cljs-ana/namespaces ns :shadow/js-requires] util/set-conj require)
157+
(swap! env/*compiler* update-in [::ana/namespaces ns :shadow/js-requires] util/set-conj require)
160158
)))))
161159
ast)
162160

@@ -1027,7 +1025,7 @@
10271025
(defn load-core []
10281026
;; cljs.core is already required and loaded when this is called
10291027
;; this just interns the macros into the analyzer env
1030-
(cljs-ana/intern-macros 'cljs.core))
1028+
(ana/intern-macros 'cljs.core))
10311029

10321030
(defn par-compile-cljs-sources
10331031
"compile files in parallel, files MUST be in dependency order and ALL dependencies must be present

src/main/shadow/build/ns_form.clj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
[clojure.string :as str]
66
[cljs.compiler :as cljs-comp]
77
[shadow.cljs.util :as util :refer (reduce-> reduce-kv->)]
8-
[shadow.build.data :as data])
9-
(:import (java.nio.file Paths FileSystems)))
8+
[shadow.build.data :as data]))
109

1110
;; [clojure.core.specs.alpha :as cs]
1211
;; too many differences in CLJS ns to make use of those

src/main/shadow/build/resolve.clj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
[shadow.cljs.util :as util]
66
[shadow.build.classpath :as cp]
77
[shadow.build.npm :as npm]
8-
[shadow.build.classpath :as classpath]
98
[shadow.build.data :as data]
109
[shadow.build.js-support :as js-support]
1110
[shadow.build.cljs-bridge :as cljs-bridge]
@@ -626,7 +625,7 @@
626625
(map #(symbol (str ns %))))))
627626
(filter (fn [spec-ns]
628627
(or (get-in state [:sym->id spec-ns])
629-
(classpath/has-resource? classpath spec-ns))))
628+
(cp/has-resource? classpath spec-ns))))
630629
(vec)))]
631630

632631
(if-not (seq auto-require-namespaces)

src/main/shadow/build/targets/browser.clj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
[shadow.build.closure :as closure]
1717
[shadow.build.modules :as modules]
1818
[shadow.build.data :as data]
19-
[shadow.build.log :as log]
2019
[shadow.core-ext :as core-ext]
2120
[cljs.compiler :as cljs-comp]
2221
[shadow.build.npm :as npm]

src/main/shadow/build/targets/shared.clj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
[shadow.build.api :as cljs]
88
[shadow.build.data :as data]
99
[shadow.build.modules :as modules]
10-
[clojure.data.json :as json])
11-
(:import [java.net InetAddress]))
10+
[clojure.data.json :as json]))
1211

1312
(defn unquoted-qualified-symbol? [sym]
1413
(and (qualified-symbol? sym)

src/main/shadow/build/targets/single_file.clj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
[shadow.build.data :as data]
1313
[clojure.data.json :as json]
1414
[clojure.string :as str]
15-
[shadow.cljs.util :as util])
16-
(:import [java.io StringReader]))
15+
[shadow.cljs.util :as util]))
1716

1817
(defn configure
1918
[{:keys [worker-info] :as state} mode {:keys [build-id output-to entry] :as config}]

0 commit comments

Comments
 (0)