1CLOSURE-COMPILER(1) closure-compiler CLOSURE-COMPILER(1)
2
3
4
6 closure-compiler - Performs checking, instrumentation, and optimization
7 on JavaScript code.
8
10 closure-compiler [OPTIONS...] [FILES...]
11
13 closure-compiler may be used to check and optimize JavaScript code. If
14 positional arguments are not given, code to check will be read from
15 standard input.
16
18 The following options are understood:
19
20 --accept_const_keyword
21 Allows usage of const keyword.
22
23 --angular_pass
24 Generate $inject properties for AngularJS for functions annotated
25 with @ngInject.
26
27 --charset VAL
28 Input and output charset for all files. By default, we accept UTF-8
29 as input and output US_ASCII.
30
31 --closure_entry_point VAL
32 Entry points to the program. Must be goog.provide'd symbols. Any
33 goog.provide'd symbols that are not a transitive dependency of the
34 entry points will be removed. Files without goog.provide's, and
35 their dependencies, will always be left in. If any entry points are
36 specified, then the manage_closure_dependencies option will be set
37 to true and all files will be sorted in dependency order.
38
39 --common_js_entry_module VAL
40 Root of your common JS dependency hierarchy. Your main script.
41
42 --common_js_module_path_prefix VAL
43 Path prefix to be removed from CommonJS module names.
44
45 --compilation_level
46 WHITESPACE_ONLY|SIMPLE_OPTIMIZATIONS|ADVANCED_OPTIMIZATIONS
47 Specifies the compilation level to use.
48
49 --create_name_map_files
50 If true, variable renaming and property renaming map files will be
51 produced as binary name_vars_map.out and binary name_props_map.out.
52 Note that this flag cannot be used in conjunction with either
53 variableMapOut putFile or property_map_output_file.
54
55 --create_source_map VAL
56 If specified, a source map file mapping the generated source files
57 back to the original source file will be output to the specified
58 path. The %outname% placeholder will expand to the name of the
59 output file that the source map corresponds to.
60
61 --debug
62 Enable debugging options.
63
64 --D, --d, --define name[=val]
65 Override the value of a variable annotated @define. The format is
66 name[=val], where name is the name of a @define variable and val is
67 a boolean, number, or a single-quoted string that contains no
68 single quotes. If val is omitted, the variable is marked true.
69
70 --externs VAL
71 The file containing JavaScript externs. May be specified multiple
72 times.
73
74 --extra_annotation VAL
75 A whitelist of tag names in JSDoc. May be specified multiple times.
76
77 --flagfile VAL
78 A file containing additional command-line options.
79
80 --formatting PRETTY_PRINT | PRINT_INPUT_DELIMITER | SINGLE_QUOTES
81 Specifies which formatting options, if any, should be applied to
82 the output JS.
83
84 --generate_exports
85 Generates export code for those marked with @export.
86
87 --help
88 Displays this message
89
90 --js VAL
91 The JavaScript filename. May be specified multiple times.
92
93 --js_output_file VAL
94 Primary output filename. If not specified, output is written to
95 stdout.
96
97 --jscomp_error VAL
98 Make the named class of warnings an error. Options: accessControls,
99 ambiguousFunctionDecl, checkEventfulObjectDisposal, checkRegExp,
100 checkStruct DictInheritance, checkTypes, checkVars, const,
101 constantProperty, deprecated, duplicateMessage, es3, es5Strict,
102 externsValidation, fileoverviewTags, globalThis,
103 internetExplorerChecks, invalidCasts, misplacedTypeAnnotation,
104 missingProperties, missingProvide, missingRequire, missingReturn,
105 nonStandardJsDocs, reportUnknownTypes, suspiciousCode,
106 strictModuleDepCheck, typeInvalidation, undefinedNames,
107 undefinedVars, unknownDefines, uselessCode, visibility.
108
109 --jscomp_off VAL
110 Turn off the named class of warnings. Options: accessControls,
111 ambiguousFunctionDecl, checkEventfulObjectDisposal, checkRegExp,
112 checkStructDictInheritance, checkTypes, checkVars, const,
113 constantProperty, deprecated, duplicateMessage, es3, es5Strict,
114 externsValidation, fileoverviewTags, globalThis,
115 internetExplorerChecks, invalidCasts, misplacedTypeAnnotation,
116 missingProperties, missingProvide, missingRequire, missingReturn,
117 nonStandardJsDocs, reportUnknownTypes, suspiciousCode,
118 strictModuleDepCheck, typeInvalidation, undefinedNames,
119 undefinedVars, unknownDefines, uselessCode, visibility.
120
121 --jscomp_warning VAL
122 Make the named class of warnings a normal warning. Options:
123 accessControls, ambiguousFunctionDecl, checkEventfulObjectDisposal,
124 checkRegExp, checkStructDictInheritance, checkTypes, checkVars,
125 const, constantProperty, deprecated, duplicateMessage, es3,
126 es5Strict, externsValidation, fileoverviewTags, globalThis,
127 internetExplorerChecks, invalidCasts, misplacedTypeAnnotation,
128 missingProperties, missingProvide, missingRequire, missingReturn,
129 nonStandardJsDocs, reportUnknownTypes, suspiciousCode,
130 strictModuleDepCheck, typeInvalidation, undefinedNames,
131 undefinedVars, unknownDefines, uselessCode, visibility.
132
133 --language_in VAL
134 Sets what language spec that input sources conform. Options:
135 ECMASCRIPT3 (default), ECMASCRIPT5, ECMASCRIPT5_STRICT.
136
137 --logging_level VAL
138 The logging level (standard java.util.logging.Level values) for
139 Compiler progress. Does not control errors or warnings for the
140 JavaScript code under compilation
141
142 --manage_closure_dependencies
143 Automatically sort dependencies so that a file that goog.provides
144 symbol X will always come before a file that goog.requires symbol
145 X. If an input provides symbols, and those symbols are never
146 required, then that input will not be included in the compilation.
147
148 --module name:num-js-files[:dep...][:]
149 A JavaScript module specification. Module names must be unique.
150 Each dep is the name of a module that this module depends on.
151 Modules must be listed in dependency order, and JS source files
152 must be listed in the corresponding order. Where --module flags
153 occur in relation to --js flags is unimportant. Provide the value
154 auto to trigger module creation from CommonJSmodules.
155
156 --module_output_path_prefix VAL
157 Prefix for filenames of compiled JS modules. module-name.js will be
158 appended to this prefix. Directories will be created as needed. Use
159 with --module.
160
161 --module_wrapper VAL
162 An output wrapper for a JavaScript module (optional). The format is
163 name:wrapper. The module name must correspond with a module
164 specified using --module. The wrapper must contain %s as the code
165 placeholde r. The %basename% placeholder can also be used to
166 substitute the base name of the module output file.
167
168 --new_type_inf
169 In development new type inference pass. DO NOT USE!
170
171 --only_closure_dependencies
172 Only include files in the transitive dependency of the entry points
173 (specified by closure_entry_point). Files that do not provide
174 dependencies will be removed. This supersedes
175 manage_closure_dependencies.
176
177 --output_manifest VAL
178 Prints out a list of all the files in the compilation. If
179 --manage_closure_dependencies is on, this will not include files
180 that got dropped because they were not required. The %outname%
181 placeholder expands to the JS output file. If you're using
182 modularization, using %outname% will create a manifest for each
183 module.
184
185 --output_module_dependencies VAL
186 Prints out a JSON file of dependencies between modules.
187
188 --output_wrapper VAL
189 Interpolate output into this string at the place denoted by the
190 marker token %output%. Use marker token %output|jsstring% to do js
191 string escaping on the output.
192
193 --print_ast
194 Prints a dot file describing the internal abstract syntax tree and
195 exits.
196
197 --print_pass_graph
198 Prints a dot file describing the passes that will get run and
199 exits.
200
201 --print_tree
202 Prints out the parse tree and exits.
203
204 --process_closure_primitives
205 Processes built-ins from the Closure library, such as
206 goog.require(), goog.provide(), and goog.exportSymbol().
207
208 --process_common_js_modules
209 Process CommonJS modules to a concatenable form.
210
211 --process_jquery_primitives
212 Processes built-ins from the jQuery library, such as jQuery.fn and
213 jQuery.extend().
214
215 --property_map_input_file VAL
216 File containing the serialized version of the property renaming map
217 produced by a previous compilation.
218
219 --property_map_output_file VAL
220 File where the serialized version of the property renaming map
221 produced should be saved.
222
223 --source_map_format V1 | DEFAULT | V2 | V3
224 The source map format to produce. Options: V1, V2, V3, DEFAULT.
225 DEFAULT produces V2.
226
227 --summary_detail_level N
228 Controls how detailed the compilation summary is. Values: 0 (never
229 print summary), 1 (print summary only if there are errors or
230 warnings), 2 (print summary if the 'checkTypes' diagnostic group is
231 enabled, see --jscomp_warning), 3 (always print summary). The
232 default level is 1.
233
234 --third_party
235 Check source validity but do not enforce Closure style rules and
236 conventions.
237
238 --tracer_mode ALL | RAW_SIZE | TIMING_ONLY | OFF
239 Shows the duration of each compiler pass and the impact to the
240 compiled output size. Options: ALL, RAW_SIZE, TIMING_ONLY, OFF.
241
242 --transform_amd_modules
243 Transform AMD to CommonJS modules.
244
245 --translations_file VAL
246 Source of translated messages. Currently only supports XTB.
247
248 --translations_project VAL
249 Scopes all translations to the specified project.When specified, we
250 will use different message ids so that messages in different
251 projects can have different translations.
252
253 --use_only_custom_externs
254 Specifies whether the default externs should be excluded.
255
256 --use_types_for_optimization
257 Experimental: perform additional optimizations based on available
258 information. Inaccurate type annotations may result in incorrect
259 results.
260
261 --variable_map_input_file VAL
262 File containing the serialized version of the variable renaming map
263 produced by a previous compilation.
264
265 --variable_map_output_file VAL
266 File where the serialized version of the variable renaming map
267 produced should be saved.
268
269 --version
270 Prints the compiler version to stderr.
271
272 --warning_level QUIET | DEFAULT |VERBOSE
273 Specifies the warning level to use. Options: QUIET, DEFAULT,
274 VERBOSE.
275
276 --warnings_whitelist_file FILE
277 A file containing warnings to suppress. Each line should be of the
278 form file-name:[line-number] warning-description.
279
281 https://code.google.com/p/closure-compiler/
282
283
284
285closure-compiler 01/31/2019 CLOSURE-COMPILER(1)