You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 14, 2024. It is now read-only.
As of release v20160822, commonJS imports may be broken: we recommend that you compile a single file only (e.g. via Browserify or other tools), or use ES6 imports.
90
-
91
-
### Flags
92
-
93
-
The Closure Compiler in JS supports many of the flags supported by the Java-based Closure Compiler.
94
-
For now, the supported flags are [listed in source](https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/gwt/client/GwtRunner.java#L93).
95
-
Specify these flags as `camelCase` format, and not like `camel_case` or `--camel_case`.
96
-
97
-
Notably, unless you're using a build system, you have to specify code via flags.
98
-
Both `jsCode` and `externs` accept an array containing objects with `src`, `path`, and `sourceMap` properties.
99
-
For those of you familiar with [Closure syntax](https://developers.google.com/closure/compiler/docs/js-for-compiler), that's `Array<{src: string, path: string, sourceMap: string}>`.
100
-
101
-
<!--
102
-
Using `path`, you can construct a virtual filesystem for use with ES6 imports or CommonJS imports (although don't forget to specify `processCommonJsModules: true`).
| angularPass | false | Generate $inject properties for AngularJS for functions annotated with @ngInject|
92
+
| assumeFunctionWrapper | false | Enable additional optimizations based on the assumption that the output will be wrapped with a function wrapper. This flag is used to indicate that "global" declarations will not actually be global but instead isolated to the compilation unit. This enables additional optimizations. |
93
+
| checksOnly | false | Don't generate output. Run checks, but no optimization passes. |
94
+
| compilationLevel | SIMPLE | Specifies the compilation level to use.<br /> Options: WHITESPACE_ONLY, SIMPLE, ADVANCED |
95
+
| dartPass | false ||
96
+
| env | BROWSER | Determines the set of builtin externs to load.<br /> Options: BROWSER, CUSTOM |
97
+
| exportLocalPropertyDefinitions | false ||
98
+
| generateExports | false | Generates export code for those marked with @export. |
99
+
| languageIn | ES6 | Sets what language spec that input sources conform to. |
100
+
| languageOut | ES5 | Sets what language spec the output should conform to. |
101
+
| newTypeInf | false | Checks for type errors using the new type inference algorithm. |
102
+
| polymerPass | false | Rewrite Polymer classes to be compiler-friendly. |
103
+
| preserveTypeAnnotations | false ||
104
+
| processCommonJsModules | false | Process CommonJS modules to a concatenable form, i.e., support `require` statements. |
105
+
| renamePrefixNamespace || Specifies the name of an object that will be used to store all non-extern globals. |
106
+
| rewritePolyfills | false | Rewrite ES6 library calls to use polyfills provided by the compiler's runtime. |
107
+
| useTypesForOptimization | false | Enable or disable the optimizations based on available type information. Inaccurate type annotations may result in incorrect results. |
108
+
| warningLevel | DEFAULT | Specifies the warning level to use.<br /> Options: QUIET, DEFAULT, VERBOSE |
109
+
| jsCode |[]| Specifies the source code to compile. |
110
+
| externs |[]| Additional externs to use for this compile. |
111
+
| createSourceMap | false | Generates a source map mapping the generated source file back to its original sources. |
112
+
113
+
### Languages
114
+
115
+
The Closure Compiler supports languages `ECMASCRIPT3`, `ECMASCRIPT5`, `ECMASCRIPT5_STRICT` for input and output, `ECMASCRIPT6`, `ECMASCRIPT6_STRICT` for input only, and `ECMASCRIPT6_TYPED` (experimental) for both.
116
+
117
+
### Source Code
118
+
119
+
Unless you're using the Gulp or Webpack plugins, you'll need to specify code via flags.
120
+
Both `jsCode` and `externs` accept an array containing objects in the form `{src, path, sourceMap}`.
121
+
Using `path`, you can construct a virtual filesystem for use with ES6 or CommonJS imports—although for CommonJS, be sure to set `processCommonJsModules: true`.
0 commit comments