Commit Graph

3097 Commits

Author SHA1 Message Date
Mihai Bazon 6b23cbc852 AST_Do nodes: walk body before condition 2015-01-06 12:29:07 +02:00
Richard van Velzen 7f9bc9e863 Pass mangle options to figure_out_scope and compute_char_frequence
Fix #219. Because the options were not set and `toplevel` is `false` by default, some toplevel names would sometimes not be mangled correctly.
2015-01-05 19:10:32 +01:00
Mihai Bazon 13219cebcb Fix handling \r\n
Close #437
2015-01-05 12:14:42 +02:00
Mihai Bazon 93a6e5780e Declare boolean type for --keep-fnames 2015-01-05 11:20:00 +02:00
Mihai Bazon fe55e0d93d Merge branch 'keep-function-expression-names' of https://github.com/rvanvelzen/UglifyJS2 2015-01-05 11:11:38 +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
Richard van Velzen e37b67d013 Add an option to prevent function names from being mangled
See #552. This is mostly useful for having the actual function names in traces.
2015-01-04 21:48:43 +01:00
Caridy Patino ad18689d92 using the original sourcemap as the base
* Creates a new SourceMapGenerator based on a SourceMapConsumer:
  https://github.com/mozilla/source-map#sourcemapgeneratorfromsourcemapsourcemapconsumer
2015-01-04 21:08:29 +01:00
truiken 0f80b1058d Resolve the relative path to lib files last
This allows usage of UglifyJS on build systems which have a flat (or non-matching relative) directory structure for source files.
2015-01-04 21:01:11 +01:00
Richard van Velzen 0d48af3f36 Add a "keep_fnames" option to the compressor to retain function expression names
See #552. This is useful for stack traces.
2015-01-04 20:14:38 +01:00
achingbrain 4613644cce passes in references to process and Buffer to silence ReferenceErrors 2015-01-04 19:26:47 +01:00
Derek Wickern 718e475613 Fix backslashes in source-map paths on Windows 2015-01-04 19:08:19 +01:00
Austin Brown aa5dd15352 Update README.md
otions => options
2015-01-04 16:01:53 +01:00
Peter Dave Hello 5bff65c132 Use svg instead of png to get better image quality 2015-01-04 15:58:00 +01:00
Richard van Velzen 24bc09b79b Fix #556
`\uFEFF` (ZERO WIDTH NO-BREAK SPACE) is removed when parsing, but was
un-escaped for the output when `ascii_only` was false.

When using
UglifyJS multiple times (creating packages from minified sources, for
example), this would lead to problems because the byte was removed when
parsing for the second time.
2015-01-04 15:01:55 +01:00
Richard van Velzen 37c17d5541 Merge pull request #570 from rvanvelzen/fix-569
Fix #569
2015-01-04 14:02:08 +01:00
Richard van Velzen 120948fa48 Merge pull request #584 from clyfish/fix-base54
fix base54
2015-01-04 14:00:23 +01:00
Richard van Velzen 66e6f0c3cb Merge pull request #592 from micschro/patch-1
Fix max_line_len not working for JSON files
2015-01-04 13:53:31 +01:00
Richard van Velzen f7447efa8c Merge pull request #600 from KenPowers/master
Use yargs instead of optimist.
2015-01-04 13:52:02 +01:00
Richard van Velzen f4d36a58c2 Fix #569
When no arguments are given to `new Function()`, it should be treated as
a regular anonymous function (http://es5.github.io/#x15.3.2.1)
2015-01-04 13:37:59 +01:00
Kenneth Powers 6d1c3e1aec Use yargs instead of optimist. 2015-01-01 01:04:54 -05:00
Mihai Bazon 73cc0505f5 Merge pull request #599 from rvanvelzen/fix-597
Fix #597
2014-12-31 14:18:31 +02:00
Richard van Velzen c75f5a1fd8 Fix #597
NaN and Infinity were replaced in the output generation, instead of
during compression. This could lead to results where `1/0` was inserted
without parens leading to invalid output.

The nodes are replaced in the compression step now, and the output
generation returns their regular names. This should not be a problem,
since they're already only constructed from the original name.
2014-12-31 12:23:00 +01:00
micschro 39d8880f2c Fix max_line_len not working for JSON files
As `maybe_newline()` is only called when `might_need_semicolon` is `true`, the `max_line_len` option has no effect for files without (or with very few) semicolons (like JSON files). A simple for this problem is to use `maybe_newline()` instead of `noop` as the `newline()` function in non-beautify mode.
2014-12-17 16:31:03 +01:00
Mihai Bazon 5538ec7bd8 v2.4.16 v2.4.16 2014-12-09 15:21:44 +02:00
Mihai Bazon f101d6429b Merge pull request #546 from jacobk/patch-1
Use uglify source map token names if missing
2014-12-04 14:07:08 +02:00
Cheng Liangyu fe06fc85d3 fix base54 2014-12-01 13:16:44 +08:00
Mihai Bazon f36a1eaa8b Add option to allow return outside of functions.
Close #288
2014-10-20 18:12:13 +03:00
Mihai Bazon a64bdda9ae Document keep_fargs. Close #557 2014-09-28 12:36:36 +03:00
Mihai Bazon 01d19b4b52 Referencing a global is assumed to have side effects.
Close #550
2014-09-28 11:18:25 +03:00
Mihai Bazon f0c1a01bc2 Merge pull request #549 from Arnavion/unreferenced-catch-symbol
Don't warn for an unreferenced exception symbol in a catch block.
2014-09-13 09:29:34 +03:00
Arnavion 7be680d3f8 Don't warn for an unreferenced exception symbol in a catch block. 2014-09-12 21:01:19 -07:00
Mihai Bazon 57dab1e1db Merge pull request #541 from TalAter/conditional-improvements
Conditional assignment of equivalent constants compressed  ( x=y?1:1 --> x=1 )
2014-09-09 18:45:12 +03:00
Jacob Kristhammar 21b3c890a1 Use uglify source map token names if missing 2014-09-09 13:02:50 +02:00
Tal Ater fb0ec720a4 Compress conditions that have side effects using sequences 2014-09-04 02:57:49 +03:00
Tal Ater 7971ed33d1 Added a test for else if 2014-09-03 01:35:30 +03:00
Tal Ater 885835a655 Compress conditional assignments where all possible outcomes are equivalant and condition has no side effects 2014-09-02 23:30:25 +03:00
Mihai Bazon 4c64554808 Turn foo.new into foo["new"] when not --screw-ie8. Fix #534 2014-08-26 10:11:01 +03:00
Mihai Bazon 548beeb6b1 Prevent error for Function(""). Close #538 2014-08-20 09:16:34 +03:00
Mihai Bazon e3066f9577 Merge pull request #529 from RReverser/master
Added example for usage with SpiderMonkey AST
2014-08-04 23:05:29 +03:00
Ingvar Stepanyan e391367488 Added example for usage with SpiderMonkey AST. 2014-08-04 20:48:14 +03:00
Mihai Bazon 18ddf2f7b5 Merge branch 'master' of https://github.com/RReverser/UglifyJS2 2014-08-04 09:01:19 +03:00
Ingvar Stepanyan f8ee5a0785 Install newest NPM on oldest Node.js. 2014-08-03 21:44:59 +03:00
Ingvar Stepanyan b467a3c877 Added generative testing for AST conversions. 2014-08-03 20:48:59 +03:00
Mihai Bazon f2d48e9019 Merge branch 'patch-1' of https://github.com/gdw2/UglifyJS2 2014-08-03 11:08:39 +03:00
Ingvar Stepanyan 5e314bf3e9 SpiderMonkey Identifier nodes should contain mangled names. 2014-08-03 01:28:58 +03:00
Ingvar Stepanyan 05ba26c7c8 Small fixes for AST conversion. 2014-08-02 13:18:27 +03:00
Ingvar Stepanyan 87b72364a4 Fixes and improvements for UglifyJS->SM AST conversion.
* Explicitly forbidden multiple catch clauses as SM-specific feature.
* Simplified describing of UglifyJS->Mozilla AST conversion rules.
* Moved alias rules to single place.
* Removed usage of dynamic type bindings in generated code (speed-up).
2014-08-01 23:45:37 +03:00
Ingvar Stepanyan 0e3ff1f970 Improved UglifyJS<->SpiderMonkey AST conversions.
* Added directives recognition in SM AST.
* Moved semi-standard SM `Property` type to separate handler.
* Added `const` recognition from SM AST.
* Removed redundant `this`-as-identifier recognition.
* Removed redundant rules for abstract SM types.
* Described `CatchClause` using string syntax.
* Added support for semi-standard `range` tuple as location source.
* Added back-conversion support (to be improved).
2014-08-01 23:42:34 +03:00
gdw2 ec3e74d7f4 Added license 2014-07-28 13:49:44 -07:00