Richard van Velzen
bdd8e34f63
Allow --no-* options to disable their respective parameter
...
Fixes #974 and #972
2016-02-17 20:04:45 +01:00
Richard van Velzen
d5c651a5e5
Allow cli options to be specified in separate definitions
...
Fix for #963 . This allows stuff like `--define a=1 --define b=1` besides only `--define a=1,b=1`
2016-02-10 10:14:46 +01:00
Mihai Bazon
7691bebea5
Rework has_directive
...
It's now available during tree walking, i.e. walker.has_directive("use
asm"), rather than as part of the scope. It's thus no longer necessary
to call `figure_out_scope` before codegen. Added special bits in the
code generator to overcome the fact that it doesn't inherit from
TreeWalker.
Fix #861
2015-11-11 22:15:25 +02:00
kzc
83db98ad3b
Fixed RegExp literal in mozilla AST generation/output and added a --dump-spidermonkey-ast flag
2015-11-01 01:02:52 -04:00
Damian Krzeminski
d5138f7467
add --pure-funcs option
...
it has the same effect as specifying `pure_funcs` in `--compressor`
option, however it's much easier to use
instead of:
--compressor 'pure_func=["Math.floor","debug","console.logTime"]'
it's now possible:
--compressor --pure-funcs Math.floor debug console.logTime
fixes #684
2015-10-13 21:24:14 -04:00
kzc
6500f8c52c
get rid of SCOPE_IS_NEEDED as it was always true
2015-10-07 15:33:24 -04:00
kzc
4d2f7d83af
Fix handling of "use asm" when no command line flags are passed to uglifyjs. SCOPE_IS_NEEDED is unconditionally true now. Refactored floating point literal parsing to be more in keeping with the AST class design.
2015-10-07 13:10:53 -04:00
kzc
593677d2ff
Add proper support for "use asm"; blocks. Disable -c optimization within "use asm"; sections and preserve floating point literals in their original form. Non-asm.js sections are optimized as before. Asm.js sections can still be mangled and minified of whitespace. No special command line flags are required.
2015-10-07 10:00:28 +02:00
Mihai Bazon
99233c44cc
No longer use vm to load code.
...
Improves performance 2x on node > 0.10.
Ref #636
2015-09-24 17:58:51 +03:00
Joao Carlos
0b82e1cd5b
Change --mangle-regex to accept a full regex
2015-06-09 15:14:41 +03:00
Joao Carlos
9aef34a816
Show descriptive error when --mangle-regex is invalid
2015-06-09 14:31:49 +03:00
Joao Carlos
0ac6918a41
Add --mangle-regex option
2015-06-09 14:16:50 +03:00
Mihai Bazon
d2dda34b2a
Remove deprecated calls to utils.print/utils.error
...
Close #542 , #641 , #647
2015-05-04 15:07:16 +03:00
Mihai Bazon
7b22f2031f
If name_cache is specified, do rename cached properties
...
(even if --mangle-props is not there)
2015-04-22 17:34:49 +03:00
Mihai Bazon
5d60484553
More fixes for the breaking changes in yargs
...
Close #670
2015-04-05 13:20:22 +03:00
なつき
db396da734
Fix long options
2015-03-29 04:00:42 -07:00
Mihai Bazon
e1c3861832
Export readDefaultReservedFile
2015-03-22 11:04:28 +02:00
Mihai Bazon
03b6121194
Add --reserve-domprops along with a default exclusion list in tools/domprops.json
2015-03-18 12:10:21 +02:00
Mihai Bazon
3ef092332b
Support multiple --reserved-file args
2015-03-18 11:53:17 +02:00
Mihai Bazon
80cfd063e2
Export readNameCache / writeNameCache
2015-03-17 10:05:49 +02:00
Mihai Bazon
aa45f6586e
rename --prop-cache to --name-cache
...
... and support storing there variable names as well, to help with multiple
invocations when mangling toplevel.
2015-03-16 13:16:30 +02:00
Mihai Bazon
375c88245a
Fix --reserved-file
2015-03-14 11:36:58 +02:00
Mihai Bazon
ea3430102c
Add property name mangler
...
We only touch properties that are present in an object literal, or which are
assigned to. Example:
x = { foo: 1 };
x.bar = 2;
x["baz"] = 3;
x[cond ? "qwe" : "asd"] = 4;
console.log(x.stuff);
The names "foo", "bar", "baz", "qwe" and "asd" will be mangled, and the
resulting mangled names will be used for the same properties throughout the
code. The "stuff" will not be, since it's just referenced but never
assigned to.
This *will* break most of the code out there, but could work on carefully
written code: do not use eval, do not define methods or properties by
walking an array of names, etc. Also, a comprehensive list of exclusions
needs to be passed, to avoid mangling properties that are standard in
JavaScript, DOM, used in external libraries etc.
2015-03-14 11:22:28 +02:00
Anthony Van de Gejuchte
7b71344051
Parse regexes properly
2015-02-11 18:29:15 +01:00
Mihai Bazon
fbbaa42ee5
Add option to preserve/enforce string quote style
...
`-q 0` (default) use single or double quotes such as to minimize the number of
bytes (prefers double quotes when both will do); this is the previous
behavior.
`-q 1` -- always use single quotes
`-q 2` -- always use double quotes
`-q 3` or just `-q` -- always use the original quotes.
Related codegen option: `quote_style`.
Close #495
Close #460
Some `yargs` guru please tell me why `uglifyjs --help` doesn't display the
help string for `-q` / `--quotes`, and why it doesn't output the expected
argument types anymore, like good old `optimist` did.
2015-01-27 22:26:27 +02:00
Mihai Bazon
93a6e5780e
Declare boolean type for --keep-fnames
2015-01-05 11:20:00 +02:00
Mihai Bazon
e1f0747e4c
Support keep_fnames in compressor, and --keep-fnames. #552
...
Passing `--keep-fnames` will enable it both for compressor/mangler, so that
function names will not be dropped (when unused) nor mangled.
2015-01-05 11:03:13 +02:00
Derek Wickern
718e475613
Fix backslashes in source-map paths on Windows
2015-01-04 19:08:19 +01:00
Kenneth Powers
6d1c3e1aec
Use yargs instead of optimist.
2015-01-01 01:04:54 -05:00
Mihai Bazon
f36a1eaa8b
Add option to allow return outside of functions.
...
Close #288
2014-10-20 18:12:13 +03:00
Artemy Tregubenko
03cf94ebe8
Added support for sourcesContent property of source map
2014-01-09 15:12:00 +01:00
Mihai Bazon
a67e3bfdd3
Fix #392
2014-01-07 12:48:54 +02:00
Mihai Bazon
c16d538ce7
Add --noerr to turn off argument name checking
...
for now only used for keys passed to `-c` or `-b`.
2013-11-28 13:15:01 +02:00
Mihai Bazon
7cf79c302b
Fix reading arguments
...
i.e. read `-c unsafe,unsafe-comps` as `-c unsafe=true,unsafe_comps=true`
2013-10-29 14:01:26 +02:00
Mihai Bazon
f1b7094a57
Add "preamble" output option
...
Close #335
2013-10-29 11:09:18 +02:00
Mihai Bazon
0358e376f0
Fix codegen for when comments_before is undefined.
...
Fix #333
2013-10-28 09:39:29 +02:00
Mihai Bazon
a89d233318
Better reporting of parse errors
2013-09-02 09:55:34 +03:00
Michael Ficarra
d9ad3c7cbf
fixes #259 : don't unnecessarily quote object properties when --screw-ie8
2013-08-18 19:45:06 -05:00
Mihai Bazon
4aa4b3e694
Support -p relative. Fix #256
2013-08-07 11:43:47 +03:00
Mihai Bazon
b7adbcab1f
Fix #251
2013-07-30 12:16:29 +03:00
Mihai Bazon
3435af494f
Don't require arguments to --enclose
2013-07-28 11:11:11 +03:00
Matt Robenolt
3a21861580
The extra /* */ isn't needed now
2013-05-21 08:50:21 -06:00
Matt Robenolt
1dbffd48ea
SourceMapping pragma has changed to //#
...
See: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit
The spec was updated on May 16th since `//@` was causing some issues with IE.
2013-05-21 08:46:27 -06:00
Mihai Bazon
ca3388cf5a
Add --expr, an option to parse a single expression (suitable for JSON)
2013-05-15 13:27:23 +03:00
Kim Joar Bekkelund
790b3bcdc6
Fix typo in bin and readme
2013-05-02 11:15:33 +02:00
Mihai Bazon
68394eed93
Make compress/mangle disabled by default, as before 5af144522a
2013-04-21 11:35:50 +03:00
Michael Ficarra
5af144522a
fixes #189 : use dotted member access when --screw-ie8 option given
2013-04-20 15:11:05 -05:00
Andreas Lind Petersen
69dde0462b
uglifyjs binary: Make read_whole_file async and don't attempt to read STDIN synchronously.
2013-03-31 13:36:22 +03:00
Michał Gołębiowski
75f0bbe6e8
renamed --screw-ie to --screw-ie8, documented it in README.md, indicated it doesn't break IE9+
2013-03-25 17:03:21 +01:00
Jake Harding
478bf4dbdd
Add support for enclose option. Closes #139 .
2013-03-24 11:11:23 +02:00