From cfe6d99f81ddd4f745718f96fb48e4c362b41906 Mon Sep 17 00:00:00 2001 From: Marcelo Jorge Vieira Date: Sat, 12 Mar 2011 14:05:07 -0300 Subject: [PATCH 1/5] Added manpage for bin/uglifyjs --- man/uglifyjs.1 | 113 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 man/uglifyjs.1 diff --git a/man/uglifyjs.1 b/man/uglifyjs.1 new file mode 100644 index 00000000..4461fb35 --- /dev/null +++ b/man/uglifyjs.1 @@ -0,0 +1,113 @@ +.\" Copyright (c) 2011 Marcelo Jorge Vieira +'\" +'\" Redistribution and use in source and binary forms, with or without +'\" modification, are permitted provided that the following conditions +'\" are met: +'\" +'\" * Redistributions of source code must retain the above +'\" copyright notice, this list of conditions and the following +'\" disclaimer. +'\" +'\" * Redistributions in binary form must reproduce the above +'\" copyright notice, this list of conditions and the following +'\" disclaimer in the documentation and/or other materials +'\" provided with the distribution. +'\" +'\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY +'\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +'\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +'\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE +'\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +'\" OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +'\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +'\" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +'\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +'\" TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +'\" THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +'\" SUCH DAMAGE. + +.TH UGLIFYJS 1 +.SH NAME +uglifyjs \- a JavaScript parser/compressor/beautifier + +.SH SYNOPSIS +.B uglifyjs [options] + +.SH DESCRIPTION +This package implements a general-purpose JavaScript +parser/compressor/beautifier toolkit. + +.SH OPTIONS + +.TP +.B \-b, \-\-beautify +.br + +.TP +.B \-i, \-\-indent +.br + +.TP +.B \-q, \-\-quote\-keys +.br + +.TP +.B \-mt, \-\-mangle\-toplevel +.br + +.TP +.B \-nm, \-\-no\-mangle +.br + +.TP +.B \-ns, \-\-no\-squeeze +.br + +.TP +.B \-\-no\-seqs +.br + +.TP +.B \-\-no\-dead\-code +.br + +.TP +.B \-nc, \-\-no\-copyright +.br + +.TP +.B \-o, \-\-output +.br + +.TP +.B \-\-overwrite +.br + +.TP +.B \-v, \-\-verbose +.br + +.TP +.B \-\-ast +.br + +.TP +.B \-\-unsafe +.br + +.TP +.B \-\-max\-line\-len +.br + +.SH BUGS +The bug tracker can be reached by visiting the website +\fIhttps://github.com/mishoo/UglifyJS/issues\fR + +Before sending a bug report, please verify that you have the latest +version of UglifyJS. Many bugs (major and minor) are fixed at each +release, and if yours is out of date, the problem may already have +been solved. + +.SH ADDITIONAL INFORMATION + +For further information, visit the website \fIhttps://github.com/mishoo/UglifyJS\fR From af9a2a388da78a02587673b451de764d5091723e Mon Sep 17 00:00:00 2001 From: Marcelo Jorge Vieira Date: Wed, 16 Mar 2011 12:15:46 -0300 Subject: [PATCH 2/5] Added new entries in manpage --reserved-names and --ascii --- man/uglifyjs.1 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/man/uglifyjs.1 b/man/uglifyjs.1 index 4461fb35..f0ed136a 100644 --- a/man/uglifyjs.1 +++ b/man/uglifyjs.1 @@ -99,6 +99,14 @@ parser/compressor/beautifier toolkit. .B \-\-max\-line\-len .br +.TP +.B \-\-reserved\-names +.br + +.TP +.B \-\-ascii +.br + .SH BUGS The bug tracker can be reached by visiting the website \fIhttps://github.com/mishoo/UglifyJS/issues\fR From 26143e660660528023c040c968303218f74e8b0c Mon Sep 17 00:00:00 2001 From: Marcelo Jorge Vieira Date: Wed, 16 Mar 2011 13:34:57 -0300 Subject: [PATCH 3/5] Fixing manpage options params --- man/uglifyjs.1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/man/uglifyjs.1 b/man/uglifyjs.1 index f0ed136a..a0e955f5 100644 --- a/man/uglifyjs.1 +++ b/man/uglifyjs.1 @@ -31,7 +31,7 @@ uglifyjs \- a JavaScript parser/compressor/beautifier .SH SYNOPSIS -.B uglifyjs [options] +.B uglifyjs [options] [input_file] .SH DESCRIPTION This package implements a general-purpose JavaScript @@ -44,7 +44,7 @@ parser/compressor/beautifier toolkit. .br .TP -.B \-i, \-\-indent +.B \-i \fInumber-of-spaces\fR, \-\-indent \fInumber-of-spaces\fR .br .TP @@ -76,7 +76,7 @@ parser/compressor/beautifier toolkit. .br .TP -.B \-o, \-\-output +.B \-o \fIfilename\fR, \-\-output \fIfilename\fR .br .TP @@ -96,11 +96,11 @@ parser/compressor/beautifier toolkit. .br .TP -.B \-\-max\-line\-len +.B \-\-max\-line\-len \fIvalue\fR .br .TP -.B \-\-reserved\-names +.B \-\-reserved\-names \fIname1\fR, \fI$name2\fR, \fIname3\fR .br .TP From 869fe50b57251ca7c92a6729b2604019f89c994e Mon Sep 17 00:00:00 2001 From: Marcelo Jorge Vieira Date: Wed, 16 Mar 2011 13:53:31 -0300 Subject: [PATCH 4/5] Added description for all options in manpage --- man/uglifyjs.1 | 62 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/man/uglifyjs.1 b/man/uglifyjs.1 index a0e955f5..f9140e6f 100644 --- a/man/uglifyjs.1 +++ b/man/uglifyjs.1 @@ -42,70 +42,130 @@ parser/compressor/beautifier toolkit. .TP .B \-b, \-\-beautify .br +Output indented code; when passed, additional options control the beautifier. +.br .TP .B \-i \fInumber-of-spaces\fR, \-\-indent \fInumber-of-spaces\fR .br +Indentation level. +.br .TP .B \-q, \-\-quote\-keys .br +Quote keys in literal objects (by default, only keys that cannot be identifier +names will be quotes). +.br .TP .B \-mt, \-\-mangle\-toplevel .br +Mangle names in the toplevel scope too (by default we don’t do this). +.br .TP .B \-nm, \-\-no\-mangle .br +Don’t mangle variable names. +.br .TP .B \-ns, \-\-no\-squeeze .br +Don’t call ast_squeeze() (which does various optimizations that result in +smaller, less readable code). +.br .TP .B \-\-no\-seqs .br +When ast_squeeze() is called (thus, unless you pass \-\-no-squeeze) it will +reduce consecutive statements in blocks into a sequence. For example, +"a = 10; b = 20; foo();" will be written as "a=10,b=20,foo();". In various +occasions, this allows us to discard the block brackets (since the block +becomes a single statement). This is ON by default because it seems safe +and saves a few hundred bytes on some libs that I tested it on, but pass +\-\-no-seqs to disable it. +.br .TP .B \-\-no\-dead\-code .br +By default, UglifyJS will remove code that is obviously unreachable +(code that follows a return, throw, break or continue statement and +is not a function/variable declaration). Pass this option to disable +this optimization. +.br .TP .B \-nc, \-\-no\-copyright .br +By default, uglifyjs will keep the initial comment tokens in the generated +code (assumed to be copyright information etc.). If you pass this it will +discard it. +.br .TP .B \-o \fIfilename\fR, \-\-output \fIfilename\fR .br +Put the result in filename. If this isn’t given, the result goes to standard +output (or see next one). +.br .TP .B \-\-overwrite .br +If the code is read from a file (not from STDIN) and you pass --overwrite then +the output will be written in the same file. +.br .TP .B \-v, \-\-verbose .br +Output some notes on STDERR (for now just how long each operation takes). +.br .TP .B \-\-ast .br +Pass this if you want to get the Abstract Syntax Tree instead of JavaScript +as output. Useful for debugging or learning more about the internals. +.br .TP .B \-\-unsafe .br +Enable other additional optimizations that are known to be unsafe in some +contrived situations, but could still be generally useful. For now only this: +foo.toString() ==> foo+"" +.br .TP .B \-\-max\-line\-len \fIvalue\fR .br +(default 32K characters) — Add a newline after around 32K characters. +I’ve seen both FF and Chrome croak when all the code was on a single line of +around 670K. Pass \-\-max-line-len 0 to disable this safety feature. +.br .TP -.B \-\-reserved\-names \fIname1\fR, \fI$name2\fR, \fIname3\fR +.B \-\-reserved\-names \fIname1\fR,\fI$name2\fR,\fIname3\fR +.br +Some libraries rely on certain names to be used, as pointed out in issue #92 +and #81, so this option allow you to exclude such names from the mangler. +For example, to keep names require and $super intact you’d specify +\-\-reserved-names "require,$super" .br .TP .B \-\-ascii .br +Pass this argument to encode non-ASCII characters as \uXXXX sequences. +By default UglifyJS won’t bother to do it and will output Unicode characters +instead. (the output is always encoded in UTF8, but if you pass this option +you’ll only get ASCII). +.br .SH BUGS The bug tracker can be reached by visiting the website From 52b77d27cc2b3a73912f90d935ab79c34034947b Mon Sep 17 00:00:00 2001 From: Marcelo Jorge Vieira Date: Sat, 19 Mar 2011 18:37:51 -0300 Subject: [PATCH 5/5] Removing trailing spaces --- man/uglifyjs.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man/uglifyjs.1 b/man/uglifyjs.1 index f9140e6f..4b851140 100644 --- a/man/uglifyjs.1 +++ b/man/uglifyjs.1 @@ -48,7 +48,7 @@ Output indented code; when passed, additional options control the beautifier. .TP .B \-i \fInumber-of-spaces\fR, \-\-indent \fInumber-of-spaces\fR .br -Indentation level. +Indentation level. .br .TP @@ -137,7 +137,7 @@ as output. Useful for debugging or learning more about the internals. .B \-\-unsafe .br Enable other additional optimizations that are known to be unsafe in some -contrived situations, but could still be generally useful. For now only this: +contrived situations, but could still be generally useful. For now only this: foo.toString() ==> foo+"" .br