|
1977 | 1977 | #(ensure-cljs-base-module % opts)))
|
1978 | 1978 |
|
1979 | 1979 | (defn add-implicit-options
|
1980 |
| - [{:keys [optimizations output-dir npm-deps] |
| 1980 | + [{:keys [optimizations output-dir npm-deps missing-js-modules] |
1981 | 1981 | :or {optimizations :none
|
1982 | 1982 | output-dir "out"}
|
1983 | 1983 | :as opts}]
|
1984 | 1984 | (let [opts (cond-> (update opts :foreign-libs
|
1985 | 1985 | (fn [libs]
|
1986 |
| - (into (index-node-modules npm-deps opts) |
| 1986 | + (into (index-node-modules |
| 1987 | + (into missing-js-modules (keys npm-deps)) opts) |
1987 | 1988 | (expand-libs libs))))
|
1988 | 1989 | (:closure-defines opts)
|
1989 | 1990 | (assoc :closure-defines
|
|
2003 | 2004 | :optimizations optimizations
|
2004 | 2005 | :output-dir output-dir
|
2005 | 2006 | :ups-libs libs
|
2006 |
| - :ups-foreign-libs (into (index-node-modules (compute-upstream-npm-deps opts) opts) |
| 2007 | + :ups-foreign-libs (into (index-node-modules (keys (compute-upstream-npm-deps opts)) opts) |
2007 | 2008 | (expand-libs foreign-libs))
|
2008 | 2009 | :ups-externs externs
|
2009 | 2010 | :emit-constants emit-constants
|
|
2134 | 2135 | (into [] (distinct (mapcat #(node-module-deps % opts) entries)))))
|
2135 | 2136 |
|
2136 | 2137 | (defn index-node-modules
|
2137 |
| - ([npm-deps] |
| 2138 | + ([modules] |
2138 | 2139 | (index-node-modules
|
2139 |
| - npm-deps |
| 2140 | + modules |
2140 | 2141 | (when env/*compiler*
|
2141 | 2142 | (:options @env/*compiler*))))
|
2142 |
| - ([npm-deps opts] |
| 2143 | + ([modules opts] |
2143 | 2144 | (let [node-modules (io/file "node_modules")]
|
2144 |
| - (if (and (not (empty? npm-deps)) (.exists node-modules) (.isDirectory node-modules)) |
2145 |
| - (let [modules (map name (keys npm-deps)) |
| 2145 | + (if (and (not (empty? modules)) (.exists node-modules) (.isDirectory node-modules)) |
| 2146 | + (let [modules (into #{} (map name) modules) |
2146 | 2147 | deps-file (io/file (str (util/output-directory opts) File/separator
|
2147 | 2148 | "cljs$node_modules.js"))]
|
2148 | 2149 | (util/mkdirs deps-file)
|
|
2252 | 2253 | (env/with-compiler-env compiler-env
|
2253 | 2254 | ;; we want to warn about NPM dep conflicts before installing the modules
|
2254 | 2255 | (check-npm-deps opts)
|
| 2256 | + (maybe-install-node-deps! opts) |
2255 | 2257 | (let [compiler-stats (:compiler-stats opts)
|
2256 | 2258 | static-fns? (or (and (= (:optimizations opts) :advanced)
|
2257 |
| - (not (false? (:static-fns opts)))) |
2258 |
| - (:static-fns opts) |
2259 |
| - ana/*cljs-static-fns*) |
2260 |
| - all-opts (-> opts |
2261 |
| - maybe-install-node-deps! |
2262 |
| - add-implicit-options |
2263 |
| - process-js-modules)] |
| 2259 | + (not (false? (:static-fns opts)))) |
| 2260 | + (:static-fns opts) |
| 2261 | + ana/*cljs-static-fns*) |
| 2262 | + sources (-find-sources source opts) |
| 2263 | + missing-js-modules (into #{} |
| 2264 | + (comp |
| 2265 | + (map :missing-js-modules) |
| 2266 | + cat) |
| 2267 | + sources) |
| 2268 | + all-opts (-> (assoc opts :missing-js-modules missing-js-modules) |
| 2269 | + add-implicit-options |
| 2270 | + process-js-modules)] |
2264 | 2271 | (check-output-to opts)
|
2265 | 2272 | (check-output-dir opts)
|
2266 | 2273 | (check-source-map opts)
|
|
2275 | 2282 | (assoc :target (:target opts))
|
2276 | 2283 | (assoc :js-dependency-index (deps/js-dependency-index all-opts))
|
2277 | 2284 | ;; Save list of sources for cljs.analyzer/locate-src - Juho Teperi
|
2278 |
| - (assoc :sources (-find-sources source all-opts)))) |
| 2285 | + (assoc :sources sources))) |
2279 | 2286 | (binding [comp/*recompiled* (when-not (false? (:recompile-dependents opts))
|
2280 | 2287 | (atom #{}))
|
2281 | 2288 | ana/*cljs-static-fns* static-fns?
|
|
0 commit comments