<?xml version='1.0'?> <!--*-nxml-*-->
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<refentry id="closure-compiler">
  <refentryinfo>
    <title>closure-compiler</title>
    <productname>closure-compiler</productname>

    <authorgroup>
      <author>
        <contrib></contrib>
        <firstname></firstname>
        <surname></surname>
        <email></email>
      </author>
    </authorgroup>
  </refentryinfo>

  <refmeta>
    <refentrytitle>closure-compiler</refentrytitle>
    <manvolnum>1</manvolnum>
  </refmeta>

  <refnamediv>
    <refname>closure-compiler</refname>
    <refpurpose>Performs checking, instrumentation, and
    optimization on JavaScript code.</refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <cmdsynopsis>
      <command>closure-compiler</command>
      <arg choice="opt" rep="repeat">OPTIONS</arg>
      <arg choice="opt" rep="repeat">FILES</arg>
    </cmdsynopsis>
  </refsynopsisdiv>

  <refsect1>
    <title>Description</title>

    <para><command>closure-compiler</command> may be used to
    check and optimize JavaScript code.
    If positional arguments are not given, code to check
    will be read from standard input.</para>
  </refsect1>

  <refsect1>
    <title>Options</title>

    <para>The following options are understood:</para>

    <variablelist>
      <varlistentry>
        <term><option>--accept_const_keyword</option></term>

        <listitem><para>Allows usage of <constant>const</constant>
        keyword.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--angular_pass</option></term>

        <listitem><para>Generate <varname>$inject</varname> properties for
        AngularJS for functions annotated with <varname>@ngInject</varname>.
        </para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--charset <replaceable>VAL</replaceable></option></term>

        <listitem><para>Input and output charset for all
      files. By default, we accept <constant>UTF-8</constant> as
      input and output <constant>US_ASCII</constant>.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--closure_entry_point <replaceable>VAL</replaceable></option></term>

        <listitem><para>Entry points to the program. Must be
        goog.provide'd symbols. Any goog.provide'd symbols that are
        not a transitive dependency of the entry points will be
        removed. Files without goog.provide's, and their dependencies,
        will always be left in. If any entry points are specified,
        then the manage_closure_dependencies option will be set to
        true and all files will be sorted in dependency order.
        </para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--common_js_entry_module <replaceable>VAL</replaceable></option></term>

        <listitem><para>Root of your common JS dependency
        hierarchy. Your main script.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--common_js_module_path_prefix <replaceable>VAL</replaceable></option></term>

        <listitem><para>Path prefix to be removed from
        CommonJS module names.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--compilation_level</option>
        WHITESPACE_ONLY|SIMPLE_OPTIMIZATIONS|ADVANCED_OPTIMIZATIONS
        </term>

        <listitem><para>Specifies the compilation level to use.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--create_name_map_files</option></term>

        <listitem><para>If true, variable renaming and property
        renaming map files will be produced as
        <literal><replaceable>binary name</replaceable>_vars_map.out</literal> and
        <literal><replaceable>binary name</replaceable>_props_map.out</literal>.
        Note that this flag cannot be used in conjunction with either
        variableMapOut putFile or property_map_output_file.
        </para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--create_source_map</option> <replaceable>VAL</replaceable></term>

        <listitem><para>If specified, a source map file mapping the
        generated source files back to the original source file will
        be output to the specified path. The
        <varname>%outname%</varname> placeholder will expand to the
        name of the output file that the source map corresponds to.
        </para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--debug</option></term>

        <listitem><para>Enable debugging options.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--D</option></term>
        <term><option>--d</option></term>
        <term><option>--define</option> <replaceable>name</replaceable><optional>=<replaceable>val</replaceable></optional></term>

        <listitem><para>Override the value of a variable
        annotated @define. The format is
        <replaceable>name</replaceable><optional>=<replaceable>val</replaceable></optional>,
        where <replaceable>name</replaceable> is the
        name of a <constant>@define</constant> variable and <replaceable>val</replaceable>
        is a boolean, number, or a single-quoted string that contains no single
        quotes. If <replaceable>val</replaceable> is omitted, the
        variable is marked true.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--externs <replaceable>VAL</replaceable></option></term>

        <listitem><para>The file containing JavaScript
        externs. May be specified multiple times.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--extra_annotation <replaceable>VAL</replaceable></option></term>

        <listitem><para>A whitelist of tag names in JSDoc.
        May be specified multiple times.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--flagfile <replaceable>VAL</replaceable></option></term>

        <listitem><para>A file containing additional command-line options.
        </para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--formatting</option>
        PRETTY_PRINT | PRINT_INPUT_DELIMITER | SINGLE_QUOTES
        </term>

        <listitem><para>Specifies which formatting options, if any, should be applied to the
        output JS.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--generate_exports</option></term>

        <listitem><para>Generates export code for those marked with
        <constant>@export</constant>.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--help</option></term>

        <listitem><para>Displays this message</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--js <replaceable>VAL</replaceable></option></term>

        <listitem><para>The JavaScript filename.
        May be specified multiple times.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--js_output_file <replaceable>VAL</replaceable></option>
        </term>

        <listitem><para>Primary output filename. If not
        specified, output is written to stdout.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--jscomp_error <replaceable>VAL</replaceable></option></term>

        <listitem><para>Make the named class of warnings an
        error. Options: <literal>accessControls</literal>,
        <literal>ambiguousFunctionDecl</literal>,
        <literal>checkEventfulObjectDisposal</literal>,
        <literal>checkRegExp</literal>,
        <literal>checkStruct</literal>
        <literal>DictInheritance</literal>,
        <literal>checkTypes</literal>,
        <literal>checkVars</literal>,
        <literal>const</literal>,
        <literal>constantProperty</literal>,
        <literal>deprecated</literal>,
        <literal>duplicateMessage</literal>,
        <literal>es3</literal>,
        <literal>es5Strict</literal>,
        <literal>externsValidation</literal>,
        <literal>fileoverviewTags</literal>,
        <literal>globalThis</literal>,
        <literal>internetExplorerChecks</literal>,
        <literal>invalidCasts</literal>,
        <literal>misplacedTypeAnnotation</literal>,
        <literal>missingProperties</literal>,
        <literal>missingProvide</literal>,
        <literal>missingRequire</literal>,
        <literal>missingReturn</literal>,
        <literal>nonStandardJsDocs</literal>,
        <literal>reportUnknownTypes</literal>,
        <literal>suspiciousCode</literal>,
        <literal>strictModuleDepCheck</literal>,
        <literal>typeInvalidation</literal>,
        <literal>undefinedNames</literal>,
        <literal>undefinedVars</literal>,
        <literal>unknownDefines</literal>,
        <literal>uselessCode</literal>,
        <literal>visibility</literal>.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--jscomp_off <replaceable>VAL</replaceable></option></term>

        <listitem><para>Turn off the named class of warnings.
        Options: <literal>accessControls</literal>,
        <literal>ambiguousFunctionDecl</literal>,
        <literal>checkEventfulObjectDisposal</literal>,
        <literal>checkRegExp</literal>,
        <literal>checkStructDictInheritance</literal>,
        <literal>checkTypes</literal>,
        <literal>checkVars</literal>,
        <literal>const</literal>,
        <literal>constantProperty</literal>,
        <literal>deprecated</literal>,
        <literal>duplicateMessage</literal>,
        <literal>es3</literal>,
        <literal>es5Strict</literal>,
        <literal>externsValidation</literal>,
        <literal>fileoverviewTags</literal>,
        <literal>globalThis</literal>,
        <literal>internetExplorerChecks</literal>,
        <literal>invalidCasts</literal>,
        <literal>misplacedTypeAnnotation</literal>,
        <literal>missingProperties</literal>,
        <literal>missingProvide</literal>,
        <literal>missingRequire</literal>,
        <literal>missingReturn</literal>,
        <literal>nonStandardJsDocs</literal>,
        <literal>reportUnknownTypes</literal>,
        <literal>suspiciousCode</literal>,
        <literal>strictModuleDepCheck</literal>,
        <literal>typeInvalidation</literal>,
        <literal>undefinedNames</literal>,
        <literal>undefinedVars</literal>,
        <literal>unknownDefines</literal>,
        <literal>uselessCode</literal>,
        <literal>visibility</literal>.
        </para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--jscomp_warning <literal>VAL</literal></option></term>

        <listitem><para>Make the named class of warnings a
        normal warning. Options:
        <literal>accessControls</literal>,
        <literal>ambiguousFunctionDecl</literal>,
        <literal>checkEventfulObjectDisposal</literal>,
        <literal>checkRegExp</literal>,
        <literal>checkStructDictInheritance</literal>,
        <literal>checkTypes</literal>,
        <literal>checkVars</literal>,
        <literal>const</literal>,
        <literal>constantProperty</literal>,
        <literal>deprecated</literal>,
        <literal>duplicateMessage</literal>,
        <literal>es3</literal>,
        <literal>es5Strict</literal>,
        <literal>externsValidation</literal>,
        <literal>fileoverviewTags</literal>,
        <literal>globalThis</literal>,
        <literal>internetExplorerChecks</literal>,
        <literal>invalidCasts</literal>,
        <literal>misplacedTypeAnnotation</literal>,
        <literal>missingProperties</literal>,
        <literal>missingProvide</literal>,
        <literal>missingRequire</literal>,
        <literal>missingReturn</literal>,
        <literal>nonStandardJsDocs</literal>,
        <literal>reportUnknownTypes</literal>,
        <literal>suspiciousCode</literal>,
        <literal>strictModuleDepCheck</literal>,
        <literal>typeInvalidation</literal>,
        <literal>undefinedNames</literal>,
        <literal>undefinedVars</literal>,
        <literal>unknownDefines</literal>,
        <literal>uselessCode</literal>,
        <literal>visibility</literal>.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--language_in <replaceable>VAL</replaceable></option></term>

        <listitem><para>Sets what language spec that input
        sources conform. Options: <literal>ECMASCRIPT3</literal>
        (default), <literal>ECMASCRIPT5</literal>,
        <literal>ECMASCRIPT5_STRICT</literal>.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--logging_level <replaceable>VAL</replaceable></option></term>

        <listitem><para>The logging level (standard
        java.util.logging.Level values) for Compiler progress. Does
        not control errors or warnings for the JavaScript code under
        compilation</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--manage_closure_dependencies</option></term>

        <listitem><para>Automatically sort dependencies so that a file
        that goog.provides symbol X will always come before a file
        that goog.requires symbol X. If an input provides symbols, and
        those symbols are never required, then that input will not be
        included in the compilation.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--module</option>
        <replaceable>name</replaceable>:<replaceable>num-js-files</replaceable><optional>:<replaceable>dep...</replaceable></optional><optional>:</optional></term>

        <listitem><para>A JavaScript module specification.  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 <option>--module</option> flags occur in
        relation to <option>--js</option> flags is unimportant.
        Provide the value <literal>auto</literal> to trigger module
        creation from CommonJSmodules.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--module_output_path_prefix</option>
        <replaceable>VAL</replaceable></term>

        <listitem><para>Prefix for filenames of compiled JS
        modules. module-name.js will be appended to this
        prefix. Directories will be created as needed. Use with
        <option>--module</option>.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--module_wrapper <replaceable>VAL</replaceable></option></term>

        <listitem><para>An output wrapper for a JavaScript module
        (optional). The format is name:wrapper. The module name must
        correspond with a module specified using --module. The wrapper
        must contain %s as the code placeholde r. The %basename%
        placeholder can also be used to substitute the base name of
        the module output file.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--new_type_inf</option></term>

        <listitem><para>In development new type inference pass. DO NOT
        USE!</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--only_closure_dependencies</option></term>

        <listitem><para>Only include files in the transitive
        dependency of the entry points (specified by
        closure_entry_point).  Files that do not provide dependencies
        will be removed. This supersedes
        <option>manage_closure_dependencies</option>.
        </para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--output_manifest <replaceable>VAL</replaceable></option></term>

        <listitem><para>Prints out a list of all the files in the
        compilation. If <option>--manage_closure_dependencies</option>
        is on, this will not include files that got dropped because
        they were not required. The <varname>%outname%</varname>
        placeholder expands to the JS output file. If you're using
        modularization, using <varname>%outname%</varname> will create
        a manifest for each module.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--output_module_dependencies <replaceable>VAL</replaceable></option></term>

        <listitem><para>Prints out a JSON file of dependencies
        between modules.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--output_wrapper <replaceable>VAL</replaceable></option></term>

        <listitem><para>Interpolate output into this string at the
        place denoted by the marker token
        <varname>%output%</varname>. Use marker token
        <varname>%output|jsstring%</varname> to do js string escaping
        on the output.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--print_ast</option></term>

        <listitem><para>Prints a dot file describing the internal
        abstract syntax tree and exits.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--print_pass_graph</option></term>

        <listitem><para>Prints a dot file describing the passes that
        will get run and exits.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--print_tree</option></term>

        <listitem><para>Prints out the parse tree and exits.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--process_closure_primitives</option></term>

        <listitem><para>Processes built-ins from the Closure
        library, such as goog.require(), goog.provide(), and goog.exportSymbol().
        </para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--process_common_js_modules</option></term>

        <listitem><para>Process CommonJS modules to a concatenable form.
        </para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--process_jquery_primitives</option></term>

        <listitem><para>Processes built-ins from the jQuery
        library, such as jQuery.fn and jQuery.extend().</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--property_map_input_file <replaceable>VAL</replaceable></option></term>

        <listitem><para>File containing the serialized version of the
        property renaming map produced by a previous compilation.
        </para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--property_map_output_file <replaceable>VAL</replaceable></option></term>

        <listitem><para>File where the serialized version of the
        property renaming map produced should be saved.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--source_map_format V1 | DEFAULT | V2 | V3</option></term>

        <listitem><para>The source map format to produce.
        Options: <literal>V1</literal>,
        <literal>V2</literal>,
        <literal>V3</literal>,
        <literal>DEFAULT</literal>.
        <literal>DEFAULT</literal>
        produces <literal>V2</literal>.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--summary_detail_level <replaceable>N</replaceable></option></term>

        <listitem><para>Controls how detailed the compilation
        summary is. 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
        <option>--jscomp_warning</option>), 3 (always print
        summary). The default level is 1.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--third_party</option></term>

        <listitem><para>Check source validity but do not enforce
        Closure style rules and conventions.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--tracer_mode ALL | RAW_SIZE | TIMING_ONLY | OFF</option></term>

        <listitem><para>Shows the duration of each compiler pass and
        the impact to the compiled output size. Options:
        <literal>ALL</literal>, <literal>RAW_SIZE</literal>,
        <literal>TIMING_ONLY</literal>, <literal>OFF</literal>.
        </para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--transform_amd_modules</option></term>

        <listitem><para>Transform AMD to CommonJS modules.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--translations_file <replaceable>VAL</replaceable></option></term>

        <listitem><para>Source of translated messages.
        Currently only supports XTB.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--translations_project <replaceable>VAL</replaceable></option></term>

        <listitem><para>Scopes all translations to the specified
        project.When specified, we will use different message ids so
        that messages in different projects can have different
        translations.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--use_only_custom_externs</option></term>

        <listitem><para>Specifies whether the default externs should
        be excluded.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--use_types_for_optimization</option></term>

        <listitem><para>Experimental: perform additional optimizations
        based on available information. Inaccurate type annotations
        may result in incorrect results.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--variable_map_input_file</option>
        <replaceable>VAL</replaceable></term>

        <listitem><para>File containing the serialized version of the
        variable renaming map produced by a previous compilation.
        </para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--variable_map_output_file <replaceable>VAL</replaceable></option></term>

        <listitem><para>File where the serialized version of the
        variable renaming map produced should be saved.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--version</option></term>

        <listitem><para>Prints the compiler version to stderr.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--warning_level QUIET | DEFAULT |VERBOSE</option></term>

        <listitem><para>Specifies the warning level to use.
        Options: <literal>QUIET</literal>,
        <literal>DEFAULT</literal>,
        <literal>VERBOSE</literal>.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--warnings_whitelist_file</option>
        <replaceable>FILE</replaceable></term>

        <listitem><para>A file containing warnings to suppress. Each
        line should be of the form <replaceable>file-name</replaceable>:<optional><replaceable>line-number</replaceable></optional> <replaceable>warning-description</replaceable>.
        </para></listitem>
      </varlistentry>
    </variablelist>
  </refsect1>

  <refsect1>
    <title>See Also</title>
    <para><link>https://code.google.com/p/closure-compiler/</link></para>
  </refsect1>
</refentry>
