CLOSURE-COMPILER(1) | Closure | CLOSURE-COMPILER(1) |
NAME¶
closure-compiler - optimising compiler for ECMAScript (JavaScript) programs
SYNOPSIS¶
closure-compiler [ OPTION ... ] closure-compiler --help
DESCRIPTION¶
The Closure Compiler Application is the command-line interface to the Closure Compiler, part of the Closure Tools project.
The Closure Compiler is a tool for making ECMAScript (JavaScript) download and run faster. It parses your program, analyzes it, removes dead code, and rewrites and minimizes what's left. It also checks syntax, variable references, and types, and warns about common pitfalls.
OPTIONS¶
--help
--version
--accept_const_keyword
--angular_pass
--charset CHARSET
--closure_entry_point ENTRYPOINT
--common_js_entry_module MODULEFILE
--common_js_module_path_prefix PREFIX
--compilation_level LEVEL
Values: WHITESPACE_ONLY, SIMPLE_OPTIMIZATIONS, ADVANCED_OPTIMIZATIONS.
--create_name_map_files
Note that this flag cannot be used in conjunction with either variable_map_output_file or property_map_output_file.
--create_source_map MAPFILE
--debug
--define DEFINITION, --D DEFINITION, -D DEFINITION
--externs EXTERNFILE
You may specify this option multiple times to specify additional EXTERNFILE files.
--extra_annotation_name TAGNAME
You may specify this option multiple times to append additional TAGNAME values.
--flagfile FILE
--formatting FORMATOPTION
Values: PRETTY_PRINT, PRINT_INPUT_DELIMITER, SINGLE_QUOTES
--generate_exports
--js INFILE
You may specify this option multiple times to append additional INFILE names.
--js_output_file OUTFILE
If not specified, output is written to stdout.
--jscomp_error WARNCLASS
See Warning Classes, below, for the list of valid WARNCLASS names.
--jscomp_off WARNCLASS
See Warning Classes, below, for the list of valid WARNCLASS names.
--jscomp_warning WARNCLASS
See Warning Classes, below, for the list of valid WARNCLASS names.
--language_in LANGSPEC
Values: ECMASCRIPT3 (default), ECMASCRIPT5, ECMASCRIPT5_STRICT.
--logging_level LEVEL
--manage_closure_dependencies
--module MODULESPEC
The format for MODULESPEC is <name>:<num-js-files>[:[<dep>,...][:]]]. Module names must be unique. Each dep is the name of a module that this module depends on. Modules must be listed in dependency order, and JS source files must be listed in the corresponding order. Where --module flags occur in relation to --js flags is unimportant. Provide the value auto to trigger module creation from CommonJSmodules.
--module_output_path_prefix PREFIX
--module_wrapper WRAPPER
The format of WRAPPER is <name>:<wrapper>. The module name must correspond with a module specified using --module. The wrapper must contain %s as the code placeholder. The %basename% placeholder can also be used to substitute the base name of the module output file.
--only_closure_dependencies
--output_manifest MANIFESTFILE
If --manage_closure_dependencies is on, this will not include files that got dropped because they were not required.
The %outname% placeholder expands to the JS output file. If you're using modularization, using %outname% will create a manifest for each module.
--output_module_dependencies DEPFILE
--output_wrapper WRAPPER
--print_ast
--print_pass_graph
--print_tree
--process_closure_primitives
--process_common_js_modules
--process_jquery_primitives
--property_map_input_file MAPFILE
--property_map_output_file MAPFILE
--source_map_format FORMAT
Values: V1, V2, V3, DEFAULT. DEFAULT produces V2.
--summary_detail_level LEVEL
Values: 0 (never print summary), 1 (print summary only if there are errors or warnings), 2 (print summary if the 'checkTypes' diagnostic group is enabled, see --jscomp_warning), 3 (always print summary). The default level is 1.
--third_party
--transform_amd_modules
--translations_file TRANSFILE
--translations_project PROJECT
When specified, use different message ids so that messages in different projects can have different translations.
--use_only_custom_externs
--use_types_for_optimization
--variable_map_input_file MAPFILE
--variable_map_output_file MAPFILE
--warning_level LEVEL
Values: QUIET, DEFAULT, VERBOSE.
--warnings_whitelist_file LISTFILE
Warning Classes¶
The jscomp_error, jscomp_warning, and jscomp_off flags require as a parameter a WARNCLASS warning class name. The following names are valid warning class names:
- accessControls
- ambiguousFunctionDecl
- checkRegExp
- checkTypes
- checkVars
- const
- constantProperty
- deprecated
- duplicateMessage
- es5Strict
- externsValidation
- fileoverviewTags
- globalThis
- internetExplorerChecks
- invalidCasts
- misplacedTypeAnnotation
- missingProperties
- nonStandardJsDocs
- suspiciousCode
- strictModuleDepCheck
- typeInvalidation
- undefinedNames
- undefinedVars
- unknownDefines
- uselessCode
- visibility
EXAMPLE¶
- •
-
closure-compiler --js hello.js --js_output_file hello-compiled.js
This command creates a new file called hello-compiled.js, which contains the compiled program.
HISTORY¶
The Closure Tools project is an effort by Google engineers to open source the tools used in many of Google's sites and web applications for use by the wider Web development community.
This manual page was written by Ben Finney <ben+ecmascript@benfinney.id.au> to document the closure-compiler command for Debian. It is free software and may be used by others under the terms of the Apache license, version 2.0.
AUTHOR¶
Ben Finney <ben+ecmascript@benfinney.id.au>
COPYRIGHT¶
Apache license, version 2.0.
2014-01-07 |