|
37 | 37 | SourceMap$DetailLevel ClosureCodingConvention SourceFile
|
38 | 38 | Result JSError CheckLevel DiagnosticGroups
|
39 | 39 | CommandLineRunner AnonymousFunctionNamingPolicy
|
40 |
| - JSModule SourceMap Es6RewriteModules VariableMap |
41 |
| - ProcessCommonJSModules Es6RewriteScriptsToModules] |
| 40 | + JSModule SourceMap VariableMap] |
42 | 41 | [com.google.javascript.jscomp.deps ModuleLoader$ResolutionMode ModuleNames]
|
43 | 42 | [com.google.javascript.rhino Node]
|
44 | 43 | [java.nio.file Path Paths Files StandardWatchEventKinds WatchKey
|
|
1736 | 1735 | (str
|
1737 | 1736 | "goog.provide(\"" module-name "\");\n"
|
1738 | 1737 | (->> (.getRequires input)
|
| 1738 | + ;; v20180204 returns string |
| 1739 | + ;; next Closure returns DependencyInfo.Require object |
| 1740 | + (map (fn [i] |
| 1741 | + (if (string? i) |
| 1742 | + i |
| 1743 | + (.getSymbol i)))) |
1739 | 1744 | ;; If CJS/ES6 module uses goog.require, goog is added to requires
|
1740 | 1745 | ;; but this would cause problems with Cljs.
|
1741 | 1746 | (remove #{"goog"})
|
|
1796 | 1801 | ^Node js-root (.getSecondChild extern-and-js-root)
|
1797 | 1802 | inputs-by-name (into {} (map (juxt #(.getName %) identity) (vals (.getInputsById closure-compiler))))]
|
1798 | 1803 |
|
1799 |
| - (.process (Es6RewriteScriptsToModules. closure-compiler) extern-root js-root) |
1800 |
| - (.process (Es6RewriteModules. closure-compiler) extern-root js-root) |
1801 |
| - (.process (ProcessCommonJSModules. closure-compiler) extern-root js-root) |
| 1804 | + ;; This will rewrite CommonJS modules |
| 1805 | + (.whitespaceOnlyPasses closure-compiler) |
| 1806 | + ;; This will take care of converting ES6 to CJS |
| 1807 | + ;; Based on language-in setting, this could also handle ES7/8/TypeScript transpilation. |
| 1808 | + (.transpileAndDontCheck closure-compiler) |
1802 | 1809 |
|
1803 | 1810 | (map (partial add-converted-source
|
1804 | 1811 | closure-compiler inputs-by-name opts)
|
|
0 commit comments