reintroduce compress documentation for keep_fnames and unsafe_methods
This commit is contained in:
parent
1d51835fba
commit
05ca844443
19
README.md
19
README.md
|
|
@ -604,7 +604,7 @@ If you're using the `X-SourceMap` header instead, you can just omit `sourceMap.u
|
||||||
|
|
||||||
## Compress options
|
## Compress options
|
||||||
|
|
||||||
- `arrows` (default `true`) -- Converts `()=>{return x}` to `()=>x`. Class
|
- `arrows` (default: `true`) -- Converts `()=>{return x}` to `()=>x`. Class
|
||||||
and object literal methods will also be converted to arrow expressions if
|
and object literal methods will also be converted to arrow expressions if
|
||||||
the resultant code is shorter: `m(){return x}` becomes `m:()=>x`.
|
the resultant code is shorter: `m(){return x}` becomes `m:()=>x`.
|
||||||
This transform requires that the `ecma` compress option is set to `6` or greater.
|
This transform requires that the `ecma` compress option is set to `6` or greater.
|
||||||
|
|
@ -662,6 +662,10 @@ If you're using the `X-SourceMap` header instead, you can just omit `sourceMap.u
|
||||||
compressor from discarding unused function arguments. You need this
|
compressor from discarding unused 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
|
||||||
|
compressor from discarding function names. Useful for code relying on
|
||||||
|
`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`) -- 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.
|
||||||
|
|
||||||
|
|
@ -726,7 +730,9 @@ If you're using the `X-SourceMap` header instead, you can just omit `sourceMap.u
|
||||||
`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.
|
||||||
|
|
||||||
- `unsafe_arrows` (default `false`) -- Convert ES5 style anonymous function
|
- `unsafe` (default: `false`) -- apply "unsafe" transformations (discussion below)
|
||||||
|
|
||||||
|
- `unsafe_arrows` (default: `false`) -- Convert ES5 style anonymous function
|
||||||
expressions to arrow functions if the function body does not reference `this`.
|
expressions to arrow functions if the function body does not reference `this`.
|
||||||
Note: it is not always safe to perform this conversion if code relies on the
|
Note: it is not always safe to perform this conversion if code relies on the
|
||||||
the function having a `prototype`, which arrow functions lack.
|
the function having a `prototype`, which arrow functions lack.
|
||||||
|
|
@ -739,14 +745,19 @@ If you're using the `X-SourceMap` header instead, you can just omit `sourceMap.u
|
||||||
comparison are switching. Compression only works if both `comparisons` and
|
comparison are switching. Compression only works if both `comparisons` and
|
||||||
`unsafe_comps` are both set to true.
|
`unsafe_comps` are both set to true.
|
||||||
|
|
||||||
- `unsafe` (default: `false`) -- apply "unsafe" transformations (discussion below)
|
|
||||||
|
|
||||||
- `unsafe_Func` (default: `false`) -- compress and mangle `Function(args, code)`
|
- `unsafe_Func` (default: `false`) -- compress and mangle `Function(args, code)`
|
||||||
when both `args` and `code` are string literals.
|
when both `args` and `code` are string literals.
|
||||||
|
|
||||||
- `unsafe_math` (default: `false`) -- optimize numerical expressions like
|
- `unsafe_math` (default: `false`) -- optimize numerical expressions like
|
||||||
`2 * x * 3` into `6 * x`, which may give imprecise floating point results.
|
`2 * x * 3` into `6 * x`, which may give imprecise floating point results.
|
||||||
|
|
||||||
|
- `unsafe_methods` (default: false) -- Converts `{ m: function(){} }` to
|
||||||
|
`{ m(){} }`. `ecma` must be set to `6` or greater to enable this transform.
|
||||||
|
If `unsafe_methods` is a RegExp then key/value pairs with keys matching the
|
||||||
|
RegExp will be converted to concise methods.
|
||||||
|
Note: if enabled there is a risk of getting a "`<method name>` is not a
|
||||||
|
constructor" TypeError should any code try to `new` the former function.
|
||||||
|
|
||||||
- `unsafe_proto` (default: `false`) -- optimize expressions like
|
- `unsafe_proto` (default: `false`) -- optimize expressions like
|
||||||
`Array.prototype.slice.call(a)` into `[].slice.call(a)`
|
`Array.prototype.slice.call(a)` into `[].slice.call(a)`
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user