aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Expand)Author
2017-02-24Merge pull request #1485 from alexlamsl/merge-2.8.0...2.8.0 stagingAlex Lam S.L
2017-02-24enable `collapse_vars` & `reduce_vars` by default...- fix corner cases in `const` optimisation - deprecate `/*@const*/` fixes #1497 closes #1498 alexlamsl
2017-02-21Support marking a call as pure...A function call or IIFE with an immediately preceding comment containing `@__PURE__` or `#__PURE__` is deemed to be a side-effect-free pure function call and can potentially be dropped. Depends on `side_effects` option. `[#@]__PURE__` hint will be removed from comment when pure call is dropped. fixes #1261 closes #1448 kzc
2017-02-21Fix: AST_Accessor missing start / end tokens...fixes #1492 closes #1493 Ondřej Španěl
2017-02-21fix `pure_funcs` & improve `side_effects`...- only drops side-effect-free arguments - drop side-effect-free parts with discarded value from `AST_Seq` & `AST_SimpleStatement` closes #1494 alexlamsl
2017-02-21clean up `max_line_len`...- never exceed specified limit - otherwise warning is shown - enabled only for final output closes #1496 alexlamsl
2017-02-21introduce `unsafe_proto`...- `Array.prototype.slice` => `[].slice` closes #1491 alexlamsl
2017-02-21remove extraneous spaces between ++/+/--/-...fixes #1377 closes #1488 alexlamsl
2017-02-21improve `--beautify bracketize`...reduce whitespaces from if-else statements fixes #1482 closes #1483 alexlamsl
2017-02-21enhance `global_defs`...- support arrays, objects & AST_Node - support `"a.b":1` on both cli & API - emit warning if variable is modified - override top-level variables fixes #1416 closes #1198 closes #1469 alexlamsl
2017-02-21evaluate AST_SymbolRef as parameter...fix invalid boolean conversion now exposed in `make_node_from_constant()` closes #1477 alexlamsl
2017-02-21improve reduce_vars and fix a bug...- update modified flag between compress() passes - support IIFE arguments - fix corner case with multiple definitions closes #1473 alexlamsl
2017-02-21improve keep_fargs & keep_fnames...- utilise in_use_ids instead of unreferenced() - drop_unused now up-to-date for subsequent passes closes #1476 alexlamsl
2017-02-21smarter const replacement taking name length into account...closes #1459 kzc
2017-02-21clean up `negate_iife`...- remove extra tree scanning phase for `negate_iife` - `negate_iife` now only deals with the narrowest form, i.e. IIFE sitting directly under `AST_SimpleStatement` - `booleans`, `conditionals` etc. will now take care the rest via more accurate accounting - `a(); void b();` => `a(); b();` fixes #1288 closes #1451 alexlamsl
2017-02-21improve string concatenation...shuffle associative operations to minimise parentheses and aid other uglification efforts closes #1454 alexlamsl
2017-02-21`-c sequences=N` suboptimal at N expression cutoff...N = 2: a; b; c; d; was: a, b; c; d; now: a, b; c, d; fixes #1455 closes #1457 alexlamsl
2017-02-21tweak do-while loops...- `do{...}while(false)` => `{...}` - clean up `AST_While` logic closes #1452 alexlamsl
2017-02-21fixes & improvements to [].join()...fixes - [a].join() => "" + a - ["a", , "b"].join() => "a,,b" - ["a", null, "b"].join() => "a,,b" - ["a", undefined, "b"].join() => "a,,b" improvements - ["a", "b"].join(null) => "anullb" - ["a", "b"].join(undefined) => "a,b" - [a + "b", c].join("") => a + "b" + c closes #1453 alexlamsl
2017-02-21drop unused: toplevel, assign-only...- assign statement does not count towards variable usage by default - only works with assignments on the same scope level as declaration - can be disabled with `unused` set to "keep_assign" - `toplevel` to drop unused top-level variables and/or functions - `top_retain` to whitelist top-level exceptions closes #1450 alexlamsl
2017-02-21fix stray else in compress with conditionals=false...closes #1449 kzc
2017-02-18enable typeof "undefined" for general use...move out of unsafe, guard corner case with screw_id8 instead closes #1446 alexlamsl
2017-02-18fix corner case in keep_fnames...happens when inner function: - just below top level - not referenced - `unused` is disabled closes #1445 alexlamsl
2017-02-18remove unused AST_Scope.nesting & AST_SymbolRef.frame...they are computed but never used closes #1444 alexlamsl
2017-02-18fix crash in unsafe replacement of undefined...remove extraneous call to AST_SymbolRef.reference() closes #1443 alexlamsl
2017-02-18Improve optimizing `function() { if(c){return foo} bar();}`...closes #1437 Anthony Van de Gejuchte
2017-02-10in mangle_names there is a check that the variable name is legal and that it ...Anat Dagan
2017-01-26fix mangling collision with keep_fnames (#1431)...* fix mangling collision with keep_fnames fixes #1423 * pass mangle options to figure_out_scope() bring command-line in line with minify() Alex Lam S.L
2017-01-26optimise binary operands with evaluate() (#1427)...- remove call to evaluate() in is_constant() and let nested optimize() does its job instead - reject RegExp in is_constant() and remove special case logic under collapse_vars - operands to conditionals optimisation are now always evaluate()-ed - throw error in constant_value() instead of returning undefined to catch possible bugs, similar to make_node_from_constant() - optimise binary boolean operators under `evaluate` instead of `conditionals`Alex Lam S.L
2017-01-26augment evaluate to extract within objects (#1425)...- gated by `unsafe` - replaces previous optimisation specific to String.length - "123"[0] => 1 - [1, 2, 3][0] => 1 - [1, 2, 3].length => 3 - does not apply to objects with overridden prototype functionsAlex Lam S.L
2017-01-19add missing LHS cases which global_defs should avoidalexlamsl
2016-11-29Generate source map data from normalized files...If using `inSourceMap` this fix will ensure the copying of `sourcesContent` is based on potentially normalized `sources` values (https://github.com/mozilla/source-map/blob/master/lib/source-map-consumer.js#L304-L309). For example `normalize` (https://github.com/mozilla/source-map/blob/master/lib/util.js#L80-L123) will rewrite `./dist/mySource.js` to `dist/mySource.js` in the target `_sources` of the `SourceMapConsumer`. As a result `orig_map.sourceContentFor(source, true);` would return `null` since the orginal `source` was no longer available in the consumer. By using the keys generating from the `SourceMapConsumer.constructor` consistency is ensured. Martijn Swaagman
2016-11-29Add --mangle-props-debug and fix --mangle-props=unquoted collision...Patch by @AshleyScirra Based on: PR #1316 Renamed the CLI debug option to --mangle-props-debug Fixes: #1321 name collision in --mangle-props=unquoted Ashley (Scirra)
2016-11-29Do not overwrite options.comments + cleanupAnthony Van de Gejuchte
2016-10-23Don't filter shebangs when using the 'some' comment filter...Also clarify documentation a bit more about using regexp as filter Anthony Van de Gejuchte
2016-10-23fix uses_arguments handling (broken since 6605d1578351)...Using the symbol declaration tracking of UglifyJS doesn't make sense here anyway, `arguments` always comes from something in the current scope. fixes #1299 Jann Horn
2016-10-06Remove console.log and add extra test caseRichard van Velzen
2016-10-06Add an option to wrap IIFEs in parenthesis...For #1307. Richard van Velzen
2016-10-06Fix (typeof side_effect()) in boolean context...Fixes #1289 with suggestion by @rvanvelzen kzc
2016-10-01Optimize unmodified variablesalexlamsl
2016-09-06Make all comment options in cli available in js api...Also removing more code within "loop" while at it. Anthony Van de Gejuchte
2016-09-01Account for side effects in `string + expr` optimizationkzc
2016-08-30implement optimization: (x = 2 * x) ---> (x *= 2)kzc
2016-08-17Fix negate_iife transform to return a correct tree for nested IIFEs...Fix for #1256, partially reverts d854523783b4 Richard van Velzen
2016-08-17Fix negate_iife regression #1254kzc
2016-08-14Fix --mangle-props and --mangle-props=unquoted...Fixes: #1247 Fix --mangle-props and --name-cache inconsistency. AST_Dot and AST_Sub properties are now mangled by --mangle-props without regard to being used in an assignment statement. Note: if --mangle-props is used then *all* javascript files used must be uglified with the same mangle options. Fix the ignore_quoted=true mangle option, also known as `--mangle-props=unquoted`. If a given property is quoted anywhere it will not be mangled in any quoted or non-quoted context. kzc
2016-08-14Fix unneeded parens around unary args in new expression.kzc
2016-07-21Legacy octal integer strict mode fixesAnthony Van de Gejuchte
2016-07-17lib/sourcemap.js: Copy sourceContent from old souce-map to the new source-map...Lauri Pokka
2016-07-15Keep const in own scope while compressing...- Fixes #1205 - Fix provided by @kzc Anthony Van de Gejuchte