| 1 |
================ |
| 2 |
closure-compiler |
| 3 |
================ |
| 4 |
|
| 5 |
-------------------------------------------------------- |
| 6 |
optimising compiler for ECMAScript (JavaScript) programs |
| 7 |
-------------------------------------------------------- |
| 8 |
|
| 9 |
:Author: |author| |
| 10 |
:Date: 2014-01-07 |
| 11 |
:Copyright: |license|. |
| 12 |
:Manual section: 1 |
| 13 |
:Manual group: Closure |
| 14 |
|
| 15 |
.. |command| replace:: **closure-compiler** |
| 16 |
.. |license| replace:: Apache license, version 2.0 |
| 17 |
|
| 18 |
|
| 19 |
SYNOPSIS |
| 20 |
======== |
| 21 |
|
| 22 |
| |command| [ `OPTION` ... ] |
| 23 |
| |command| **--help** |
| 24 |
|
| 25 |
|
| 26 |
DESCRIPTION |
| 27 |
=========== |
| 28 |
|
| 29 |
The Closure Compiler Application is the command-line interface to the |
| 30 |
Closure Compiler, part of the Closure Tools project. |
| 31 |
|
| 32 |
The Closure Compiler is a tool for making ECMAScript (JavaScript) download |
| 33 |
and run faster. It parses your program, analyzes it, removes dead code, and |
| 34 |
rewrites and minimizes what's left. It also checks syntax, variable |
| 35 |
references, and types, and warns about common pitfalls. |
| 36 |
|
| 37 |
|
| 38 |
OPTIONS |
| 39 |
======= |
| 40 |
|
| 41 |
**--help** |
| 42 |
|
| 43 |
Describe how to use the Closure Compiler Application. |
| 44 |
|
| 45 |
**--version** |
| 46 |
|
| 47 |
Print the Closure Compiler version to stderr. |
| 48 |
|
| 49 |
**--accept_const_keyword** |
| 50 |
|
| 51 |
Allow usage of const keyword. |
| 52 |
|
| 53 |
**--angular_pass** |
| 54 |
|
| 55 |
Generate $inject properties for AngularJS for functions annotated with |
| 56 |
``@ngInject``. |
| 57 |
|
| 58 |
**--charset** `CHARSET` |
| 59 |
|
| 60 |
Specify `CHARSET` to be the input and output charset for all files. By |
| 61 |
default, we accept UTF-8 as input and output US_ASCII. |
| 62 |
|
| 63 |
**--closure_entry_point** `ENTRYPOINT` |
| 64 |
|
| 65 |
Specify entry point `ENTRYPOINT` to the program. Must be goog.provide'd |
| 66 |
symbols. Any goog.provide'd symbols that are not a transitive |
| 67 |
dependency of the entry points will be removed. Files without |
| 68 |
goog.provides, and their dependencies, will always be left in. If any |
| 69 |
entry points are specified, then the ``manage_closure_dependencies`` |
| 70 |
option will be set to true and all files will be sorted in dependency |
| 71 |
order. |
| 72 |
|
| 73 |
**--common_js_entry_module** `MODULEFILE` |
| 74 |
|
| 75 |
Specify the root of your common JS dependency hierarchy to be |
| 76 |
`MODULEFILE`. Your main script. |
| 77 |
|
| 78 |
**--common_js_module_path_prefix** `PREFIX` |
| 79 |
|
| 80 |
Specify a path prefix `PREFIX` to be removed from CommonJS module |
| 81 |
names. |
| 82 |
|
| 83 |
**--compilation_level** `LEVEL` |
| 84 |
|
| 85 |
Set the compilation level to `LEVEL`. |
| 86 |
|
| 87 |
Values: ``WHITESPACE_ONLY``, ``SIMPLE_OPTIMIZATIONS``, |
| 88 |
``ADVANCED_OPTIMIZATIONS``. |
| 89 |
|
| 90 |
**--create_name_map_files** |
| 91 |
|
| 92 |
Specify that variable renaming and property renaming map files will be |
| 93 |
produced as {binary name}_vars_map.out and {binary name}_props_map.out. |
| 94 |
|
| 95 |
Note that this flag cannot be used in conjunction with either |
| 96 |
``variable_map_output_file`` or ``property_map_output_file``. |
| 97 |
|
| 98 |
**--create_source_map** `MAPFILE` |
| 99 |
|
| 100 |
Specify a source map file `MAPFILE`, mapping the generated source files |
| 101 |
back to the original source file will be output to the specified path. |
| 102 |
The ``%outname%`` placeholder will expand to the name of the output file |
| 103 |
that the source map corresponds to. |
| 104 |
|
| 105 |
**--debug** |
| 106 |
|
| 107 |
Enable debugging options. |
| 108 |
|
| 109 |
**--define** `DEFINITION`, **--D** `DEFINITION`, **-D** `DEFINITION` |
| 110 |
|
| 111 |
Override the value of a variable annotated @define. The format of |
| 112 |
`DEFINITION` is <name>[=<val>], where <name> is the name of a @define |
| 113 |
variable and <val> is a boolean, number, or a single-quot ed string |
| 114 |
that contains no single quotes. If [=<val>] is omitted, the variable is |
| 115 |
marked true. |
| 116 |
|
| 117 |
**--externs** `EXTERNFILE` |
| 118 |
|
| 119 |
Specify that the file `EXTERNFILE` contains JavaScript externs. |
| 120 |
|
| 121 |
You may specify this option multiple times to specify additional |
| 122 |
`EXTERNFILE` files. |
| 123 |
|
| 124 |
**--extra_annotation_name** `TAGNAME` |
| 125 |
|
| 126 |
Specify `TAGNAME` to append to the whitelist of tag names in JSDoc. |
| 127 |
|
| 128 |
You may specify this option multiple times to append additional |
| 129 |
`TAGNAME` values. |
| 130 |
|
| 131 |
**--flagfile** `FILE` |
| 132 |
|
| 133 |
Specify that `FILE` contains additional command-line options. |
| 134 |
|
| 135 |
**--formatting** `FORMATOPTION` |
| 136 |
|
| 137 |
Specifies the formatting option `FORMATOPTION` to apply to the output |
| 138 |
JS. |
| 139 |
|
| 140 |
Values: ``PRETTY_PRINT``, ``PRINT_INPUT_DELIMITER``, ``SINGLE_QUOTES`` |
| 141 |
|
| 142 |
**--generate_exports** |
| 143 |
|
| 144 |
Generates export code for those marked with @export. |
| 145 |
|
| 146 |
**--js** `INFILE` |
| 147 |
|
| 148 |
Specify `INFILE` as an input filename. |
| 149 |
|
| 150 |
You may specify this option multiple times to append additional |
| 151 |
`INFILE` names. |
| 152 |
|
| 153 |
**--js_output_file** `OUTFILE` |
| 154 |
|
| 155 |
Specify `OUTFILE` as the primary output filename. |
| 156 |
|
| 157 |
If not specified, output is written to stdout. |
| 158 |
|
| 159 |
**--jscomp_error** `WARNCLASS` |
| 160 |
|
| 161 |
Make the named class of warnings `WARNCLASS` an error. |
| 162 |
|
| 163 |
See `Warning Classes`_, below, for the list of valid `WARNCLASS` names. |
| 164 |
|
| 165 |
**--jscomp_off** `WARNCLASS` |
| 166 |
|
| 167 |
Turn off the named class of warnings `WARNCLASS`. |
| 168 |
|
| 169 |
See `Warning Classes`_, below, for the list of valid `WARNCLASS` names. |
| 170 |
|
| 171 |
**--jscomp_warning** `WARNCLASS` |
| 172 |
|
| 173 |
Make the named class of warnings `WARNCLASS` a normal warning. |
| 174 |
|
| 175 |
See `Warning Classes`_, below, for the list of valid `WARNCLASS` names. |
| 176 |
|
| 177 |
**--language_in** `LANGSPEC` |
| 178 |
|
| 179 |
Specify the input sources conform to the language `LANGSPEC`. |
| 180 |
|
| 181 |
Values: ``ECMASCRIPT3`` (default), ``ECMASCRIPT5``, |
| 182 |
``ECMASCRIPT5_STRICT``. |
| 183 |
|
| 184 |
**--logging_level** `LEVEL` |
| 185 |
|
| 186 |
Specify `LEVEL` as the logging level (standard java.util. logging.Level |
| 187 |
values) for Compiler progress. Does not control errors or warnings for |
| 188 |
the JavaScript code under compilation. |
| 189 |
|
| 190 |
**--manage_closure_dependencies** |
| 191 |
|
| 192 |
Automatically sort dependencies so that a file that goog.provides |
| 193 |
symbol X will always come before a file that goog.requires symbol X. If |
| 194 |
an input provides symbols, and those symbols are never required, then |
| 195 |
that input will not be included in the compilation. |
| 196 |
|
| 197 |
**--module** `MODULESPEC` |
| 198 |
|
| 199 |
Specify the JavaScript module specification `MODULESPEC`. |
| 200 |
|
| 201 |
The format for `MODULESPEC` is <name>:<num-js-files>[:[<dep>,...][:]]]. |
| 202 |
Module names must be unique. Each dep is the name of a module that this |
| 203 |
module depends on. Modules must be listed in dependency order, and JS |
| 204 |
source files must be listed in the corresponding order. Where |
| 205 |
**--module** flags occur in relation to **--js** flags is unimportant. |
| 206 |
Provide the value ``auto`` to trigger module creation from |
| 207 |
CommonJSmodules. |
| 208 |
|
| 209 |
**--module_output_path_prefix** `PREFIX` |
| 210 |
|
| 211 |
Specify the filename prefix `PREFIX` for filenames of compiled JS |
| 212 |
modules. <module-name>.js will be appended to this prefix. Directories |
| 213 |
will be created as needed. Use with **--module**. |
| 214 |
|
| 215 |
**--module_wrapper** `WRAPPER` |
| 216 |
|
| 217 |
Specify `WRAPPER` as output wrapper for a JavaScript module (optional). |
| 218 |
|
| 219 |
The format of `WRAPPER` is <name>:<wrapper>. The module name must |
| 220 |
correspond with a module specified using **--module**. The wrapper must |
| 221 |
contain %s as the code placeholder. The %basename% placeholder can also |
| 222 |
be used to substitute the base name of the module output file. |
| 223 |
|
| 224 |
**--only_closure_dependencies** |
| 225 |
|
| 226 |
Only include files in the transitive dependency of the entry points |
| 227 |
(specified by closure_entry_point). Files that do not provide |
| 228 |
dependencies will be removed. This supersedes |
| 229 |
``manage_closure_dependencies``. |
| 230 |
|
| 231 |
**--output_manifest** `MANIFESTFILE` |
| 232 |
|
| 233 |
Prints out a list of all the files in the compilation to |
| 234 |
`MANIFESTFILE`. |
| 235 |
|
| 236 |
If **--manage_closure_dependencies** is on, this will not include files |
| 237 |
that got dropped because they were not required. |
| 238 |
|
| 239 |
The ``%outname%`` placeholder expands to the JS output file. If you're |
| 240 |
using modularization, using ``%outname%`` will create a manifest for |
| 241 |
each module. |
| 242 |
|
| 243 |
**--output_module_dependencies** `DEPFILE` |
| 244 |
|
| 245 |
Prints out a JSON file `DEPFILE` of dependencies between modules. |
| 246 |
|
| 247 |
**--output_wrapper** `WRAPPER` |
| 248 |
|
| 249 |
Interpolate output into `WRAPPER` at the place denoted by the marker |
| 250 |
token ``%output%``. Use marker token ``%output|jsstring%`` to do js |
| 251 |
string escaping on the output. |
| 252 |
|
| 253 |
**--print_ast** |
| 254 |
|
| 255 |
Print a dot file describing the internal abstract syntax tree and exit. |
| 256 |
|
| 257 |
**--print_pass_graph** |
| 258 |
|
| 259 |
Print a dot file describing the passes that will get run and exit. |
| 260 |
|
| 261 |
**--print_tree** |
| 262 |
|
| 263 |
Print out the parse tree and exit. |
| 264 |
|
| 265 |
**--process_closure_primitives** |
| 266 |
|
| 267 |
Processes built-ins from the Closure library, such as goog.require(), |
| 268 |
goog.provide(), and goog.exportSymbol(). |
| 269 |
|
| 270 |
**--process_common_js_modules** |
| 271 |
|
| 272 |
Process CommonJS modules to a concatenable form. |
| 273 |
|
| 274 |
**--process_jquery_primitives** |
| 275 |
|
| 276 |
Processes built-ins from the JQuery library, such as jQuery.fn and |
| 277 |
jQuery.extend(). |
| 278 |
|
| 279 |
**--property_map_input_file** `MAPFILE` |
| 280 |
|
| 281 |
Specify `MAPFILE` as containing the serialized version of the property |
| 282 |
renaming map produced by a previous compilation. |
| 283 |
|
| 284 |
**--property_map_output_file** `MAPFILE` |
| 285 |
|
| 286 |
Save the serialized version of the property renaming map produced to |
| 287 |
`MAPFILE`. |
| 288 |
|
| 289 |
**--source_map_format** `FORMAT` |
| 290 |
|
| 291 |
Product the source map in format `FORMAT`. |
| 292 |
|
| 293 |
Values: ``V1``, ``V2``, ``V3``, ``DEFAULT``. ``DEFAULT`` produces |
| 294 |
``V2``. |
| 295 |
|
| 296 |
**--summary_detail_level** `LEVEL` |
| 297 |
|
| 298 |
Specify the compilation summary detail level `LEVEL`. |
| 299 |
|
| 300 |
Values: ``0`` (never print summary), ``1`` (print summary only if there |
| 301 |
are errors or warnings), ``2`` (print summary if the 'checkTypes' |
| 302 |
diagnostic group is enabled, see **--jscomp_warning**), ``3`` (always |
| 303 |
print summary). The default level is ``1``. |
| 304 |
|
| 305 |
**--third_party** |
| 306 |
|
| 307 |
Check source validity but do not enforce Closure style rules and |
| 308 |
conventions. |
| 309 |
|
| 310 |
**--transform_amd_modules** |
| 311 |
|
| 312 |
Transform AMD to CommonJS modules. |
| 313 |
|
| 314 |
**--translations_file** `TRANSFILE` |
| 315 |
|
| 316 |
Specify `TRANSFILE` as the source of translated messages. Currently |
| 317 |
only supports XTB. |
| 318 |
|
| 319 |
**--translations_project** `PROJECT` |
| 320 |
|
| 321 |
Scope all translations to the specified project. |
| 322 |
|
| 323 |
When specified, use different message ids so that messages in different |
| 324 |
projects can have different translations. |
| 325 |
|
| 326 |
**--use_only_custom_externs** |
| 327 |
|
| 328 |
Specifies that the default externs should be excluded. |
| 329 |
|
| 330 |
**--use_types_for_optimization** |
| 331 |
|
| 332 |
Experimental: perform additional optimizations based on available |
| 333 |
information. Inaccurate type annotations may result in incorrect |
| 334 |
results. |
| 335 |
|
| 336 |
**--variable_map_input_file** `MAPFILE` |
| 337 |
|
| 338 |
Specify `MAPFILE` as containing the serialized version of the variable |
| 339 |
renaming map produced by a previous compilation. |
| 340 |
|
| 341 |
**--variable_map_output_file** `MAPFILE` |
| 342 |
|
| 343 |
Save the serialized version of the variable renaming map produced to |
| 344 |
`MAPFILE`. |
| 345 |
|
| 346 |
**--warning_level** `LEVEL` |
| 347 |
|
| 348 |
Specify the warning level to use. |
| 349 |
|
| 350 |
Values: ``QUIET``, ``DEFAULT``, ``VERBOSE``. |
| 351 |
|
| 352 |
**--warnings_whitelist_file** `LISTFILE` |
| 353 |
|
| 354 |
Suppress warnings listed in `LISTFILE`. Each line should be of the form |
| 355 |
<file-name>:<line-number>? <warning-d escription> |
| 356 |
|
| 357 |
|
| 358 |
Warning Classes |
| 359 |
--------------- |
| 360 |
|
| 361 |
The ``jscomp_error``, ``jscomp_warning``, and ``jscomp_off`` flags |
| 362 |
require as a parameter a `WARNCLASS` warning class name. The following |
| 363 |
names are valid warning class names: |
| 364 |
|
| 365 |
* ``accessControls`` |
| 366 |
* ``ambiguousFunctionDecl`` |
| 367 |
* ``checkRegExp`` |
| 368 |
* ``checkTypes`` |
| 369 |
* ``checkVars`` |
| 370 |
* ``const`` |
| 371 |
* ``constantProperty`` |
| 372 |
* ``deprecated`` |
| 373 |
* ``duplicateMessage`` |
| 374 |
* ``es5Strict`` |
| 375 |
* ``externsValidation`` |
| 376 |
* ``fileoverviewTags`` |
| 377 |
* ``globalThis`` |
| 378 |
* ``internetExplorerChecks`` |
| 379 |
* ``invalidCasts`` |
| 380 |
* ``misplacedTypeAnnotation`` |
| 381 |
* ``missingProperties`` |
| 382 |
* ``nonStandardJsDocs`` |
| 383 |
* ``suspiciousCode`` |
| 384 |
* ``strictModuleDepCheck`` |
| 385 |
* ``typeInvalidation`` |
| 386 |
* ``undefinedNames`` |
| 387 |
* ``undefinedVars`` |
| 388 |
* ``unknownDefines`` |
| 389 |
* ``uselessCode`` |
| 390 |
* ``visibility`` |
| 391 |
|
| 392 |
|
| 393 |
EXAMPLE |
| 394 |
======= |
| 395 |
|
| 396 |
* | |command| --js hello.js --js_output_file hello-compiled.js |
| 397 |
|
| 398 |
This command creates a new file called ``hello-compiled.js``, which |
| 399 |
contains the compiled program. |
| 400 |
|
| 401 |
|
| 402 |
HISTORY |
| 403 |
======= |
| 404 |
|
| 405 |
The Closure Tools project is an effort by Google engineers to open source |
| 406 |
the tools used in many of Google's sites and web applications for use by |
| 407 |
the wider Web development community. |
| 408 |
|
| 409 |
This manual page was written by |author| to document the |command| command |
| 410 |
for Debian. It is free software and may be used by others under the terms |
| 411 |
of the |license|. |
| 412 |
|
| 413 |
.. |author| replace:: |authorname| |authoremail| |
| 414 |
.. |authorname| replace:: Ben Finney |
| 415 |
.. |authoremail| replace:: <[email protected]> |
| 416 |
|
| 417 |
.. |
| 418 |
Local variables: |
| 419 |
mode: rst |
| 420 |
coding: utf-8 |
| 421 |
time-stamp-format: "%:y-%02m-%02d" |
| 422 |
time-stamp-start: "^:Date:[ ]+" |
| 423 |
time-stamp-end: "$" |
| 424 |
time-stamp-line-limit: 20 |
| 425 |
End: |
| 426 |
vim: filetype=rst fileencoding=utf-8 : |