fix wording and formatting (#2512)
This commit is contained in:
62
README.md
62
README.md
@@ -598,17 +598,17 @@ If you're using the `X-SourceMap` header instead, you can just omit `sourceMap.u
|
|||||||
|
|
||||||
## Compress options
|
## Compress options
|
||||||
|
|
||||||
- `booleans` (default: `true`) -- various optimizations for boolean context, for example `!!a
|
- `booleans` (default: `true`) -- various optimizations for boolean context,
|
||||||
? b : c → a ? b : c`
|
for example `!!a ? b : c → a ? b : c`
|
||||||
|
|
||||||
- `cascade` (default: `true`) -- small optimization for sequences, transform `x, x` into `x`
|
- `cascade` (default: `true`) -- small optimization for sequences, transform
|
||||||
and `x = something(), x` into `x = something()`
|
`x, x` into `x` and `x = something(), x` into `x = something()`
|
||||||
|
|
||||||
- `collapse_vars` (default: `true`) -- Collapse single-use non-constant variables - side
|
- `collapse_vars` (default: `true`) -- Collapse single-use non-constant variables,
|
||||||
effects permitting.
|
side effects permitting.
|
||||||
|
|
||||||
- `comparisons` (default: `true`) -- apply certain optimizations to binary nodes, for example:
|
- `comparisons` (default: `true`) -- apply certain optimizations to binary nodes,
|
||||||
`!(a <= b) → a > b` (only when `unsafe_comps`), attempts to negate binary
|
e.g. `!(a <= b) → a > b` (only when `unsafe_comps`), attempts to negate binary
|
||||||
nodes, e.g. `a = !b && !c && !d && !e → a=!(b||c||d||e)` etc.
|
nodes, e.g. `a = !b && !c && !d && !e → a=!(b||c||d||e)` etc.
|
||||||
|
|
||||||
- `conditionals` (default: `true`) -- apply optimizations for `if`-s and conditional
|
- `conditionals` (default: `true`) -- apply optimizations for `if`-s and conditional
|
||||||
@@ -616,7 +616,7 @@ If you're using the `X-SourceMap` header instead, you can just omit `sourceMap.u
|
|||||||
|
|
||||||
- `dead_code` (default: `true`) -- remove unreachable code
|
- `dead_code` (default: `true`) -- remove unreachable code
|
||||||
|
|
||||||
- `drop_console` (default: `false`) -- default `false`. Pass `true` to discard calls to
|
- `drop_console` (default: `false`) -- Pass `true` to discard calls to
|
||||||
`console.*` functions. If you wish to drop a specific function call
|
`console.*` functions. If you wish to drop a specific function call
|
||||||
such as `console.info` and/or retain side effects from function arguments
|
such as `console.info` and/or retain side effects from function arguments
|
||||||
after dropping the function call then use `pure_funcs` instead.
|
after dropping the function call then use `pure_funcs` instead.
|
||||||
@@ -625,7 +625,7 @@ If you're using the `X-SourceMap` header instead, you can just omit `sourceMap.u
|
|||||||
|
|
||||||
- `evaluate` (default: `true`) -- attempt to evaluate constant expressions
|
- `evaluate` (default: `true`) -- attempt to evaluate constant expressions
|
||||||
|
|
||||||
- `expression` (default: `false`) -- default `false`. Pass `true` to preserve completion values
|
- `expression` (default: `false`) -- Pass `true` to preserve completion values
|
||||||
from terminal statements without `return`, e.g. in bookmarklets.
|
from terminal statements without `return`, e.g. in bookmarklets.
|
||||||
|
|
||||||
- `global_defs` (default: `{}`) -- see [conditional compilation](#conditional-compilation)
|
- `global_defs` (default: `{}`) -- see [conditional compilation](#conditional-compilation)
|
||||||
@@ -647,19 +647,18 @@ If you're using the `X-SourceMap` header instead, you can just omit `sourceMap.u
|
|||||||
|
|
||||||
- `join_vars` (default: `true`) -- join consecutive `var` statements
|
- `join_vars` (default: `true`) -- join consecutive `var` statements
|
||||||
|
|
||||||
- `keep_fargs` (default: `true`) -- default `true`. Prevents the
|
- `keep_fargs` (default: `true`) -- Prevents the compressor from discarding unused
|
||||||
compressor from discarding unused function arguments. You need this
|
function arguments. You need this for code which relies on `Function.length`.
|
||||||
for code which relies on `Function.length`.
|
|
||||||
|
|
||||||
- `keep_fnames` (default: `false`) -- Pass `true` to prevent the
|
- `keep_fnames` (default: `false`) -- Pass `true` to prevent the
|
||||||
compressor from discarding function names. Useful for code relying on
|
compressor from discarding function names. Useful for code relying on
|
||||||
`Function.prototype.name`. See also: the `keep_fnames` [mangle option](#mangle).
|
`Function.prototype.name`. See also: the `keep_fnames` [mangle option](#mangle).
|
||||||
|
|
||||||
- `keep_infinity` (default: `false`) -- default `false`. Pass `true` to prevent `Infinity` from
|
- `keep_infinity` (default: `false`) -- Pass `true` to prevent `Infinity` from
|
||||||
being compressed into `1/0`, which may cause performance issues on Chrome.
|
being compressed into `1/0`, which may cause performance issues on Chrome.
|
||||||
|
|
||||||
- `loops` (default: `true`) -- optimizations for `do`, `while` and `for` loops when we can
|
- `loops` (default: `true`) -- optimizations for `do`, `while` and `for` loops
|
||||||
statically determine the condition
|
when we can statically determine the condition.
|
||||||
|
|
||||||
- `negate_iife` (default: `true`) -- negate "Immediately-Called Function Expressions"
|
- `negate_iife` (default: `true`) -- negate "Immediately-Called Function Expressions"
|
||||||
where the return value is discarded, to avoid the parens that the
|
where the return value is discarded, to avoid the parens that the
|
||||||
@@ -707,21 +706,22 @@ If you're using the `X-SourceMap` header instead, you can just omit `sourceMap.u
|
|||||||
occasions the default sequences limit leads to very slow compress times in which
|
occasions the default sequences limit leads to very slow compress times in which
|
||||||
case a value of `20` or less is recommended.
|
case a value of `20` or less is recommended.
|
||||||
|
|
||||||
- `side_effects` (default: `true`) -- default `true`. Pass `false` to disable potentially dropping
|
- `side_effects` (default: `true`) -- Pass `false` to disable potentially dropping
|
||||||
functions marked as "pure". A function call is marked as "pure" if a comment
|
functions marked as "pure". A function call is marked as "pure" if a comment
|
||||||
annotation `/*@__PURE__*/` or `/*#__PURE__*/` immediately precedes the call. For
|
annotation `/*@__PURE__*/` or `/*#__PURE__*/` immediately precedes the call. For
|
||||||
example: `/*@__PURE__*/foo();`
|
example: `/*@__PURE__*/foo();`
|
||||||
|
|
||||||
- `switches` (default: `true`) -- de-duplicate and remove unreachable `switch` branches
|
- `switches` (default: `true`) -- de-duplicate and remove unreachable `switch` branches
|
||||||
|
|
||||||
- `toplevel` (default: `false`) -- drop unreferenced functions (`"funcs"`) and/or variables (`"vars"`)
|
- `toplevel` (default: `false`) -- drop unreferenced functions (`"funcs"`) and/or
|
||||||
in the top level scope (`false` by default, `true` to drop both unreferenced
|
variables (`"vars"`) in the top level scope (`false` by default, `true` to drop
|
||||||
functions and variables)
|
both unreferenced functions and variables)
|
||||||
|
|
||||||
- `top_retain` (default: `null`) -- prevent specific toplevel functions and variables from `unused`
|
- `top_retain` (default: `null`) -- prevent specific toplevel functions and
|
||||||
removal (can be array, comma-separated, RegExp or function. Implies `toplevel`)
|
variables from `unused` removal (can be array, comma-separated, RegExp or
|
||||||
|
function. Implies `toplevel`)
|
||||||
|
|
||||||
- `typeofs` (default: `true`) -- default `true`. Transforms `typeof foo == "undefined"` into
|
- `typeofs` (default: `true`) -- Transforms `typeof foo == "undefined"` into
|
||||||
`foo === void 0`. Note: recommend to set this value to `false` for IE10 and
|
`foo === void 0`. Note: recommend to set this value to `false` for IE10 and
|
||||||
earlier versions due to known issues.
|
earlier versions due to known issues.
|
||||||
|
|
||||||
@@ -746,25 +746,25 @@ If you're using the `X-SourceMap` header instead, you can just omit `sourceMap.u
|
|||||||
- `unsafe_regexp` (default: `false`) -- enable substitutions of variables with
|
- `unsafe_regexp` (default: `false`) -- enable substitutions of variables with
|
||||||
`RegExp` values the same way as if they are constants.
|
`RegExp` values the same way as if they are constants.
|
||||||
|
|
||||||
- `unused` (default: `true`) -- drop unreferenced functions and variables (simple direct variable
|
- `unused` (default: `true`) -- drop unreferenced functions and variables (simple
|
||||||
assignments do not count as references unless set to `"keep_assign"`)
|
direct variable assignments do not count as references unless set to `"keep_assign"`)
|
||||||
|
|
||||||
- `warnings` (default: `false`) -- display warnings when dropping unreachable code or unused
|
- `warnings` (default: `false`) -- display warnings when dropping unreachable
|
||||||
declarations etc.
|
code or unused declarations etc.
|
||||||
|
|
||||||
## Mangle options
|
## Mangle options
|
||||||
|
|
||||||
- `eval` (default `false`). Pass `true` to mangle names visible in scopes
|
- `eval` (default `false`) -- Pass `true` to mangle names visible in scopes
|
||||||
where `eval` or `with` are used.
|
where `eval` or `with` are used.
|
||||||
|
|
||||||
- `keep_fnames` (default `false`). Pass `true` to not mangle function names.
|
- `keep_fnames` (default `false`) -- Pass `true` to not mangle function names.
|
||||||
Useful for code relying on `Function.prototype.name`. See also: the `keep_fnames`
|
Useful for code relying on `Function.prototype.name`. See also: the `keep_fnames`
|
||||||
[compress option](#compress-options).
|
[compress option](#compress-options).
|
||||||
|
|
||||||
- `reserved` (default `[]`). Pass an array of identifiers that should be
|
- `reserved` (default `[]`) -- Pass an array of identifiers that should be
|
||||||
excluded from mangling. Example: `["foo", "bar"]`.
|
excluded from mangling. Example: `["foo", "bar"]`.
|
||||||
|
|
||||||
- `toplevel` (default `false`). Pass `true` to mangle names declared in the
|
- `toplevel` (default `false`) -- Pass `true` to mangle names declared in the
|
||||||
top level scope.
|
top level scope.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|||||||
Reference in New Issue
Block a user