aboutsummaryrefslogtreecommitdiff
path: root/lib/output.js
AgeCommit message (Collapse)Author
2015-10-06Implement shebang supportAnthony Van de Gejuchte
2015-07-30Fix semicolon printing when restricting max line lengthRichard van Velzen
Fixes #755
2015-05-04Fix blank lines in the output.Mihai Bazon
The issue was more obvious when max_line_len has a small value, rather than the default 32K characters. A blank line showed up after most statements.
2015-01-27Add option to preserve/enforce string quote styleMihai Bazon
`-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-26Keep single line comments after nlb, after nlbAnthony Van de Gejuchte
Fixes #583
2015-01-04Fix #556Richard van Velzen
`\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-04Merge pull request #592 from micschro/patch-1Richard van Velzen
Fix max_line_len not working for JSON files
2014-12-31Fix #597Richard van Velzen
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-17Fix max_line_len not working for JSON filesmicschro
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-07-18Fix parens for AST_UndefinedMihai Bazon
Do the same as for AST_Unary, since we output undefined as `void 0`. Reported at https://github.com/mishoo/UglifyJS2/issues/338#issuecomment-48858341
2014-07-01Check for the case an AST_For's init is an EmptyStatementMihai Bazon
(lame fix for #503)
2014-04-27Actually, even better. #475Mihai Bazon
- also handle x = + ++y, x = - --y; - don't use parens, a space suffices.
2014-04-27Better fix for #475Mihai Bazon
2014-04-27Fix parens in +(+x). Close #475Mihai Bazon
2014-01-26Merge branch 'master' of github.com:mishoo/UglifyJS2Mihai Bazon
2014-01-26Move unescaping regexps under a codegen option (`unescape_regexps`)Mihai Bazon
2014-01-25Don't unescape \x00 in regexes (it breaks IE8)Daniel Stutzman
2014-01-21More chars that cannot be unescaped in regexps.Mihai Bazon
2014-01-19Don't unescape byte order marks in regexpsVille Lautanala
2014-01-18Don't unescape \x2f (slash) in regexps. #54Mihai Bazon
2014-01-10simplifyMihai Bazon
2014-01-10Unescape Unicode sequences in regexps when ascii_only is false. #54Mihai Bazon
2014-01-05Fix parens for property access -- (foo, bar)["baz"]Mihai Bazon
2013-12-18Better fix for comments in AST_ExitMihai Bazon
Close #374
2013-12-18Take out all comments from an AST_Exit's valueMihai Bazon
Fix #372
2013-10-30Workaround for Safari bugMihai Bazon
Close #313
2013-10-30Fix parsing setters/getters (allow keywords for name).Mihai Bazon
The "key" property was always "set" or "get", which didn't make much sense. Now it'll be the actual name of the setter/getter (AST_Node), and the AST_Accessor object itself, which represents the function, won't store any name. Close #319
2013-10-30Fix output for `x = 2 * (a % b / b * c)`Mihai Bazon
(issue #337)
2013-10-29Add "preamble" output optionMihai Bazon
Close #335
2013-10-28Fix codegen for when comments_before is undefined.Mihai Bazon
Fix #333
2013-09-06Avoid printing <!-- in the output (HTML5 comment)Mihai Bazon
2013-09-06Support HTML5 comment syntax (enabled by default!)Mihai Bazon
See http://javascript.spec.whatwg.org/#comment-syntax https://github.com/mishoo/UglifyJS/issues/503 https://github.com/marijnh/acorn/issues/62
2013-08-20Move support for `negate_iife` in the compressor, rather than code generatorMihai Bazon
(the code generator doesn't maintain enough context to know whether the return value is important or discarded) Fixes #272
2013-08-18fixes #259: don't unnecessarily quote object properties when --screw-ie8Michael Ficarra
2013-07-18Fix output for arrays whose last element is a hole: [1,,]David Glasser
1529ab96 started to do this (by considering holes to be separate from "undefined") but it still converted [1,,] (length 2, last element hole, trailing comma) to [1,] (length 1, trailing comma) Unfortunately the test suite doesn't really make this clear: the new test here passes with or without this patch because run-tests.js beautifys the expected output (in "make_code"), which does the incorrect transformation! If you make some manual change to arrays.js to make the test fail and see the INPUT and OUTPUT, then you can see that without this fix, [1,,] -> [1,], and with this fix it stays [1,,].
2013-06-03Escape null characters as \x00Ville Lautanala
Since \0 might be mistakenly interpreted as octal if followed by a number and using literal null is in some cases interpreted as end of string, escape null as \x00.
2013-05-22Add `negate_iife` option to the code generator.Mihai Bazon
See discussion in a9511dfbe5c0d96d8cacb87582aa9a19737bbb98
2013-05-20Fix output of statement: `new function(){...};`Mihai Bazon
Close #209
2013-05-09Use the negation hack rather than parens for a toplevel function expression callMihai Bazon
(only in !beautify mode)
2013-03-31Quote objects with numeric keysVladimir Zhuravlev
2013-03-31Don't use \xYY for identifiersMihai Bazon
Fix #173
2013-03-31Output, to_ascii: Escape non-ascii chars with \xnn instead of \unnnn ↵Andreas Lind Petersen
whenever possible.
2013-02-06Force space after literal regexp when used in "instanceof" or "in"Mihai Bazon
Close #118
2013-02-06Fix parens for NaNMihai Bazon
Close #116
2013-02-06Fix parens for negative numbersMihai Bazon
Close #115
2013-02-06Fix parens for AST_NewMihai Bazon
Close #114
2013-02-05Ugly hack to print comments before return/throw statementsMihai Bazon
Close #112
2013-01-17[AST_Hole] the print function can be a no-op.Mihai Bazon
2013-01-17Fix output for arrays containing undefined values.David Glasser
1b6bcca7 was a first attempt at this. That commit made Uglify stop replacing holes with undefined, but instead it started replacing undefined with holes. This is slightly problematic, because there is a difference between a hole and an undefined value. More problematically, it changed [1,undefined] to [1,] which generally doesn't even parse as a hole (just as a trailing comma), so it didn't even preserve the length of the array! Instead, parse holes as their own special AST node which prints invisibly.
2012-12-21Fix output when semicolons is off.Mihai Bazon
(need to force a semicolon for the empty body of an `if`) Close #72