Commit Graph

1806 Commits

Author SHA1 Message Date
Mihai Bazon
e88dcc3819 added --acorn and --spidermonkey options v2.0 2012-10-05 15:22:12 +03:00
Mihai Bazon
ecd9f21467 fixed import of locations from SpiderMonkey AST 2012-10-05 15:05:06 +03:00
Mihai Bazon
a9b6f9909a use the appropriate constructor for symbols 2012-10-04 17:28:35 +03:00
Mihai Bazon
708ec0467c minor 2012-10-04 17:28:09 +03:00
Mihai Bazon
682a58a1f5 removed some unused variables 2012-10-04 08:49:18 +03:00
Mihai Bazon
f20c251882 moving code around 2012-10-03 21:39:47 +03:00
Mihai Bazon
2bd8a118c2 define AST_Node.from_mozilla_ast(ast)
returns an UglifyJS2 AST given a Mozilla AST.  Still needs some work to do
(need to create specific nodes like AST_SymbolRef, AST_SymbolLambda
etc. instead of base AST_Symbol, in order for the mangler/compressor to work
properly)
2012-10-03 20:03:17 +03:00
Mihai Bazon
42ce7ed606 ignore tmp/ 2012-10-03 20:01:32 +03:00
Mihai Bazon
11863d6f9a more cleanup (dropped AST_SwitchBlock) 2012-10-03 15:52:31 +03:00
Mihai Bazon
3412498795 AST cleanup (dropped AST_StatementBase) 2012-10-03 15:41:11 +03:00
Mihai Bazon
9221ad62db added package.json 2012-10-03 13:38:39 +03:00
Mihai Bazon
c11de17e99 added option for side-effect-free statements, fix test 2012-10-03 13:08:03 +03:00
Mihai Bazon
e0f5075e45 fix endless loop in tests 2012-10-03 12:49:47 +03:00
Mihai Bazon
bd94eeb6f7 drop tmp. files 2012-10-03 12:49:33 +03:00
Mihai Bazon
7e8880be1c document the CLI tool 2012-10-03 12:22:59 +03:00
Mihai Bazon
0678ae2076 fix for a = !b && !c && !d && !e → a=!(b||c||d||e) 2012-10-03 11:34:05 +03:00
Mihai Bazon
378ed17809 disable hoist_vars by default and change comparations to comparisons 2012-10-03 11:27:05 +03:00
Mihai Bazon
5c151f90b3 fixed usage string 2012-10-02 21:08:16 +03:00
Mihai Bazon
815abcfe18 support for --comments option to keep comments containing @license or @preserve 2012-10-02 16:40:42 +03:00
Mihai Bazon
cb2e811191 discard annoying nodejs warning 2012-10-02 16:40:01 +03:00
Mihai Bazon
075f93ec0d line numbers start at 1 2012-10-02 16:39:53 +03:00
Mihai Bazon
2a5456260e added option to keep some comments in the output 2012-10-02 14:32:30 +03:00
Mihai Bazon
36be211e99 option to exclude certain names from mangling 2012-10-02 14:02:33 +03:00
Mihai Bazon
dde5b22b5e support defines 2012-10-02 13:20:07 +03:00
Mihai Bazon
e1098b04a7 "use strict"; 2012-10-02 12:45:58 +03:00
Mihai Bazon
211792757c more constant folding (for names defined with const) 2012-10-02 12:45:17 +03:00
Mihai Bazon
347160c631 add AST_SymbolConst for names defined with const 2012-10-02 12:22:39 +03:00
Mihai Bazon
ff696cd7bc drop more unused names 2012-10-02 12:02:33 +03:00
Mihai Bazon
9e5dd81f1e a shy attempt to obey width in the beautifier; added bracketize option to always print brackets around if/do/while/for statements; export more options via the CLI 2012-10-02 11:22:38 +03:00
Mihai Bazon
896444482a minor 2012-09-28 11:12:47 +03:00
Mihai Bazon
05e15b1c0c fix mangling
(bug in our code prevented the mangler from using a name that was in use
prior to mangling but not after it)
2012-09-27 00:01:16 +03:00
Mihai Bazon
13278c6649 removed the "squeeze" method (it's now effectively "transform") 2012-09-26 19:52:32 +03:00
Mihai Bazon
15d58f5917 some speedup and more savings from unused vars that have side effects in initialization 2012-09-26 19:05:49 +03:00
Mihai Bazon
78be8f5296 compressor successfully moved to TreeTransformer 2012-09-26 14:27:01 +03:00
Mihai Bazon
a24e7ee976 checkpoint (refactoring, WIP) 2012-09-26 12:16:16 +03:00
Mihai Bazon
e979d01f04 minor 2012-09-26 11:24:04 +03:00
Mihai Bazon
242dd10131 more cleanups 2012-09-25 20:39:15 +03:00
Mihai Bazon
9321d418bc moving code around (refactoring, WIP) 2012-09-25 15:59:27 +03:00
Mihai Bazon
10c7f52074 discard all \uFEFF characters (https://github.com/mishoo/UglifyJS/issues/462) 2012-09-25 15:30:59 +03:00
Mihai Bazon
4201577dd7 started some refactoring (WIP) -- moving squeezer to TreeTransformer 2012-09-25 15:15:47 +03:00
Mihai Bazon
e836e2ae5f minor 2012-09-25 12:48:36 +03:00
Mihai Bazon
ea6d1ea701 it's not safe to assume that property access is side-effect-free
(getters/setters + various browser bugs will trigger side effects; also, an
exception is thrown when the expression is undefined)
2012-09-25 10:32:14 +03:00
Mihai Bazon
368ac8f93c some boolean cleanup 2012-09-25 10:31:03 +03:00
Mihai Bazon
42038fd67f Support input source map
This is useful while compressing generated code; for example compressing JS
compiled by CoffeeScript (assuming you got a source map):

    uglifyjs2 --in-source-map generated.js.map \
              --source-map uglified.js.map \
              -o uglified.js

The above assumes you have a "generated.js.map" file which is the source
mapping between your CoffeeScript and the generated.js (compiled output from
CoffeeScript).  The name of the input file is not present in this example;
it will be fetched from the source map (but it can be passed manually too).

The output will be in "uglified.js" and the output map "uglified.js.map"
will actually map to the original CoffeeScript code, rather than to
generated.js.
2012-09-24 17:02:18 +03:00
Mihai Bazon
4f97da9660 minor tests fix 2012-09-24 10:27:49 +03:00
Mihai Bazon
a83b28503f properly drop mutually-referring declarations that are not otherwise
referenced and have no side effects
2012-09-23 12:47:34 +03:00
Mihai Bazon
76d88b59dc tree transformer api (WIP) 2012-09-22 19:41:09 +03:00
Mihai Bazon
ec7f895b54 log filename in parse errors / compressor warnings 2012-09-21 14:44:25 +03:00
Mihai Bazon
5491e1d7b1 better support for multiple input files:
- use a single AST_Toplevel node for all files
- keep original source filename in the tokens
2012-09-21 14:19:05 +03:00
Mihai Bazon
c4f8c2103f more on detecting side effects 2012-09-21 11:23:44 +03:00